hipp  1.0
hipp/gui/HippView.h
Go to the documentation of this file.
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 HIPPVIEW_H_
00022 #define HIPPVIEW_H_
00023 
00024 #include <wx/docview.h>
00025 #include <wx/print.h>
00026 #include <wx/timer.h>
00027 #include "HippFrame.h"
00028 #include <H3DUtil/AutoRef.h>
00029 #include "../nodes/PaintableTexture.h"
00030 #include "HippShape.h"
00031 #include "HippPrintFormats.h"
00032 #include <time.h>
00033 
00034 using H3DUtil::AutoRef;
00035 
00036 
00037 namespace hipp {
00038 class HippFrame;
00039 class HippDocument;
00040 
00057 class HippView: public wxView {
00058 public:
00059         HippView();
00060         //~HippView();
00061 
00063         virtual bool OnCreate(wxDocument *doc, long flags);
00065         virtual wxPrintout *OnCreatePrintout();
00067         virtual void OnDraw(wxDC* dc);
00069         virtual void OnDraw(wxTimerEvent &event);
00071         virtual void Draw();
00073         virtual void OnDrawForPrinter(wxDC* dc, PRINT_FORMAT format);
00075         virtual void OnUpdate(wxView *sender, wxObject *hint = NULL);
00077         virtual bool OnClose(bool deleteWindow = true);
00078 
00079         HippDocument* GetDocument();
00080         void SetDocument(wxDocument *doc);
00081 
00082         virtual void DoSelectShape(wxJoystickEvent &event);
00084         void OnCut(wxCommandEvent& event);
00085 
00086         int current_viewpoint_id;
00087 
00088         void OnFullscreen(wxCommandEvent & event);
00089         void RestoreWindow(wxCommandEvent & event);
00090         void MirrorScene(wxCommandEvent & event);
00091         void RenderMode(wxCommandEvent & event);
00092         void OnIdle(wxIdleEvent & event);
00093 
00094         void togglePenColour();
00095         void updatePenOptions();
00096         bool* getPenWhitePtr() {return penWhitePtr;}
00097         int* getPenWidthPtr() {return penWidthPtr;}
00098 
00099     wxPoint getDevicePos() const;
00100     void UpdateWindowSize(wxSizeEvent &frameSizeEvent);
00101 
00102         list<Node*> GetTopLevelViews();
00103 
00104         HippFrame* GetFrame(){return frame;}
00105 
00106     wxTimer *m_timer;
00107 
00108 private:
00110         virtual void OnDrawToDC(int w, int h, const unsigned char * cairoData, wxDC* dc);
00112         virtual void OnDrawShapeOntoContext(HippShape* shape, Cairo::RefPtr<Cairo::Context> context, HippShape* selectedShape, bool isHaptic);
00113 
00114         void HippView::CloseFile();
00115         bool loadFile(const string &filename);
00116         HippFrame* frame;
00117 
00118         wxString currentFilename;
00119         wxString currentPath;
00120         bool lastmirror;
00121         bool lastDeviceStatus;
00122         string settings_path;
00123         string common_path;
00124         string deviceinfo_file;
00125         string viewpoint_file;
00126         string render_mode;
00127         bool loaded_first_file;
00128         NodeVector allDevices;
00129         list<Node*> VPlist;
00130         TimeStamp last_viewmenu_update;
00131         bool* penWhitePtr;
00132         int* penWidthPtr;
00133 
00134     HippShape* lastTopShape;
00135 
00136         AutoRef<Node> device_info;
00137 
00138         X3D::DEFNodes default_stylus_dn;
00139 
00140         vector<PaintableTexture*> textures;
00141 
00142         clock_t init, final;
00143 
00144 DECLARE_DYNAMIC_CLASS( HippView)
00145 };
00146 }
00147 #endif /* HIPPVIEW_H_ */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines