hrev46793 adds 3 changesets to branch 'master' old head: fc90d9a48e66ef7725f730a8c740cdb7c9691883 new head: 02d8dd1561c81c50706231d491f153e0ba0c3094 overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=02d8dd1+%5Efc90d9a ---------------------------------------------------------------------------- cff5000: Show search term in window tab 4c56a10: Truncate names of files/folders that are being grep'ed 02d8dd1: Coding style fixes [ Humdinger <humdingerb@xxxxxxxxx> ] ---------------------------------------------------------------------------- 2 files changed, 83 insertions(+), 59 deletions(-) src/apps/text_search/GrepWindow.cpp | 140 ++++++++++++++++++-------------- src/apps/text_search/GrepWindow.h | 2 + ############################################################################ Commit: cff5000f79eb6a0b149e17817630beb32f446793 URL: http://cgit.haiku-os.org/haiku/commit/?id=cff5000 Author: Humdinger <humdingerb@xxxxxxxxx> Date: Wed Jan 29 11:39:01 2014 UTC Show search term in window tab ---------------------------------------------------------------------------- diff --git a/src/apps/text_search/GrepWindow.cpp b/src/apps/text_search/GrepWindow.cpp index 357028b..414a326 100644 --- a/src/apps/text_search/GrepWindow.cpp +++ b/src/apps/text_search/GrepWindow.cpp @@ -397,8 +397,16 @@ GrepWindow::_SetWindowTitle() BString title; if (entry.InitCheck() == B_OK) { BPath path; - if (entry.GetPath(&path) == B_OK) - title << B_TRANSLATE(APP_NAME) << ": " << path.Path(); + if (entry.GetPath(&path) == B_OK) { + if (fOldPattern.Length()) { + title = B_TRANSLATE("%appname% : %path% : %searchtext%"); + title.ReplaceAll("%searchtext%", fOldPattern.String()); + } else + title = B_TRANSLATE("%appname% : %path%"); + + title.ReplaceAll("%appname%", B_TRANSLATE(APP_NAME)); + title.ReplaceAll("%path%", path.Path()); + } } if (!title.Length()) @@ -802,6 +810,8 @@ GrepWindow::_OnStartCancel() fOldPattern = fSearchText->Text(); + _SetWindowTitle(); + FileIterator* iterator = new (nothrow) InitialIterator(fModel); fGrepper = new (nothrow) Grepper(fOldPattern.String(), fModel, this, iterator); @@ -1491,6 +1501,7 @@ GrepWindow::_OnFileDrop(BMessage* message) fModel->fSelectedFiles = *message; fSearchResults->MakeEmpty(); + fOldPattern = ""; _SetWindowTitle(); } @@ -1500,6 +1511,7 @@ void GrepWindow::_OnRefsReceived(BMessage* message) { _OnFileDrop(message); + fOldPattern = ""; // It seems a B_CANCEL always follows a B_REFS_RECEIVED // from a BFilePanel in Open mode. // ############################################################################ Commit: 4c56a102ca3b2345953ae9f30701d8f074ecd2c2 URL: http://cgit.haiku-os.org/haiku/commit/?id=4c56a10 Author: Humdinger <humdingerb@xxxxxxxxx> Date: Wed Jan 29 11:57:38 2014 UTC Truncate names of files/folders that are being grep'ed ---------------------------------------------------------------------------- diff --git a/src/apps/text_search/GrepWindow.cpp b/src/apps/text_search/GrepWindow.cpp index 414a326..407b2ab 100644 --- a/src/apps/text_search/GrepWindow.cpp +++ b/src/apps/text_search/GrepWindow.cpp @@ -144,6 +144,7 @@ GrepWindow::GrepWindow(BMessage* message) _LoadPrefs(); _TileIfMultipleWindows(); + fSearchBoxWidth = fSearchText->Bounds().Width(); Show(); } @@ -157,6 +158,7 @@ GrepWindow::~GrepWindow() void GrepWindow::FrameResized(float width, float height) { + fSearchBoxWidth = fSearchText->Bounds().Width(); BWindow::FrameResized(width, height); fModel->fFrame = Frame(); _SavePrefs(); @@ -1035,8 +1037,13 @@ GrepWindow::_OnNodeMonitorPulse() void GrepWindow::_OnReportFileName(BMessage* message) { - if (fModel->fState != STATE_UPDATE) - fSearchText->SetText(message->FindString("filename")); + if (fModel->fState != STATE_UPDATE) { + BString name = message->FindString("filename"); + fSearchText->TruncateString(&name, B_TRUNCATE_MIDDLE, + fSearchBoxWidth - 10); + + fSearchText->SetText(name); + } } diff --git a/src/apps/text_search/GrepWindow.h b/src/apps/text_search/GrepWindow.h index dd4dce1..702bc20 100644 --- a/src/apps/text_search/GrepWindow.h +++ b/src/apps/text_search/GrepWindow.h @@ -141,6 +141,8 @@ private: bigtime_t fLastNodeMonitorEvent; ChangesIterator* fChangesIterator; BMessageRunner* fChangesPulse; + float fSearchBoxWidth; + BFilePanel* fFilePanel; }; ############################################################################ Revision: hrev46793 Commit: 02d8dd1561c81c50706231d491f153e0ba0c3094 URL: http://cgit.haiku-os.org/haiku/commit/?id=02d8dd1 Author: Humdinger <humdingerb@xxxxxxxxx> Date: Wed Jan 29 12:03:06 2014 UTC Coding style fixes ---------------------------------------------------------------------------- diff --git a/src/apps/text_search/GrepWindow.cpp b/src/apps/text_search/GrepWindow.cpp index 407b2ab..5700586 100644 --- a/src/apps/text_search/GrepWindow.cpp +++ b/src/apps/text_search/GrepWindow.cpp @@ -85,48 +85,48 @@ static const bigtime_t kChangesPulseInterval = 150000; GrepWindow::GrepWindow(BMessage* message) : BWindow(BRect(0, 0, 1, 1), NULL, B_DOCUMENT_WINDOW, 0), - fSearchText(NULL), - fSearchResults(NULL), - fMenuBar(NULL), - fFileMenu(NULL), - fNew(NULL), - fOpen(NULL), - fClose(NULL), - fQuit(NULL), - fActionMenu(NULL), - fSelectAll(NULL), - fSearch(NULL), - fTrimSelection(NULL), - fCopyText(NULL), - fSelectInTracker(NULL), - fOpenSelection(NULL), - fPreferencesMenu(NULL), - fRecurseLinks(NULL), - fRecurseDirs(NULL), - fSkipDotDirs(NULL), - fCaseSensitive(NULL), - fEscapeText(NULL), - fTextOnly(NULL), - fInvokePe(NULL), - fShowLinesMenuitem(NULL), - fHistoryMenu(NULL), - fEncodingMenu(NULL), - fUTF8(NULL), - fShiftJIS(NULL), - fEUC(NULL), - fJIS(NULL), - - fShowLinesCheckbox(NULL), - fButton(NULL), - - fGrepper(NULL), - fOldPattern(""), - fModel(new (nothrow) Model()), - fLastNodeMonitorEvent(system_time()), - fChangesIterator(NULL), - fChangesPulse(NULL), - - fFilePanel(NULL) + fSearchText(NULL), + fSearchResults(NULL), + fMenuBar(NULL), + fFileMenu(NULL), + fNew(NULL), + fOpen(NULL), + fClose(NULL), + fQuit(NULL), + fActionMenu(NULL), + fSelectAll(NULL), + fSearch(NULL), + fTrimSelection(NULL), + fCopyText(NULL), + fSelectInTracker(NULL), + fOpenSelection(NULL), + fPreferencesMenu(NULL), + fRecurseLinks(NULL), + fRecurseDirs(NULL), + fSkipDotDirs(NULL), + fCaseSensitive(NULL), + fEscapeText(NULL), + fTextOnly(NULL), + fInvokePe(NULL), + fShowLinesMenuitem(NULL), + fHistoryMenu(NULL), + fEncodingMenu(NULL), + fUTF8(NULL), + fShiftJIS(NULL), + fEUC(NULL), + fJIS(NULL), + + fShowLinesCheckbox(NULL), + fButton(NULL), + + fGrepper(NULL), + fOldPattern(""), + fModel(new (nothrow) Model()), + fLastNodeMonitorEvent(system_time()), + fChangesIterator(NULL), + fChangesPulse(NULL), + + fFilePanel(NULL) { if (fModel == NULL) return; @@ -189,7 +189,7 @@ void GrepWindow::MenusEnded() } -void GrepWindow::MessageReceived(BMessage *message) +void GrepWindow::MessageReceived(BMessage* message) { switch (message->what) { case MSG_NEW_WINDOW: @@ -421,7 +421,7 @@ GrepWindow::_SetWindowTitle() void GrepWindow::_CreateMenus() { - fMenuBar = new BMenuBar(BRect(0,0,1,1), "menubar"); + fMenuBar = new BMenuBar(BRect(0, 0, 1, 1), "menubar"); fFileMenu = new BMenu(B_TRANSLATE("File")); fActionMenu = new BMenu(B_TRANSLATE("Actions")); @@ -454,7 +454,8 @@ GrepWindow::_CreateMenus() B_TRANSLATE("Open selection"), new BMessage(MSG_OPEN_SELECTION), 'O'); fSelectInTracker = new BMenuItem( - B_TRANSLATE("Show files in Tracker"), new BMessage(MSG_SELECT_IN_TRACKER), 'K'); + B_TRANSLATE("Show files in Tracker"), + new BMessage(MSG_SELECT_IN_TRACKER), 'K'); fCopyText = new BMenuItem( B_TRANSLATE("Copy text to clipboard"), new BMessage(MSG_COPY_TEXT), 'B'); @@ -466,7 +467,8 @@ GrepWindow::_CreateMenus() B_TRANSLATE("Look in sub-folders"), new BMessage(MSG_RECURSE_DIRS)); fSkipDotDirs = new BMenuItem( - B_TRANSLATE("Skip folders starting with a dot"), new BMessage(MSG_SKIP_DOT_DIRS)); + B_TRANSLATE("Skip folders starting with a dot"), + new BMessage(MSG_SKIP_DOT_DIRS)); fCaseSensitive = new BMenuItem( B_TRANSLATE("Case-sensitive"), new BMessage(MSG_CASE_SENSITIVE)); @@ -584,13 +586,13 @@ GrepWindow::_LayoutViews() float menubarWidth, menubarHeight = 20; fMenuBar->GetPreferredSize(&menubarWidth, &menubarHeight); - BBox *background = new BBox( + BBox* background = new BBox( BRect(0, menubarHeight + 1, 2, menubarHeight + 2), B_EMPTY_STRING, B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP, B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP, B_PLAIN_BORDER); - BScrollView *scroller = new BScrollView( + BScrollView* scroller = new BScrollView( "ScrollSearchResults", fSearchResults, B_FOLLOW_ALL_SIDES, B_FULL_UPDATE_ON_RESIZE, true, true, B_NO_BORDER); @@ -647,7 +649,7 @@ GrepWindow::_TileIfMultipleWindows() be_app->Unlock(); if (windowCount > 1) - MoveBy(20,20); + MoveBy(20, 20); } BScreen screen(this); @@ -658,7 +660,7 @@ GrepWindow::_TileIfMultipleWindows() || windowFrame.top > screenFrame.bottom || windowFrame.right < screenFrame.left || windowFrame.bottom < screenFrame.top) - MoveTo(50,50); + MoveTo(50, 50); } @@ -976,7 +978,7 @@ GrepWindow::_OnNodeMonitorEvent(BMessage* message) #endif } TRACE_NM("path: %s\n", path.String()); -//message->PrintToStream(); +// message->PrintToStream(); break; } @@ -1102,7 +1104,7 @@ GrepWindow::_OnReportResult(BMessage* message) void -GrepWindow::_OnReportError(BMessage *message) +GrepWindow::_OnReportError(BMessage* message) { const char* buf; if (message->FindString("error", &buf) == B_OK) @@ -1250,7 +1252,7 @@ GrepWindow::_OnInvokeItem() // Get the line number. // only this level has line numbers if (level == 1) { - BStringItem *str = dynamic_cast<BStringItem*>(item); + BStringItem* str = dynamic_cast<BStringItem*>(item); if (str != NULL) { lineNum = atol(str->Text()); // fortunately, atol knows when to stop the conversion @@ -1562,7 +1564,7 @@ GrepWindow::_OnOpenPanelCancel() void -GrepWindow::_OnSelectAll(BMessage *message) +GrepWindow::_OnSelectAll(BMessage* message) { BMessenger messenger(fSearchResults); messenger.SendMessage(B_SELECT_ALL); @@ -1595,6 +1597,7 @@ GrepWindow::_ModelChanged() _SavePrefs(); } + bool GrepWindow::_OpenInPe(const entry_ref &ref, int32 lineNum) { @@ -1677,7 +1680,7 @@ GrepWindow::_OpenFoldersInTracker(BList* folderList) bool -GrepWindow::_AreAllFoldersOpenInTracker(BList *folderList) +GrepWindow::_AreAllFoldersOpenInTracker(BList* folderList) { // Compare the folders we want open in Tracker to // the actual Tracker windows currently open.