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 */ 00018 00019 #ifndef MAINCONTROLLER_H 00020 #define MAINCONTROLLER_H 00021 00034 class NanoFrame; 00035 #include "nanoFrame.hpp" 00036 #include "ruleManager.hpp" 00037 #include "layoutManager.hpp" 00038 #include "truthTableManager.hpp" 00039 #include "forbiddenPatternManager.hpp" 00040 #include "fileManagerView.hpp" 00041 #include "simulationManager.hpp" 00042 #include <wx/txtstrm.h> 00043 #include <wx/wfstream.h> 00044 00045 class RuleManager; 00046 class LayoutManager; 00047 class TruthTableManager; 00048 class ForbiddenPatternManager; 00049 class SimulationManager; 00050 00051 class MainController 00052 { 00053 public: 00054 MainController(); 00055 ~MainController(); 00056 void initControllers(); 00057 RuleManager* getRules(); 00058 LayoutManager* getLayouts(); 00059 ForbiddenPatternManager* getForbiddenPatterns(); 00060 TruthTableManager* getTruthTables(); 00061 void setNanoFrame(NanoFrame *frame); 00062 void setRules(RuleManager *rules); 00063 void setLayouts(LayoutManager *layouts); 00064 void setForbiddenPatterns(ForbiddenPatternManager *forbiddenPatterns); 00065 void setTruthTables(TruthTableManager *truthTables); 00066 void tablesChanged(); 00067 void FPsChanged(); 00068 void rulesChanged(); 00069 void setStatusMessage(wxString message); 00070 void save(); 00071 void saveAs(); 00072 void open(); 00073 void newFile(); 00074 void startSimulation(); 00075 void prepareSimulation(); 00076 void elementChanged(); 00077 NanoFrame* getNanoFrame(); 00078 00079 private: 00081 NanoFrame *frame; 00083 RuleManager *rules; 00085 LayoutManager *layouts; 00087 ForbiddenPatternManager *forbiddenPatterns; 00089 TruthTableManager *truthTables; 00091 SimulationManager *simulation; 00093 FileManagerView fileView; 00095 wxString fileName; 00096 void saveFileNames(wxTextOutputStream *stream); 00097 void saveTables(wxTextOutputStream *stream); 00098 void saveRules(wxTextOutputStream *stream); 00099 void savePatterns(wxTextOutputStream *stream); 00100 bool openFile(wxString file); 00101 bool openTables(wxFileInputStream *fileStream, wxTextInputStream *inStream); 00102 bool openRules(wxFileInputStream *fileStream, wxTextInputStream *inStream); 00103 bool openFPs(wxFileInputStream *fileStream, wxTextInputStream *inStream); 00104 }; 00105 #endif //MAINCONTROLLER_H 00106