1 /* PoorManWindow.h 2 * 3 * Philip Harrison 4 * Started: 4/25/2004 5 * Version: 0.1 6 */ 7 8 #ifndef POOR_MAN_WINDOW_H 9 #define POOR_MAN_WINDOW_H 10 11 #include <pthread.h> 12 13 #include <SupportDefs.h> 14 #include <Window.h> 15 #include <String.h> 16 17 class BPoint; 18 class BFilePanel; 19 class BMessage; 20 class BMenuBar; 21 class BMenu; 22 class BTextView; 23 class BStringView; 24 class BScrollView; 25 class BRect; 26 class BFile; 27 class BFont; 28 29 class PoorManView; 30 class PoorManPreferencesWindow; 31 class PoorManServer; 32 33 class PoorManWindow: public BWindow 34 { 35 public: 36 PoorManWindow(BRect frame); 37 virtual ~PoorManWindow(); 38 virtual void MessageReceived(BMessage * message); 39 40 virtual void FrameMoved(BPoint origin); 41 virtual void FrameResized(float width, float height); 42 virtual bool QuitRequested(); 43 virtual void Zoom(BPoint origin, float width, float height); 44 45 // ------------------------------------------- 46 // Public PoorMan Window Methods 47 void SetDirLabel(const char * name); 48 void SetHits(uint32 num); 49 uint32 GetHits() { return hits; } 50 status_t SaveConsole(BMessage * message, bool); 51 52 status_t SaveSettings(); 53 status_t ReadSettings(); 54 void DefaultSettings(); 55 56 status_t StartServer(); 57 status_t StopServer(); 58 59 PoorManServer* GetServer()const{return fServer;} 60 // ------------------------------------------- 61 // Preferences and Settings 62 // Site Tab 63 bool DirListFlag() { return dir_list_flag; } 64 void SetDirListFlag(bool flag) { dir_list_flag = flag; } 65 const char * IndexFileName() { return index_file_name.String(); } 66 void SetIndexFileName(const char * str) { index_file_name.SetTo(str); } 67 const char * WebDir() { return web_directory.String(); } 68 void SetWebDir(const char * str) { web_directory.SetTo(str); } 69 // Logging Tab 70 bool LogConsoleFlag() { return log_console_flag; } 71 void SetLogConsoleFlag(bool flag) { log_console_flag = flag; } 72 bool LogFileFlag() { return log_file_flag; } 73 void SetLogFileFlag(bool flag) { log_file_flag = flag; } 74 const char * LogPath() { return log_path.String(); } 75 void SetLogPath(const char * str); 76 // Advanced Tab 77 int16 MaxConnections() { return max_connections; } 78 void SetMaxConnections(int16 num) { max_connections = num; } 79 80 81 private: 82 // ------------------------------------------- 83 // PoorMan Window Methods 84 void UpdateStatusLabelAndMenuItem(); 85 void UpdateHitsLabel(); 86 87 private: 88 // ------------------------------------------- 89 // PoorMan Window 90 PoorManView * mainView; 91 92 // ------------------------------------------- 93 // Build Menu Methods 94 BMenu * BuildFileMenu() const; 95 BMenu * BuildEditMenu() const; 96 BMenu * BuildControlsMenu() const; 97 98 // -------------------------------------------- 99 // MenuBar & Menu items 100 BMenuBar * FileMenuBar; 101 BMenu * FileMenu; 102 BMenu * EditMenu; 103 BMenu * ControlsMenu; 104 105 // -------------------------------------------- 106 // Status, Hits, Directory 107 BStringView * statusView; 108 BStringView * hitsView; 109 BStringView * dirView; 110 111 bool status; 112 uint32 hits; 113 char hitsLabel[25]; 114 115 // -------------------------------------------- 116 // Logging View 117 BScrollView * scrollView; 118 BTextView * loggingView; 119 // use asctime() for format of [Date/Time]: 120 121 122 // ------------------------------------------- 123 // PoorMan Preference Window 124 PoorManPreferencesWindow * prefWindow; 125 126 // site tab 127 BString web_directory; 128 BString index_file_name; 129 bool dir_list_flag; 130 131 // logging tab 132 bool log_console_flag; 133 bool log_file_flag; 134 BString log_path; 135 136 // advanced tab 137 int16 max_connections; 138 139 bool is_zoomed; 140 float last_width; 141 float last_height; 142 BRect frame; 143 BRect setwindow_frame; 144 145 // File Panels 146 BFilePanel * saveConsoleFilePanel; 147 BFilePanel * saveConsoleSelectionFilePanel; 148 149 BFile* fLogFile; 150 BFont* fLogViewFont; 151 152 PoorManServer* fServer; 153 154 pthread_rwlock_t fLogFileLock; 155 }; 156 157 #endif 158