#include <layergal.h>
Inheritance diagram for LayerStateAction:
Public Member Functions | |
LayerStateAction () | |
Constructor for the action. | |
~LayerStateAction () | |
virtual ActionCode | Execute () |
Executes the action. Puts the action's layer's visible state to the opposite setting. | |
Static Public Member Functions | |
static ActionCode | Init (UndoableOperation *pOp, ActionList *pActionList, OpLayerGalParam Param) |
This is the function which creates an instance of this action. If there is no room in the undo buffer (which is determined by the base class Init function called within) the function will either return AC_NO_RECORD which means the operation can continue, but no undo information needs to be stored, or AC_OK which means the operation should continue AND record undo information. If the function returns AC_FAIL, there was not enough memory to record the undo information, and the user has decided not to continue with the operation. | |
Protected Attributes | |
OpLayerGalParam | Param |
Definition at line 248 of file layergal.h.
|
Constructor for the action.
Definition at line 2099 of file layergal.cpp.
|
|
Definition at line 2343 of file layergal.cpp.
|
|
Executes the action. Puts the action's layer's visible state to the opposite setting.
Reimplemented from Action. Definition at line 2300 of file layergal.cpp. 02301 { 02302 ActionCode Ac = AC_FAIL; 02303 02304 if (pOperation->IS_KIND_OF(UndoableOperation)) 02305 { 02306 Param.NewState = !Param.NewState; 02307 02308 // Swap LAYER_CHANGE vars 02309 Swap(Param.VisibleState,Param.OldVisibleState); 02310 Swap(Param.LockedState, Param.OldLockedState); 02311 String_256 Str = Param.OldName; 02312 Param.OldName = Param.NewName; 02313 Param.NewName = Str; 02314 02315 Ac = LayerStateAction::Init((UndoableOperation*)pOperation,pOppositeActLst,Param); 02316 02317 if (Ac != AC_FAIL) 02318 { 02319 LayerSGallery* pGal = Param.pLayerSGal; 02320 02321 if (pGal != NULL) 02322 { 02323 pGal->ForceRedrawOfList(); 02324 02325 Document* pDoc = GetWorkingDoc(); 02326 02327 if (pDoc != NULL && pGal->IsVisible()) 02328 { 02329 pGal->SetBoolGadgetSelected(_R(IDC_BTN_MULTILAYER),!(pDoc->IsMultilayer() == 0)); 02330 pGal->SetBoolGadgetSelected(_R(IDC_BTN_ALLVISIBLE),!(pDoc->IsAllVisible() == 0)); 02331 } 02332 } 02333 } 02334 } 02335 else 02336 { 02337 ERROR3("LayerStateAction::Execute() called with op that's not an undoable op"); 02338 } 02339 02340 return Ac; 02341 }
|
|
This is the function which creates an instance of this action. If there is no room in the undo buffer (which is determined by the base class Init function called within) the function will either return AC_NO_RECORD which means the operation can continue, but no undo information needs to be stored, or AC_OK which means the operation should continue AND record undo information. If the function returns AC_FAIL, there was not enough memory to record the undo information, and the user has decided not to continue with the operation.
Definition at line 2134 of file layergal.cpp. 02137 { 02138 UINT32 ActSize = sizeof(LayerStateAction); 02139 02140 LayerStateAction* pNewAction; 02141 ActionCode Ac = Action::Init(pOp,pActionList,ActSize,CC_RUNTIME_CLASS(LayerStateAction),(Action**)&pNewAction); 02142 02143 if (Ac != AC_FAIL && pNewAction != NULL) 02144 { 02145 pNewAction->Param = EntryParam; 02146 OpLayerGalParam& Param = pNewAction->Param; 02147 02148 switch (Param.GetReason()) 02149 { 02150 case LAYER_VISIBLE: 02151 ERROR3IF(Param.pLayer == NULL,"Param.pLayer == NULL"); 02152 02153 if (Param.pLayer != NULL) 02154 LayerSGallery::DoChangeVisible(Param.pLayer,Param.NewState); 02155 break; 02156 02157 case LAYER_LOCKED: 02158 ERROR3IF(Param.pLayer == NULL,"Param.pLayer == NULL"); 02159 02160 if (Param.pLayer != NULL) 02161 LayerSGallery::DoChangeLocked(Param.pLayer,Param.NewState); 02162 break; 02163 02164 case LAYER_ALLVISIBLE: 02165 case FRAME_ALLVISIBLE: 02166 if (Param.pLayerSGal != NULL) 02167 { 02168 Param.pLayerSGal->DoChangeAllVisible(Param.NewState); 02169 Param.pLayerSGal->ForceRedrawOfList(); 02170 } 02171 break; 02172 02173 case LAYER_MULTILAYER: 02174 case FRAME_MULTILAYER: 02175 if (Param.pLayerSGal != NULL) 02176 { 02177 Param.pLayerSGal->DoChangeMultilayer(Param.NewState); 02178 Param.pLayerSGal->ForceRedrawOfList(); 02179 } 02180 break; 02181 02182 case FRAME_MOVE: 02183 case LAYER_MOVE: 02184 case LAYER_TOGGLEBACKGROUND: 02185 ERROR3IF(Param.pLayer == NULL,"Param.pLayer == NULL"); 02186 ERROR3IF(Param.pLayerSGal == NULL,"Param.pLayerSGal == NULL"); 02187 02188 if (Param.pLayer != NULL) 02189 { 02190 if (Param.GetReason() == FRAME_MOVE) 02191 { 02192 Param.pLayer->SetBackground(FALSE); 02193 Param.pLayer->SetPrintable(!Param.pLayer->IsPrintable()); 02194 } 02195 else 02196 { 02197 Param.pLayer->SetBackground(!Param.pLayer->IsBackground()); 02198 Param.pLayer->SetPrintable(!Param.pLayer->IsPrintable()); 02199 } 02200 // Cause the layer gallery items to be recreated 02201 Param.pLayerSGal->CreateNewSubtree(Param.pLayer->FindDocument()); 02202 } 02203 break; 02204 02205 case LAYER_CHANGE: 02206 ERROR3IF(Param.pLayer == NULL,"Param.pLayer == NULL"); 02207 02208 if (Param.pLayer != NULL) 02209 { 02210 Param.OldVisibleState = Param.pLayer->IsVisible(); 02211 Param.OldLockedState = Param.pLayer->IsLocked(); 02212 Param.OldName = Param.pLayer->GetLayerID(); 02213 02214 LayerSGallery::DoChangeVisible(Param.pLayer,Param.VisibleState); 02215 LayerSGallery::DoChangeLocked(Param.pLayer,Param.LockedState); 02216 Param.pLayer->SetLayerID(Param.NewName); 02217 } 02218 break; 02219 02220 case LAYER_SOLID: 02221 ERROR3IF(Param.pLayer == NULL,"Param.pLayer == NULL"); 02222 02223 if (Param.pLayer != NULL) 02224 { 02225 PORTNOTE("galleries", "Disabled frame gallery") 02226 #ifndef EXCLUDE_FROM_XARALX 02227 FrameSGallery::DoChangeSolid(Param.pLayer,Param.NewState); 02228 #endif 02229 Param.pLayer->SetEdited(TRUE); 02230 Param.pLayer->SetFrame(TRUE); // double check this 02231 #ifdef _DEBUG 02232 // Tell the frame gallery to update its display of the frame 02233 BROADCAST_TO_ALL(LayerMsg(Param.pLayer, LayerMsg::REDRAW_LAYER)); 02234 #endif 02235 } 02236 break; 02237 02238 case LAYER_OVERLAY: 02239 ERROR3IF(Param.pLayer == NULL,"Param.pLayer == NULL"); 02240 02241 if (Param.pLayer != NULL) 02242 { 02243 PORTNOTE("galleries", "Disabled frame gallery") 02244 #ifndef EXCLUDE_FROM_XARALX 02245 FrameSGallery::DoChangeOverlay(Param.pLayer,Param.NewState); 02246 #endif 02247 Param.pLayer->SetEdited(TRUE); 02248 Param.pLayer->SetFrame(TRUE); // double check this 02249 #ifdef _DEBUG 02250 // Tell the frame gallery to update its display of the frame 02251 BROADCAST_TO_ALL(LayerMsg(Param.pLayer, LayerMsg::REDRAW_LAYER)); 02252 #endif 02253 } 02254 break; 02255 02256 case LAYER_MAKEFRAME: 02257 ERROR3IF(Param.pLayer == NULL,"Param.pLayer == NULL"); 02258 if (Param.pLayer != NULL) 02259 { 02260 Param.pLayer->SetFrame(Param.NewState); 02261 } 02262 break; 02263 02264 case LAYER_ACTIVE: 02265 ERROR3IF(Param.pLayer == NULL,"Param.pLayer == NULL"); 02266 if (Param.pLayer != NULL) 02267 { 02268 Param.pLayer->SetActive(Param.NewState); 02269 02270 // Ensure that the gallery is updated with the new active layer details 02271 BROADCAST_TO_ALL(LayerMsg(Param.pLayer, LayerMsg::UPDATE_ACTIVE_LAYER)); 02272 } 02273 break; 02274 02275 default: 02276 ERROR3("Unknown Reason code"); 02277 break; 02278 } 02279 } 02280 02281 return Ac; 02282 }
|
|
Definition at line 261 of file layergal.h. |