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 _OnFileDrop(BMessage* message); 88 void _OnRefsReceived(BMessage* message); 89 void _OnOpenPanel(); 90 void _OnOpenPanelCancel(); 91 void _OnSelectAll(BMessage* message); 92 void _OnNewWindow(); 93 94 void _ModelChanged(); 95 bool _OpenInPe(const entry_ref& ref, int32 lineNum); 96 void _RemoveFolderListDuplicates(BList* folderList); 97 status_t _OpenFoldersInTracker(BList* folderList); 98 bool _AreAllFoldersOpenInTracker(BList* folderList); 99 status_t _SelectFilesInTracker(BList* folderList, 100 BMessage* refsMessage); 101 102 private: 103 BTextControl* fSearchText; 104 GrepListView* fSearchResults; 105 106 BMenuBar* fMenuBar; 107 BMenu* fFileMenu; 108 BMenuItem* fNew; 109 BMenuItem* fOpen; 110 BMenuItem* fClose; 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