OpPalettePopupCommand Class Reference

#include <palmenu.h>

Inheritance diagram for OpPalettePopupCommand:

Operation MessageHandler ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

virtual void Do (OpDescriptor *pOpDesc)
 Handles the menu selection.

Static Public Member Functions

static BOOL Init (BitmapExportPaletteControl *, BmapPrevDlg *)
static OpState GetCommandState (String_256 *ShadeReason, OpDescriptor *pOpDesc)

Static Protected Member Functions

static BOOL InitPolymorphicCommand (TCHAR *OpToken, UINT32 MenuTextID)
 This function registers a menu operation.

Private Member Functions

 CC_DECLARE_DYNCREATE (OpPalettePopupCommand)

Static Private Attributes

static BitmapExportPaletteControlm_pPaletteControl = 0
static BmapPrevDlgm_pBmapPrevDlg = 0

Detailed Description

Definition at line 146 of file palmenu.h.


Member Function Documentation

OpPalettePopupCommand::CC_DECLARE_DYNCREATE OpPalettePopupCommand   )  [private]
 

void OpPalettePopupCommand::Do OpDescriptor pOpDesc  )  [virtual]
 

Handles the menu selection.

Author:
Alex_Price (Xara Group Ltd) <camelotdev@xara.com>
Date:
09/08/99
Parameters:
pOpDesc - ? [INPUTS]
Returns:
-

Reimplemented from Operation.

Definition at line 342 of file palmenu.cpp.

00343 {  
00344     ERROR3IF(!m_pPaletteControl,    "Help, I am the palette right click menu and I can't talk to the palette");
00345     ERROR3IF(!m_pBmapPrevDlg,       "Help, I am the palette right click menu and I can't talk to the preview dialog");
00346 
00347     //  Get the token of the item selected by the user.
00348     String_256 s(pOpDesc->Token);
00349 
00350 
00351     if (s.IsIdentical((TCHAR *)OPTOKEN_PALETTE_LOCKED))
00352          m_pPaletteControl->SetSelectedColourToggleLocked();
00353     else if (s.IsIdentical((TCHAR *)OPTOKEN_PALETTE_WEB_SAFE))
00354         m_pPaletteControl->SetSelectedColourWebSafe();
00355     else if (s.IsIdentical((TCHAR *)OPTOKEN_PALETTE_TRANSPARENT_BACKGROUND))
00356     {
00357         BmapPrevDlg::m_pExportOptions->SetBackgroundTransparency(!BmapPrevDlg::m_pExportOptions->IsBackgroundTransparent());
00358         m_pBmapPrevDlg->DoPreview();
00359     }
00360     else if (s.IsIdentical((TCHAR *)OPTOKEN_PALETTE_TRANSPARENT))
00361         m_pPaletteControl->SetSelectedColourToggleTransparent();
00362     else if (s.IsIdentical((TCHAR *)OPTOKEN_PALETTE_DELETE))
00363         m_pPaletteControl->SetSelectedColourToggleDeleted();
00364     else if (s.IsIdentical((TCHAR *)OPTOKEN_PALETTE_RESTORE))
00365         m_pPaletteControl->SetSelectedColourToggleDeleted();
00366     else if (s.IsIdentical((TCHAR *)OPTOKEN_PALETTE_SYSTEM_COLOURS))
00367         BmapPrevDlg::m_pExportOptions->SetToUseSystemPalette(!BmapPrevDlg::m_pExportOptions->IsUsingSystemPalette());
00368     else if (s.IsIdentical((TCHAR *)OPTOKEN_PALETTE_SORT_BY_USE))
00369     {
00370         m_pPaletteControl->SetCurrentSortType(BitmapExportPaletteInterface::SORT_USE);
00371         m_pPaletteControl->RenderSoon();
00372     }
00373     else if (s.IsIdentical((TCHAR *)OPTOKEN_PALETTE_SORT_BY_LUMINANCE))
00374     {
00375         m_pPaletteControl->SetCurrentSortType(BitmapExportPaletteInterface::SORT_LUMINANCE);
00376         m_pPaletteControl->RenderSoon();
00377     }
00378     else if (s.IsIdentical((TCHAR *)OPTOKEN_PALETTE_SORT_BY_HUE))
00379     {
00380         m_pPaletteControl->SetCurrentSortType(BitmapExportPaletteInterface::SORT_HUE);
00381         m_pPaletteControl->RenderSoon();
00382     }
00383 
00384     BmapPrevDlg::m_pExportOptions->InvalidatePalette();
00385     m_pBmapPrevDlg->UpdateCurrentTab();
00386     m_pBmapPrevDlg->DoPreview();
00387 
00388     End();
00389 }

OpState OpPalettePopupCommand::GetCommandState String_256 ShadeReason,
OpDescriptor pOpDesc
[static]
 

Definition at line 242 of file palmenu.cpp.

00243 {
00244     OpState OpSt;
00245     OpSt.Greyed = FALSE;
00246 
00247     //  Get the properties of the colour under consideration
00248     BOOL bLocked                = m_pPaletteControl->GetSelectedColourLocked();
00249     BOOL bDeleted               = m_pPaletteControl->GetSelectedColourDeleted();
00250     BOOL bWebSafe               = m_pPaletteControl->GetSelectedColourWebSafe();
00251     BOOL bTransparentBackground = BmapPrevDlg::m_pExportOptions->IsBackgroundTransparent();
00252     BOOL bTransparent           = m_pPaletteControl->GetSelectedColourTransparent();
00253     BOOL bSupportsTransp        = BmapPrevDlg::m_pExportOptions->GetSupportsTransparency();
00254 
00255     //  Locked menu item
00256     if( pOpDesc->Token == String_256( OPTOKEN_PALETTE_LOCKED ) )
00257     {
00258         if (bDeleted)
00259             OpSt.Greyed = TRUE;
00260         else if (bLocked)
00261             OpSt.Ticked = TRUE;
00262     }
00263 
00264     //  WebSafe menu item
00265     if( pOpDesc->Token == String_256( OPTOKEN_PALETTE_WEB_SAFE ) )
00266     {
00267         if (bTransparent || bDeleted || bWebSafe)
00268             OpSt.Greyed = TRUE;
00269     }
00270 
00271     //  Background transparent menu item
00272     if( pOpDesc->Token == String_256( OPTOKEN_PALETTE_TRANSPARENT_BACKGROUND ) )
00273     {
00274         if (bDeleted || !bSupportsTransp)
00275             OpSt.Greyed = TRUE;
00276         else if (bTransparentBackground)
00277             OpSt.Ticked = TRUE;
00278     }
00279 
00280     //  Transparent menu item
00281     if( pOpDesc->Token == String_256( OPTOKEN_PALETTE_TRANSPARENT ) )
00282     {
00283         if (bDeleted || !bSupportsTransp)
00284             OpSt.Greyed = TRUE;
00285         else if (bTransparent)
00286             OpSt.Ticked = TRUE;
00287     }
00288 
00289     //  Delete menu item
00290     if( pOpDesc->Token == String_256( OPTOKEN_PALETTE_DELETE ) )
00291     {
00292         if(bDeleted)
00293             OpSt.RemoveFromMenu = TRUE;
00294     }
00295 
00296     //  Restore menu item
00297     if( pOpDesc->Token == String_256( OPTOKEN_PALETTE_RESTORE ) )
00298     {
00299         if(!bDeleted)
00300             OpSt.RemoveFromMenu = TRUE;
00301     }
00302 
00303     //  The 'Sort by...' menu items.
00304     if( pOpDesc->Token == String_256( OPTOKEN_PALETTE_SORT_BY_USE ) )
00305         if (m_pPaletteControl->GetCurrentSortType() == BitmapExportPaletteInterface::SORT_USE)
00306             OpSt.Ticked = TRUE;
00307 
00308     if( pOpDesc->Token == String_256( OPTOKEN_PALETTE_SORT_BY_LUMINANCE ) )
00309         if (m_pPaletteControl->GetCurrentSortType() == BitmapExportPaletteInterface::SORT_LUMINANCE)
00310             OpSt.Ticked = TRUE;
00311 
00312     if( pOpDesc->Token == String_256( OPTOKEN_PALETTE_SORT_BY_HUE ) )
00313         if (m_pPaletteControl->GetCurrentSortType() == BitmapExportPaletteInterface::SORT_HUE)
00314             OpSt.Ticked = TRUE;
00315 
00316     //  Tick it if the 'System Colours' button is pressed in
00317 //  if( ( pOpDesc->Token == String_256( OPTOKEN_PALETTE_SYSTEM_COLOURS ) ))
00318 //      if (BmapPrevDlg::IsU
00319 //              ( m_pDialog->IsSystemColours() ) )
00320 //          OpSt.Ticked = TRUE;
00321 
00322     return OpSt; 
00323 }

BOOL OpPalettePopupCommand::Init BitmapExportPaletteControl ,
BmapPrevDlg
[static]
 

Definition at line 210 of file palmenu.cpp.

00211 {
00212     m_pPaletteControl   = pPaletteControl;
00213     m_pBmapPrevDlg      = pBmapPrevDlg;
00214 
00215     InitPolymorphicCommand( OPTOKEN_PALETTE_LOCKED,                 _R(IDS_MENU_LOCKED) );
00216     InitPolymorphicCommand( OPTOKEN_PALETTE_WEB_SAFE,               _R(IDS_MENU_WEB_SAFE) );
00217     InitPolymorphicCommand( OPTOKEN_PALETTE_TRANSPARENT_BACKGROUND, _R(IDS_MENU_TRANSPARENT_BACK) );
00218     InitPolymorphicCommand( OPTOKEN_PALETTE_TRANSPARENT,            _R(IDS_MENU_TRANSPARENT) );
00219 
00220     InitPolymorphicCommand( OPTOKEN_PALETTE_RESTORE,                _R(IDS_MENU_RESTORE) );
00221     InitPolymorphicCommand( OPTOKEN_PALETTE_DELETE,                 _R(IDS_MENU_DELETE) );
00222 
00223     InitPolymorphicCommand( OPTOKEN_PALETTE_SYSTEM_COLOURS,         _R(IDS_MENU_SYSTEM_COLOURS) );
00224 
00225     InitPolymorphicCommand( OPTOKEN_PALETTE_SORT_BY_USE,            _R(IDS_MENU_SORT_BY_USE) );
00226     InitPolymorphicCommand( OPTOKEN_PALETTE_SORT_BY_LUMINANCE,      _R(IDS_MENU_SORT_BY_LUMINANCE) );
00227     InitPolymorphicCommand( OPTOKEN_PALETTE_SORT_BY_HUE,            _R(IDS_MENU_SORT_BY_HUE) );
00228 
00229     return TRUE;
00230 }               

BOOL OpPalettePopupCommand::InitPolymorphicCommand TCHAR OpToken,
UINT32  MenuTextID
[static, protected]
 

This function registers a menu operation.

Author:
Alex_Price (Xara Group Ltd) <camelotdev@xara.com>
Date:
09/08/99
Parameters:
OpToken - the token of a menu operation [INPUTS] MenuTextID - the resource string of the menu command.
Returns:
TRUE if everything went OK, and FALSE otherwise.

Definition at line 180 of file palmenu.cpp.

00181 {
00182     return(RegisterOpDescriptor(0,                                  // Tool ID 
00183                                 MenuTextID,                         // String resource ID
00184                                 CC_RUNTIME_CLASS(OpPalettePopupCommand),// Runtime class
00185                                 OpToken,                            // Token string
00186                                 OpPalettePopupCommand::GetCommandState, // GetState function
00187                                 0,                                  // help ID
00188                                 0,                                  // bubble help
00189                                 0,                                  // resource ID
00190                                 0,                                  // control ID
00191                                 SYSTEMBAR_ILLEGAL,                  // Bar ID
00192                                 FALSE,                              // Receive system messages
00193                                 FALSE,                              // Smart duplicate operation
00194                                 TRUE,                               // Clean operation
00195                                 NULL,                               // No vertical counterpart
00196                                 0,                                  // String for one copy only error
00197                                 DONT_GREY_WHEN_SELECT_INSIDE        // Auto state flags
00198                                 ));
00199 }


Member Data Documentation

BmapPrevDlg * OpPalettePopupCommand::m_pBmapPrevDlg = 0 [static, private]
 

Definition at line 161 of file palmenu.h.

BitmapExportPaletteControl * OpPalettePopupCommand::m_pPaletteControl = 0 [static, private]
 

Definition at line 160 of file palmenu.h.


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