#include <ruleManager.hpp>
Collaboration diagram for RuleManager:
Public Member Functions | |
RuleManager (MainController *controller) | |
Constructor. | |
virtual | ~RuleManager () |
Destructor. | |
void | setView (RuleView *view) |
Sets the rule view. | |
void | newRule (int width, int height) |
Creates a new rule. | |
void | newRule (Rule *rule) |
Adds a new rule to the collection. | |
void | ruleSelected (unsigned int ruleId) |
Selects a rule. | |
void | cellChanged (GridType grid, int x, int y) |
Cell status change. | |
void | removeRule () |
Deletes the selected rule from the collection. | |
void | copyGrids () |
Copies the initial configuration of the selected rule to its final configuration. | |
bool | saveFile () |
Saves the rule collection. | |
bool | saveFileAs () |
Saves the rule collection to a specified file. | |
void | openFile () |
Opens a rule collection file. | |
bool | openPFile (wxString file) |
Opens a rule collection file for a new project. | |
bool | saveFilename (wxString file) |
Saves the rule collection to a file. | |
wxArrayString | getRuleList () |
Member accessor. | |
bool | isModified () |
Member accessor. | |
wxString | getFileName () |
Member accessor. | |
void | clean () |
bool | checkRules () |
Checks the rule collection for invalid or repeated rules. | |
Rule * | getRule (unsigned int id) |
Returns a rule from the collection. | |
Private Member Functions | |
void | updateGrids (bool changed) |
Updates the grids of the view to the selected rule. | |
void | updateList () |
Updates the view rule list. | |
void | deleteRules () |
Deletes all the rules from the collection. | |
bool | appendRules (bool mustDeleteRules, bool newFile) |
Appends a rule file. | |
Private Attributes | |
RuleView * | view |
Rule view. | |
FileManagerView | fileView |
File System interation view. | |
RuleDiskManager * | diskManager |
Data persistance. | |
MainController * | controller |
Main application controller. | |
map< unsigned int, Rule * > | ruleList |
The rule collection. | |
unsigned int | nextId |
Next identifier to be used for a new rule. | |
unsigned int | currentRule |
Current selected rule. | |
bool | modified |
Has been the collection been modified after saving? | |
bool | needNewFile |
Do we need a filename for saving the rule collection? | |
wxString | fileName |
FIlename of the rule collection. |
This class is the main controller for the rule collection. It manages it's view and data persistance layers and also provides services to the other controllers.
Definition at line 46 of file ruleManager.hpp.
|
Constructor.
Definition at line 29 of file ruleManager.cpp. References controller, currentRule, diskManager, fileName, modified, needNewFile, and nextId. |
|
Destructor.
Definition at line 42 of file ruleManager.cpp. References diskManager. |
|
Appends a rule file.
Definition at line 381 of file ruleManager.cpp. References controller, currentRule, deleteRules(), diskManager, MainController::elementChanged(), fileName, fileView, modified, FileManagerView::openFileChoose(), RuleDiskManager::openRules(), ruleSelected(), RuleView::selectRule(), updateList(), and view. Here is the call graph for this function: ![]() |
|
Cell status change.
Definition at line 101 of file ruleManager.cpp. References controller, currentRule, MainController::elementChanged(), modified, nFINAL, nINITIAL, ruleList, and updateGrids(). Referenced by RuleView::OnClick(). Here is the call graph for this function: ![]() |
|
Checks the rule collection for invalid or repeated rules.
Definition at line 508 of file ruleManager.cpp. References ruleList. Referenced by RuleView::OnCheck(), and MainController::prepareSimulation(). |
|
Deletes the rule collection and cleans all the controller information. Definition at line 491 of file ruleManager.cpp. References controller, currentRule, deleteRules(), MainController::elementChanged(), fileName, modified, MainController::rulesChanged(), ruleSelected(), RuleView::selectRule(), updateList(), and view. Referenced by MainController::newFile(). Here is the call graph for this function: ![]() |
|
Copies the initial configuration of the selected rule to its final configuration.
Definition at line 194 of file ruleManager.cpp. References currentRule, ruleList, and updateGrids(). Referenced by RuleView::OnCopy(). Here is the call graph for this function: ![]() |
|
Deletes all the rules from the collection.
Definition at line 365 of file ruleManager.cpp. References controller, currentRule, MainController::elementChanged(), nextId, and ruleList. Referenced by appendRules(), clean(), openFile(), and openPFile(). Here is the call graph for this function: ![]() |
|
Member accessor.
Definition at line 457 of file ruleManager.cpp. References fileName. Referenced by MainController::save(), and MainController::saveFileNames(). |
|
Returns a rule from the collection.
Definition at line 563 of file ruleManager.cpp. References ruleList. Referenced by LayoutManager::getListRuleEnabled(). |
|
Member accessor.
Definition at line 430 of file ruleManager.cpp. References ruleList. Referenced by LayoutManager::rulesChanged(). |
|
Member accessor.
Definition at line 447 of file ruleManager.cpp. References modified. Referenced by MainController::open(). |
|
Adds a new rule to the collection.
Definition at line 415 of file ruleManager.cpp. References controller, currentRule, MainController::elementChanged(), modified, nextId, ruleList, and MainController::rulesChanged(). Here is the call graph for this function: ![]() |
|
Creates a new rule.
Definition at line 53 of file ruleManager.cpp. References controller, currentRule, MainController::elementChanged(), fileName, modified, needNewFile, nextId, ruleList, MainController::rulesChanged(), ruleSelected(), RuleView::selectRule(), RuleView::updateGrids(), updateList(), and view. Referenced by RuleView::OnNewRule(), and RuleDiskManager::returnRules(). Here is the call graph for this function: ![]() |
|
Opens a rule collection file. The user is asked to append the rules to the existing ones or overwrite them. Definition at line 301 of file ruleManager.cpp. References deleteRules(), modified, RuleView::msgYesNo(), ruleList, saveFile(), and view. Referenced by RuleView::OnOpen(). Here is the call graph for this function: ![]() |
|
Opens a rule collection file for a new project.
Definition at line 350 of file ruleManager.cpp. References controller, currentRule, deleteRules(), diskManager, MainController::elementChanged(), fileName, RuleDiskManager::openRules(), ruleSelected(), RuleView::selectRule(), updateList(), and view. Here is the call graph for this function: ![]() |
|
Deletes the selected rule from the collection.
Definition at line 142 of file ruleManager.cpp. References currentRule, and ruleList. Referenced by RuleView::OnRemove(). |
|
Selects a rule.
Definition at line 88 of file ruleManager.cpp. References currentRule, and updateGrids(). Referenced by appendRules(), clean(), newRule(), RuleView::OnSelection(), and openPFile(). Here is the call graph for this function: ![]() |
|
Saves the rule collection. If the collection has not been saved before, the user is asked for a file name.
Definition at line 210 of file ruleManager.cpp. References diskManager, fileName, fileView, modified, needNewFile, ruleList, FileManagerView::saveFileChoose(), RuleDiskManager::saveRules(), and view. Referenced by RuleView::OnSave(), openFile(), MainController::save(), and MainController::saveAs(). Here is the call graph for this function: ![]() |
|
Saves the rule collection to a specified file.
Definition at line 258 of file ruleManager.cpp. References fileName, fileView, ruleList, FileManagerView::saveFileChoose(), and view. Referenced by RuleView::OnSaveAs(). Here is the call graph for this function: ![]() |
|
Saves the rule collection to a file.
Definition at line 468 of file ruleManager.cpp. References ruleList. Referenced by MainController::save(). |
|
Sets the rule view.
Definition at line 78 of file ruleManager.cpp. References view. |
|
Updates the grids of the view to the selected rule.
Definition at line 128 of file ruleManager.cpp. References currentRule, ruleList, RuleView::updateGrids(), and view. Referenced by cellChanged(), copyGrids(), and ruleSelected(). Here is the call graph for this function: ![]() |
|
Updates the view rule list.
Definition at line 179 of file ruleManager.cpp. References ruleList. Referenced by appendRules(), clean(), newRule(), and openPFile(). |
|
Main application controller.
Definition at line 78 of file ruleManager.hpp. Referenced by appendRules(), cellChanged(), clean(), deleteRules(), newRule(), openPFile(), and RuleManager(). |
|
Current selected rule.
Definition at line 84 of file ruleManager.hpp. Referenced by appendRules(), cellChanged(), clean(), copyGrids(), deleteRules(), newRule(), openPFile(), removeRule(), RuleManager(), ruleSelected(), and updateGrids(). |
|
Data persistance.
Definition at line 76 of file ruleManager.hpp. Referenced by appendRules(), openPFile(), RuleManager(), saveFile(), and ~RuleManager(). |
|
FIlename of the rule collection.
Definition at line 90 of file ruleManager.hpp. Referenced by appendRules(), clean(), getFileName(), newRule(), openPFile(), RuleManager(), saveFile(), and saveFileAs(). |
|
File System interation view.
Definition at line 74 of file ruleManager.hpp. Referenced by appendRules(), saveFile(), and saveFileAs(). |
|
Has been the collection been modified after saving?
Definition at line 86 of file ruleManager.hpp. Referenced by appendRules(), cellChanged(), clean(), isModified(), newRule(), openFile(), RuleManager(), and saveFile(). |
|
Do we need a filename for saving the rule collection?
Definition at line 88 of file ruleManager.hpp. Referenced by newRule(), RuleManager(), and saveFile(). |
|
Next identifier to be used for a new rule.
Definition at line 82 of file ruleManager.hpp. Referenced by deleteRules(), newRule(), and RuleManager(). |
|
The rule collection.
Definition at line 80 of file ruleManager.hpp. Referenced by cellChanged(), checkRules(), copyGrids(), deleteRules(), getRule(), getRuleList(), newRule(), openFile(), removeRule(), saveFile(), saveFileAs(), saveFilename(), updateGrids(), and updateList(). |
|
Rule view.
Definition at line 72 of file ruleManager.hpp. Referenced by appendRules(), clean(), newRule(), openFile(), openPFile(), saveFile(), saveFileAs(), setView(), and updateGrids(). |