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 00032 #ifndef FORBIDDENPATTERNMANAGER_HPP_ 00033 #define FORBIDDENPATTERNMANAGER_HPP_ 00034 00035 #include "forbiddenPatternView.hpp" 00036 #include "forbiddenPattern.hpp" 00037 #include "fileManagerView.hpp" 00038 #include "forbiddenPatternDiskManager.hpp" 00039 #include "mainController.hpp" 00040 #include <map> 00041 00042 using namespace std; 00043 00044 class ForbiddenPatternView; 00045 class ForbiddenPatternDiskManager; 00046 class MainController; 00047 00048 class ForbiddenPatternManager 00049 { 00050 public: 00051 ForbiddenPatternManager(MainController *controller); 00052 virtual ~ForbiddenPatternManager(); 00053 void setView(ForbiddenPatternView *view); 00054 void newFP(int width, int height); 00055 void newFP(ForbiddenPattern *fp); 00056 void FPSelected(unsigned int FPId); 00057 void cellChanged(int x, int y); 00058 void removeFP(); 00059 bool saveFile(); 00060 bool saveFileAs(); 00061 void openFile(); 00062 bool openPFile(wxString file); 00063 bool saveFilename(wxString file); 00064 wxArrayString getFPList(); 00065 ForbiddenPattern *getFP(unsigned int id); 00066 bool isModified(); 00067 wxString getFileName(); 00068 void clean(); 00069 bool checkPatterns(); 00070 00071 private: 00073 FileManagerView fileView; 00075 ForbiddenPatternDiskManager *diskManager; 00077 ForbiddenPatternView *view; 00079 MainController *controller; 00081 wxString fileName; 00083 bool modified; 00085 bool needNewFile; 00087 map<unsigned int, ForbiddenPattern*> FPList; 00089 unsigned int nextId; 00091 unsigned int currentFP; 00092 void updateGrids(bool changed); 00093 void updateList(); 00094 bool appendFPs(bool mustDeleteFPs, bool newFile); 00095 void deleteFPs(); 00096 }; 00097 00098 #endif /*FORBIDDENPATTERNMANAGER_HPP_*/