FramePropertiesTab Class Reference

Allows the user to set various Frame properties. More...

#include <aprps.h>

Inheritance diagram for FramePropertiesTab:

GIFAnimationPropertyTabs PropertyTabs ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 FramePropertiesTab ()
 FramePropertiesTab constructor.
 ~FramePropertiesTab ()
 FramePropertiesTab destructor.
virtual BOOL Init ()
 FramePropertiesTab init routine.
virtual BOOL HandleMsg (DialogMsg *Msg)
 Handles all the messages for this frame property tab.
virtual BOOL InitSection ()
 Sets initial values for this tab on the animation properties dialog box.
virtual BOOL CommitSection ()
 Takes the values in this tab of the layer properties dialog box. Called when ok or apply now is pressed on the main dialog box.
virtual BOOL UpdateLayerSection ()
 Called when the layer-related section of the tab should be updated.
virtual BOOL GreySection ()
 Called when all documents are closed.
virtual BOOL UngreySection ()
 Called when the user has selected a new document.
virtual BOOL UpdateSection ()
 Called when we have switched to a new document and need to update all the controls on this tab.
virtual CDlgResID GetPageID ()
 Allows the options dialog code to determine the dialog ID of this section.
virtual BOOL IsPropertyRequired ()
 Allows the Frame properties to determine if this tab is required.
BOOL ChangeControlStatus (const BOOL Status, BOOL IgnoreOverlay=FALSE)
 Called to grey/ungrey controls on this tab.
BOOL ChangeLayerState ()
 Called when the layer state has been changed from within the frame gallery, this function updates the controls of the frame properties tab.

Protected Member Functions

BOOL ShowDetails ()
 Shows the details of the associated layer in this tab.
virtual BOOL UpdateApplyState ()
 This changes the 'Apply now' state based on the settings of the active layer and the settings in this tab. If the settings are the same, the 'Apply state' is FALSE, else it are TRUE.
BOOL HavePropertiesChanged (Layer *pLayer, BOOL ValidateDelayValue=FALSE)

Protected Attributes

BOOL m_GreyStatus

Detailed Description

Allows the user to set various Frame properties.

Author:
Ranbir_Rana (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/06/97

Definition at line 259 of file aprps.h.


Constructor & Destructor Documentation

FramePropertiesTab::FramePropertiesTab  ) 
 

FramePropertiesTab constructor.

/

/*!

Author:
Ranbir_Rana (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/06/97
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Definition at line 3263 of file aprps.cpp.

03264 {   
03265     //  Does nothing at present.
03266 }            

FramePropertiesTab::~FramePropertiesTab  ) 
 

FramePropertiesTab destructor.

Author:
Ranbir_Rana (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/06/97
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Definition at line 3281 of file aprps.cpp.

03282 {   
03283 }        


Member Function Documentation

BOOL FramePropertiesTab::ChangeControlStatus const BOOL  Status,
BOOL  IgnoreOverlay = FALSE
 

Called to grey/ungrey controls on this tab.

Author:
Ranbir_Rana (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/06/97
Parameters:
Status - Flag to determine whether to grey/ungrey the controls. [INPUTS] IgnoreOverlay - If we wish to ignore this field, this parameter is set TRUE, defaults FALSE.
- [OUTPUTS]
Returns:
-

Definition at line 3620 of file aprps.cpp.

03621 {
03622     // Set the controls to the correct state.
03623     pPropertiesDlg->EnableGadget(_R(IDC_FRAMETAB_NAME),Status);
03624     pPropertiesDlg->EnableGadget(_R(IDC_FRAMETAB_SOLID),Status);
03625 
03626     // In some cases we do not want change the status of this check box.
03627 
03628     if(!IgnoreOverlay)
03629         pPropertiesDlg->EnableGadget(_R(IDC_FRAMETAB_OVERLAY),Status);
03630 
03631     // Determine whether the apply now/ok/canel buttons should be greyed/ungreyed.
03632     // Ensure a vlaid spread ptr.
03633     if(pSpread)
03634     {
03635         // Get a ptr to the active layer.
03636         Layer* pLayer = pSpread->FindActiveLayer();
03637 
03638         // Ensure a valid layer ptr.
03639         if(pLayer)
03640         {
03641             // Have the properties changed for this layer.
03642             if(HavePropertiesChanged(pLayer))
03643             {
03644                 // Grey the apply now/ok/cancel buttons.
03645                 FramePropertiesTab::UngreyApplyNow();
03646             }
03647 //          else
03648                 // Grey the apply now/ok/cancel buttons.
03649 //              FramePropertiesTab::GreyApplyNow();
03650         }
03651     }
03652     else
03653     {
03654         // Grey the apply now/ok/cancel buttons.
03655         FramePropertiesTab::GreyApplyNow();
03656     }
03657     
03658     // Everything ok.
03659     return TRUE;
03660 }           

BOOL FramePropertiesTab::ChangeLayerState  ) 
 

Called when the layer state has been changed from within the frame gallery, this function updates the controls of the frame properties tab.

Author:
Ranbir_Rana (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/06/97
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if ok, FALSE otherwise

Definition at line 3838 of file aprps.cpp.

03839 {
03840     ERROR2IF(pPropertiesDlg == NULL,FALSE,"FramePropertiesTab::UpdateLayerSection() called with a NULL dialog pointer");
03841 
03842     BOOL ok = pPropertiesDlg->TalkToPage(GetPageID());
03843     if (!ok)
03844         return TRUE;    
03845 
03846     // Ensure we have a valid spread ptr.
03847     if(!pSpread)
03848         return FALSE;
03849 
03850     // Get a ptr to the active layer.
03851     Layer* pLayer = pSpread->FindActiveLayer();
03852 
03853     // Check for a NULL ptr.
03854     if(!pLayer)
03855         return FALSE;
03856 
03857     // Is the Solid or Overlay flag selected?
03858 
03859     // If the "Background" check box is ticked, grey the "Overlay" check box field.
03860     if(pLayer->IsSolid())
03861     {
03862 
03863         // Set the "Background" check box to the correct state.
03864         pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_FRAMETAB_SOLID), TRUE);            
03865 
03866         // Grey the "Overlay" check box.
03867         pPropertiesDlg->EnableGadget(_R(IDC_FRAMETAB_OVERLAY), FALSE);
03868     }
03869     else
03870     {
03871         // Set the "Background" check box to the correct state.
03872         pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_FRAMETAB_SOLID), FALSE);           
03873 
03874         // Ungrey the "Overlay" check box.
03875         pPropertiesDlg->EnableGadget(_R(IDC_FRAMETAB_OVERLAY), TRUE);
03876 
03877     }
03878 
03879     // Is the overlay check box ticked?
03880     if(pLayer->IsOverlay()) 
03881     {
03882         // Set the "Background" check box to the correct state.
03883         pPropertiesDlg->EnableGadget(_R(IDC_FRAMETAB_SOLID), TRUE);         
03884 
03885         // Set the "Overlay" check box to the correct state.
03886         pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_FRAMETAB_OVERLAY), TRUE);          
03887     }
03888     else
03889     {
03890         // Set the "Overlay" check box to the correct state.
03891         pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_FRAMETAB_OVERLAY), FALSE);         
03892     }
03893 
03894     // Set the correct state of the flag.
03895     FramePropertiesTab::SetApplyNowState(TRUE);
03896 
03897     // Ungrey the apply/ok/cancel buttons.
03898     FramePropertiesTab::UngreyApplyNow();
03899 
03900     // Everything ok.
03901     return TRUE;
03902 }

BOOL FramePropertiesTab::CommitSection  )  [virtual]
 

Takes the values in this tab of the layer properties dialog box. Called when ok or apply now is pressed on the main dialog box.

Author:
Ranbir_Rana (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/06/97
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
True if values in dialog box ok, False otherwise.

Reimplemented from GIFAnimationPropertyTabs.

Definition at line 3357 of file aprps.cpp.

03358 {
03359     ERROR2IF(pPropertiesDlg == NULL,FALSE,"FramePropertiesTab::CommitSection called with no dialog pointer");
03360 
03361     BOOL ok = pPropertiesDlg->TalkToPage(GetPageID());
03362     if (!ok)
03363         return TRUE;    
03364 
03365     // Get a ptr to the active frame layer.
03366     Layer* pLayer = pSpread->FindActiveLayer();
03367 
03368     // Only do the op if we have a frame layer with a different set of properties.
03369     if (pLayer != NULL && HavePropertiesChanged(pLayer, TRUE))
03370     {
03371         DWORD Delay = 0;                    // The delay value set for this frame layer.
03372         String_256 FrameLayerName;          // The Name for this frame layer.
03373         UINT32 AreDelayValuesSame = FALSE;  // Flag to indicate whether the frame layer delay values are the same.
03374 
03375         // Pass these new values onto the Frame layer.
03376         FrameLayerName  = pPropertiesDlg->GetStringGadgetValue(_R(IDC_FRAMETAB_NAME),NULL); 
03377         BOOL DelayValid = FALSE;
03378         Delay = pPropertiesDlg->GetLongGadgetValue(_R(IDC_FRAMETAB_DELAY), 0, 65535, _R(IDS_BMPPREFS_INVALIDDELAY) ,&DelayValid);
03379 
03380         // If the delay value is invalid, then go no further!
03381         if(!DelayValid)
03382             return FALSE;
03383 
03384         // Are either of these check boxes selected.
03385         BOOL Overlay = pPropertiesDlg->GetBoolGadgetSelected(_R(IDC_FRAMETAB_OVERLAY));
03386         BOOL Solid = pPropertiesDlg->GetBoolGadgetSelected(_R(IDC_FRAMETAB_SOLID));
03387 
03388         // If the background and overlay flags are both set, force the ovrelay flag to false.
03389         // This is possible since the overlay check box may be greyed but at the same time be ticked.
03390         if(Solid && Overlay)
03391             Overlay = FALSE;
03392 
03393         // Is the "Show frame" check box ticked.
03394         BOOL IsHidden = pPropertiesDlg->GetBoolGadgetSelected(_R(IDC_FRAMETAB_SHOWFRAME));
03395 
03396         // Set the correct state of the layer IsHidden flag.
03397         if(IsHidden)
03398             pLayer->SetHiddenFrame(FALSE);
03399         else
03400             pLayer->SetHiddenFrame(TRUE);
03401 
03402         // Check if we are changing the solid (background) layer flag. If we are then
03403         // mark all dependent frames as edited.
03404         if (pLayer->IsSolid() != Solid)
03405         {
03406             // Mark all frames above this as edited until we reach the last frame
03407             // OR we hit a solid/background layer.
03408             Layer * pFrame = pLayer->FindNextFrameLayer();
03409             while (pFrame != NULL && !pFrame->IsSolid())
03410             {
03411                 // Mark that frame as edited
03412                 pFrame->SetEdited(TRUE);
03413                 pFrame = pFrame->FindNextFrameLayer();
03414             }
03415         }
03416 
03417         // Pass the new data onto the layer.
03418         pLayer->SetSolid(Solid);
03419         pLayer->SetOverlay(Overlay);
03420         pLayer->SetFrameDelay(Delay);
03421         pLayer->SetLayerID(FrameLayerName);
03422         
03423         // Mark the document as edited.
03424         // First get a ptr to the current document.
03425         Document* pDoc = Document::GetCurrent();
03426 
03427         // Set this document as edited.
03428         if(pDoc)
03429             pDoc->SetModified(TRUE);                    
03430 
03431         // Mark this layer as edited.
03432         pLayer->SetEdited(TRUE);
03433 
03434 #ifdef _DEBUG
03435         // Tell the frame gallery to update its display of the frame
03436         BROADCAST_TO_ALL(LayerMsg(pLayer, LayerMsg::REDRAW_LAYER));
03437 #endif
03438 
03439         // Get the OILBitmap Bitmap associated with this frame layer and set its delay value and Name details.
03440         // First find the kernel bitmap.
03441         // It might be the generated one
03442         KernelBitmap* pKernelBitmap = pLayer->GetGeneratedBitmap();
03443         // or if not present, may be a referenced one, i.e. single node bitmap on the layer.
03444         if (pKernelBitmap == NULL)
03445             pKernelBitmap = pLayer->GetReferencedBitmap();
03446 
03447         // Check for an empty frame layer. 
03448         if(pKernelBitmap == NULL)
03449         {
03450             //if the frame layer delay values for this animation are no longer the same, force the animation properties tab to update itself.
03451             if(!SameflDelayValues())
03452                 BROADCAST_TO_ALL(LayerMsg(pLayer, LayerMsg::UPDATE_ACTIVE_LAYER));
03453             else
03454                 AreDelayValuesSame = TRUE;
03455 
03456             // Currently "Many" is displayed in the animation propertiess tab, but the frame propertiess tab delay
03457             // values have changed to give all the frame layers the same delay value. Therfore, update the animation properties tab.
03458             if(AreDelayValuesSame && m_IsManyDisplayed)
03459                 BROADCAST_TO_ALL(LayerMsg(pLayer, LayerMsg::UPDATE_ACTIVE_LAYER));
03460             
03461             // Force a redraw of the frame gallery. Allows us to update frame layer Name/Delay details.
03462             BROADCAST_TO_ALL(LayerMsg(pLayer, LayerMsg::REDRAW_LAYER));
03463 
03464             return TRUE;
03465         }
03466         
03467         // Get the OILBitmap assciated with this kernel bitmap.
03468         OILBitmap* pOILBitmap = pKernelBitmap->GetActualBitmap();
03469         if (pOILBitmap == NULL)
03470         {
03471 
03472             //if the frame layer delay values for this animation are no longer the same, force the animation properties tab to update itself.
03473             if(!SameflDelayValues())
03474                 BROADCAST_TO_ALL(LayerMsg(pLayer, LayerMsg::UPDATE_ACTIVE_LAYER));
03475             else
03476                 AreDelayValuesSame = TRUE;
03477 
03478             // Currently "Many" is displayed in the animation propertiess tab, but the frame propertiess tab delay
03479             // values have changed to give all the frame layers the same delay value. Therfore, update the animation properties tab.
03480             if(AreDelayValuesSame && m_IsManyDisplayed)
03481                 BROADCAST_TO_ALL(LayerMsg(pLayer, LayerMsg::UPDATE_ACTIVE_LAYER));
03482                         
03483             // Force a redraw of the frame gallery. Allows us to update frame layer Name/Delay details.
03484             BROADCAST_TO_ALL(LayerMsg(pLayer, LayerMsg::REDRAW_LAYER));
03485 
03486             return TRUE;
03487         }
03488 
03489         // Set the delay value in the OILBitmap.
03490         pOILBitmap->SetBitmapAnimDelay(Delay);
03491 
03492         // Set the name in the OILBitmap.
03493         pOILBitmap->SetName(FrameLayerName);
03494 
03495 PORTNOTE("other", "Disabled OpGrabFrame")
03496 #ifndef EXCLUDE_FROM_XARALX
03497         if (PreviewDialog::GetPreviewDialog())
03498         {
03499             OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_FRAME_GRABFRAME); 
03500             GIFAnimationExportParam Param;
03501             if (pOpDesc != NULL)
03502                 pOpDesc->Invoke(&Param);
03503             else
03504             {
03505                 ERROR3("Couldn't find OPTOKEN_FRAME_GRABALLFRAMES op descriptor");
03506             }
03507         }
03508 #endif
03509 
03510         //if the frame layer delay values for this animation are no longer the same, force the animation properties tab to update itself.
03511         if(!SameflDelayValues())
03512             BROADCAST_TO_ALL(LayerMsg(pLayer, LayerMsg::UPDATE_ACTIVE_LAYER));
03513         else
03514             AreDelayValuesSame = TRUE;
03515 
03516         // Currently "Many" is displayed in the animation propertiess tab, a change to the frame properties tab delay
03517         // value has caused all the frame layers to have the same delay value. Therfore, update the animation properties tab.
03518         if(AreDelayValuesSame && m_IsManyDisplayed)
03519             BROADCAST_TO_ALL(LayerMsg(pLayer, LayerMsg::UPDATE_ACTIVE_LAYER));
03520     }
03521 
03522     // Force a redraw of the frame gallery.
03523     BROADCAST_TO_ALL(LayerMsg(pLayer, LayerMsg::REDRAW_LAYER));
03524 
03525     // Everything is OK!
03526     return TRUE;
03527 }

CDlgResID FramePropertiesTab::GetPageID  )  [virtual]
 

Allows the options dialog code to determine the dialog ID of this section.

Author:
Ranbir_Rana (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/06/97
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
The dialog ID of this tab section.

Reimplemented from GIFAnimationPropertyTabs.

Definition at line 3316 of file aprps.cpp.

03317 {
03318     return _R(IDD_TAB_FRAME_PROPERTIES); 
03319 }

BOOL FramePropertiesTab::GreySection  )  [virtual]
 

Called when all documents are closed.

Author:
Ranbir_Rana (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/06/97
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Reimplemented from PropertyTabs.

Definition at line 3542 of file aprps.cpp.

03543 {
03544     ERROR2IF(pPropertiesDlg == NULL,FALSE,"FramePropertiesTab::GreySection called with no dialog pointer");
03545 
03546     BOOL ok = pPropertiesDlg->TalkToPage(GetPageID());
03547     if (!ok)
03548         return TRUE;    
03549 
03550     // Only update if we are not already grey 
03551     if (m_GreyStatus == TRUE)
03552         return TRUE;
03553 
03554     // Set thewse two controls here, fixes a bug.
03555     pPropertiesDlg->EnableGadget(_R(IDC_FRAMETAB_DELAY),FALSE);
03556     pPropertiesDlg->EnableGadget(_R(IDC_FRAMETAB_SHOWFRAME),FALSE);
03557 
03558     // Call our central greying/ungreying function
03559     ok = ChangeControlStatus(FALSE);
03560     
03561     // Set the correct grey status.
03562     m_GreyStatus = TRUE;
03563     SetApplyNowState(FALSE);
03564 
03565     return ok;
03566 } 

BOOL FramePropertiesTab::HandleMsg DialogMsg Msg  )  [virtual]
 

Handles all the messages for this frame property tab.

Author:
Ranbir_Rana (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/06/97
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Reimplemented from GIFAnimationPropertyTabs.

Definition at line 3918 of file aprps.cpp.

03919 {
03920     ERROR2IF(Msg == NULL,FALSE,"FramePropertiesTab::Message null message received");
03921     ERROR2IF(pPropertiesDlg == NULL,FALSE,"FramePropertiesTab::HandleMsg called with no dialog pointer");
03922 
03923     // Talk to the correct page.
03924     BOOL ok = pPropertiesDlg->TalkToPage(GetPageID());
03925     if (!ok)
03926         return TRUE;        
03927 
03928     switch(Msg->DlgMsg)
03929     {
03930         case DIM_CREATE:    
03931             m_GreyStatus = FALSE;
03932             ok = InitSection();
03933             if (!ok)
03934                 InformError();
03935             break;
03936 
03937         case DIM_LFT_BN_CLICKED:
03938         {
03939             if (FALSE) {}
03940             else if (Msg->GadgetID ==_R(IDC_FRAMETAB_SOLID))
03941             {
03942                 // If the "Background" check box is ticked, grey the "Overlay" check box.
03943                 BOOL Value = pPropertiesDlg->GetBoolGadgetSelected(_R(IDC_FRAMETAB_SOLID));
03944                 if (Value)
03945                 {
03946                     // Grey the 'Overlay' check box.
03947                     pPropertiesDlg->EnableGadget(_R(IDC_FRAMETAB_OVERLAY), FALSE);
03948                 }
03949                 else
03950                 {
03951                     // Ungrey the 'Overlay' check box.
03952                     pPropertiesDlg->EnableGadget(_R(IDC_FRAMETAB_OVERLAY), TRUE);                               
03953                 }
03954             }
03955             else if (Msg->GadgetID == _R(IDC_FRAMETAB_SHOWFRAME))
03956             {
03957                 // If the "Show frame" check box is ticked, grey the "Disaply this frame for" check box.
03958                 BOOL Value = pPropertiesDlg->GetBoolGadgetSelected(_R(IDC_FRAMETAB_SHOWFRAME));
03959 
03960                 // Get a ptr to the active layer.
03961                 Layer* pLayer = pSpread->FindActiveLayer();
03962 
03963                 // Ensure we have a valid ptr.
03964                 if( pLayer)
03965                 {
03966                     // The 'Show frame' check box is ticked.
03967                     if(Value)
03968                     {
03969                         // Ungrey the 'Delay this frame for' check box.
03970                         pPropertiesDlg->EnableGadget(_R(IDC_FRAMETAB_DELAY), TRUE);
03971     
03972                         // Pass this value onto the layer. This is necessary as when we force the frame gallery 
03973                         // to update itself, it takes the value stored in the layer. 
03974                         //pLayer->SetHiddenFrame(FALSE);
03975                     }
03976                     else
03977                     {
03978                         // Grey the 'Delay this frame for' check box.  
03979                         pPropertiesDlg->EnableGadget(_R(IDC_FRAMETAB_DELAY), FALSE);
03980     
03981                         // Pass this value onto the layer. This is necessary as when we force the frame gallery 
03982                         // to update itself, it takes the value stored in the layer. 
03983                         //pLayer->SetHiddenFrame(TRUE);
03984                     }
03985     
03986                     // Tell the frame gallery to update its display of the frame.
03987                     // We do this to update the right click pop-up menu.
03988                     BROADCAST_TO_ALL(LayerMsg(pLayer, LayerMsg::REDRAW_LAYER));
03989                 }
03990             }
03991             
03992             // Set the correct state of the flag.
03993             FramePropertiesTab::SetApplyNowState(TRUE);
03994 
03995             // Ungrey the apply/ok/cancel buttons.
03996             FramePropertiesTab::UngreyApplyNow();
03997             
03998         }
03999         break;
04000 
04001         case DIM_SELECTION_CHANGED:
04002         {
04003             if(FramePropertiesTab::GetApplyNowState())
04004             {
04005                 // Ungrey the apply/ok/cancel buttons.
04006                 FramePropertiesTab::UngreyApplyNow();   
04007             }           
04008         }
04009         break;
04010 
04011         case DIM_TEXT_CHANGED:
04012         {
04013             // Do we want to deal with text change msgs?
04014             if(!GetIgnoreTextChangeMsg())
04015             {
04016                 // Get a ptr to the active layer.
04017                 Layer* pLayer = pSpread->FindActiveLayer();
04018 
04019                 // Ensure we have a valid layer ptr.
04020                 if (pLayer)
04021                 {
04022                     // Have the frame properties changed?
04023                     if(HavePropertiesChanged(pLayer))
04024                     {
04025                         // Set the correct state of the m_ApplyNow flag.
04026                         FramePropertiesTab::SetApplyNowState(TRUE);
04027 
04028                         // Ungrey the apply/ok/cancel buttons.
04029                         FramePropertiesTab::UngreyApplyNow();
04030                     }
04031                 }
04032 
04033                 // We need to make a note of this value change, 
04034                 // this impacts on the value displayed in the delay 
04035                 // edit field in the animation properties tab.
04036                 SetFrameDelayValueChanged(TRUE);
04037             }
04038         }
04039         break;
04040 
04041         case DIM_SET_ACTIVE:
04042         {
04043             if(FramePropertiesTab::GetApplyNowState())
04044             {
04045                 // Ungrey the apply/ok/cancel buttons.
04046                 FramePropertiesTab::UngreyApplyNow();   
04047             }           
04048         }
04049         break;
04050 
04051         default:
04052             break;
04053     }
04054     return TRUE;
04055 }  

BOOL FramePropertiesTab::HavePropertiesChanged Layer pLayer,
BOOL  ValidateDelayValue = FALSE
[protected]
 

Author:
Ranbir_Rana (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/06/97
Parameters:
pLayer - ptr to a layer [INPUTS] ValidateDelayValue - Flag to determine when we need to validate the delay value. Defaults to false.
- [OUTPUTS]
Returns:
TRUE if settings in the dlg are different to the given layer's settings, else FALSE

Definition at line 4117 of file aprps.cpp.

04118 {
04119     ERROR2IF(pPropertiesDlg == NULL,FALSE,"FramePropertiesTab::HavePropertiesChanged called with a NULL dialog pointer");
04120 
04121     BOOL ok = pPropertiesDlg->TalkToPage(GetPageID());
04122     if (!ok)
04123         return TRUE;
04124 
04125     // Get the current values from the tab.
04126     BOOL        CurBackground   =   pPropertiesDlg->GetBoolGadgetSelected(_R(IDC_FRAMETAB_SOLID));
04127     BOOL        CurOverlay      =   pPropertiesDlg->GetBoolGadgetSelected(_R(IDC_FRAMETAB_OVERLAY));
04128     String_256  CurName         =   pPropertiesDlg->GetStringGadgetValue(_R(IDC_FRAMETAB_NAME),NULL);
04129     BOOL        CurIsHidden     =   pPropertiesDlg->GetBoolGadgetSelected(_R(IDC_FRAMETAB_SHOWFRAME));
04130     DWORD       CurDelay = 0;
04131 
04132     // Do we want to validate the delay input.
04133     if(ValidateDelayValue)
04134     {
04135         BOOL DelayValid = FALSE;
04136         CurDelay = pPropertiesDlg->GetLongGadgetValue(_R(IDC_FRAMETAB_DELAY), 0, 65535, _R(IDS_BMPPREFS_INVALIDDELAY) ,&DelayValid);
04137 
04138         // If the delay value is invalid, then go no further!
04139         if(!DelayValid)
04140             return FALSE;
04141     }
04142     else
04143     {
04144         CurDelay = pPropertiesDlg->GetLongGadgetValue(_R(IDC_FRAMETAB_DELAY), 0, 65535, _R(IDS_BMPPREFS_INVALIDDELAY) ,NULL);
04145     }   
04146 
04147     // If the check box is selected, then the frame is not hidden.
04148     if(CurIsHidden)
04149         CurIsHidden = FALSE;
04150     else
04151         CurIsHidden = TRUE;
04152 
04153     // If the background and overlay flags have both been set, then force the ovrelay flag to false.
04154     // This can occur since the overlay check box may be greyed but at the same time be ticked.
04155     if(CurBackground && CurOverlay)
04156         CurOverlay = FALSE;
04157 
04158     // Get the values stored in the frame layer.
04159     BOOL        Background  =   pLayer->IsSolid();
04160     BOOL        Overlay     =   pLayer->IsOverlay();
04161     String_256  Name        =   pLayer->GetLayerID();
04162     DWORD       Delay       =   pLayer->GetFrameDelay();
04163     BOOL        IsHidden    =   pLayer->IsHiddenFrame();
04164 
04165     // Compare the current values against those stored in the frame layer.
04166     return ((Background != CurBackground)   || 
04167             (Overlay    != CurOverlay)      ||
04168             (Name       != CurName)         ||
04169             (Delay      != CurDelay)        ||
04170             (IsHidden   != CurIsHidden ));  
04171 }

BOOL FramePropertiesTab::Init void   )  [virtual]
 

FramePropertiesTab init routine.

Author:
Ranbir_Rana (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/06/97
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
True if initialised ok, False if failed.

Reimplemented from GIFAnimationPropertyTabs.

Definition at line 3298 of file aprps.cpp.

03299 {   
03300     return TRUE;
03301 }        

BOOL FramePropertiesTab::InitSection  )  [virtual]
 

Sets initial values for this tab on the animation properties dialog box.

Author:
Ranbir_Rana (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/06/97
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if successful, else FALSE

Reimplemented from GIFAnimationPropertyTabs.

Definition at line 4186 of file aprps.cpp.

04187 {
04188     ERROR2IF(pPropertiesDlg == NULL,FALSE,"FramePropertiesTab::InitSection called with no dialog pointer");
04189 
04190     // Get a ptr to the current document.
04191     Document* pDoc = Document::GetCurrent();
04192 
04193     // If there is no document, then grey the tab.
04194     if(!pDoc)
04195     {
04196         GreySection();
04197         return (TRUE);
04198     }
04199 
04200     // Display the details for this tab.
04201     ShowDetails();
04202 
04203     return TRUE;
04204 }

BOOL FramePropertiesTab::IsPropertyRequired  )  [virtual]
 

Allows the Frame properties to determine if this tab is required.

Author:
Ranbir_Rana (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/06/97
Returns:
Returns True if this tab is a program option.

Reimplemented from PropertyTabs.

Definition at line 3332 of file aprps.cpp.

03333 {
03334     //  If the dialog has been invoked via the options button on the Export dialog box,
03335     //  then hide the frame properties tab.
03336     if (!GetIncludeFramePropertiesTab() || GetBrowserPreviewTab())
03337         return FALSE;
03338     else
03339         return TRUE;    // This tab is required 
03340 }

BOOL FramePropertiesTab::ShowDetails  )  [protected]
 

Shows the details of the associated layer in this tab.

Author:
Ranbir_Rana (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/06/97
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Definition at line 3703 of file aprps.cpp.

03704 {
03705     ERROR2IF(pPropertiesDlg == NULL,FALSE,"FramePropertiseTab::ShowDetails called with a NULL dialog pointer");
03706 
03707     BOOL ok = pPropertiesDlg->TalkToPage(GetPageID());
03708     if (!ok)
03709         return TRUE;        
03710 
03711     // Ensure we have a valid spread ptr.
03712     if(!pSpread)
03713         return FALSE;
03714 
03715     // Get a ptr to the active layer.
03716     Layer* pLayer = pSpread->FindActiveLayer();
03717 
03718     // Check for a NULL ptr.
03719     if(!pLayer)
03720         return FALSE;
03721 
03722     // Ignore all DIM_TEXT_CHANGED msgs which are sent from this function.
03723     SetIgnoreTextChangeMsg(TRUE);
03724 
03725     // Set the dialog detais
03726     // Set the layer Layer Name.
03727     pPropertiesDlg->SetStringGadgetValue(_R(IDC_FRAMETAB_NAME), pLayer->GetLayerID());
03728 
03729     // Set the "Background" check box.
03730     pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_FRAMETAB_SOLID), pLayer->IsSolid());
03731 
03732     // If the "Background" check box is ticked, grey the "Overlay" check box field.
03733     BOOL BackGroundSelected = FALSE;        // Is the "Background" check box ticked.
03734     if(pLayer->IsSolid())
03735         BackGroundSelected = TRUE;
03736 
03737     // The backgoround check box is ticked.
03738     if(BackGroundSelected)
03739     {
03740         // Grey the "Overlay" check box.
03741         pPropertiesDlg->EnableGadget(_R(IDC_FRAMETAB_OVERLAY), FALSE);
03742     }
03743     else
03744     {
03745         // Set the "Overlay" check box to the correct state.
03746         pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_FRAMETAB_OVERLAY), pLayer->IsOverlay());           
03747     }
03748 
03749     // Set the "Frame Delay" edit field.
03750     pPropertiesDlg->SetLongGadgetValue(_R(IDC_FRAMETAB_DELAY), pLayer->GetFrameDelay());            
03751     
03752     // Is the frame hidden?
03753     BOOL IsHidden = pLayer->IsHiddenFrame();
03754 
03755     // The frame is not hidden.
03756     if(!IsHidden)
03757     {
03758         // Ungrey the 'Delay this frame for' check box.
03759         pPropertiesDlg->EnableGadget(_R(IDC_FRAMETAB_DELAY), TRUE);
03760 
03761         // Pass this value onto the control.
03762         pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_FRAMETAB_SHOWFRAME), TRUE);
03763     }
03764     else
03765     {
03766         // The frame is hidden.
03767         // Pass this value onto the control.
03768         pPropertiesDlg->SetBoolGadgetSelected(_R(IDC_FRAMETAB_SHOWFRAME), FALSE);
03769 
03770         // Grey the 'Delay this frame for' check box.
03771         pPropertiesDlg->EnableGadget(_R(IDC_FRAMETAB_DELAY), FALSE);
03772     }
03773 
03774     // Set the controls to the correct state. 
03775     // If the "Backgorund" check box is selected then we have already determined the state of the "Overlay" check box.
03776     // Therefore setting the second parameter TRUE ensures we do not change the status of this control.
03777     if(BackGroundSelected)
03778         ChangeControlStatus(!m_GreyStatus, TRUE);
03779     else
03780         ChangeControlStatus(!m_GreyStatus);
03781 
03782     // We once again wish to deal with DIM_TEXT_CHANGED msgs.
03783     SetIgnoreTextChangeMsg(FALSE);
03784 
03785     // Everything ok.
03786     return TRUE;
03787 }

BOOL FramePropertiesTab::UngreySection  )  [virtual]
 

Called when the user has selected a new document.

Author:
Ranbir_Rana (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/06/97
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Reimplemented from PropertyTabs.

Definition at line 3581 of file aprps.cpp.

03582 {
03583     ERROR2IF(pPropertiesDlg == NULL,FALSE,"FramePropertiesTab::UngreySection called with no dialog pointer");
03584 
03585     BOOL ok = pPropertiesDlg->TalkToPage(GetPageID());  // The FramePropertiesTab identifier
03586     if (!ok)
03587         return TRUE;    
03588 
03589     // Only update if we are not already ungrey 
03590     if (m_GreyStatus == FALSE)
03591         return TRUE;
03592 
03593     // Grey the controls on the frame properties tab.
03594     pPropertiesDlg->EnableGadget(_R(IDC_FRAMETAB_SHOWFRAME),TRUE);
03595     pPropertiesDlg->EnableGadget(_R(IDC_FRAMETAB_NAME),TRUE);
03596     pPropertiesDlg->EnableGadget(_R(IDC_FRAMETAB_SOLID),TRUE);
03597     pPropertiesDlg->EnableGadget(_R(IDC_FRAMETAB_DELAY),TRUE);
03598     pPropertiesDlg->EnableGadget(_R(IDC_FRAMETAB_SHOWFRAME),TRUE);
03599         
03600     // Set the correct grey status.
03601     m_GreyStatus = FALSE;
03602 
03603     return ok;
03604 }

BOOL FramePropertiesTab::UpdateApplyState  )  [protected, virtual]
 

This changes the 'Apply now' state based on the settings of the active layer and the settings in this tab. If the settings are the same, the 'Apply state' is FALSE, else it are TRUE.

Author:
Ranbir_Rana (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/06/97
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if ok, FALSE otherwise

Reimplemented from GIFAnimationPropertyTabs.

Definition at line 4072 of file aprps.cpp.

04073 {
04074 /*
04075     ERROR2IF(pPropertiesDlg == NULL,FALSE,"animationColoursTab::CommitSection called with a NULL dialog pointer");
04076 
04077     // Ensure we talk to the correct page.
04078     BOOL ok = pPropertiesDlg->TalkToPage(GetPageID());
04079     if (!ok)
04080         return TRUE;
04081 
04082     // Ensure we have an active layer.
04083     Layer* pLayer = GetActiveLayer();
04084 
04085     // Have the properties for this changed.
04086     if (pLayer != NULL)
04087         FramePropertiesTab::SetApplyNowState(HavePropertiesChanged(pLayer));
04088 
04089     // The new state for the 'Apply/ok/Cancel' buttons.
04090     BOOL NewApplyNowState = FramePropertiesTab::GetApplyNowState();
04091 
04092     // If the properties for this tab have changed, then ungrey the apply now button.
04093     if (NewApplyNowState  || GetCurrentApplyNow())
04094     {
04095         // Ungrey the apply/ok/cancel buttons.
04096         FramePropertiesTab::UngreyApplyNow();
04097     }
04098 */
04099     // Everything ok.
04100     return TRUE;
04101 }

BOOL FramePropertiesTab::UpdateLayerSection  )  [virtual]
 

Called when the layer-related section of the tab should be updated.

Author:
Ranbir_Rana (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/06/97
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
TRUE if ok, FALSE otherwise

Reimplemented from PropertyTabs.

Definition at line 3802 of file aprps.cpp.

03803 {
03804     ERROR2IF(pPropertiesDlg == NULL,FALSE,"FramePropertiesTab::UpdateLayerSection() called with a NULL dialog pointer");
03805 
03806     BOOL ok = pPropertiesDlg->TalkToPage(GetPageID());
03807     if (!ok)
03808         return TRUE;    
03809 
03810     // When the frame gallery is opening an UPDATE_ACTIVE_LAYER message is sent. 
03811     // We wish to ignore the message, therefore this flag will be set to false.
03812     if(m_FrameGalleryOpen && !m_ChangeLayerState)
03813         ShowDetails();
03814 
03815     // This flag is only true when the active layer state has been
03816     // changed from within the frame gallery. At all other times we
03817     // invoke the Showdetails function above.
03818     if(m_ChangeLayerState)
03819         ChangeLayerState();
03820 
03821     // Everything ok.
03822     return TRUE;
03823 }

BOOL FramePropertiesTab::UpdateSection  )  [virtual]
 

Called when we have switched to a new document and need to update all the controls on this tab.

> BOOL FramePropertiesTab::UpdateSection()

Author:
Ranbir_Rana (Xara Group Ltd) <camelotdev@xara.com>
Date:
10/06/97
Returns:
-

Reimplemented from PropertyTabs.

Definition at line 3674 of file aprps.cpp.

03675 {
03676     ERROR2IF(pPropertiesDlg == NULL,FALSE,"FramePropertiesTab::UpdateSection called with no dialog pointer");
03677 
03678     // Ensure we talk to the correct page.
03679     BOOL ok = pPropertiesDlg->TalkToPage(GetPageID());
03680     if (!ok)
03681         return TRUE;        
03682 
03683     // Display the correct details.
03684     ShowDetails();
03685 
03686     // Everything ok.
03687     return TRUE;
03688 }


Member Data Documentation

BOOL FramePropertiesTab::m_GreyStatus [protected]
 

Definition at line 285 of file aprps.h.


The documentation for this class was generated from the following files:
Generated on Sat Nov 10 03:54:35 2007 for Camelot by  doxygen 1.4.4