OpQuality Class Reference

Operation to set quality level on a DocView Notes: Will be on a dialog somewhere eventually. More...

#include <qualops.h>

Inheritance diagram for OpQuality:

Operation MessageHandler ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 OpQuality ()
 Constructor for OpQuality operation. It is not undoable.
void Do (OpDescriptor *)
 Sets quality level on current view.

Static Public Member Functions

static BOOL Init ()
 Creates all the opDescriptors that call this operation.
static OpState GetState (String_256 *, OpDescriptor *)
 This item is always available.

Static Private Member Functions

static INT32 ConvertToValue (OpDescriptor *)
 This is how we use one operation for many levels of quality. Scope: Private, Static.

Detailed Description

Operation to set quality level on a DocView Notes: Will be on a dialog somewhere eventually.

Author:
Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/4/94

Definition at line 172 of file qualops.h.


Constructor & Destructor Documentation

OpQuality::OpQuality  ) 
 

Constructor for OpQuality operation. It is not undoable.

Author:
Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/4/94
Parameters:
[INPUTS] 
[OUTPUTS] 
Returns:

Errors: None

Definition at line 606 of file qualops.cpp.

00607 {
00608 }


Member Function Documentation

INT32 OpQuality::ConvertToValue OpDescriptor OpDesc  )  [static, private]
 

This is how we use one operation for many levels of quality. Scope: Private, Static.

Author:
Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/4/94
Parameters:
A pointer to an opdescriptor. [INPUTS]
- [OUTPUTS]
Returns:
Numeric value for quality based on token in opdescriptor.

Definition at line 655 of file qualops.cpp.

00656 {
00657     if( OpDesc->Token == String(OPTOKEN_QUALITYANTIALIASED) )
00658         return QUALITY_LEVEL_ANTI;
00659     
00660     if( OpDesc->Token == String(OPTOKEN_QUALITYNORMAL) )
00661         return QUALITY_LEVEL_NORMAL;
00662     
00663     if (OpDesc->Token == String(OPTOKEN_QUALITYSIMPLE))
00664         return QUALITY_LEVEL_SIMPLE;
00665     
00666     if (OpDesc->Token == String(OPTOKEN_QUALITYOUTLINE))
00667         return QUALITY_LEVEL_OUTLINE;
00668 
00669     if (OpDesc->Token == String(OPTOKEN_QUALITYSLIDER))
00670         return ((QualitySliderDescriptor*)OpDesc)->CurrentSliderPos;
00671 
00672     TRACE( _T("Bad opdesc token %s\n"), (TCHAR *)(OpDesc->Token) );
00673     ENSURE(FALSE, "OpQuality passed bad opdesc");
00674 
00675     return 100;         // default to Normal
00676 }

void OpQuality::Do OpDescriptor OpDesc  )  [virtual]
 

Sets quality level on current view.

Author:
Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
Date:
22/4/94
Parameters:
None [INPUTS]
None [OUTPUTS]
Returns:
None

Errors: None

Reimplemented from Operation.

Definition at line 535 of file qualops.cpp.

00536 {
00537     // Find out about the view
00538     DocView *pDocView = DocView::GetSelected();
00539     if (pDocView == NULL)
00540         return;
00541 
00542     // Find out the new quality setting
00543     INT32 NewQuality = ConvertToValue(OpDesc);
00544 
00545     // Use this as the new default quality.
00546     Quality::DefaultQuality.SetQuality(NewQuality);
00547 
00548     // tell the selected DocView and get it to redraw itself if it changed
00549     const BOOL Changed = pDocView->RenderQuality.SetQuality(NewQuality);
00550 
00551     // redraw the document
00552     if (Changed)
00553     {
00554         CBitmapCache* pBC = Camelot.GetBitmapCache();
00555 //      pBC->DeInitialise();                        // Brute force cache clear
00556         if ( pBC )
00557             pBC->RemoveLowPriorityBitmaps();        // Remove all cached bitmaps but not more permanent ones...???
00558 
00559         pDocView->ForceRedraw();
00560         BROADCAST_TO_ALL(ScreenChangeMsg());
00561     }
00562     
00563 
00564     OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_QUALITYSLIDER);
00565     if (pOpDesc!=NULL)
00566     {
00567         // Found the opdescriptor. Now find all the gadgets associated with it
00568         List Gadgets;
00569         if (pOpDesc->BuildGadgetList(&Gadgets))
00570         {
00571             // Found some. Set the controls position according to the quality
00572             GadgetListItem* pGadgetItem = (GadgetListItem*) Gadgets.GetHead();
00573 
00574             while (pGadgetItem!=NULL)
00575             {
00576                 // Set the sliders position
00577                 pGadgetItem->pDialogOp->SetLongGadgetValue(pGadgetItem->gidGadgetID, NewQuality /*110-NewQuality+10*/);
00578 
00579                 // go find the next gadget
00580                 pGadgetItem = (GadgetListItem*) Gadgets.GetNext(pGadgetItem);
00581             }
00582             
00583             // Clean out the list
00584             Gadgets.DeleteAll();
00585         }
00586     }
00587 
00588     // and finish
00589     End();
00590 }

OpState OpQuality::GetState String_256 ,
OpDescriptor OpDesc
[static]
 

This item is always available.

Author:
Andy_Pennell (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/4/94
Parameters:
[INPUTS] 
[OUTPUTS] 
Returns:

Errors: None

Definition at line 626 of file qualops.cpp.

00627 {
00628     OpState OpSt;
00629 
00630     const DocView *pDocView = DocView::GetSelected();
00631 
00632     if (
00633         pDocView &&
00634         ( pDocView->RenderQuality.GetQuality() == ConvertToValue( OpDesc ) )
00635        )
00636         OpSt.Ticked = TRUE;
00637 
00638     return OpSt;
00639 }

BOOL OpQuality::Init void   )  [static]
 

Creates all the opDescriptors that call this operation.

Author:
Rik_Heywood (Xara Group Ltd) <camelotdev@xara.com>
Date:
2/11/94
Returns:
TRUE if the Quality Op was started ok

Reimplemented from SimpleCCObject.

Definition at line 403 of file qualops.cpp.

00404 {
00405     // Register our default quality preference - we default to maximum quality.
00406     Camelot.DeclareSection( _T("Rendering"), 20 ); 
00407     Quality::DefaultQuality.QualityValue = QUALITY_MAX;
00408     Camelot.DeclarePref( _T("Rendering"), _T("DefaultQuality"), 
00409                         &Quality::DefaultQuality.QualityValue, 10, QUALITY_MAX); 
00410 
00411     // Create a new OpDescriptor for the slider
00412     QualitySliderDescriptor* pOpDesc = new QualitySliderDescriptor(0,
00413                                     _R(IDS_VIEWQUALITY), 
00414                                     CC_RUNTIME_CLASS(OpQuality), 
00415                                     OPTOKEN_QUALITYSLIDER,
00416                                     QualitySliderDescriptor::GetState, 
00417                                     0, 
00418                                     _R(IDBBL_VIEWQUALITYSLIDER),
00419                                     _R(IDC_QUALITYSLIDER),
00420                                     _R(IDC_QUALITYSLIDER));
00421 
00422     // check that it worked
00423     if (pOpDesc==NULL)
00424         return FALSE;
00425 
00426     // and do the same for the menu option descriptors
00427     if (!Operation::RegisterOpDescriptor(
00428                         0,
00429                         _R(IDS_QUALITY_ANTI_ALIASED),
00430                         CC_RUNTIME_CLASS(OpQuality),
00431                         OPTOKEN_QUALITYANTIALIASED,
00432                         OpQuality::GetState,
00433                         0,                              // help ID
00434                         _R(IDBBL_QUALITYANTIALIAS),         // bubble help
00435                         _R(IDD_BARCONTROLSTORE),            // resource ID
00436                         _R(IDC_BTN_WINDOWQUALITYAA),        // control ID
00437                         SYSTEMBAR_WINDOW,               // Bar ID
00438                         TRUE,                           // Recieve system messages
00439                         FALSE,                          // Smart duplicate operation
00440                         TRUE,                           // Clean operation
00441                         0,                              // No vertical counterpart
00442                         0,                              // String for one copy only error
00443                         (DONT_GREY_WHEN_SELECT_INSIDE | GREY_WHEN_NO_CURRENT_DOC), // Auto state flags
00444                         TRUE                            // tickable
00445 
00446                         ))
00447         return FALSE;
00448 
00449     if (!Operation::RegisterOpDescriptor(
00450                         0,
00451                         _R(IDS_QUALITY_NORMAL),
00452                         CC_RUNTIME_CLASS(OpQuality),
00453                         OPTOKEN_QUALITYNORMAL,
00454                         OpQuality::GetState,
00455                         0,                              // help ID
00456                         _R(IDBBL_QUALITYNORMAL),            // bubble help
00457                         _R(IDD_BARCONTROLSTORE),            // resource ID
00458                         _R(IDC_BTN_WINDOWQUALITYNORMAL),    // control ID
00459                         SYSTEMBAR_WINDOW,               // Bar ID
00460                         TRUE,                           // Recieve system messages
00461                         FALSE,                          // Smart duplicate operation
00462                         TRUE,                           // Clean operation
00463                         0,                              // No vertical counterpart
00464                         0,                              // String for one copy only error
00465                         (DONT_GREY_WHEN_SELECT_INSIDE | GREY_WHEN_NO_CURRENT_DOC), // Auto state flags
00466                         TRUE                            // tickable
00467                         ))
00468         return FALSE;
00469 
00470     if (!Operation::RegisterOpDescriptor(
00471                         0,
00472                         _R(IDS_QUALITY_SIMPLE),
00473                         CC_RUNTIME_CLASS(OpQuality),
00474                         OPTOKEN_QUALITYSIMPLE,
00475                         OpQuality::GetState,
00476                         0,                              // help ID 
00477                         _R(IDBBL_QUALITYSIMPLE),            // bubble help
00478                         _R(IDD_BARCONTROLSTORE),            // resource ID
00479                         _R(IDC_BTN_WINDOWQUALITYSIMPLE),    // control ID
00480                         SYSTEMBAR_WINDOW,               // Bar ID
00481                         TRUE,                           // Recieve system messages
00482                         FALSE,                          // Smart duplicate operation
00483                         TRUE,                           // Clean operation
00484                         0,                              // No vertical counterpart
00485                         0,                              // String for one copy only error
00486                         (DONT_GREY_WHEN_SELECT_INSIDE | GREY_WHEN_NO_CURRENT_DOC), // Auto state flags
00487                         TRUE                            // tickable
00488                         ))
00489         return FALSE;
00490 
00491     if (!Operation::RegisterOpDescriptor(
00492                         0,
00493                         _R(IDS_QUALITY_OUTLINE),
00494                         CC_RUNTIME_CLASS(OpQuality),
00495                         OPTOKEN_QUALITYOUTLINE,
00496                         OpQuality::GetState,
00497                         0,                              // help ID 
00498                         _R(IDBBL_QUALITYOUTLINE),           // bubble help
00499                         _R(IDD_BARCONTROLSTORE),            // resource ID
00500                         _R(IDC_BTN_WINDOWQUALITYOUTLINE),   // control ID
00501                         SYSTEMBAR_WINDOW,               // Bar ID
00502                         TRUE,                           // Recieve system messages
00503                         FALSE,                          // Smart duplicate operation
00504                         TRUE,                           // Clean operation
00505                         0,                              // No vertical counterpart
00506                         0,                              // String for one copy only error
00507                         (DONT_GREY_WHEN_SELECT_INSIDE | GREY_WHEN_NO_CURRENT_DOC), // Auto state flags
00508                         TRUE                            // tickable
00509                         ))
00510         return FALSE;
00511 
00512     return TRUE;
00513 }


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