|
hipp
1.0
|
00001 /* 00002 Copyright 2011 Certec, Lund University, Sweden 00003 00004 This file is part of HIPP. 00005 00006 HIPP is free software: you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation, either version 3 of the License, or 00009 (at your option) any later version. 00010 00011 HIPP is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with HIPP. If not, see <http://www.gnu.org/licenses/>. 00018 00019 */ 00020 00021 #ifndef __HippFrame__ 00022 #define __HippFrame__ 00023 00024 #include <wx/wx.h> 00025 #include <wx/propdlg.h> 00026 #include <wx/bookctrl.h> 00027 #include <wx/docview.h> 00028 #include <wx/spinctrl.h> 00029 #include <wx/config.h> 00030 #include <wx/confbase.h> 00031 00032 #include "WxWidgetsWindow.h" 00033 #include <H3D/GlobalSettings.h> 00034 #include <H3D/StereoInfo.h> 00035 00036 #include <H3D/Group.h> 00037 #include <H3D/Transform.h> 00038 #include <H3D/Scene.h> 00039 #include <H3D/KeySensor.h> 00040 #include <H3D/SpaceWareSensor.h> 00041 #include <H3D/DeviceInfo.h> //REMOVE 00042 #include <H3D/ResourceResolver.h> 00043 #include <H3D/NavigationInfo.h> 00044 #include <H3D/X3D.h> 00045 00046 #include <H3DUtil/Console.h> 00047 00048 #include "ConsoleDialog.h" 00049 #include "H3DViewerTreeViewDialog.h" 00050 #include "WxFrameBase.h" 00051 #include "HippConsole.h" 00052 #include <wx/log.h> 00053 #include "FrameRateDialog.h" 00054 #include "PreferencesDialog.h" 00055 00056 using namespace std; 00057 using namespace H3D; 00058 00059 namespace hipp { 00060 00081 class HippFrame: public WxFrameBase 00082 { 00083 DECLARE_CLASS(HippFrame) 00084 public: 00085 HippFrame(wxDocManager *manager, wxFrame *_parent, wxWindowID _id, const wxString & _title, const wxPoint & _pos, const wxSize & _size, long _style = wxDEFAULT_FRAME_STYLE); 00086 wxMenu *helpMenu, *navigationDevices; 00087 wxFileHistory *recentFiles; 00088 void clearData(); 00089 void OnMRUFile(wxCommandEvent & event); 00090 void OnOpenFileURL(wxCommandEvent & event); 00091 00092 //Modifying document 00093 void OnBackground(wxCommandEvent & event); 00094 void OnHapticBackground(wxCommandEvent & event); 00095 bool getHapticBackgroundEnable() const; 00096 void OnToggle(wxCommandEvent & event); 00097 void OnThicknessReduce(wxCommandEvent & event); 00098 void OnThicknessIncrease(wxCommandEvent & event); 00099 00100 void OnExit(wxCommandEvent & event); 00101 void OnCopy(wxCommandEvent & event); 00102 void OnPaste(wxCommandEvent & event); 00103 void OnCut(wxCommandEvent & event); 00104 void OnDelete(wxCommandEvent & event); 00105 void OnSelectNone(wxCommandEvent & event); 00106 void OnClear(wxCommandEvent & event); 00107 void OnWindowExit(wxCloseEvent & event); 00108 void OnAbout(wxCommandEvent & event); 00109 void ShowConsole(wxCommandEvent & event); 00110 void ShowTreeView(wxCommandEvent & event); 00111 void ShowFrameRate(wxCommandEvent & event); 00112 void ShowCppLog(wxCommandEvent & event); 00113 void ShowPreferences(wxCommandEvent & event); 00114 void GetSelection(wxMenuEvent & event); 00115 00116 void SetLabel(const wxString& label); 00117 00118 // Viewpoint / paper orientation commands 00119 void OnChangeVPHorizontal(wxCommandEvent& event); 00120 void OnChangeVPVertical(wxCommandEvent& event); 00121 void OnChangeVPEasel(wxCommandEvent& event); 00122 void OnChangeVPSlanted(wxCommandEvent& event); 00123 void SetDrawingBoardAngle (int draw_angle); 00124 00125 wxString GetCurrentFilename(); 00126 void SetCurrentFilename(wxString); 00127 00128 // Modifying the status bar text 00129 void DoUpdateSelectedCurveStatus(wxCommandEvent & event); 00130 void UpdateStatusBar(wxString str); 00131 00132 // Modify shapes commands 00133 void OnProperties(wxCommandEvent & event); 00134 void OnEnlarge(wxCommandEvent& event); 00135 void OnShrink(wxCommandEvent& event); 00136 void OnScale(wxCommandEvent& event); 00137 void OnFill(wxCommandEvent& event); 00138 void OnMoveRight(wxCommandEvent& event); 00139 void OnMoveLeft(wxCommandEvent& event); 00140 void OnMoveUp(wxCommandEvent& event); 00141 void OnMoveDown(wxCommandEvent& event); 00142 void OnTransformToRectangle(wxCommandEvent& event); 00143 void OnTransformToCircle(wxCommandEvent& event); 00144 void OnTransformToLine(wxCommandEvent & event); 00145 void OnTransformToVLine(wxCommandEvent & event); 00146 void OnTransformToHLine(wxCommandEvent & event); 00147 void OnOrder(wxCommandEvent & event); 00148 00149 H3DWindowNode *getGlWindow() const 00150 { 00151 return glwindow; 00152 } 00153 00154 void updateFrameRates() 00155 { 00156 frameRates->updateFrameRates(); 00157 } 00158 00159 bool getPrintModeBW(){ 00160 return file_print_options->IsChecked(hippID_BW); 00161 } 00162 00163 inline wxMenuBar *getMenuBar() 00164 { 00165 return menuBar; 00166 } 00167 00168 inline wxMenu *getEditMenu() 00169 { 00170 return editMenu; 00171 } 00172 00173 inline AutoRef<Transform> getTransform(){ 00174 return t; 00175 } 00176 00177 inline void ClearSceneGraph(){ 00178 t->children->clear(); 00179 viewpoint.reset(NULL); 00180 } 00181 00182 // getters and setters for pen color and size 00183 bool* getPenWhitePtr() const; 00184 int* getPenWidthPtr() const; 00185 void savePenColour(bool b); 00186 void savePenWidth(int width); 00187 bool* togglePenColour(); 00188 00189 AutoRef<Scene> scene; 00190 AutoRef<KeySensor> ks; 00191 AutoRef<SpaceWareSensor> ss; 00192 AutoRef<Transform> t; 00193 // AutoRef<Node> device_info; 00194 AutoRef<Node> viewpoint; 00195 AutoRef<Group> g; 00196 AutoRef<GlobalSettings> global_settings; 00197 00198 private: 00199 void LoadH3D(); 00200 WxWidgetsWindow *glwindow; 00201 AutoRef<StereoInfo> stereo_info; 00202 NavigationInfo *mynav; 00203 DeviceInfo *mydevice; 00204 bool lastDeviceStatus; 00205 wxConfigBase *h3dConfig; 00206 HippConsole *console; 00207 wxLogTextCtrl *logger; 00208 wxLogChain *logChain; 00209 int selection; 00210 int navTypeCount; 00211 int deviceCount; 00212 H3DHapticsDevice *myH3Ddevice; 00213 string stylus_file; 00214 bool avatar_collision; 00215 bool hapticBackgroundEnable; 00216 bool* penWhitePtr; 00217 bool penWhite; 00218 int* penWidthPtr; 00219 int penWidth; 00220 00221 public: 00222 consoleDialog * theConsole; 00223 H3DViewerTreeViewDialog * tree_view_dialog; 00224 FrameRateDialog * frameRates; 00225 wxLogWindow * cppLog; 00226 PreferencesDialog *preferences_dialog; 00227 00228 friend class HippView; 00229 00230 map< int, X3DViewpointNode * > itemIdViewpointMap; 00231 00232 protected: 00233 DECLARE_EVENT_TABLE() 00234 virtual void OnOpenFile( wxCommandEvent& event ); 00235 }; 00236 00237 enum 00238 { FRAME_EXIT = wxID_HIGHEST + 1, 00239 FRAME_OPEN, 00240 FRAME_OPEN_URL, 00241 FRAME_CLOSE, 00242 FRAME_CHOOSEDIR, 00243 FRAME_FULLSCREEN, 00244 FRAME_RESTORE, 00245 FRAME_MIRROR, 00246 FRAME_CONSOLE, 00247 FRAME_TREEVIEW, 00248 FRAME_FRAMERATE, 00249 FRAME_SELECTION, 00250 FRAME_VIEWPOINT, 00251 00252 // To change the angle of the "paper" 00253 FRAME_VERTICAL_BOARD, 00254 FRAME_HORIZONTAL_BOARD, 00255 FRAME_EASEL_BOARD, 00256 FRAME_SLANTED_BOARD, 00257 00258 FRAME_NAVIGATION = 6500, 00259 FRAME_DEVICE = 6550, 00260 FRAME_CHOOSERENDERER = 6600, 00261 FRAME_OPENHAPTICS, 00262 FRAME_CHAI3D, 00263 FRAME_GODOBJECT, 00264 FRAME_RUSPINI, 00265 FRAME_RENDERMODE, 00266 FRAME_MONO, 00267 FRAME_QUADBUFFERED, 00268 FRAME_HORZSPLIT, 00269 FRAME_HORZSPLITKEEPASPECT, 00270 FRAME_VERTSPLIT, 00271 FRAME_VERTSPLITKEEPASPECT, 00272 FRAME_HORZINTERLACED, 00273 FRAME_VERTINTERLACED, 00274 FRAME_CHECKERINTERLACED, 00275 FRAME_SHARPDISPLAY, 00276 FRAME_REDBLUE, 00277 FRAME_REDGREEN, 00278 FRAME_REDCYAN, 00279 FRAME_DEVICECONTROL, 00280 FRAME_HAPTICSCONTROL, 00281 // New Stuff 00282 FRAME_COPY, 00283 FRAME_PASTE, 00284 FRAME_CUT, 00285 FRAME_BACKGROUND 00286 }; 00287 } 00288 #endif // __HippFrame__
1.7.5.1