00001 /* 00002 * * 00003 * This program is free software; you can redistribute it and/or modify * 00004 * it under the terms of the GNU General Public License as published by * 00005 * the Free Software Foundation; either version 2 of the License, or * 00006 * (at your option) any later version. * 00007 * * 00008 * This program is distributed in the hope that it will be useful, * 00009 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00010 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 00011 * GNU General Public License for more details. * 00012 * * 00013 * You should have received a copy of the GNU General Public License * 00014 * along with this program; if not, write to the * 00015 * Free Software Foundation, Inc., * 00016 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 00017 */ 00030 #ifndef LAYOUTVIEW_HPP_ 00031 #define LAYOUTVIEW_HPP_ 00032 00033 #include <wx/wx.h> 00034 00035 #include "layoutCanvas.hpp" 00036 #include "layoutManager.hpp" 00037 #include "truthTableCanvas.hpp" 00038 #include <map> 00039 00040 using namespace std; 00041 00042 class LayoutManager; 00043 00044 class LayoutView : public wxPanel 00045 { 00046 public: 00047 LayoutView(wxWindow* parent, wxWindowID id, LayoutManager *controller); 00048 virtual ~LayoutView(); 00049 void updateGrids(Grid grid, bool changed); 00050 void OnNew(wxCommandEvent &event); 00051 void OnSave(wxCommandEvent &event); 00052 void OnSaveAs(wxCommandEvent &event); 00053 void OnOpen(wxCommandEvent &event); 00054 void OnClick(LayoutCanvasEvent &event); 00055 void updateTTList(map<wxString, bool> tables); 00056 void updateFPList(map<unsigned int, bool> FPs); 00057 void updateRuleList(map<unsigned int, bool> rules); 00058 void updateInputList(wxArrayString strings); 00059 void updateOutputList(wxArrayString strings); 00060 void selectTable(wxString table); 00061 void errorMsg(wxString message); 00062 bool msgYesNo(wxString message); 00063 void OnTableSelected(wxCommandEvent &event); 00064 void OnInputSelected(wxCommandEvent &event); 00065 void OnOutputSelected(wxCommandEvent &event); 00066 void OnTableChecked(wxCommandEvent &event); 00067 void OnRuleChecked(wxCommandEvent &event); 00068 void OnFPChecked(wxCommandEvent &event); 00069 void OnAssignInput(wxCommandEvent &event); 00070 void OnAssignOutput(wxCommandEvent &event); 00071 void OnPrepare(wxCommandEvent &event); 00072 void OnStart(wxCommandEvent &event); 00073 void onlyAssign(bool enable); 00074 void OnKeyPressed(wxKeyEvent &event); 00075 void updateCanvas(); 00076 void updateInputs(vector<coordinate> inputs); 00077 void updateOutputs(vector<coordinate> outputs); 00078 void checkTable(wxString table, bool enabled); 00079 void checkRule(wxString rule, bool enabled); 00080 void checkFP(wxString FP, bool enabled); 00081 void enableCheckSimulation(bool enable); 00082 void enableStartSimulation(bool enable); 00083 00084 private: 00085 DECLARE_EVENT_TABLE() 00086 void initControls(); 00087 void initSizers(); 00088 00089 LayoutManager *controller; 00090 00091 //Labels 00092 wxStaticText *labelTitle; 00093 00094 //Buttons 00095 wxBitmapButton *buttonNew; 00096 wxBitmapButton *buttonOpen; 00097 wxBitmapButton *buttonSave; 00098 wxBitmapButton *buttonSaveAs; 00099 wxBitmapButton *buttonAssignInput; 00100 wxBitmapButton *buttonAssignOutput; 00101 wxButton *buttonPrepareSimulation; 00102 wxButton *buttonStartSimulation; 00103 00104 //Other controls 00105 wxCheckListBox *listTables; 00106 wxCheckListBox *listRules; 00107 wxCheckListBox *listFPs; 00108 wxListBox *listInputs; 00109 wxListBox *listOutputs; 00110 LayoutCanvas *canvas; 00111 }; 00112 00113 #endif /*LAYOUTVIEW_HPP_*/