ForbiddenPatternManager Class Reference

Forbidden pattern controller. More...

#include <forbiddenPatternManager.hpp>

Collaboration diagram for ForbiddenPatternManager:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 ForbiddenPatternManager (MainController *controller)
 Constructor.
virtual ~ForbiddenPatternManager ()
 Destructor.
void setView (ForbiddenPatternView *view)
 Sets the forbidden pattern view.
void newFP (int width, int height)
 Creates a new pattern and adds it to the collection.
void newFP (ForbiddenPattern *fp)
 Adds a pattern to the collection.
void FPSelected (unsigned int FPId)
 Selects a pattern.
void cellChanged (int x, int y)
 Changes the status of a cell of the pattern.
void removeFP ()
 Deletes the pattern currently selected.
bool saveFile ()
 Saves the pattern collection to a file.
bool saveFileAs ()
 Saves the pattern collection to a file.
void openFile ()
 Opens a file containing forbidden patterns.
bool openPFile (wxString file)
 Deletes all the patterns of the collection and opens a file.
bool saveFilename (wxString file)
 Saves the collection to the file.
wxArrayString getFPList ()
 Returns a string list of the patterns of the collection.
ForbiddenPatterngetFP (unsigned int id)
 Pattern access.
bool isModified ()
 Modified status.
wxString getFileName ()
 Member accessor.
void clean ()
 Resets the controller.
bool checkPatterns ()
 Checks the validity of the pattern collection.

Private Member Functions

void updateGrids (bool changed)
 Updates the grid of the view to the current FP.
void updateList ()
 Updates the pattern list for the view.
bool appendFPs (bool mustDeleteFPs, bool newFile)
 Appends the patterns of a file to the collection.
void deleteFPs ()
 Deletes all the patterns of the collection.

Private Attributes

FileManagerView fileView
 File manager view for filesystem interaction.
ForbiddenPatternDiskManagerdiskManager
 Data persistance class.
ForbiddenPatternViewview
 Presentation class.
MainControllercontroller
 Main application controller.
wxString fileName
 Current filename for the forbidden patterns.
bool modified
 Has the forbidden pattern collection been modified without saving?
bool needNewFile
 Do I need a file name to save the forbidden pattern collection?
map< unsigned int, ForbiddenPattern * > FPList
 Collection of forbidden patterns.
unsigned int nextId
 Next identifier to be used for the coming forbidden pattern.
unsigned int currentFP
 Forbidden pattern currently in use.

Detailed Description

Forbidden pattern controller.

This class is the main controller for forbidden patterns. It manages the forbidden pattern view, manages the forbidden pattern collection of the system, provides services to the other controllers regarding forbidden patterns, and manages the disk persistance class.

Author:
Bernat Ràfales Mulet <the_bell@users.sourceforge.net>
Version:
Revision
1.13

Definition at line 48 of file forbiddenPatternManager.hpp.


Constructor & Destructor Documentation

ForbiddenPatternManager::ForbiddenPatternManager MainController controller  ) 
 

Constructor.

Parameters:
controller the main application controller.

Definition at line 29 of file forbiddenPatternManager.cpp.

References controller, currentFP, diskManager, fileName, modified, needNewFile, and nextId.

ForbiddenPatternManager::~ForbiddenPatternManager  )  [virtual]
 

Destructor.

Definition at line 42 of file forbiddenPatternManager.cpp.

References diskManager.


Member Function Documentation

bool ForbiddenPatternManager::appendFPs bool  mustDeleteFPs,
bool  newFile
[private]
 

Appends the patterns of a file to the collection.

This method asks the user for a pattern file to be opened and, after deleting the patterns of the collection depending on a parameter, adds the patterns of the file to the collection. This method is called when the user wants to open a pattern file from the pattern view.

Parameters:
mustDeleteFPs true if the patterns of the collection have to be deleted before adding the new ones.
newFile true if we have to set the current pattern file name to the file selected by the user.
Returns:
True iif the file was correctly opened.

Definition at line 369 of file forbiddenPatternManager.cpp.

References controller, currentFP, deleteFPs(), diskManager, MainController::elementChanged(), fileName, fileView, FPSelected(), modified, FileManagerView::openFileChoose(), ForbiddenPatternDiskManager::openFPs(), ForbiddenPatternView::selectFP(), updateList(), and view.

Here is the call graph for this function:

void ForbiddenPatternManager::cellChanged int  x,
int  y
 

Changes the status of a cell of the pattern.

It changes the status of the cell at coordinates x and y. The status graph is ENABLED->DISABLED->DON'T CARE->ENABLED

Parameters:
x the x coordinate.
y the y coordinate.

Definition at line 65 of file forbiddenPatternManager.cpp.

References controller, currentFP, MainController::elementChanged(), FPList, modified, and updateGrids().

Referenced by ForbiddenPatternView::OnClick().

Here is the call graph for this function:

bool ForbiddenPatternManager::checkPatterns  ) 
 

Checks the validity of the pattern collection.

Returns:
True iif the collection is valid. The collection is valid if it does not contain any repeated pattern.

Definition at line 498 of file forbiddenPatternManager.cpp.

References FPList.

Referenced by ForbiddenPatternView::OnCheck().

void ForbiddenPatternManager::clean  ) 
 

Resets the controller.

Deletes all the patterns and resets all the members. Used when creating a new project.

Definition at line 481 of file forbiddenPatternManager.cpp.

References controller, currentFP, deleteFPs(), MainController::elementChanged(), fileName, MainController::FPsChanged(), FPSelected(), modified, ForbiddenPatternView::selectFP(), updateList(), and view.

Referenced by MainController::newFile().

Here is the call graph for this function:

void ForbiddenPatternManager::deleteFPs  )  [private]
 

Deletes all the patterns of the collection.

Definition at line 328 of file forbiddenPatternManager.cpp.

References controller, currentFP, MainController::elementChanged(), FPList, and nextId.

Referenced by appendFPs(), clean(), openFile(), and openPFile().

Here is the call graph for this function:

void ForbiddenPatternManager::FPSelected unsigned int  FPId  ) 
 

Selects a pattern.

Parameters:
FPId the identifier of the pattern to be selected.

Definition at line 135 of file forbiddenPatternManager.cpp.

References currentFP, and updateGrids().

Referenced by appendFPs(), clean(), newFP(), ForbiddenPatternView::OnSelection(), and openPFile().

Here is the call graph for this function:

wxString ForbiddenPatternManager::getFileName  ) 
 

Member accessor.

Returns:
The file name of the collection.

Definition at line 445 of file forbiddenPatternManager.cpp.

References fileName.

Referenced by MainController::save(), and MainController::saveFileNames().

ForbiddenPattern * ForbiddenPatternManager::getFP unsigned int  id  ) 
 

Pattern access.

Parameters:
id the pattern identifier.
Returns:
The forbidden pattern identified by the parameter.

Definition at line 544 of file forbiddenPatternManager.cpp.

References FPList.

Referenced by LayoutManager::getListFPEnabled().

wxArrayString ForbiddenPatternManager::getFPList  ) 
 

Returns a string list of the patterns of the collection.

Returns:
A string list of the patterns of the collection.

Definition at line 418 of file forbiddenPatternManager.cpp.

References FPList.

Referenced by LayoutManager::FPsChanged().

bool ForbiddenPatternManager::isModified  ) 
 

Modified status.

Returns:
True iif the collection was modified after last save or after it was opened.

Definition at line 435 of file forbiddenPatternManager.cpp.

References modified.

Referenced by MainController::open().

void ForbiddenPatternManager::newFP ForbiddenPattern fp  ) 
 

Adds a pattern to the collection.

Parameters:
fp the pattern to be added.

Definition at line 403 of file forbiddenPatternManager.cpp.

References controller, currentFP, MainController::elementChanged(), FPList, MainController::FPsChanged(), modified, and nextId.

Here is the call graph for this function:

void ForbiddenPatternManager::newFP int  width,
int  height
 

Creates a new pattern and adds it to the collection.

Parameters:
width the pattern width.
height the pattern height.

Definition at line 96 of file forbiddenPatternManager.cpp.

References controller, currentFP, MainController::elementChanged(), fileName, FPList, MainController::FPsChanged(), FPSelected(), modified, needNewFile, nextId, ForbiddenPatternView::selectFP(), ForbiddenPatternView::updateGrids(), updateList(), and view.

Referenced by ForbiddenPatternView::OnNew(), and ForbiddenPatternDiskManager::returnFPs().

Here is the call graph for this function:

void ForbiddenPatternManager::openFile  ) 
 

Opens a file containing forbidden patterns.

The user is asked to select the file.

Definition at line 283 of file forbiddenPatternManager.cpp.

References deleteFPs(), FPList, modified, ForbiddenPatternView::msgYesNo(), saveFile(), and view.

Referenced by ForbiddenPatternView::OnOpen().

Here is the call graph for this function:

bool ForbiddenPatternManager::openPFile wxString  file  ) 
 

Deletes all the patterns of the collection and opens a file.

This method is used when a new project is opened. The controller must delete all the patterns before opening the ones in the file.

Parameters:
file pattern file to be opened.
Returns:
True iif the file was correctly opened.

Definition at line 344 of file forbiddenPatternManager.cpp.

References controller, currentFP, deleteFPs(), diskManager, MainController::elementChanged(), fileName, FPSelected(), ForbiddenPatternDiskManager::openFPs(), ForbiddenPatternView::selectFP(), updateList(), and view.

Here is the call graph for this function:

void ForbiddenPatternManager::removeFP  ) 
 

Deletes the pattern currently selected.

Definition at line 143 of file forbiddenPatternManager.cpp.

References currentFP, and FPList.

Referenced by ForbiddenPatternView::OnRemove().

bool ForbiddenPatternManager::saveFile  ) 
 

Saves the pattern collection to a file.

If the pattern collection has been saved previously it's saved on the same file. If not, the user is asked to enter a file name to save the collection to.

Returns:
True iif the file was correctly saved.

Definition at line 191 of file forbiddenPatternManager.cpp.

References diskManager, fileName, fileView, FPList, modified, needNewFile, FileManagerView::saveFileChoose(), ForbiddenPatternDiskManager::saveFPs(), and view.

Referenced by ForbiddenPatternView::OnSave(), openFile(), MainController::save(), and MainController::saveAs().

Here is the call graph for this function:

bool ForbiddenPatternManager::saveFileAs  ) 
 

Saves the pattern collection to a file.

The user is asked to enter a file name to save the collection to.

Returns:
True iif the file was correctly saved.

Definition at line 241 of file forbiddenPatternManager.cpp.

References fileName, fileView, FPList, FileManagerView::saveFileChoose(), and view.

Referenced by ForbiddenPatternView::OnSaveAs().

Here is the call graph for this function:

bool ForbiddenPatternManager::saveFilename wxString  file  ) 
 

Saves the collection to the file.

Parameters:
file the file to be saved.
Returns:
True iif the collection was correctly saved.

Definition at line 456 of file forbiddenPatternManager.cpp.

References FPList.

Referenced by MainController::save().

void ForbiddenPatternManager::setView ForbiddenPatternView view  ) 
 

Sets the forbidden pattern view.

Parameters:
view the forbidden pattern view.

Definition at line 52 of file forbiddenPatternManager.cpp.

References view.

void ForbiddenPatternManager::updateGrids bool  changed  )  [private]
 

Updates the grid of the view to the current FP.

Parameters:
changed indicates if the update is due to a status change or due to a pattern select event, the view needs this information to know if it has to mantain the scrollbar positions or not.

Definition at line 80 of file forbiddenPatternManager.cpp.

References currentFP, FPList, ForbiddenPatternView::updateGrids(), and view.

Referenced by cellChanged(), and FPSelected().

Here is the call graph for this function:

void ForbiddenPatternManager::updateList  )  [private]
 

Updates the pattern list for the view.

Definition at line 121 of file forbiddenPatternManager.cpp.

References FPList.

Referenced by appendFPs(), clean(), newFP(), and openPFile().


Member Data Documentation

MainController* ForbiddenPatternManager::controller [private]
 

Main application controller.

Definition at line 79 of file forbiddenPatternManager.hpp.

Referenced by appendFPs(), cellChanged(), clean(), deleteFPs(), ForbiddenPatternManager(), newFP(), and openPFile().

unsigned int ForbiddenPatternManager::currentFP [private]
 

Forbidden pattern currently in use.

Definition at line 91 of file forbiddenPatternManager.hpp.

Referenced by appendFPs(), cellChanged(), clean(), deleteFPs(), ForbiddenPatternManager(), FPSelected(), newFP(), openPFile(), removeFP(), and updateGrids().

ForbiddenPatternDiskManager* ForbiddenPatternManager::diskManager [private]
 

Data persistance class.

Definition at line 75 of file forbiddenPatternManager.hpp.

Referenced by appendFPs(), ForbiddenPatternManager(), openPFile(), saveFile(), and ~ForbiddenPatternManager().

wxString ForbiddenPatternManager::fileName [private]
 

Current filename for the forbidden patterns.

Definition at line 81 of file forbiddenPatternManager.hpp.

Referenced by appendFPs(), clean(), ForbiddenPatternManager(), getFileName(), newFP(), openPFile(), saveFile(), and saveFileAs().

FileManagerView ForbiddenPatternManager::fileView [private]
 

File manager view for filesystem interaction.

Definition at line 73 of file forbiddenPatternManager.hpp.

Referenced by appendFPs(), saveFile(), and saveFileAs().

map<unsigned int, ForbiddenPattern*> ForbiddenPatternManager::FPList [private]
 

Collection of forbidden patterns.

Definition at line 87 of file forbiddenPatternManager.hpp.

Referenced by cellChanged(), checkPatterns(), deleteFPs(), getFP(), getFPList(), newFP(), openFile(), removeFP(), saveFile(), saveFileAs(), saveFilename(), updateGrids(), and updateList().

bool ForbiddenPatternManager::modified [private]
 

Has the forbidden pattern collection been modified without saving?

Definition at line 83 of file forbiddenPatternManager.hpp.

Referenced by appendFPs(), cellChanged(), clean(), ForbiddenPatternManager(), isModified(), newFP(), openFile(), and saveFile().

bool ForbiddenPatternManager::needNewFile [private]
 

Do I need a file name to save the forbidden pattern collection?

Definition at line 85 of file forbiddenPatternManager.hpp.

Referenced by ForbiddenPatternManager(), newFP(), and saveFile().

unsigned int ForbiddenPatternManager::nextId [private]
 

Next identifier to be used for the coming forbidden pattern.

Definition at line 89 of file forbiddenPatternManager.hpp.

Referenced by deleteFPs(), ForbiddenPatternManager(), and newFP().

ForbiddenPatternView* ForbiddenPatternManager::view [private]
 

Presentation class.

Definition at line 77 of file forbiddenPatternManager.hpp.

Referenced by appendFPs(), clean(), newFP(), openFile(), openPFile(), saveFile(), saveFileAs(), setView(), and updateGrids().


The documentation for this class was generated from the following files:
Generated on Fri Sep 1 23:57:07 2006 for NanoComp by  doxygen 1.4.6