1 /* 2 * Copyright (c) 1998-2007 Matthijs Hollemans 3 * 4 * Permission is hereby granted, free of charge, to any person obtaining a 5 * copy of this software and associated documentation files (the "Software"), 6 * to deal in the Software without restriction, including without limitation 7 * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8 * and/or sell copies of the Software, and to permit persons to whom the 9 * Software is furnished to do so, subject to the following conditions: 10 * 11 * The above copyright notice and this permission notice shall be included in 12 * all copies or substantial portions of the Software. 13 * 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 20 * DEALINGS IN THE SOFTWARE. 21 */ 22 #ifndef GREP_WINDOW_H 23 #define GREP_WINDOW_H 24 25 #include <InterfaceKit.h> 26 #include <FilePanel.h> 27 28 #include "Model.h" 29 #include "GrepListView.h" 30 31 class BMessageRunner; 32 class ChangesIterator; 33 class Grepper; 34 35 class GrepWindow : public BWindow { 36 public: 37 GrepWindow(BMessage* message); 38 virtual ~GrepWindow(); 39 40 virtual void FrameResized(float width, float height); 41 virtual void FrameMoved(BPoint origin); 42 virtual void MenusBeginning(); 43 virtual void MenusEnded(); 44 virtual void MessageReceived(BMessage* message); 45 virtual void Quit(); 46 47 private: 48 void _InitRefsReceived(entry_ref* directory, 49 BMessage* message); 50 void _SetWindowTitle(); 51 void _CreateMenus(); 52 void _CreateViews(); 53 void _LayoutViews(); 54 void _TileIfMultipleWindows(); 55 56 void _LoadPrefs(); 57 void _SavePrefs(); 58 59 void _StartNodeMonitoring(); 60 void _StopNodeMonitoring(); 61 62 void _OnStartCancel(); 63 void _OnSearchFinished(); 64 void _OnNodeMonitorEvent(BMessage* message); 65 void _OnNodeMonitorPulse(); 66 void _OnReportFileName(BMessage* message); 67 void _OnReportResult(BMessage* message); 68 void _OnReportError(BMessage* message); 69 void _OnRecurseLinks(); 70 void _OnRecurseDirs(); 71 void _OnSkipDotDirs(); 72 void _OnEscapeText(); 73 void _OnCaseSensitive(); 74 void _OnTextOnly(); 75 void _OnInvokePe(); 76 void _OnCheckboxShowLines(); 77 void _OnMenuShowLines(); 78 void _OnInvokeItem(); 79 void _OnSearchText(); 80 void _OnHistoryItem(BMessage* message); 81 void _OnTrimSelection(); 82 void _OnCopyText(); 83 void _OnSelectInTracker(); 84 void _OnQuitNow(); 85 void _OnAboutRequested(); 86 void _OnFileDrop(BMessage* message); 87 void _OnRefsReceived(BMessage* message); 88 void _OnOpenPanel(); 89 void _OnOpenPanelCancel(); 90 void _OnSelectAll(BMessage* message); 91 void _OnNewWindow(); 92 93 void _ModelChanged(); 94 bool _OpenInPe(const entry_ref& ref, int32 lineNum); 95 void _RemoveFolderListDuplicates(BList* folderList); 96 status_t _OpenFoldersInTracker(BList* folderList); 97 bool _AreAllFoldersOpenInTracker(BList* folderList); 98 status_t _SelectFilesInTracker(BList* folderList, 99 BMessage* refsMessage); 100 101 private: 102 BTextControl* fSearchText; 103 GrepListView* fSearchResults; 104 105 BMenuBar* fMenuBar; 106 BMenu* fFileMenu; 107 BMenuItem* fNew; 108 BMenuItem* fOpen; 109 BMenuItem* fClose; 110 BMenuItem* fAbout; 111 BMenuItem* fQuit; 112 BMenu* fActionMenu; 113 BMenuItem* fSelectAll; 114 BMenuItem* fSearch; 115 BMenuItem* fTrimSelection; 116 BMenuItem* fCopyText; 117 BMenuItem* fSelectInTracker; 118 BMenuItem* fOpenSelection; 119 BMenu* fPreferencesMenu; 120 BMenuItem* fRecurseLinks; 121 BMenuItem* fRecurseDirs; 122 BMenuItem* fSkipDotDirs; 123 BMenuItem* fCaseSensitive; 124 BMenuItem* fEscapeText; 125 BMenuItem* fTextOnly; 126 BMenuItem* fInvokePe; 127 BMenuItem* fShowLinesMenuitem; 128 BMenu* fHistoryMenu; 129 BMenu* fEncodingMenu; 130 BMenuItem* fUTF8; 131 BMenuItem* fShiftJIS; 132 BMenuItem* fEUC; 133 BMenuItem* fJIS; 134 135 BCheckBox* fShowLinesCheckbox; 136 BButton* fButton; 137 138 Grepper* fGrepper; 139 BString fOldPattern; 140 Model* fModel; 141 bigtime_t fLastNodeMonitorEvent; 142 ChangesIterator* fChangesIterator; 143 BMessageRunner* fChangesPulse; 144 145 BFilePanel* fFilePanel; 146 }; 147 148 #endif // GREP_WINDOW_H 149