#include <sglayer.h>
Inheritance diagram for LayerSGallery:

Public Member Functions | |
| LayerSGallery () | |
| LayerSGallery default constructor. | |
| ~LayerSGallery () | |
| LayerSGallery destructor. | |
| virtual MsgResult | Message (Msg *Message) |
| A standard message handler, really. | |
| virtual BOOL | InitMenuCommands (void) |
| Initialises any menu commands that this gallery needs. | |
| virtual BOOL | BuildCommandMenu (GalleryContextMenu *TheMenu, SGMenuID MenuID) |
| To build a menu of commands to be popped up over the gallery. | |
| virtual OpState | GetCommandState (StringBase *CommandID, String_256 *ShadeReason) |
| To determine the state of a given menu item. This method is an exact parallel to an Op's GetState method (in fact, it is called by an Op's GetState). | |
| virtual void | DoCommand (StringBase *CommandID) |
| To apply a given command when it is chosen from the menu. | |
| virtual void | CreateNewSubtree (Document *ParentDoc, SGDisplayGroup *ExistingGroup=NULL) |
| Internal call. This takes the Layer list of the given document and creates a DisplayTree subtree from it. This subtree is then added to the DisplayTree. Note that this does not force a redraw of the list - after making this call, you should also call ForceRedrawOfList. | |
| Spread * | GetSelectedSpread (void) |
| To find the current layer gallery spread. | |
| virtual void | DoChangeAllVisible (BOOL AllVisible) |
| Called when the AllVisible button is clicked in the layers gallery. Effects the visibility of all layers, regardless of their visibility. | |
| virtual void | DoChangeMultilayer (BOOL Multilayer) |
| Called when the Multilayer button is clicked in the layers gallery. Effects the locked state of all layers, regardless of their individual locked state. | |
| virtual void | DoChangeLayerState (Layer *pLayer, OpLayerGalReason Reason, BOOL NewState) |
| Undoable way of changing the layer's state. | |
Static Public Member Functions | |
| static void | ForceRedrawLayer (Document *pDoc, Layer *pLayer) |
| Does a ForceRedraw on the layer in the given doc. | |
| static void | MakeActiveLayer (Layer *pNewActiveLayer, BOOL TellAll=TRUE) |
| Makes the layer active. Firstly it will inactivate any other active layers, forcing it to redraw if necessary Then it will set this layer to be active, again forcing a redraw if necessary. | |
| static void | EnsureActiveLayerIntegrity (Spread *pSpread, Layer **ppActiveLayer=NULL) |
| This checks that there is one and only one active layer in the given spread. If there isn't an active layer, the first layer is made active. If there is more than on active layer, all but the first active layer are made inactive. | |
| static void | SetActive (Document *pDoc, Layer *pLayer, BOOL state) |
| Calls pLayer->SetActive(state), redrawing and changing the layer's selection if necessary. DON'T CALL THIS FUNC!! USE MakeActiveLayer() INSTEAD!!!! | |
| static void | MakeTopLayerActive (Spread *pSpread) |
| Makes the layer active. Firstly it will inactivate any other active layers, forcing it to redraw if necessary If the new layer is already active, nothing else happens Then it will set this layer to be active, again forcing a redraw if necessary. | |
| static String_256 | CreateUniqueLayerID (Spread *pSpread) |
| Used to generate a LayerID which is unique for the spread. The name generated is normally of the form "Layer n", where n is the number of layers in the spread + 1. If "Layer n" already exists on the spread then "Layer m" is generated where m is the smallest integer greater than n such that the id is unique. | |
| static void | DoChangeVisible (Layer *pLayer, BOOL Visible) |
| Called when the visible button is clicked in a layer gallery item. Changes the visibility of the displayed layer. | |
| static void | DoChangeLocked (Layer *pLayer, BOOL Locked) |
| Called when the Locked button is clicked in a layer gallery item. Changes the lockedness of the displayed layer. | |
| static BOOL | DoMoveSelectionToActiveLayer () |
Protected Member Functions | |
| virtual BOOL | PreCreate (void) |
| Layer SuperGallery PreCreate handler. | |
| virtual BOOL | PostCreate (void) |
| The LayerSGallery PostCreate handler. This overrides the base class PostCreate function. It is called at the very end of the SuperGallery::Create method, after the window has been created and opened. | |
| virtual BOOL | ApplyAction (SGActionType Action) |
| Applies certain conventional gallery actions (usually associated with gallery buttons, for new, edit, delete, etc). | |
| virtual void | DoShadeGallery (BOOL ShadeIt) |
| Called by the base class whenever the shaded status of the gallery is changed, to allow derived galleries to shade/unshade any extra controls that they provide in the window. ONLY called if the gallery is actually open/visible. | |
| virtual SGDisplayItem * | CopyDisplayItem (SGDisplayItem *SourceItem, SGDisplayGroup *DestGroup, SGDisplayItem *TargetPosition=NULL) |
| "Copies" the existing node in the tree in an appropriate fashion. | |
| virtual void | NewSelectedSpread (Spread *pNewSelSpread=NULL) |
| Central place for setting the layer gal's selected spread. Also takes a copy of the selected document. | |
| virtual void | EnsureSelSpreadSelectionIntegrity () |
| This makes sure that all the invisible and/or locked layers in the spread have no selection. It calls NodeRenderableInk::DeselectAllOnLayer() on each layer that should NOT have a selection, just in case. Currently only called after an undo or redo op, because it could be quite slow. | |
| virtual void | EnsureActiveLayerIntegrity () |
| This checks that there is one and only one active layer in the gallery's spread. | |
| virtual BOOL | CheckVarsAreValid () |
| A routine that checks to see if critical vars are OK. All it does at the mo is check that pSpread and pDoc are not NULL. In debug builds, an ENSURE will go off if something goes wrong. | |
| virtual SGDisplayLayer * | GetSelectedLayerGalItem () |
| Gets the selected layer gallery item In debug builds, an ENSURE will go off if there is no selected gal item. | |
| virtual BOOL | HasLayerGotChildren (Layer *pLayer) |
| Scans the layer for children that render something on the screen. It ignores attributes, hidden nodes, etc - nodes that don't render anything themselves. | |
| virtual BOOL | PrepareToDelete (void) |
| Scans the current Gallery selection. Possibly asks the user for confirmation about the delete. Possibly adjusts the selection as appropriate. Then returns a value to indicate whether the remaining selection should be deleted. | |
| virtual BOOL | DoDeleteSelection (void) |
| FORCIBLY deletes the current gallery selection. By the time this function is called, PrepareToDelete has made sure that it is safe to continue. This must simply invoke a forced delete upon the selection. Deletion of colours occurs by hiding (with undo). | |
| virtual void | DoCreateNewItem (void) |
| This function is meant to be overridden in derived classes It creates a new item and adds it to the Gallery DisplayList The item may be created by cloning/deriving/basing-on the selected item, depending on the type of Gallery concerned. | |
| virtual void | DoChangeName () |
| Pops up the name changing dialog for the selected layer. | |
| virtual void | DoCopyLayer () |
| Pops up the name changing dialog for the selected layer, and if OK is clicked a copy of the layer is made with the new name. | |
| virtual void | DoLayerProperties () |
| Opens the layer properties dlg. | |
| virtual void | DoCreateGuideLayer () |
| Creates a guide layer. | |
| virtual void | DoChangeLayerStatus (Layer *pLayer, const LayerStatus &NewStatus) |
| General undoable way of changing the selected layer's status. | |
| virtual void | DoMoveLayer (MoveLayerType Reason) |
| Called when the Locked button is clicked in the layers gallery. Changes the lockedness of the selected layer, if there is one. | |
| virtual INT32 | GetGuideLayerState (DocView *pDocView) |
| This returns the current state of the guide layer. It is used to determine whether we need to recreate and redraw the layer gallery when the selected view changes. | |
| virtual BOOL | IsSelectedItemGuideLayer () |
| General function for finding out if the selected item is a guide layer Notes: Need not be overridden - the default action is to do nothing extra to the normal shade/unshade operation. | |
| BOOL | IsLayerMode (Document *pDoc) |
| BOOL | CloseLayerGallery () |
| BOOL | OpenFrameGallery () |
| void | SetNewDocBorn (BOOL Val) |
| BOOL | GetNewDocBorn () |
Protected Attributes | |
| Spread * | pSpread |
| Document * | pDoc |
| SGDisplayGroup * | DisplayForeground |
| SGDisplayGroup * | DisplayBackground |
| BOOL | m_NewDocBorn |
| INT32 | OldGuideLayerState |
| INT32 | NewGuideLayerState |
Definition at line 267 of file sglayer.h.
|
|
LayerSGallery default constructor.
Definition at line 1290 of file sglayer.cpp. 01291 { 01292 #ifndef EXCLUDE_GALS 01293 DlgResID = _R(IDD_LAYERSGALLERY); 01294 pSpread = NULL; 01295 pDoc = NULL; 01296 DisplayForeground = NULL; // Group of foreground layers 01297 DisplayBackground = NULL; // Group of background layers 01298 01299 OldGuideLayerState = -1; 01300 NewGuideLayerState = -1; 01301 m_NewDocBorn = FALSE; 01302 #endif 01303 }
|
|
|
LayerSGallery destructor.
Definition at line 1317 of file sglayer.cpp.
|
|
|
Applies certain conventional gallery actions (usually associated with gallery buttons, for new, edit, delete, etc).
Reimplemented from SuperGallery. Reimplemented in FrameSGallery. Definition at line 1527 of file sglayer.cpp. 01528 { 01529 // No display tree? Better forget about it then! 01530 if (DisplayTree == NULL) 01531 return(FALSE); 01532 01533 // Determine useful info - this is usually needed for most actions, so always get it 01534 Document *SelectedDoc = Document::GetSelected(); 01535 SGDisplayGroup *DocumentGroup = DisplayTree->FindSubtree(this, SelectedDoc, NULL); 01536 SGDisplayLayer *FirstSelected = NULL; 01537 01538 if (DocumentGroup != NULL) 01539 FirstSelected = (SGDisplayLayer *) DocumentGroup->FindNextSelectedItem(NULL); 01540 01541 // Now, process the action TO DO! - see Colour gallery for examples 01542 switch(Action) 01543 { 01544 case SGACTION_CREATE: 01545 DoCreateNewItem(); 01546 break; 01547 01548 case SGACTION_EDIT: 01549 DoChangeName(); 01550 break; 01551 01552 case SGACTION_DELETE: 01553 if (PrepareToDelete()) 01554 DoDeleteSelection(); 01555 break; 01556 01557 // case SGACTION_APPLY: 01558 // case SGACTION_REDEFINE: 01559 // case SGACTION_DISPLAYMODECHANGED: 01560 // These operations are not provided by the layer gallery 01561 // break; 01562 01563 default: 01564 return(SuperGallery::ApplyAction(Action)); 01565 } 01566 01567 return(TRUE); 01568 }
|
|
||||||||||||
|
To build a menu of commands to be popped up over the gallery.
Reimplemented from SuperGallery. Reimplemented in FrameSGallery. Definition at line 3279 of file sglayer.cpp. 03280 { 03281 BOOL ok = TRUE; 03282 03283 if (MenuID == SGMENU_OVERITEM) 03284 { 03285 // Over-list menu 03286 SGDisplayLayer* pLayerGalItem = GetSelectedLayerGalItem(); 03287 03288 #ifndef STANDALONE 03289 // no layer properties tab present on standalone version 03290 if (pLayerGalItem != NULL) 03291 { 03292 // Changed for Frame/Layer integration. 03293 //#ifdef WEBSTER 03294 // GIFAnimationPropertyTabs * pTabHandler = GIFAnimationPropertyTabsDlg::GetGIFAnimationPropertiesTabs(); 03295 //#else 03296 LayerPropertyTabs * pTabHandler = LayerPropertyTabsDlg::GetLayerPropertiesTabs(); 03297 //#endif //webster 03298 if (pTabHandler) 03299 { 03300 pTabHandler->SetCurrentLayer(pLayerGalItem->GetDisplayedLayer()); 03301 } 03302 } 03303 #endif 03304 ok = ok && AddCommand(TheMenu, (StringBase *) &SGCmd_New); 03305 ok = ok && AddCommand(TheMenu, (StringBase *) &SGCmd_Copy); 03306 ok = ok && AddCommand(TheMenu, (StringBase *) &SGCmd_Delete,TRUE); 03307 ok = ok && AddCommand(TheMenu, (StringBase *) &SGCmd_Create); 03308 #ifndef STANDALONE 03309 ok = ok && AddCommand(TheMenu, (StringBase *) &SGCmd_Properties); 03310 #endif 03311 } 03312 03313 return(ok); 03314 }
|
|
|
A routine that checks to see if critical vars are OK. All it does at the mo is check that pSpread and pDoc are not NULL. In debug builds, an ENSURE will go off if something goes wrong.
Definition at line 2395 of file sglayer.cpp.
|
|
|
Definition at line 3454 of file sglayer.cpp. 03455 { 03456 SuperGallery* pSuperGallery = SuperGallery::FindSuperGallery(_R(IDD_LAYERSGALLERY)); 03457 03458 // Ensure a valid ptr. 03459 if (pSuperGallery == NULL) 03460 return FALSE; 03461 03462 if (pSuperGallery->GetRuntimeClass() == CC_RUNTIME_CLASS(LayerSGallery)) 03463 { 03464 PORTNOTE("galleries", "Disabled frame gallery") 03465 #ifndef EXCLUDE_FROM_XARALX 03466 GIFAnimationPropertyTabs::SetFrameGalleryOpen(FALSE); 03467 #endif 03468 // Toggle the visible state of the gallery window 03469 pSuperGallery->SetVisibility( FALSE ); 03470 } 03471 else 03472 { 03473 ERROR3("Got the frame gallery but it's not of the LayerSGallery class"); 03474 } 03475 03476 SGInit::UpdateGalleryButton(_R(OPTOKEN_DISPLAYLAYERGALLERY), FALSE); 03477 03478 // Everything ok. 03479 return TRUE; 03480 }
|
|
||||||||||||||||
|
"Copies" the existing node in the tree in an appropriate fashion.
TargetPosition - NULL (to add to the end of the sibling list), or points to the item BEFORE which the SourceItem will be copied.
Notes: This method should be overridden by derived galleries to provide appropriate behaviour (some galleries (e.g colour) will copy the real-item that the given display-item references to the new group (document), while other galleries (layer) may just move the item after all). Note the handy InsertCopiedItem and MoveBefore/After methods which are available to take all of the hard work out of copying/moving items! See the body of this method in the source code for example pseudocode. For real code, see the Colour Gallery (sgcolour.cpp)
Reimplemented from SuperGallery. Definition at line 3147 of file sglayer.cpp. 03149 { 03150 ERROR3IF(SourceItem == NULL || DestGroup == NULL, "Illegal NULL param"); 03151 if (SourceItem == NULL || DestGroup == NULL) 03152 return(NULL); 03153 03154 ERROR3IF(!IS_A(DestGroup,SGLayerGroup),"DestGroup is not a SGLayerGroup"); 03155 ERROR3IF(!IS_A(SourceItem,SGDisplayLayer),"SourceItem is not a SGDisplayLayer"); 03156 if (!IS_A(DestGroup,SGLayerGroup) || !IS_A(SourceItem,SGDisplayLayer)) 03157 return(NULL); 03158 03159 SGLayerGroup* pDestLayerGroup = (SGLayerGroup*)DestGroup; 03160 SGDisplayLayer* pSourceLayerItem = (SGDisplayLayer*)SourceItem; 03161 03162 SGDisplayItem* pDestItem = TargetPosition; 03163 BOOL Before = TRUE; 03164 03165 if (pDestItem == NULL) 03166 { 03167 pDestItem = (SGDisplayItem*) pDestLayerGroup->GetChild(); 03168 Before = TRUE; 03169 03170 if (pDestItem == NULL) 03171 { 03172 SGDisplayNode* pNode = SourceItem; 03173 while (pNode != NULL) 03174 { 03175 pDestItem = (SGDisplayItem*) pNode; 03176 if (pDestLayerGroup->IsForeground()) 03177 pNode = pNode->GetPrevious(); 03178 else 03179 pNode = pNode->GetNext(); 03180 } 03181 03182 Before = pDestLayerGroup->IsForeground(); 03183 } 03184 else 03185 { 03186 SGDisplayItem* pLastDestItem = NULL; 03187 while (pDestItem != NULL) 03188 { 03189 pLastDestItem = pDestItem; 03190 pDestItem = (SGDisplayItem*)(pDestItem->GetNext()); 03191 } 03192 03193 pDestItem = pLastDestItem; 03194 Before = FALSE; 03195 } 03196 } 03197 03198 ERROR3IF(pDestItem == NULL,"pDestItem is still NULL"); 03199 if (pDestItem == NULL) 03200 return(NULL); 03201 03202 // Move the display item around 03203 SourceItem->RemoveFromTree(); // Delink from current displaytree position 03204 SuperGallery::InsertCopiedItem(SourceItem, DestGroup, TargetPosition); 03205 03206 if (pDestItem != NULL) 03207 { 03208 ERROR3IF(!IS_A(pDestItem,SGDisplayLayer),"SourceItem is not a SGDisplayLayer"); 03209 if (!IS_A(pDestItem,SGDisplayLayer)) 03210 return(NULL); 03211 03212 SGDisplayLayer* pDestLayerItem = (SGDisplayLayer*)pDestItem; 03213 pDestLayerItem->MoveLayer(pSourceLayerItem,Before,TRUE); 03214 } 03215 03216 return(SourceItem); 03217 }
|
|
||||||||||||
|
Internal call. This takes the Layer list of the given document and creates a DisplayTree subtree from it. This subtree is then added to the DisplayTree. Note that this does not force a redraw of the list - after making this call, you should also call ForceRedrawOfList.
Reimplemented in FrameSGallery. Definition at line 1348 of file sglayer.cpp. 01349 { 01350 if (DisplayTree == NULL) 01351 return; 01352 01353 TRACEUSER( "Neville", _T("LayerSGallery::CreateNewSubtree Just about to DestroySubtree\n")); 01354 // The layer gallery only ever shows one document, so destroy the entire tree 01355 // and start again from scratch (note that this doesn't destroy the root node) 01356 DisplayTree->DestroySubtree(); 01357 01358 // All groups will be destroyed by DestroySubtree(), so we'd better forget them 01359 DisplayForeground = NULL; 01360 DisplayBackground = NULL; 01361 01362 TRACEUSER( "Neville", _T("LayerSGallery::CreateNewSubtree completed DestroySubtree\n")); 01363 01364 if (ParentDoc == NULL) 01365 return; 01366 01367 SGDisplayLayer *DisplayLayer = NULL; 01368 01369 EnsureActiveLayerIntegrity(); 01370 01371 // Create the foreground layer group 01372 DisplayForeground = new SGLayerGroup(this, ParentDoc,NULL,TRUE); // Create new Group 01373 if (DisplayForeground == NULL) // Total failure - abort 01374 return; 01375 DisplayTree->AddItem(DisplayForeground); // Add new group to tree 01376 01377 // Create the background layer group 01378 DisplayBackground = new SGLayerGroup(this, ParentDoc,NULL,FALSE); // Create new Group 01379 if (DisplayBackground == NULL) // Total failure - abort 01380 return; 01381 DisplayTree->AddItem(DisplayBackground); // Add new group to tree 01382 01383 01384 Spread* pSelSpread = GetSelectedSpread(); 01385 ERROR3IF(pSelSpread == NULL,"No selected spread in LayerSGallery"); 01386 if (pSelSpread == NULL) return; 01387 01388 Layer* pLayer = pSelSpread->FindLastLayer(); 01389 Layer* pActiveLayer = NULL; 01390 Layer* pGuideLayer = NULL; 01391 01392 while (pLayer != NULL) 01393 { 01394 // Keep a ptr to the guide layer, if there is one 01395 if (pLayer->IsGuide()) 01396 pGuideLayer = pLayer; 01397 01398 DisplayLayer = new SGDisplayLayer(pLayer); 01399 01400 if (DisplayLayer != NULL) 01401 { 01402 if (pLayer->IsBackground()) 01403 DisplayBackground->AddItem(DisplayLayer); 01404 else 01405 DisplayForeground->AddItem(DisplayLayer); 01406 } 01407 01408 if (pLayer->IsActive()) 01409 { 01410 ERROR3IF(pActiveLayer != NULL, 01411 "Found more than one active layer in the selected spread"); 01412 pActiveLayer = pLayer; 01413 01414 DisplayLayer->SetSelected(TRUE); // Make the active layer selected 01415 } 01416 01417 pLayer = pLayer->FindPrevLayer(); 01418 } 01419 01420 // The new state of the Guide Layer is now the old state 01421 OldGuideLayerState = NewGuideLayerState; 01422 01423 if (pGuideLayer == NULL) 01424 NewGuideLayerState = -1; // If there's no guide layer, set new state to be -1 01425 else 01426 NewGuideLayerState = pGuideLayer->IsVisible(); // New state is based on the guide layer's visibility 01427 01428 if (IsVisible()) 01429 { 01430 SetBoolGadgetSelected(_R(IDC_BTN_MULTILAYER),!(ParentDoc->IsMultilayer() == 0)); 01431 SetBoolGadgetSelected(_R(IDC_BTN_ALLVISIBLE),!(ParentDoc->IsAllVisible() == 0)); 01432 } 01433 01434 TRACEUSER( "Neville", _T("LayerSGallery::CreateNewSubtree exit\n")); 01435 }
|
|
|
Used to generate a LayerID which is unique for the spread. The name generated is normally of the form "Layer n", where n is the number of layers in the spread + 1. If "Layer n" already exists on the spread then "Layer m" is generated where m is the smallest integer greater than n such that the id is unique.
Definition at line 2327 of file sglayer.cpp. 02328 { 02329 if (pSpread == NULL) return String_256(""); 02330 02331 String_256 UniqueLayerID; 02332 INT32 NumLayers = 0; 02333 02334 Layer* pLayer = pSpread->FindFirstLayer(); 02335 02336 // Calculate how many layers are on the current spread 02337 while (pLayer != NULL) 02338 { 02339 // Don't cound the guide layer - it's LayerID (aka Name) is "Guides" 02340 if(!pLayer->IsGuide()) 02341 { 02342 NumLayers++; 02343 } 02344 pLayer = pLayer->FindNextLayer(); 02345 } 02346 02347 INT32 NewLayerNum = NumLayers+1; 02348 02349 BOOL Unique; // Flag used to indicate if the id generated is unique or not 02350 do 02351 { 02352 // Construct a first attempt at a unique layer id 'Layer n' 02353 // where n = the number of layers on the current spread + 1 02354 UniqueLayerID.MakeMsg(_R(IDS_SGLAYER_LAYER_NUM), /*TEXT("Layer #1%ld"),*/NewLayerNum); 02355 02356 // Check that UniqueLayerID is indeed unique 02357 Unique = TRUE; // Until we know better 02358 pLayer = pSpread->FindFirstLayer(); 02359 while (pLayer != NULL) 02360 { 02361 if (UniqueLayerID == pLayer->GetLayerID()) 02362 { 02363 Unique = FALSE; 02364 02365 // UniqueLayerID is not unique so increment NewLayerNum and try again 02366 NewLayerNum++; 02367 break; 02368 } 02369 pLayer = pLayer->FindNextLayer(); 02370 } 02371 02372 } while (!Unique); 02373 02374 return(UniqueLayerID); 02375 }
|
|
|
Called when the AllVisible button is clicked in the layers gallery. Effects the visibility of all layers, regardless of their visibility.
Definition at line 2736 of file sglayer.cpp. 02737 { 02738 if (!CheckVarsAreValid()) return; 02739 02740 // Get the state prior to the change 02741 BOOL PrevAllVisible = pDoc->IsAllVisible(); 02742 02743 // If no change, return 02744 if (PrevAllVisible == AllVisible) return; 02745 02746 Layer* pLayer = pSpread->FindFirstLayer(); 02747 02748 while (pLayer != NULL) 02749 { 02750 // Do not include the page background layer in this process as this is very bad! 02751 if (!pLayer->IsPageBackground()) 02752 { 02753 pDoc->SetAllVisible(PrevAllVisible); 02754 BOOL PrevVisible = pLayer->IsVisible(); 02755 // BOOL PrevLocked = pLayer->IsLocked(); 02756 02757 pDoc->SetAllVisible(AllVisible); 02758 BOOL PostVisible = pLayer->IsVisible(); 02759 // BOOL PostLocked = pLayer->IsLocked(); 02760 02761 if (PrevVisible != PostVisible) 02762 { 02763 LayerSGallery::ForceRedrawLayer(pDoc,pLayer); 02764 02765 if (!PostVisible) 02766 NodeRenderableInk::DeselectAllOnLayer(pLayer); 02767 } 02768 } 02769 02770 pLayer = pLayer->FindNextLayer(); 02771 } 02772 02773 pDoc->SetAllVisible(AllVisible); 02774 02775 // inform that visible layers have changed 02776 BROADCAST_TO_ALL(LayerMsg(pLayer, LayerMsg::LAYER_VISIBILITY_CHANGED)); 02777 }
|
|
||||||||||||||||
|
Undoable way of changing the layer's state.
Definition at line 2951 of file sglayer.cpp. 02952 { 02953 if (!CheckVarsAreValid()) return; 02954 02955 OpLayerGalParam Param(Reason, pSpread); 02956 02957 Param.pLayer = pLayer; 02958 Param.NewState = NewState; 02959 Param.pLayerSGal= this; 02960 02961 OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_LAYERGALCHANGE); 02962 if (pOpDesc != NULL) 02963 pOpDesc->Invoke((OpParam*)&Param); 02964 else 02965 { 02966 ERROR3("Couldn't find OPTOKEN_LAYERGALCHANGE op descriptor"); 02967 } 02968 }
|
|
||||||||||||
|
General undoable way of changing the selected layer's status.
Definition at line 2919 of file sglayer.cpp. 02920 { 02921 if (!CheckVarsAreValid()) return; 02922 02923 OpLayerGalParam Param(LAYER_CHANGE, pSpread); 02924 02925 Param.pLayer = pLayer; 02926 Param.Status = NewStatus; 02927 02928 OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_LAYERGALCHANGE); 02929 if (pOpDesc != NULL) 02930 pOpDesc->Invoke((OpParam*)&Param); 02931 else 02932 { 02933 ENSURE(FALSE,"Couldn't find OPTOKEN_LAYERGALCHANGE op descriptor"); 02934 } 02935 }
|
|
||||||||||||
|
Called when the Locked button is clicked in a layer gallery item. Changes the lockedness of the displayed layer.
Definition at line 2891 of file sglayer.cpp. 02892 { 02893 ERROR3IF(pLayer == NULL,"pLayer == NULL"); 02894 if (pLayer == NULL) return; 02895 02896 BOOL PrevLocked = pLayer->IsLocked(); 02897 pLayer->SetLocked(Locked); 02898 BOOL PostLocked = pLayer->IsLocked(); 02899 02900 if (PrevLocked != PostLocked) 02901 NodeRenderableInk::DeselectAllOnLayer(pLayer); 02902 }
|
|
|
Called when the Multilayer button is clicked in the layers gallery. Effects the locked state of all layers, regardless of their individual locked state.
Definition at line 2796 of file sglayer.cpp. 02797 { 02798 if (!CheckVarsAreValid()) return; 02799 02800 // Get the state prior to the change 02801 BOOL PrevMultilayer = pDoc->IsMultilayer(); 02802 02803 // If no change, return 02804 if (PrevMultilayer == Multilayer) return; 02805 02806 Layer* pLayer = pSpread->FindFirstLayer(); 02807 BOOL PrevLocked; 02808 BOOL PostLocked; 02809 02810 while (pLayer != NULL) 02811 { 02812 // Do not include the page background layer in this process as this is very bad! 02813 if (!pLayer->IsPageBackground()) 02814 { 02815 pDoc->SetMultilayer(PrevMultilayer); 02816 PrevLocked = pLayer->IsLocked(); 02817 pDoc->SetMultilayer(Multilayer); 02818 PostLocked = pLayer->IsLocked(); 02819 02820 if ((PrevLocked != PostLocked) && PostLocked) 02821 NodeRenderableInk::DeselectAllOnLayer(pLayer); 02822 } 02823 02824 pLayer = pLayer->FindNextLayer(); 02825 } 02826 02827 pDoc->SetMultilayer(Multilayer); 02828 }
|
|
|
Pops up the name changing dialog for the selected layer.
Definition at line 2610 of file sglayer.cpp. 02611 { 02612 SGDisplayLayer* pLayerGalItem = GetSelectedLayerGalItem(); 02613 02614 if (pLayerGalItem != NULL) 02615 { 02616 LayerDlgParam Param(LAYER_CHANGE_NAME,NULL,pLayerGalItem->GetDisplayedLayer()); 02617 LayerNameDlg::StartUp(&Param); 02618 } 02619 }
|
|
||||||||||||
|
Called when the visible button is clicked in a layer gallery item. Changes the visibility of the displayed layer.
Definition at line 2850 of file sglayer.cpp. 02851 { 02852 ERROR3IF(pLayer == NULL,"pLayer == NULL"); 02853 if (pLayer == NULL) return; 02854 02855 BOOL PrevVisible = pLayer->IsVisible(); 02856 pLayer->SetVisible(Visible); 02857 BOOL PostVisible = pLayer->IsVisible(); 02858 02859 if (PrevVisible != PostVisible) 02860 { 02861 // Force a redraw if the layer's visibility has changed 02862 LayerSGallery::ForceRedrawLayer(pLayer->FindDocument(), pLayer); 02863 02864 // inform that visible layers have changed 02865 BROADCAST_TO_ALL(LayerMsg(pLayer, LayerMsg::LAYER_VISIBILITY_CHANGED)); 02866 02867 // If layer has just become invisible, remove the selections on the layer 02868 if (!PostVisible) 02869 NodeRenderableInk::DeselectAllOnLayer(pLayer); 02870 } 02871 }
|
|
|
To apply a given command when it is chosen from the menu.
The base class handles all of these (maybe more - see the base class help) Properties, Sort, Find; New, Edit, Delete, Redefine; (it calls ApplyAction as appropriate) NextGroup, PrevGroup, FoldGroup, UnfoldGroup; Reimplemented from SuperGallery. Reimplemented in FrameSGallery. Definition at line 3424 of file sglayer.cpp. 03425 { 03426 if (*CommandID == SGCmd_Copy) 03427 DoCopyLayer(); 03428 else if (*CommandID == SGCmd_New) 03429 DoCreateNewItem(); 03430 else if (*CommandID == SGCmd_Delete) 03431 { 03432 if (PrepareToDelete()) 03433 DoDeleteSelection(); 03434 } 03435 else if (*CommandID == SGCmd_Properties) 03436 DoLayerProperties(); 03437 else if (*CommandID == SGCmd_Create) 03438 DoCreateGuideLayer(); 03439 03440 // Don't call the base class 'cos we don't want any other commands 03441 }
|
|
|
Pops up the name changing dialog for the selected layer, and if OK is clicked a copy of the layer is made with the new name.
Reimplemented in FrameSGallery. Definition at line 2637 of file sglayer.cpp. 02638 { 02639 SGDisplayLayer* pLayerGalItem = GetSelectedLayerGalItem(); 02640 02641 if (pLayerGalItem != NULL) 02642 { 02643 LayerDlgParam Param(LAYER_COPY,NULL,pLayerGalItem->GetDisplayedLayer()); 02644 LayerNameDlg::StartUp(&Param); 02645 } 02646 }
|
|
|
Creates a guide layer.
Definition at line 2704 of file sglayer.cpp. 02705 { 02706 #ifndef WEBSTER 02707 OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_GUIDELINE); 02708 ERROR3IF(pOpDesc == NULL,"FindOpDescriptor(OPTOKEN_GUIDELINE) failed"); 02709 02710 if (pOpDesc != NULL) 02711 { 02712 OpGuidelineParam GuidelineParam; 02713 02714 GuidelineParam.Method = GUIDELINEOPMETHOD_CREATE_GUIDE_LAYER; 02715 02716 pOpDesc->Invoke(&GuidelineParam); 02717 } 02718 #endif // WEBSTER 02719 }
|
|
|
This function is meant to be overridden in derived classes It creates a new item and adds it to the Gallery DisplayList The item may be created by cloning/deriving/basing-on the selected item, depending on the type of Gallery concerned.
Reimplemented in FrameSGallery. Definition at line 2589 of file sglayer.cpp. 02590 { 02591 if (!CheckVarsAreValid()) 02592 return; 02593 LayerDlgParam Param(LAYER_NEW,pSpread,NULL); 02594 LayerNameDlg::StartUp(&Param); 02595 02596 }
|
|
|
FORCIBLY deletes the current gallery selection. By the time this function is called, PrepareToDelete has made sure that it is safe to continue. This must simply invoke a forced delete upon the selection. Deletion of colours occurs by hiding (with undo).
Reimplemented in FrameSGallery. Definition at line 2549 of file sglayer.cpp. 02550 { 02551 SGDisplayLayer* pLayerGalItem = GetSelectedLayerGalItem(); 02552 02553 if (pLayerGalItem != NULL) 02554 { 02555 OpLayerGalParam Param(LAYER_DELETE,pSpread); 02556 Param.pLayer = pLayerGalItem->GetDisplayedLayer(); 02557 02558 OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_LAYERGALCHANGE); 02559 if (pOpDesc != NULL) 02560 pOpDesc->Invoke((OpParam*)&Param); 02561 else 02562 { 02563 ERROR3("Couldn't find OPTOKEN_LAYERGALCHANGE op descriptor"); 02564 } 02565 return (TRUE); 02566 } 02567 02568 return (pLayerGalItem != NULL); 02569 }
|
|
|
Opens the layer properties dlg.
Definition at line 2661 of file sglayer.cpp. 02662 { 02663 #ifndef STANDALONE 02664 // layer property tabs not present in viewer 02665 OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_LAYERPROPERTYTABS); 02666 02667 if (pOpDesc != NULL) 02668 { |