CBiasGainDlg Class Reference

#include <biasdlg.h>

Inheritance diagram for CBiasGainDlg:

DialogOp Operation MessageHandler ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 CBiasGainDlg ()
 ~CBiasGainDlg ()
void Do (OpDescriptor *)
void DoWithParam (OpDescriptor *, OpParam *OwningGadgetParams)
virtual MsgResult Message (Msg *)
void InvokeVia (CBiasGainGadget &pInvokeWith, CProfileBiasGain *pInvokeOn, BOOL bMany)
void ReInitialiseDialog (CProfileBiasGain *ReInitOn, BOOL bMany)
void DisableAllControls ()
void EnableAllControls ()
void ToggleFillProfile ()
void ToggleTranspFillProfile ()
CProfileBiasGain GetCurrentDialogProfile ()

Static Public Member Functions

static BOOL Init ()
static OpState GetState (String_256 *, OpDescriptor *)
 Returns the OpState of the CBiasGainDlg dialogue operation ie. whether or not it is greyed on the menu etc!!!

Static Public Attributes

static const UINT32 IDD = _R(IDD_BIASGAIN)
static const CDlgMode Mode = MODELESS

Protected Member Functions

virtual void DrawCurve (const CProfileBiasGain &CurveShape, ReDrawInfoType *ExtraInfo)
virtual void DrawCurveInterpolate (const CProfileBiasGain &CurveShape, ReDrawInfoType *ExtraInfo)
virtual void DrawFillInterpolate (const CProfileBiasGain &CurveShape, ReDrawInfoType *ExtraInfo)
virtual void DrawTranspFillInterpolate (const CProfileBiasGain &CurveShape, ReDrawInfoType *ExtraInfo)
virtual void InitSliders (CProfileBiasGain const &)
virtual void WriteSliders (CProfileBiasGain const &)
virtual void ReadSliders (CProfileBiasGain &)
virtual void InitiProfileCombobox ()
void InitOneSlider (CGadgetID GadgetID)
void WriteOneSlider (AFp ValueMinus1ToPlus1, CGadgetID GadgetID)
AFp ReadOneSlider (CGadgetID GadgetID)
void InitBiasGainGadget (CProfileBiasGain const &)
virtual void InitEditBoxes (CProfileBiasGain const &)
virtual void WriteEditBoxes (CProfileBiasGain const &)
virtual void ReadEditBoxes (CProfileBiasGain &)

Static Protected Attributes

static const INT32 kSliderLength_s = INT32( 200 )
static const INT32 kSliderHalfLength_s = kSliderLength_s / INT32( 2 )
static const INT32 kSliderMin_s = -( kSliderHalfLength_s )
static const INT32 kSliderMax_s = +( kSliderHalfLength_s )

Private Member Functions

virtual void HandleSliderPosChanging (CDlgMessage const &, CProfileBiasGain &)
virtual void HandleSliderPosSet (CDlgMessage const &, CProfileBiasGain &)
virtual void HandleCommit (CDlgMessage const &, CProfileBiasGain &)
virtual void HandleInput (CDlgMessage const &, CProfileBiasGain &)
virtual void HandleBiasEditChange (CDlgMessage const &, CProfileBiasGain &)
virtual void BroadcastMessage (CDlgMessage const &, CProfileBiasGain const &) const
 CBiasGainDlg (const CBiasGainDlg &)
CBiasGainDlgoperator= (const CBiasGainDlg &)

Private Attributes

CBiasGainGadgetpOwningGadget_m
CBiasGainGadget BiasGainGadget
CGadgetID Id_m
CBitmapGridDropDownm_pobddStandardProfile
CProfileBiasGain BiasGain_m
BOOL manyDisabledControls
BOOL useFillProfile
BOOL useTranspFillProfile

Detailed Description

Definition at line 136 of file biasdlg.h.


Constructor & Destructor Documentation

CBiasGainDlg::CBiasGainDlg  ) 
 

Definition at line 151 of file biasdlg.cpp.

00152     : DialogOp( CBiasGainDlg::IDD, CBiasGainDlg::Mode ),
00153       pOwningGadget_m( 0 ),
00154       Id_m( 0 ),
00155       BiasGain_m()
00156 {
00157     m_pobddStandardProfile = NULL;
00158 }

CBiasGainDlg::~CBiasGainDlg  ) 
 

Definition at line 161 of file biasdlg.cpp.

00162 {
00163     delete m_pobddStandardProfile;
00164     //EndTimedProcessing();
00165 }

CBiasGainDlg::CBiasGainDlg const CBiasGainDlg  )  [private]
 


Member Function Documentation

void CBiasGainDlg::BroadcastMessage CDlgMessage const &  Message,
CProfileBiasGain const &  BiasGain
const [private, virtual]
 

Function : CBiasGainDlg::BroadcastMessage Author : Mikhail Tatarnikov Purpose : Broadcasts a message to all DialogOp-derived classes, sending the current profile as parameter Returns : void Exceptions: Parameters: [in] CDlgMessage const& Message - a message to broadcast; [in] CProfileBiasGain const& BiasGain - the profile value to send with the message. Notes :

Definition at line 1526 of file biasdlg.cpp.

01527 {
01528     BROADCAST_TO_CLASS(DialogMsg(0, Message, Id_m, reinterpret_cast<UINT_PTR>(&BiasGain)), DialogOp);
01529 }

void CBiasGainDlg::DisableAllControls  ) 
 

Function : CBiasGainDlg::DisableAllControls Author : Mikhail Tatarnikov Purpose : Disable all dialog controls. Returns : void Exceptions: Parameters: None Notes :

Definition at line 1188 of file biasdlg.cpp.

01189 {
01190     manyDisabledControls = TRUE;
01191 
01192     EnableGadget (_R(IDC_STATIC1), FALSE);
01193     EnableGadget (_R(IDC_STATIC2), FALSE);
01194     EnableGadget (_R(IDC_STATIC3), FALSE);
01195     EnableGadget (_R(IDC_STATIC4), FALSE);
01196     EnableGadget (_R(IDC_STATIC5), FALSE);
01197     EnableGadget (_R(IDC_STATIC6), FALSE);
01198     //EnableGadget (_R(IDC_STATIC7), FALSE);
01199     EnableGadget (_R(IDC_STATIC8), FALSE);
01200     EnableGadget (_R(IDC_STATIC9), FALSE);
01201     EnableGadget (_R(IDC_SLIDER_BIAS), FALSE);
01202     EnableGadget (_R(IDC_SLIDER_GAIN), FALSE);
01203     EnableGadget (_R(IDC_EDIT_BIAS), FALSE);
01204     EnableGadget (_R(IDC_EDIT_GAIN), FALSE);
01205     //EnableGadget (_R(IDC_CURVE), FALSE);
01206     InvalidateGadget( _R(IDC_CURVE) );
01207     InvalidateGadget( _R(IDC_CURVEINTERPOLATE) );
01208 }

void CBiasGainDlg::Do OpDescriptor  )  [virtual]
 

Function : CBiasGainDlg::Do Author : Mikhail Tatarnikov Purpose : Creates and shows a CBiasGainDlg dialog Returns : void Exceptions: Parameters: [in/out] OpDescriptor* - Notes :

Reimplemented from Operation.

Definition at line 246 of file biasdlg.cpp.

00247 {
00248     Create();
00249     Open();
00250 }

void CBiasGainDlg::DoWithParam OpDescriptor ,
OpParam OwningGadgetParams
[virtual]
 

Function : CBiasGainDlg::DoWithParam Author : Mikhail Tatarnikov Purpose : Creates and shows a CBiasGainDlg dialog Returns : void Exceptions: Parameters: [in] OpDescriptor* - [in] OpParam* OwningGadgetParams - the dialog parameters (param1 is a CBiasGainGadget* and param2 is really a CProfileBiasGain*) Notes :

Reimplemented from Operation.

Definition at line 272 of file biasdlg.cpp.

00273 {
00274     BOOL noProfile = FALSE;
00275     
00276     // extract the param info: an owning gadget ptr, and input biasgain value
00277     pOwningGadget_m  =  reinterpret_cast<CBiasGainGadget*>((void*)(OwningGadgetParams->Param1));
00278     pOwningGadget_m->SetCBaisGainDlg (this);
00279     
00280     const CProfileBiasGain* invokeOn = reinterpret_cast<CProfileBiasGain const*>((void*)(OwningGadgetParams->Param2));
00281     
00282     if (invokeOn != NULL)
00283     {
00284         BiasGain_m = *(invokeOn);
00285     }
00286     else
00287     {
00288         noProfile = TRUE;
00289     }
00290 
00291     // get the ID
00292     if( pOwningGadget_m != 0 )
00293     {
00294         Id_m  =  pOwningGadget_m->GetGadgetID();
00295     }
00296 
00297 
00298     Create();
00299     Open();
00300 
00301     if (pOwningGadget_m->GetUseFillProfile () == TRUE)
00302     {
00303         ToggleFillProfile ();
00304     }
00305 
00306     if (pOwningGadget_m->GetUseTranspFillProfile () == TRUE)
00307     {
00308         ToggleTranspFillProfile ();
00309     }
00310 
00311 
00312     // set the dialog title
00313     if( pOwningGadget_m != 0 )
00314     {
00315         String_256  Title;
00316         pOwningGadget_m->GetDialogTitle( Title );
00317         DialogManager::SetTitlebarName( WindowID,  &Title );
00318     }
00319 
00320     if (noProfile == TRUE)
00321     {
00322 //      SetCustomComboGadgetValue ( _R(IDC_BIASGAINCOMBO), (CustomComboBoxControlDataItem*) NULL, TRUE, -1);
00323         m_pobddStandardProfile->SetSelected(-1);
00324 
00325         // and disable all other controls ....
00326         DisableAllControls ();
00327     }
00328 
00329     // tell the owning gadget that this dialog has opened
00330     if( pOwningGadget_m != 0 )
00331     {
00332         pOwningGadget_m->DialogHasOpened();
00333     }
00334 }

void CBiasGainDlg::DrawCurve const CProfileBiasGain CurveShape,
ReDrawInfoType ExtraInfo
[protected, virtual]
 

Definition at line 543 of file biasdlg.cpp.

00544 {
00545     // drawing constants:  overall resolution, curve steps, curve width, colors
00546     static const INT32  kWidth      =  15000;
00547     static const INT32  kHeight     =  15000;
00548     static const INT32  kStep       =     20;
00549     static const INT32  kLineWidth  =    500;
00550 
00551     static const StockColour  kBackgoundOutline  =  COLOUR_NONE;
00552     static const StockColour  kBackgound         =  COLOUR_WHITE;
00553     static const StockColour  kBackgoundMany     =  COLOUR_LTGREY;  // for the MANY case
00554     static const StockColour  kCurve             =  COLOUR_DKGREY;
00555 
00556 
00557     DocRect  RenderRect( 0, 0,  kWidth, kHeight );
00558 
00559     RenderRegion*  pRenderRegion  =  CreateGRenderRegion( &RenderRect, ExtraInfo );
00560 
00561     if( pRenderRegion != 0 )
00562     {
00563         pRenderRegion->SaveContext();
00564 
00565         // set drawing quality
00566         Quality           QualityThing( Quality::QualityMax );
00567         QualityAttribute  AntiAliasQualityAttr( QualityThing );
00568         pRenderRegion->SetQuality( &AntiAliasQualityAttr, FALSE );
00569         //pRenderRegion->RRQuality.SetQuality( QUALITY_MAX );   // doesnt enable antialiasing
00570         
00571 
00572         // draw the background
00573         pRenderRegion->SetLineColour( kBackgoundOutline );
00574         if (manyDisabledControls == FALSE)
00575         {
00576             pRenderRegion->SetFillColour( kBackgound );
00577         }
00578         else
00579         {
00580             pRenderRegion->SetFillColour( kBackgoundMany );
00581         }
00582         pRenderRegion->DrawRect( &RenderRect );
00583 
00584         if (manyDisabledControls == FALSE)
00585         {
00586             // draw curve
00587             {
00588                 // make a copy of the biasgain object with the right scaling to calculate
00589                 // curve points for the drawing area
00590                 CProfileBiasGain  DiagramMapper( CurveShape );
00591                 DiagramMapper.SetIntervals( AFp( 0.0 ), AFp( kWidth ) );
00592 
00593                 // create a path to hold the geometry of the curve
00594                 Path  CurvePath;
00595                 CurvePath.Initialise( kWidth );
00596                 CurvePath.IsFilled  =  FALSE;
00597                 CurvePath.FindStartOfPath();
00598 
00599 
00600                 // make the first point on the curve
00601                 static const DocCoord  StartPoint( 0, 0 );
00602                 CurvePath.InsertMoveTo( StartPoint );
00603 
00604                 // step through the x axis calculating points on the curve
00605                 for( INT32 x = kStep  ;  x < kWidth  ;  x += kStep )
00606                 {
00607                     const AFp       CurvePointFp  =  DiagramMapper.MapInterval( AFp( x ) );
00608                     const DocCoord  CurrentPoint( x, INT32( CurvePointFp + AFp(0.5) ) );
00609 
00610                     CurvePath.InsertLineTo( CurrentPoint );
00611                 }
00612 
00613                 // connect the last looped step of the curve to the corner of the diagram
00614                 static const DocCoord  EndPoint( kWidth, kWidth );
00615                 CurvePath.InsertLineTo( EndPoint );
00616 
00617 
00618                 // set some line drawing choices
00619                 pRenderRegion->SetLineWidth( kLineWidth );
00620                 pRenderRegion->SetLineColour( kCurve );
00621 
00622                 // render the path of the curve
00623                 pRenderRegion->DrawPath( &CurvePath );
00624             }
00625         }
00626 
00627         pRenderRegion->RestoreContext();
00628         DestroyGRenderRegion( pRenderRegion );
00629     }
00630 }

void CBiasGainDlg::DrawCurveInterpolate const CProfileBiasGain CurveShape,
ReDrawInfoType ExtraInfo
[protected, virtual]
 

Definition at line 641 of file biasdlg.cpp.

00642 {
00643     // drawing constants:  overall resolution, curve steps, curve width, colors
00644     static const INT32  kWidth      =  ExtraInfo->dx;
00645     static const INT32  kBitWidth   =  kWidth/14;
00646     static const INT32  kHeight     =  ExtraInfo->dy;
00647     static const INT32  kHalfHeight =  kHeight/2;
00648     static const INT32  kQuartHeight = kHeight/4;
00649     static const INT32  kLineWidth  =  1500;
00650     static const INT32  kHalfLineWidth = kLineWidth/2;
00651 
00652     static const StockColour  kBackgoundOutline  =  COLOUR_NONE;
00653     static const StockColour  kBackgound         =  COLOUR_WHITE;
00654     static const StockColour  kBackgoundMany     =  COLOUR_LTGREY;  // for the MANY case
00655     static const StockColour  kCurve             =  COLOUR_BLACK;//COLOUR_BLUE;
00656 
00657 
00658     DocRect  RenderRect( 0, 0,  kWidth, kHeight );
00659 
00660     RenderRegion*  pRenderRegion  =  CreateGRenderRegion( &RenderRect, ExtraInfo );
00661 
00662 
00663     if( pRenderRegion != 0 )
00664     {
00665         pRenderRegion->SaveContext();
00666 
00667         // set drawing quality
00668         Quality           QualityThing( Quality::QualityMax );
00669         QualityAttribute  AntiAliasQualityAttr( QualityThing );
00670         pRenderRegion->SetQuality( &AntiAliasQualityAttr, FALSE );
00671         //pRenderRegion->RRQuality.SetQuality( QUALITY_MAX );   // doesnt enable antialiasing       
00672 
00673         // draw the background
00674         pRenderRegion->SetLineColour( kBackgoundOutline );
00675         if (manyDisabledControls == FALSE)
00676         {
00677             pRenderRegion->SetFillColour( kBackgound );
00678         }
00679         else
00680         {
00681             pRenderRegion->SetFillColour( kBackgoundMany );
00682         }
00683         pRenderRegion->DrawRect( &RenderRect );
00684 
00685         if (manyDisabledControls == FALSE)
00686         {
00687             // render ....
00688 
00689             static const AFp xOffset = (kHalfHeight - kQuartHeight) + kHalfLineWidth;
00690 
00691             CProfileBiasGain  DiagramMapper( CurveShape );
00692             DiagramMapper.SetIntervals( AFp( 0.0 ), AFp( kWidth - (2*xOffset)) );
00693 
00694             // create a path to hold the geometry of the curve
00695             Path  CurvePath;
00696             CurvePath.Initialise( kWidth );
00697             CurvePath.IsFilled  =  FALSE;
00698             CurvePath.FindStartOfPath();
00699 
00700             // common part of -1 to +1 curve ....
00701 
00702             //  |
00703             //  |
00704 
00705             static const DocCoord vc1 ( 0, kHalfHeight - kQuartHeight );
00706             static const DocCoord vc2 ( 0, kHalfHeight + kQuartHeight );
00707 
00708             static DocCoord  StartPoint ((INT32)xOffset, kHalfHeight - kQuartHeight);
00709             CurvePath.InsertMoveTo( StartPoint );
00710             static DocCoord  EndStartPoint ((INT32)xOffset, kHalfHeight + kQuartHeight);
00711             CurvePath.InsertLineTo( EndStartPoint );
00712 
00713             for (INT32 i = 1; i < 13/*19*/; i++)
00714             {   
00715                 static DocCoord vi1;
00716                 vi1 = vc1;
00717                 vi1.x += (i) * kBitWidth;
00718                 vi1.x = (INT32)(xOffset + DiagramMapper.MapInterval( AFp( vi1.x ) ) );
00719                 CurvePath.InsertMoveTo( vi1 );
00720                 static DocCoord vi2;
00721                 vi2 = vc2;
00722                 vi2.x += (i) * kBitWidth;
00723                 vi2.x = (INT32)(xOffset + DiagramMapper.MapInterval( AFp( vi2.x ) ) );
00724                 CurvePath.InsertLineTo( vi2 );
00725             }
00726 
00727             static DocCoord  StartEndPoint (kWidth - (INT32)xOffset, kHalfHeight - kQuartHeight);
00728             CurvePath.InsertMoveTo( StartEndPoint );
00729             static DocCoord  EndPoint (kWidth - (INT32)xOffset, kHalfHeight + kQuartHeight);
00730             CurvePath.InsertLineTo( EndPoint );
00731 
00732             // set some line drawing choices
00733             pRenderRegion->SetLineWidth( kLineWidth );
00734             pRenderRegion->SetLineColour( kCurve );
00735 
00736             // render the path of the curve
00737             pRenderRegion->DrawPath( &CurvePath );
00738         }
00739 
00740         pRenderRegion->RestoreContext();
00741         DestroyGRenderRegion( pRenderRegion );
00742     }
00743 }

void CBiasGainDlg::DrawFillInterpolate const CProfileBiasGain CurveShape,
ReDrawInfoType ExtraInfo
[protected, virtual]
 

Definition at line 756 of file biasdlg.cpp.

00757 {
00758     // drawing constants:  overall resolution, curve steps, curve width, colors
00759     static const INT32  kWidth      =  ExtraInfo->dx;
00760 //  static const INT32  kBitWidth   =  kWidth/20;
00761     static const INT32  kHalfWidth  =  kWidth/2;
00762     static const INT32  kHeight     =  ExtraInfo->dy;
00763     static const INT32  kHalfHeight =  kHeight/2;
00764 //  static const INT32  kQuartHeight = kHeight/4;
00765     static const INT32  kLineWidth  =  2000;
00766 //  static const INT32  kHalfLineWidth = kLineWidth/2;
00767 
00768     static const StockColour  kBackgoundOutline  =  COLOUR_NONE;
00769     static const StockColour  kBackgound         =  COLOUR_WHITE;
00770     static const StockColour  kBackgoundMany     =  COLOUR_LTGREY;  // for the MANY case
00771 //  static const StockColour  kCurve             =  COLOUR_BLUE;
00772     static /*const*/ StockColour  kStartColour   =  COLOUR_BLACK;
00773     static /*const*/ StockColour  kEndColour     =  COLOUR_WHITE;
00774 
00775 
00776     DocRect  RenderRect( 0, 0,  kWidth, kHeight );
00777 
00778     RenderRegion*  pRenderRegion  =  CreateGRenderRegion( &RenderRect, ExtraInfo );
00779 
00780 
00781     if( pRenderRegion != 0 )
00782     {
00783         pRenderRegion->SaveContext();
00784 
00785         // set drawing quality
00786         Quality           QualityThing( Quality::QualityMax );
00787         QualityAttribute  AntiAliasQualityAttr( QualityThing );
00788         pRenderRegion->SetQuality( &AntiAliasQualityAttr, FALSE );
00789         //pRenderRegion->RRQuality.SetQuality( QUALITY_MAX );   // doesnt enable antialiasing       
00790 
00791         // draw the background
00792         pRenderRegion->SetLineColour( kBackgoundOutline );
00793         if (manyDisabledControls == FALSE)
00794         {
00795             pRenderRegion->SetFillColour( kBackgound );
00796         }
00797         else
00798         {
00799             pRenderRegion->SetFillColour( kBackgoundMany );
00800         }
00801         pRenderRegion->DrawRect( &RenderRect );
00802 
00803         LinearFillAttribute DummyFillAttribute;//= new LinearFillAttribute ();
00804 
00805         if (manyDisabledControls == FALSE)
00806         {
00807             NodeRegularShape* DummyShape = new NodeRegularShape ();
00808 
00809             if (DummyShape != NULL)
00810             {
00811                 DummyShape->SetUpShape ();
00812                 DummyShape->MakeRectangle (kWidth, kHeight, 0);
00813                 Matrix* TransformMatrix = new Matrix ();
00814                 if (TransformMatrix != NULL)
00815                 {
00816                     TransformMatrix->SetTranslation (kHalfWidth, kHalfHeight);
00817                     DummyShape->SetTransformMatrix (TransformMatrix);
00818                     delete (TransformMatrix);
00819                 }
00820 
00821                 //JoinTypeAttribute DummyJoinType;      DummyJoinType.JoinType = MitreJoin;
00822                 //AttrJoinType* DummyJoin = (AttrJoinType*) DummyJoinType.MakeNode ();
00823                 //DummyJoin->AttachNode (DummyShape, FIRSTCHILD);
00824 
00825                 // set up the start point ....
00826                 
00827                 DocCoord StartPoint (0, kHalfHeight);
00828                 DummyFillAttribute.SetStartPoint (&StartPoint);
00829                 
00830                 DocColour* StartColour = pOwningGadget_m->GetStartColour ();
00831                 DocColour vStartColour (kStartColour);
00832                 if (StartColour != NULL) { DummyFillAttribute.SetStartColour (StartColour); }
00833                 else { DummyFillAttribute.SetStartColour (&vStartColour); }
00834                 
00835                 // set up the end point ....
00836                 
00837                 DocCoord EndPoint (kWidth, kHalfHeight);
00838                 DummyFillAttribute.SetEndPoint (&EndPoint);
00839                 
00840                 DocColour* EndColour = pOwningGadget_m->GetEndColour ();
00841                 DocColour vEndColour (kEndColour);
00842                 if (EndColour != NULL) { DummyFillAttribute.SetEndColour (EndColour); }
00843                 else { DummyFillAttribute.SetEndColour (&vEndColour); }
00844 
00845                 // set these guys to NULL ....
00846                 
00847                 DummyFillAttribute.SetEndPoint2 (NULL);
00848                 DummyFillAttribute.SetEndPoint3 (NULL);
00849                 
00850                 CProfileBiasGain  DiagramMapper( CurveShape );
00851                 DummyFillAttribute.SetProfile (DiagramMapper);
00852 
00853                 pRenderRegion->SetFillGeometry((ColourFillAttribute*) &DummyFillAttribute, FALSE);          // Set Grad-filled
00854 
00855                 // now lets set-up the fill effect (if there is one) ....
00856                 
00857                 if (pOwningGadget_m->GetFillEffect () != NULL)
00858                 {
00859                     pRenderRegion->SetFillEffect (pOwningGadget_m->GetFillEffect (), FALSE);
00860                 }
00861 
00862                 pRenderRegion->SetLineWidth( kLineWidth );
00863                 //pRenderRegion->SetLineColour( kCurve );
00864                 //pRenderRegion->SetFillColour (kCurve);
00865 
00866                 DummyShape->Render (pRenderRegion);
00867                 delete (DummyShape);
00868             }
00869         }
00870 
00871         pRenderRegion->RestoreContext();
00872         DestroyGRenderRegion( pRenderRegion );
00873     }
00874 }

void CBiasGainDlg::DrawTranspFillInterpolate const CProfileBiasGain CurveShape,
ReDrawInfoType ExtraInfo
[protected, virtual]
 

Definition at line 876 of file biasdlg.cpp.

00877 {
00878     // drawing constants:  overall resolution, curve steps, curve width, colors
00879     static const INT32  kWidth      =  ExtraInfo->dx;
00880 //  static const INT32  kBitWidth   =  kWidth/20;
00881     static const INT32  kHalfWidth  =  kWidth/2;
00882     static const INT32  kHeight     =  ExtraInfo->dy;
00883     static const INT32  kHalfHeight =  kHeight/2;
00884 //  static const INT32  kQuartHeight = kHeight/4;
00885     static const INT32  kLineWidth  =  2000;
00886 //  static const INT32  kHalfLineWidth = kLineWidth/2;
00887 
00888     static const StockColour  kBackgoundOutline  =  COLOUR_NONE;
00889     static const StockColour  kBackgound         =  COLOUR_WHITE;
00890     static const StockColour  kBackgoundMany     =  COLOUR_LTGREY;  // for the MANY case
00891     static const StockColour  kCurve             =  COLOUR_WHITE;
00892     static const StockColour  kCurve2             =  COLOUR_BLUE;//COLOUR_BLACK;//COLOUR_MAGENTA;
00893 //  static /*const*/ StockColour  kStartColour   =  COLOUR_BLACK;
00894 //  static /*const*/ StockColour  kEndColour     =  COLOUR_WHITE;
00895 
00896 
00897     DocRect  RenderRect( 0, 0,  kWidth, kHeight );
00898 
00899     RenderRegion*  pRenderRegion  =  CreateGRenderRegion( &RenderRect, ExtraInfo );
00900 
00901 
00902     if( pRenderRegion != 0 )
00903     {
00904         pRenderRegion->SaveContext();
00905 
00906         // set drawing quality
00907         Quality           QualityThing( Quality::QualityMax );
00908         QualityAttribute  AntiAliasQualityAttr( QualityThing );
00909         pRenderRegion->SetQuality( &AntiAliasQualityAttr, FALSE );
00910         //pRenderRegion->RRQuality.SetQuality( QUALITY_MAX );   // doesnt enable antialiasing       
00911 
00912         // draw the background
00913         pRenderRegion->SetLineColour( kBackgoundOutline );
00914         if (manyDisabledControls == FALSE)
00915         {
00916             pRenderRegion->SetFillColour( kBackgound );
00917         }
00918         else
00919         {
00920             pRenderRegion->SetFillColour( kBackgoundMany );
00921         }
00922         pRenderRegion->DrawRect( &RenderRect );
00923 
00924         LinearTranspFillAttribute DummyFillAttribute;
00925 
00926         if (manyDisabledControls == FALSE)
00927         {
00928             NodeRegularShape* DummyShape = new NodeRegularShape ();
00929 
00930             if (DummyShape != NULL)
00931             {
00932                 NodeRegularShape* DummyShape2 = new NodeRegularShape ();
00933 
00934                 if (DummyShape2 != NULL)
00935                 {
00936                     DummyShape->SetUpShape ();
00937                     DummyShape->MakeRectangle (kWidth, kHeight, 0);
00938                     Matrix* TransformMatrix = new Matrix ();
00939                     TransformMatrix->SetTranslation (kHalfWidth, kHalfHeight);
00940                     DummyShape->SetTransformMatrix (TransformMatrix);
00941                     delete (TransformMatrix);
00942 
00943                     DummyShape2->SetUpShape ();
00944                     DummyShape2->MakeRectangle (kWidth, kHalfHeight, 0);
00945                     Matrix* TransformMatrix2 = new Matrix ();
00946                     TransformMatrix2->SetTranslation (kHalfWidth, kHalfHeight);
00947                     DummyShape2->SetTransformMatrix (TransformMatrix2);
00948                     delete (TransformMatrix2);
00949 
00950                     //JoinTypeAttribute DummyJoinType;      DummyJoinType.JoinType = MitreJoin;
00951                     //AttrJoinType* DummyJoin = (AttrJoinType*) DummyJoinType.MakeNode ();
00952                     //DummyJoin->AttachNode (DummyShape, FIRSTCHILD);
00953 
00954                     DocCoord StartPoint (0, kHalfHeight);
00955                     DummyFillAttribute.SetStartPoint (&StartPoint);
00956                     DocCoord EndPoint (kWidth, kHalfHeight);
00957                     DummyFillAttribute.SetEndPoint (&EndPoint);
00958                     DummyFillAttribute.SetEndPoint2 (NULL);
00959                     DummyFillAttribute.SetEndPoint3 (NULL);
00960                     
00961                     // set up the start transparency ....
00962                     
00963                     UINT32* StartVal = pOwningGadget_m->GetStartTransp ();
00964                     UINT32 vStartVal (0);
00965                     if (StartVal != NULL) { DummyFillAttribute.SetStartTransp (StartVal); }
00966                     else { DummyFillAttribute.SetStartTransp (&vStartVal); }
00967 
00968                     // set up the end transparency ....
00969                     
00970                     UINT32* EndVal = pOwningGadget_m->GetEndTransp ();
00971                     UINT32 vEndVal (255);
00972                     if (EndVal != NULL) { DummyFillAttribute.SetEndTransp (EndVal); }
00973                     else { DummyFillAttribute.SetEndTransp (&vEndVal); }
00974 
00975                     // and set these guys to NULL ....
00976                     
00977                     DummyFillAttribute.SetEndTransp2 (NULL);
00978                     DummyFillAttribute.SetEndTransp3 (NULL);
00979                 
00980                     CProfileBiasGain  DiagramMapper( CurveShape );
00981                     DummyFillAttribute.SetProfile (DiagramMapper);
00982 
00983                     pRenderRegion->SetLineWidth( kLineWidth );
00984                     //pRenderRegion->SetLineColour( kCurve );
00985                     pRenderRegion->SetFillColour (kCurve2);
00986 
00987                     DummyShape2->Render (pRenderRegion);
00988 
00989                     pRenderRegion->SetTranspFillGeometry((TranspFillAttribute*) &DummyFillAttribute, FALSE);            // Set Grad-filled
00990 
00991                     pRenderRegion->SetFillColour (kCurve);
00992                     DummyShape->Render (pRenderRegion);
00993 
00994                     delete (DummyShape2);
00995                     delete (DummyShape);
00996                 }
00997             }
00998         }
00999 
01000         pRenderRegion->RestoreContext();
01001         DestroyGRenderRegion( pRenderRegion );
01002     }
01003 }

void CBiasGainDlg::EnableAllControls  ) 
 

Function : CBiasGainDlg::EnableAllControls Author : Mikhail Tatarnikov Purpose : Enable all dialog controls Returns : void Exceptions: Parameters: None Notes :

Definition at line 1221 of file biasdlg.cpp.

01222 {
01223     manyDisabledControls = FALSE;
01224 
01225     EnableGadget (_R(IDC_STATIC1), TRUE);
01226     EnableGadget (_R(IDC_STATIC2), TRUE);
01227     EnableGadget (_R(IDC_STATIC3), TRUE);
01228     EnableGadget (_R(IDC_STATIC4), TRUE);
01229     EnableGadget (_R(IDC_STATIC5), TRUE);
01230     EnableGadget (_R(IDC_STATIC6), TRUE);
01231     //EnableGadget (_R(IDC_STATIC7), TRUE);
01232     EnableGadget (_R(IDC_STATIC8), TRUE);
01233     EnableGadget (_R(IDC_STATIC9), TRUE);
01234     EnableGadget (_R(IDC_SLIDER_BIAS), TRUE);
01235     EnableGadget (_R(IDC_SLIDER_GAIN), TRUE);
01236     EnableGadget (_R(IDC_EDIT_BIAS), TRUE);
01237     EnableGadget (_R(IDC_EDIT_GAIN), TRUE);
01238     //EnableGadget (_R(IDC_CURVE), TRUE);
01239     InvalidateGadget( _R(IDC_CURVE) );
01240     InvalidateGadget( _R(IDC_CURVEINTERPOLATE) );
01241 }

CProfileBiasGain CBiasGainDlg::GetCurrentDialogProfile  ) 
 

Function : CBiasGainDlg::GetCurrentDialogProfile Author : Mikhail Tatarnikov Purpose : Return the current biasgain profile Returns : CProfileBiasGain - the current bias/gain value. Exceptions: Parameters: None Notes :

Definition at line 1253 of file biasdlg.cpp.

01254 {
01255     return (BiasGain_m);
01256 }

OpState CBiasGainDlg::GetState String_256 pHelpString,
OpDescriptor
[static]
 

Returns the OpState of the CBiasGainDlg dialogue operation ie. whether or not it is greyed on the menu etc!!!

Function : OpStateCBiasGainDlg::GetState Author : Mikhail Tatarnikov Purpose : Returns the OpState of the CBiasGainDlg dialogue operation (whether or not it should be greyed on the menu etc) Returns : void Exceptions: Parameters: [in] String_256* pHelpString - [in] OpDescriptor* - Notes :

Definition at line 225 of file biasdlg.cpp.

00226 {
00227 
00228     static OpState  DialogState;
00229     DialogState.Greyed = FALSE;
00230 
00231     return  DialogState;
00232 
00233 }

void CBiasGainDlg::HandleBiasEditChange CDlgMessage const &  ,
CProfileBiasGain
[private, virtual]
 

Definition at line 1442 of file biasdlg.cpp.

01443 {
01444     // read values from edit boxes (both (simplifies code)) into biasgain object
01445 //  ReadEditBoxes(BiasGain_m);
01446     const AFp BiasMinus1ToPlus1 = AFp(GetDoubleGadgetValue(_R(IDC_EDIT_BIAS), double(-1.0), double(+1.0)));
01447     const AFp GainMinus1ToPlus1 = AFp(GetDoubleGadgetValue(_R(IDC_EDIT_GAIN), double(-1.0), double(+1.0)));
01448     
01449     rBiasGain.SetBias(BiasMinus1ToPlus1);
01450     rBiasGain.SetGain(GainMinus1ToPlus1);
01451     
01452     // make the sliders agree with the edit boxes
01453     WriteSliders(rBiasGain);
01454     
01455     // Update the combobox as well.
01456     m_pobddStandardProfile->SetSelected(-1);
01457 
01458     // do general input handling
01459     HandleInput(rDlgMessage,  rBiasGain);
01460     
01461 }

void CBiasGainDlg::HandleCommit CDlgMessage const &  Message,
CProfileBiasGain BiasGain
[private, virtual]
 

Function : CBiasGainDlg::HandleCommit Author : Mikhail Tatarnikov Purpose : Handles DIM_COMMIT message from the dialog's edit boxes Returns : void Exceptions: Parameters: [in] CDlgMessage const& Message - a message from edit box controls; [in] CProfileBiasGain& BiasGain - the current bias/gain value. Notes :

Definition at line 1473 of file biasdlg.cpp.

01474 {
01475     // read values from edit boxes (both (simplifies code)) into biasgain object
01476     ReadEditBoxes( BiasGain_m );
01477 
01478     // make the sliders agree with the edit boxes
01479     WriteSliders( BiasGain_m );
01480 
01481     // do general input handling
01482     HandleInput( Message,  BiasGain );
01483 
01484 }

void CBiasGainDlg::HandleInput CDlgMessage const &  Message,
CProfileBiasGain BiasGain
[private, virtual]
 

Function : CBiasGainDlg::HandleInput Author : Mikhail Tatarnikov Purpose : Handles a message from the dialog controls. Returns : void Exceptions: Parameters: [in] CDlgMessage const& Message - an input message to handle; [in] CProfileBiasGain& BiasGain - the current bias/gain value. Notes :

Definition at line 1497 of file biasdlg.cpp.

01498 {
01499 
01500     // prompt a diagram redraw to illustrate the new values
01501     InvalidateGadget( _R(IDC_CURVE) );
01502     InvalidateGadget( _R(IDC_CURVEINTERPOLATE) );
01503 
01504     // Broadcast a special profile change message, allowing all interested parties
01505     // to handle it. Depending on the input type we send either interactive or final change.
01506     if (Message == DIM_SLIDER_POS_CHANGING || Message == DIM_TEXT_CHANGED)
01507         BroadcastMessage(DIM_PROFILE_CHANGING,  BiasGain_m);
01508     else if (Message == DIM_SLIDER_POS_IDLE)
01509         BroadcastMessage(DIM_PROFILE_CHANGEIDLE,  BiasGain_m);
01510     else
01511         BroadcastMessage(DIM_PROFILE_CHANGED,  BiasGain_m);
01512 
01513 }

void CBiasGainDlg::HandleSliderPosChanging CDlgMessage const &  Message,
CProfileBiasGain BiasGain
[private, virtual]
 

Function : CBiasGainDlg::HandleSliderPosChanging Author : Mikhail Tatarnikov Purpose : Handles slider DIM_SLIDER_POS_CHANGING messages Returns : void Exceptions: Parameters: [in] CDlgMessage const& Message - a message from edit box controls; [in] CProfileBiasGain& BiasGain - the current bias/gain value. Notes :

Definition at line 1405 of file biasdlg.cpp.

01406 {
01407 
01408     // read values from sliders (both (simplifies code)) into biasgain object
01409     ReadSliders( BiasGain );
01410 
01411     // make the edit boxes agree with the sliders
01412     WriteEditBoxes( BiasGain );
01413 
01414     // Make the profile control show a custom image (cause after all, now we have
01415     // a custom bias/gain).
01416     
01417     m_pobddStandardProfile->SetSelected(-1);
01418 
01419     // do general input handling
01420     HandleInput( Message,  BiasGain );
01421 }

void CBiasGainDlg::HandleSliderPosSet CDlgMessage const &  Message,
CProfileBiasGain BiasGain
[private, virtual]
 

Function : CBiasGainDlg::HandleSliderPosSet Author : Mikhail Tatarnikov Purpose : Handles slider DIM_SLIDER_POS_SET messages Returns : void Exceptions: Parameters: [in] CDlgMessage const& Message - a message from edit box controls; [in] CProfileBiasGain& BiasGain - the current bias/gain value. Notes :

Definition at line 1434 of file biasdlg.cpp.

01435 {
01436     // do the same as slider changing
01437     HandleSliderPosChanging( Message,  BiasGain );
01438 }

BOOL CBiasGainDlg::Init void   )  [static]
 

Function : CBiasGainDlg::Init Author : Mikhail Tatarnikov Purpose : Creates an OpDescriptor for a CBiasGainDlg dialog Returns : BOOL - TRUE if succeeded, FALSE otherwise. Exceptions: Parameters: None Notes :

Reimplemented from SimpleCCObject.

Definition at line 179 of file biasdlg.cpp.

00180 {
00181     return  RegisterOpDescriptor(
00182         0,                                  // Tool ID
00183         _R(IDS_BIASGAINDLG),                    // String resource ID
00184         CC_RUNTIME_CLASS( CBiasGainDlg ),   // Runtime class
00185         OPTOKEN_BIASGAIN_DLG,               // Token string
00186         CBiasGainDlg::GetState,             // GetState function
00187         0,                                  // Help ID
00188         _R(IDBBL_BIASGAIN),                 // Bubble ID
00189         _R(IDD_BARCONTROLSTORE),            // Resource ID
00190         0,                                  // _R(IDC_BIASGAIN) - We don't need the automatic enabling/disabling control -
00191                                             // everything can be done by the toolbar only, since no one else knows about the fill type
00192                                             // (the control state depends on in).
00193         SYSTEMBAR_EDIT,                     // Bar ID
00194         TRUE,                               // Recieve system messages
00195         FALSE,                              // Smart duplicate operation
00196         TRUE,                               // Clean operation
00197         0,                                  // No vertical counterpart
00198         0,                                  // String for one copy only
00199         ( DONT_GREY_WHEN_SELECT_INSIDE | GREY_WHEN_NO_CURRENT_DOC ) // Auto state flags
00200     );
00201 }

void CBiasGainDlg::InitBiasGainGadget CProfileBiasGain const &  BiasGain  )  [protected]
 

Function : CBiasGainDlg::InitBiasGainGadget Author : Mikhail Tatarnikov Purpose : Updates profile combobox with a value. Returns : void Exceptions: Parameters: [in] CProfileBiasGain const& BiasGain - the value to initialize with Notes :

Definition at line 1070 of file biasdlg.cpp.

01071 {
01072     INT32 iProfileIndex = BiasGainGadget.FindPresetBiasGain(BiasGain);
01073     
01074     m_pobddStandardProfile->SetSelected(iProfileIndex);
01075 }

void CBiasGainDlg::InitEditBoxes CProfileBiasGain const &  BiasGain  )  [protected, virtual]
 

Function : CBiasGainDlg::InitEditBoxes Author : Mikhail Tatarnikov Purpose : initialise the dialog box edit controls, including setting values Returns : void Exceptions: Parameters: [in] CProfileBiasGain const& BiasGain - the value to initalize the edit boxes with. Notes :

Definition at line 1341 of file biasdlg.cpp.

01342 {
01343     WriteEditBoxes( BiasGain );
01344 }

void CBiasGainDlg::InitiProfileCombobox  )  [protected, virtual]
 

Function : CBiasGainDlg::InitiProfileCombobox Author : Mikhail Tatarnikov Purpose : Initializes the profile combobox Returns : void Exceptions: Parameters: None Notes :

Definition at line 1036 of file biasdlg.cpp.

01037 {
01038     // Check if we have already been initialized.
01039     if (m_pobddStandardProfile)
01040     {
01041         delete m_pobddStandardProfile;
01042