CommandsHandler Class Reference

#include <CommandsHandler.h>

Collaboration diagram for CommandsHandler:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 CommandsHandler ()
 ~CommandsHandler ()
void registerCommand (CommandObject *doneAction, CommandObject *unDoAction)
bool undo ()
bool redo ()
bool isPosibleUNDO ()
bool isPosibleREDO ()
void setPosibleUNDO (bool UNDOstate)
void setPosibleREDO (bool REDOstate)
void clearActions ()
int getTotalCommands ()
CommandObjectgetActual_UNDO ()
CommandObjectgetActual_REDO ()
CommandObjectget_DO_CommandAt (int position)
CommandObjectget_UNDO_CommandAt (int position)
void validateOperationsAvaliability ()
void setModelBoss (ICommandsUser *theModelParent)

Private Attributes

CommandsRegisterStructureredo_actions
CommandsRegisterStructureunDo_actions
bool posibleUNDO
bool posibleREDO
ICommandsUsertheWorksSpaceBoss
bool isLastREDO_executed
bool isLastUNDO_executed
std::deque< CommandObject * > executionQueue


Detailed Description

Definition at line 15 of file CommandsHandler.h.


Constructor & Destructor Documentation

CommandsHandler::CommandsHandler (  ) 

Definition at line 19 of file CommandsHandler.cxx.

References isLastREDO_executed, isLastUNDO_executed, posibleREDO, posibleUNDO, redo_actions, and unDo_actions.

00020         {
00021                 redo_actions = new CommandsRegisterStructure();
00022                 unDo_actions = new CommandsRegisterStructure();
00023 
00024                 posibleREDO = false;
00025                 posibleUNDO = false;
00026 
00027                 isLastREDO_executed = true;
00028                 isLastUNDO_executed = false;
00029         }

CommandsHandler::~CommandsHandler (  ) 

Definition at line 34 of file CommandsHandler.cxx.

References clearActions(), redo_actions, and unDo_actions.

00035         {
00036                 clearActions();
00037                 delete redo_actions;
00038                 delete unDo_actions;
00039         }

Here is the call graph for this function:


Member Function Documentation

void CommandsHandler::clearActions (  ) 

Definition at line 198 of file CommandsHandler.cxx.

References CommandsRegisterStructure::clearActions(), redo_actions, and unDo_actions.

Referenced by ~CommandsHandler().

00199         {
00200                 redo_actions->clearActions();
00201                 unDo_actions->clearActions();
00202         }

Here is the call graph for this function:

Here is the caller graph for this function:

CommandObject * CommandsHandler::get_DO_CommandAt ( int  position  ) 

Definition at line 237 of file CommandsHandler.cxx.

References CommandsRegisterStructure::getCommandAt(), and redo_actions.

00238         {
00239                 return redo_actions->getCommandAt(position);
00240         }

Here is the call graph for this function:

CommandObject * CommandsHandler::get_UNDO_CommandAt ( int  position  ) 

Definition at line 246 of file CommandsHandler.cxx.

References CommandsRegisterStructure::getCommandAt(), and unDo_actions.

00247         {
00248                 return unDo_actions->getCommandAt(position);
00249         }

Here is the call graph for this function:

CommandObject * CommandsHandler::getActual_REDO (  ) 

Definition at line 228 of file CommandsHandler.cxx.

References CommandsRegisterStructure::getActual_Pointer(), and redo_actions.

Referenced by redo().

00229         {
00230                 return redo_actions->getActual_Pointer();
00231         }

Here is the call graph for this function:

Here is the caller graph for this function:

CommandObject * CommandsHandler::getActual_UNDO (  ) 

Definition at line 219 of file CommandsHandler.cxx.

References CommandsRegisterStructure::getActual_Pointer(), and unDo_actions.

Referenced by undo().

00220         {
00221                 return unDo_actions->getActual_Pointer();
00222         }

Here is the call graph for this function:

Here is the caller graph for this function:

int CommandsHandler::getTotalCommands (  ) 

Definition at line 208 of file CommandsHandler.cxx.

References CommandsRegisterStructure::getTotalCommandsCount(), redo_actions, and unDo_actions.

00209         {
00210                 int value = redo_actions->getTotalCommandsCount();
00211                 return value == (unDo_actions->getTotalCommandsCount())  ? value : -1;
00212         }

Here is the call graph for this function:

bool CommandsHandler::isPosibleREDO (  ) 

Definition at line 172 of file CommandsHandler.cxx.

References posibleREDO.

00173         {
00174                 return posibleREDO;
00175         }

bool CommandsHandler::isPosibleUNDO (  ) 

Definition at line 163 of file CommandsHandler.cxx.

References posibleUNDO.

00164         {
00165                 return posibleUNDO;
00166         }

bool CommandsHandler::redo (  ) 

Definition at line 112 of file CommandsHandler.cxx.

References ICommandsUser::executeCommand(), getActual_REDO(), CommandsRegisterStructure::hasActualNext(), CommandsRegisterStructure::hasActualPrevious(), CommandsRegisterStructure::hasLastNext(), isLastREDO_executed, isLastUNDO_executed, CommandsRegisterStructure::moveBack_Last(), CommandsRegisterStructure::moveForward_Actual(), CommandsRegisterStructure::moveForward_Last(), posibleREDO, redo_actions, theWorksSpaceBoss, unDo_actions, and validateOperationsAvaliability().

Referenced by ContourWorkspace::callREDO().

00113         {
00114                 bool executed = posibleREDO;
00115                 if( posibleREDO )
00116                 {                       
00117                         validateOperationsAvaliability();//para borrar!!!!!!!!-----------------------------*********************---------------------
00118                         isLastREDO_executed = true;
00119                         //isLastUNDO_executed = false; // Posible needed
00120                         executed = theWorksSpaceBoss->executeCommand(getActual_REDO(), true);
00121                         if (!unDo_actions->hasActualPrevious() && !redo_actions->hasActualPrevious())
00122                         {                                                               
00123                                 executed = redo_actions->moveForward_Actual();
00124                                 executed = executed && redo_actions->moveBack_Last();
00125                                 isLastUNDO_executed = false;
00126                         }
00127                         else if (!unDo_actions->hasActualPrevious() && redo_actions->hasActualPrevious())
00128                         {
00129                                 executed = redo_actions->moveForward_Actual();
00130                                 if(unDo_actions->hasLastNext())
00131                                         executed = executed && unDo_actions->moveForward_Last();        
00132                                 executed = executed && unDo_actions->moveForward_Actual();
00133                                 if(redo_actions->hasLastNext())
00134                                         executed = executed && redo_actions->moveForward_Last();
00135                         }
00136                         else 
00137                         {       
00138                                 executed = unDo_actions->moveForward_Actual();  
00139                                 executed = executed && unDo_actions->moveForward_Last();        
00140                                 executed = executed && redo_actions->moveForward_Actual();              
00141                                 if( redo_actions->hasLastNext() ) 
00142                                                 executed = executed && redo_actions->moveForward_Last();        
00143                                 else
00144                                         executed = executed && redo_actions->moveBack_Last();   
00145                         }
00146                         if (!unDo_actions->hasActualPrevious() && redo_actions->hasActualPrevious())
00147                         {
00148                                 isLastUNDO_executed = false;
00149                         }
00150                         if (!unDo_actions->hasActualNext() && !redo_actions->hasActualNext())
00151                         {
00152                                 isLastUNDO_executed = false;
00153                         }
00154                         validateOperationsAvaliability();
00155                 }               
00156                 return executed;
00157         }

Here is the call graph for this function:

Here is the caller graph for this function:

void CommandsHandler::registerCommand ( CommandObject doneAction,
CommandObject unDoAction 
)

Definition at line 51 of file CommandsHandler.cxx.

References CommandsRegisterStructure::getActualIndex(), isLastREDO_executed, isLastUNDO_executed, posibleREDO, posibleUNDO, redo_actions, CommandsRegisterStructure::registerCommand(), CommandsRegisterStructure::setActualIndex(), and unDo_actions.

Referenced by ContourWorkspace::callRegisterCommand().

00052         {
00053                 int actToUNDO = unDo_actions->getActualIndex(); 
00054                 redo_actions->setActualIndex( actToUNDO );                              
00055                 
00056                 redo_actions->registerCommand(doneAction);
00057                 unDo_actions->registerCommand(unDoAction);
00058                 
00059                 posibleREDO = false;
00060                 posibleUNDO = true;
00061 
00062                 isLastREDO_executed = true;
00063                 isLastUNDO_executed = false;
00064                 
00065         }

Here is the call graph for this function:

Here is the caller graph for this function:

void CommandsHandler::setModelBoss ( ICommandsUser theModelParent  ) 

Definition at line 255 of file CommandsHandler.cxx.

References theWorksSpaceBoss.

Referenced by ContourWorkspace::ContourWorkspace().

00256         {
00257                 theWorksSpaceBoss = theModelParent;
00258         }

Here is the caller graph for this function:

void CommandsHandler::setPosibleREDO ( bool  REDOstate  ) 

Definition at line 190 of file CommandsHandler.cxx.

References posibleREDO.

00191         {
00192                 posibleREDO = REDOstate;
00193         }

void CommandsHandler::setPosibleUNDO ( bool  UNDOstate  ) 

Definition at line 181 of file CommandsHandler.cxx.

References posibleUNDO.

00182         {
00183                 posibleUNDO = UNDOstate;
00184         }

bool CommandsHandler::undo (  ) 

Definition at line 71 of file CommandsHandler.cxx.

References ICommandsUser::executeCommand(), getActual_UNDO(), CommandsRegisterStructure::hasActualNext(), CommandsRegisterStructure::hasActualPrevious(), CommandsRegisterStructure::hasLastNext(), isLastREDO_executed, isLastUNDO_executed, CommandsRegisterStructure::moveBack_Actual(), CommandsRegisterStructure::moveBack_Last(), posibleUNDO, redo_actions, theWorksSpaceBoss, unDo_actions, and validateOperationsAvaliability().

Referenced by ContourWorkspace::callUNDO().

00072         {
00073                 bool executed = posibleUNDO;
00074                 if( posibleUNDO )
00075                 {                       
00076                         validateOperationsAvaliability();//para borrar!!!!!!!!-----------------------------*********************---------------------
00077                         executed = theWorksSpaceBoss->executeCommand(getActual_UNDO(), true);
00078                         isLastUNDO_executed = true;
00079                         if (!unDo_actions->hasActualNext() && !redo_actions->hasActualNext())
00080                         {                               
00081                                 if(unDo_actions->hasActualPrevious())
00082                                         executed = unDo_actions->moveBack_Actual() ;
00083                                 else
00084                                         executed = true;
00085                                 if( unDo_actions->hasLastNext() ) 
00086                                         executed = executed && unDo_actions->moveBack_Last();   
00087                                 isLastREDO_executed = false;
00088                         }
00089                         else if (!unDo_actions->hasActualPrevious() && redo_actions->hasActualPrevious())
00090                         {
00091                                 executed = redo_actions->moveBack_Actual();     
00092                                 executed = executed && redo_actions->moveBack_Last();   
00093                                 executed = executed && unDo_actions->moveBack_Last();                           
00094                         }
00095                         else 
00096                         {                                       
00097                                 executed = unDo_actions->moveBack_Last();
00098                                 executed = executed && unDo_actions->moveBack_Actual(); 
00099                                 executed = executed && redo_actions->moveBack_Actual(); 
00100                                 if( redo_actions->hasLastNext() ) 
00101                                         executed = executed && redo_actions->moveBack_Last();   
00102                         }
00103                         validateOperationsAvaliability();                       
00104                 }
00105                 return executed;
00106         }

Here is the call graph for this function:

Here is the caller graph for this function:

void CommandsHandler::validateOperationsAvaliability (  ) 

Definition at line 263 of file CommandsHandler.cxx.

References CommandsRegisterStructure::hasActualNext(), CommandsRegisterStructure::hasActualPrevious(), isLastREDO_executed, isLastUNDO_executed, posibleREDO, posibleUNDO, redo_actions, and unDo_actions.

Referenced by redo(), and undo().

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 150 of file CommandsHandler.h.

Definition at line 144 of file CommandsHandler.h.

Referenced by redo(), setModelBoss(), and undo().


The documentation for this class was generated from the following files:

Generated on Wed Jun 27 23:28:33 2012 for creaContours_lib by  doxygen 1.5.7.1