1 /* 2 * Copyright (c) 1998-2007 Matthijs Hollemans 3 * All rights reserved. Distributed under the terms of the MIT License. 4 */ 5 #ifndef GREP_WINDOW_H 6 #define GREP_WINDOW_H 7 8 #include <Catalog.h> 9 #include <InterfaceKit.h> 10 #include <FilePanel.h> 11 #include <Locale.h> 12 13 #include "Model.h" 14 #include "GrepListView.h" 15 16 class BMessageRunner; 17 class ChangesIterator; 18 class Grepper; 19 20 class GrepWindow : public BWindow { 21 public: 22 GrepWindow(BMessage* message); 23 virtual ~GrepWindow(); 24 25 virtual void FrameResized(float width, float height); 26 virtual void FrameMoved(BPoint origin); 27 virtual void MenusBeginning(); 28 virtual void MenusEnded(); 29 virtual void MessageReceived(BMessage* message); 30 virtual void Quit(); 31 32 private: 33 void _InitRefsReceived(entry_ref* directory, 34 BMessage* message); 35 void _SetWindowTitle(); 36 void _CreateMenus(); 37 void _CreateViews(); 38 void _LayoutViews(); 39 void _TileIfMultipleWindows(); 40 41 void _LoadPrefs(); 42 void _SavePrefs(); 43 44 void _StartNodeMonitoring(); 45 void _StopNodeMonitoring(); 46 47 void _OnStartCancel(); 48 void _OnSearchFinished(); 49 void _OnNodeMonitorEvent(BMessage* message); 50 void _OnNodeMonitorPulse(); 51 void _OnReportFileName(BMessage* message); 52 void _OnReportResult(BMessage* message); 53 void _OnReportError(BMessage* message); 54 void _OnRecurseLinks(); 55 void _OnRecurseDirs(); 56 void _OnSkipDotDirs(); 57 void _OnRegularExpression(); 58 void _OnCaseSensitive(); 59 void _OnTextOnly(); 60 void _OnInvokeEditor(); 61 void _OnCheckboxShowLines(); 62 void _OnInvokeItem(); 63 void _OnSearchText(); 64 void _OnHistoryItem(BMessage* message); 65 void _OnTrimSelection(); 66 void _OnCopyText(); 67 void _OnSelectInTracker(); 68 void _OnQuitNow(); 69 void _OnFileDrop(BMessage* message); 70 void _OnRefsReceived(BMessage* message); 71 void _OnOpenPanel(); 72 void _OnOpenPanelCancel(); 73 void _OnSelectAll(BMessage* message); 74 void _OnNewWindow(); 75 76 void _ModelChanged(); 77 bool _OpenInEditor(const entry_ref& ref, int32 lineNum); 78 void _RemoveFolderListDuplicates(BList* folderList); 79 status_t _OpenFoldersInTracker(BList* folderList); 80 bool _AreAllFoldersOpenInTracker(BList* folderList); 81 status_t _SelectFilesInTracker(BList* folderList, 82 BMessage* refsMessage); 83 84 private: 85 BTextControl* fSearchText; 86 GrepListView* fSearchResults; 87 88 BMenuBar* fMenuBar; 89 BMenu* fFileMenu; 90 BMenuItem* fNew; 91 BMenuItem* fOpen; 92 BMenuItem* fClose; 93 BMenuItem* fQuit; 94 BMenu* fActionMenu; 95 BMenuItem* fSelectAll; 96 BMenuItem* fSearch; 97 BMenuItem* fTrimSelection; 98 BMenuItem* fCopyText; 99 BMenuItem* fSelectInTracker; 100 BMenuItem* fOpenSelection; 101 BMenu* fPreferencesMenu; 102 BMenuItem* fRecurseLinks; 103 BMenuItem* fRecurseDirs; 104 BMenuItem* fSkipDotDirs; 105 BMenuItem* fCaseSensitive; 106 BMenuItem* fRegularExpression; 107 BMenuItem* fTextOnly; 108 BMenuItem* fInvokeEditor; 109 BMenu* fHistoryMenu; 110 BMenu* fEncodingMenu; 111 BMenuItem* fUTF8; 112 BMenuItem* fShiftJIS; 113 BMenuItem* fEUC; 114 BMenuItem* fJIS; 115 116 BCheckBox* fShowLinesCheckbox; 117 BButton* fButton; 118 119 Grepper* fGrepper; 120 BString fOldPattern; 121 Model* fModel; 122 bigtime_t fLastNodeMonitorEvent; 123 ChangesIterator* fChangesIterator; 124 BMessageRunner* fChangesPulse; 125 126 127 BFilePanel* fFilePanel; 128 }; 129 130 #endif // GREP_WINDOW_H 131