1 // Copyright (C) 2015 Phil Rosenberg 2 // 3 // This file is part of PLplot. 4 // 5 // PLplot is free software; you can redistribute it and/or modify 6 // it under the terms of the GNU Library General Public License as published 7 // by the Free Software Foundation; either version 2 of the License, or 8 // (at your option) any later version. 9 // 10 // PLplot is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 // GNU Library General Public License for more details. 14 // 15 // You should have received a copy of the GNU Library General Public License 16 // along with PLplot; if not, write to the Free Software 17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 18 // 19 20 #ifndef WXPLFRAME_H 21 #define WXPLFRAME_H 22 23 #include <wx/wx.h> 24 #include <wx/frame.h> 25 #include "wxPLplotstream.h" 26 #include "wxPLplotwindow.h" 27 #include <vector> 28 #include "../drivers/wxwidgets_comms.h" 29 30 //Note that this header is not part of the PLplot public API and is likely to 31 //change without warning 32 33 34 class wxPlFrame : public wxPLplotwindow<wxFrame> 35 { 36 public: 37 static const int ID_FILE_EXIT; 38 static const int ID_HELP_ABOUT; 39 static const int ID_PAGE_NEXT; 40 static const int ID_PAGE_PREV; 41 static const int ID_PAGE_FIXASPECT; 42 static const int ID_CHECK_TIMER; 43 44 wxPlFrame( wxWindow *parent, wxWindowID id, const wxString &title, wxString file, long fileSize, 45 const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, long style = wxDEFAULT_FRAME_STYLE, 46 const wxString &name = wxFrameNameStr ); 47 ~wxPlFrame(); 48 void fixAspect( bool fix ); 49 //overloads of SetClientSize that ensure the wxStream size is changed 50 //immediately 51 void SetClientSize( int width, int height ); 52 void SetClientSize( const wxSize &size ); 53 void SetClientSize( const wxRect &rect ); 54 private: 55 void setupMenus(); 56 void OnExit( wxCommandEvent& event ); 57 void OnAbout( wxCommandEvent& event ); 58 void OnToggleFixAspect( wxCommandEvent& event ); 59 void OnNextPage( wxCommandEvent& event ); 60 void OnPrevPage( wxCommandEvent& event ); 61 void OnCheckTimer( wxTimerEvent &event ); 62 void OnMouse( wxMouseEvent &event ); 63 void OnKey( wxKeyEvent &event ); 64 bool ReadTransmission(); 65 void SetPageAndUpdate( size_t page = size_t(-1) ); 66 std::vector<std::vector<char> > m_pageBuffers; 67 std::vector<bool> m_bufferValidFlags; 68 size_t m_viewingPage; 69 size_t m_writingPage; 70 char * m_transferBuffer; 71 wxString m_file; 72 size_t m_fileSize; 73 74 PLMemoryMap m_memoryMap; 75 #ifdef PL_WXWIDGETS_IPC3 76 // Private variable to hold all components of a MemoryMapHeader struct for a wxPlframe instance. 77 MemoryMapHeader m_header; 78 #else 79 PLNamedMutex m_mutex; 80 #endif 81 wxTimer m_checkTimer; 82 int m_currentTimerInterval; 83 static const int m_idleTimerInterval = 100; 84 static const int m_busyTimerInterval = 0; 85 int m_nothingToDoCounter; 86 static const int m_nothingToDoCounterLimit = 5000; 87 bool m_transferComplete; 88 bool m_inCheckTimerFunction; 89 90 wxPoint m_cursorPosition; 91 int m_locateModePage; 92 size_t m_plottedBufferAmount; 93 unsigned char m_previousTransmissionType; 94 95 DECLARE_EVENT_TABLE(); 96 }; 97 #endif // APEX_MAINFRAME_H 98