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 <Catalog.h> 26 #include <InterfaceKit.h> 27 #include <FilePanel.h> 28 #include <Locale.h> 29 30 #include "Model.h" 31 #include "GrepListView.h" 32 33 class BMessageRunner; 34 class ChangesIterator; 35 class Grepper; 36 37 class GrepWindow : public BWindow { 38 public: 39 GrepWindow(BMessage* message); 40 virtual ~GrepWindow(); 41 42 virtual void FrameResized(float width, float height); 43 virtual void FrameMoved(BPoint origin); 44 virtual void MenusBeginning(); 45 virtual void MenusEnded(); 46 virtual void MessageReceived(BMessage* message); 47 virtual void Quit(); 48 49 private: 50 void _InitRefsReceived(entry_ref* directory, 51 BMessage* message); 52 void _SetWindowTitle(); 53 void _CreateMenus(); 54 void _CreateViews(); 55 void _LayoutViews(); 56 void _TileIfMultipleWindows(); 57 58 void _LoadPrefs(); 59 void _SavePrefs(); 60 61 void _StartNodeMonitoring(); 62 void _StopNodeMonitoring(); 63 64 void _OnStartCancel(); 65 void _OnSearchFinished(); 66 void _OnNodeMonitorEvent(BMessage* message); 67 void _OnNodeMonitorPulse(); 68 void _OnReportFileName(BMessage* message); 69 void _OnReportResult(BMessage* message); 70 void _OnReportError(BMessage* message); 71 void _OnRecurseLinks(); 72 void _OnRecurseDirs(); 73 void _OnSkipDotDirs(); 74 void _OnEscapeText(); 75 void _OnCaseSensitive(); 76 void _OnTextOnly(); 77 void _OnInvokePe(); 78 void _OnCheckboxShowLines(); 79 void _OnMenuShowLines(); 80 void _OnInvokeItem(); 81 void _OnSearchText(); 82 void _OnHistoryItem(BMessage* message); 83 void _OnTrimSelection(); 84 void _OnCopyText(); 85 void _OnSelectInTracker(); 86 void _OnQuitNow(); 87 void _OnAboutRequested(); 88 void _OnFileDrop(BMessage* message); 89 void _OnRefsReceived(BMessage* message); 90 void _OnOpenPanel(); 91 void _OnOpenPanelCancel(); 92 void _OnSelectAll(BMessage* message); 93 void _OnNewWindow(); 94 95 void _ModelChanged(); 96 bool _OpenInPe(const entry_ref& ref, int32 lineNum); 97 void _RemoveFolderListDuplicates(BList* folderList); 98 status_t _OpenFoldersInTracker(BList* folderList); 99 bool _AreAllFoldersOpenInTracker(BList* folderList); 100 status_t _SelectFilesInTracker(BList* folderList, 101 BMessage* refsMessage); 102 103 private: 104 BTextControl* fSearchText; 105 GrepListView* fSearchResults; 106 107 BMenuBar* fMenuBar; 108 BMenu* fFileMenu; 109 BMenuItem* fNew; 110 BMenuItem* fOpen; 111 BMenuItem* fClose; 112 BMenuItem* fAbout; 113 BMenuItem* fQuit; 114 BMenu* fActionMenu; 115 BMenuItem* fSelectAll; 116 BMenuItem* fSearch; 117 BMenuItem* fTrimSelection; 118 BMenuItem* fCopyText; 119 BMenuItem* fSelectInTracker; 120 BMenuItem* fOpenSelection; 121 BMenu* fPreferencesMenu; 122 BMenuItem* fRecurseLinks; 123 BMenuItem* fRecurseDirs; 124 BMenuItem* fSkipDotDirs; 125 BMenuItem* fCaseSensitive; 126 BMenuItem* fEscapeText; 127 BMenuItem* fTextOnly; 128 BMenuItem* fInvokePe; 129 BMenuItem* fShowLinesMenuitem; 130 BMenu* fHistoryMenu; 131 BMenu* fEncodingMenu; 132 BMenuItem* fUTF8; 133 BMenuItem* fShiftJIS; 134 BMenuItem* fEUC; 135 BMenuItem* fJIS; 136 137 BCheckBox* fShowLinesCheckbox; 138 BButton* fButton; 139 140 Grepper* fGrepper; 141 BString fOldPattern; 142 Model* fModel; 143 bigtime_t fLastNodeMonitorEvent; 144 ChangesIterator* fChangesIterator; 145 BMessageRunner* fChangesPulse; 146 147 BFilePanel* fFilePanel; 148 }; 149 150 #endif // GREP_WINDOW_H 151