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         m_pobddStandardProfile = NULL;
01043     }
01044 
01045     m_pobddStandardProfile = new CBitmapGridDropDown;
01046     m_pobddStandardProfile->Init(WindowID, _R(IDC_BIASGAINCOMBO));
01047     
01048     m_pobddStandardProfile->SetColumns(1);
01049     m_pobddStandardProfile->SetItemSize(wxSize(21, 21));
01050     
01051     m_pobddStandardProfile->AddItem(_R(IDB_PROFILE1));
01052     m_pobddStandardProfile->AddItem(_R(IDB_PROFILE2));
01053     m_pobddStandardProfile->AddItem(_R(IDB_PROFILE3));
01054     m_pobddStandardProfile->AddItem(_R(IDB_PROFILE4));
01055     m_pobddStandardProfile->AddItem(_R(IDB_PROFILE5));
01056     
01057     m_pobddStandardProfile->SetUnselectedItem(_R(IDB_PROFILE6));
01058 }

void CBiasGainDlg::InitOneSlider CGadgetID  GadgetID  )  [protected]
 

Function : CBiasGainDlg::InitOneSlider Author : Mikhail Tatarnikov Purpose : Initialize a slider Returns : void Exceptions: Parameters: [in] CGadgetID GadgetID - a slider to initialize. Notes :

Definition at line 1286 of file biasdlg.cpp.

01287 {
01288 
01289     SetGadgetRange( GadgetID, kSliderMin_s, kSliderMax_s );
01290     SetGadgetBitmaps( GadgetID, _R(IDB_SLIDERBASE), _R(IDB_SLIDERSLIDER) );
01291 
01292 }

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

Function : CBiasGainDlg::InitSliders Author : Mikhail Tatarnikov Purpose : Initializes and updates the sliders Returns : void Exceptions: Parameters: [in] CProfileBiasGain const& BiasGain - a value to update sliders wiht. Notes :

Definition at line 1017 of file biasdlg.cpp.

01018 {
01019 
01020     InitOneSlider( _R(IDC_SLIDER_BIAS) );
01021     InitOneSlider( _R(IDC_SLIDER_GAIN) );
01022 
01023     WriteSliders( BiasGain );
01024 
01025 }

void CBiasGainDlg::InvokeVia CBiasGainGadget pInvokeWith,
CProfileBiasGain pInvokeOn,
BOOL  bMany
 

Function : CBiasGainDlg::InvokeVia Author : Mikhail Tatarnikov Purpose : Invoke the bias/gain dialog Returns : void Exceptions: Parameters: [in] CBiasGainGadget& pInvokeWith - the parent control (used for routing messages); [in] CProfileBiasGain* pInvokeOn - an initial value to display; [in] BOOL bMany - Notes :

Definition at line 1108 of file biasdlg.cpp.

01109 {
01110     OpDescriptor*  pOpDescriptor = OpDescriptor::FindOpDescriptor( OPTOKEN_BIASGAIN_DLG );
01111     if( pOpDescriptor != 0 )
01112     {
01113         if (pInvokeOn != NULL)
01114         {
01115             OpParam  Param( reinterpret_cast<void*>( &pInvokeWith ),  reinterpret_cast<void*>( pInvokeOn ) );
01116             DoWithParam( pOpDescriptor, &Param );
01117         }
01118         else if (bMany == TRUE)                 // we need to display the many setting ....
01119         {
01120             OpParam  Param( reinterpret_cast<void*>( &pInvokeWith ),  reinterpret_cast<void*>( pInvokeOn ) );
01121             DoWithParam( pOpDescriptor, &Param );
01122         }
01123         else    // I'm not sure if this is ever called - BUT we'd best provide a 'default' anyway
01124         {
01125             CProfileBiasGain defaultInvokeOn;
01126 
01127             OpParam  Param( reinterpret_cast<void*>( &pInvokeWith ),  reinterpret_cast<void*>( &defaultInvokeOn ) );
01128             DoWithParam( pOpDescriptor, &Param );
01129         }
01130     }
01131 }

MsgResult CBiasGainDlg::Message Msg Message  )  [virtual]
 

Function : CBiasGainDlg::Message Author : Mikhail Tatarnikov Purpose : handle messages for this dialog - including create/cancel and slider and edit Returns : MsgResult - Exceptions: Parameters: [in] Msg* Message - an incoming message to handle Notes :

Reimplemented from DialogOp.

Definition at line 346 of file biasdlg.cpp.

00347 {
00348     if( IS_OUR_DIALOG_MSG( Message ) )
00349     {
00350         DialogMsg* Msg  =  static_cast<DialogMsg*>( Message );//dynamic_cast<DialogMsg*>( Message );   // needs rtti enabled
00351 
00352         switch( Msg->DlgMsg )
00353         {   
00354             case DIM_TITLEFOCUSWARN:
00355             {
00356                 DialogManager::DefaultKeyboardFocus();
00357             }
00358             break;
00359             
00360             case DIM_CREATE :
00361             {
00362                 manyDisabledControls = FALSE;
00363                 useFillProfile = FALSE;
00364                 useTranspFillProfile = FALSE;
00365                 
00366                 // initialise gadgets
00367                 InitSliders( BiasGain_m );
00368                 InitEditBoxes( BiasGain_m );
00369                 InitiProfileCombobox();
00370 
00371                 InitBiasGainGadget(BiasGain_m); // Setup combobox with the current bias.
00372 
00373                 InvalidateGadget( _R(IDC_CURVE) );
00374                 InvalidateGadget( _R(IDC_CURVEINTERPOLATE) );
00375 
00376                 DialogManager::DefaultKeyboardFocus();
00377 
00378                 break;
00379             }
00380 
00381             case DIM_CANCEL :
00382             {
00383                 if (!(IsCustomComboDropdownVisible (_R(IDC_BIASGAINCOMBO))))
00384                 {
00385                     Close();
00386                     //End();
00387                     //DlgMgr->Delete( WindowID, this );
00388 
00389                     // tell the owning gadget that this dialog has closed
00390                     if( pOwningGadget_m != 0 )
00391                     {
00392                         pOwningGadget_m->DialogHasClosed();
00393                         return DLG_EAT_IF_HUNGRY(Msg);  // We cna't do anything else here, since the dialog has just been deleted.
00394                     }
00395                 }
00396                 else
00397                 {
00398                     CloseDropdown (_R(IDC_BIASGAINCOMBO), FALSE);
00399                 }
00400                 break;
00401             }
00402 
00403             case DIM_LFT_BN_UP:
00404                 DialogManager::DefaultKeyboardFocus();
00405             break;
00406 
00407             // slider interaction messages
00408             case DIM_SLIDER_POS_CHANGING :
00409             {
00410                 BiasGain_m.SetGeneratesInfiniteUndo (TRUE);
00411                 HandleSliderPosChanging( Msg->DlgMsg,  BiasGain_m );
00412                 break;
00413             }
00414 
00415             case DIM_SLIDER_POS_SET:
00416             {
00417                 BiasGain_m.SetGeneratesInfiniteUndo (FALSE);
00418                 HandleSliderPosSet( Msg->DlgMsg,  BiasGain_m );
00419                 DialogManager::DefaultKeyboardFocus();
00420                 break;
00421             }
00422 
00423             case DIM_SLIDER_POS_IDLE:
00424             {
00425                 BiasGain_m.SetGeneratesInfiniteUndo (FALSE);
00426                 HandleSliderPosSet( Msg->DlgMsg,  BiasGain_m );
00427                 break;
00428             }
00429 
00430             // edit box interaction messages
00431             case DIM_COMMIT :
00432             {
00433                 HandleCommit( Msg->DlgMsg,  BiasGain_m );
00434                 DialogManager::DefaultKeyboardFocus();
00435 
00436                 break;
00437             }
00438 
00439             case DIM_TEXT_CHANGED:
00440             {
00441                 HandleBiasEditChange(Msg->DlgMsg, BiasGain_m);
00442                 DialogManager::DefaultKeyboardFocus();
00443                 
00444                 break;
00445             }
00446             
00447             case DIM_REDRAW :
00448             {
00449                 if( Msg->GadgetID == _R(IDC_CURVE) )
00450                 {
00451                     DrawCurve( BiasGain_m,  reinterpret_cast<ReDrawInfoType*>( Msg->DlgMsgParam ) );
00452                 }
00453                 else if ( Msg->GadgetID == _R(IDC_CURVEINTERPOLATE))
00454                 {
00455                     if ((useFillProfile == FALSE) && (useTranspFillProfile == FALSE))
00456                     {
00457                         DrawCurveInterpolate( BiasGain_m,  reinterpret_cast<ReDrawInfoType*>( Msg->DlgMsgParam ) );
00458                     }
00459                     else if (useFillProfile == TRUE)
00460                     {
00461                         DrawFillInterpolate( BiasGain_m,  reinterpret_cast<ReDrawInfoType*>( Msg->DlgMsgParam ) );
00462                     }
00463                     else
00464                     {
00465                         DrawTranspFillInterpolate( BiasGain_m,  reinterpret_cast<ReDrawInfoType*>( Msg->DlgMsgParam ) );
00466                     }
00467                 }
00468 
00469                 break;
00470             }
00471 
00472             case DIM_SELECTION_CHANGED:
00473             {
00474                 if (Msg->GadgetID == _R(IDC_BIASGAINCOMBO))
00475                 {
00476 //                  WORD  DropdownListIndex;
00477 //                  GetValueIndex( _R(IDC_BIASGAINCOMBO), &DropdownListIndex );
00478                     INT32 iSelected = m_pobddStandardProfile->GetSelected();
00479                     if (iSelected == -1)
00480                         break;
00481                         
00482                     DWORD dwSelected = (DWORD)iSelected;
00483 
00484                     switch(dwSelected)
00485                     {
00486                         // get preset value to match the dropdown list index
00487                         //
00488                         case  0 :
00489                         case  1 :
00490                         case  2 :
00491                         case  3 :
00492                         case  4 :
00493                         {
00494                             // first we need to update our dialog to reflect this change
00495 
00496                             if (manyDisabledControls == TRUE)
00497                             {
00498                                 EnableAllControls ();
00499                             }
00500                             
00501                             BiasGainGadget.GetPresetBiasGainValue(dwSelected, BiasGain_m );
00502                             InitSliders( BiasGain_m );
00503                             InitEditBoxes( BiasGain_m );
00504                             InvalidateGadget( _R(IDC_CURVE) );
00505                             InvalidateGadget( _R(IDC_CURVEINTERPOLATE) );
00506                             
00507                             // and then update all the other stuff in the document
00508 
00509                             BiasGainGadget.SetInfobarGadgetID (pOwningGadget_m->GetGadgetID ());
00510                             BiasGainGadget.Message (Msg);//pOwningGadget_m->Message (Msg);
00511                         }
00512                         HandleInput(Msg->DlgMsg, BiasGain_m);
00513                     }
00514                     DialogManager::DefaultKeyboardFocus();
00515                 }
00516             }
00517             
00518             default:
00519                 break;
00520         }
00521     
00522     }
00523 
00524     // Pass all unhandled messages to base class for default processing!
00525     return  DialogOp::Message( Message );
00526 
00527 }  

CBiasGainDlg& CBiasGainDlg::operator= const CBiasGainDlg  )  [private]
 

void CBiasGainDlg::ReadEditBoxes CProfileBiasGain BiasGain  )  [protected, virtual]
 

Function : CBiasGainDlg::ReadEditBoxes Author : Mikhail Tatarnikov Purpose : Reads the bias/gain value from the edit box controls Returns : void Exceptions: Parameters: [out] CProfileBiasGain& BiasGain - the value read. Notes :

Definition at line 1375 of file biasdlg.cpp.

01376 {
01377 
01378     const AFp  BiasMinus1ToPlus1  =  AFp( GetDoubleGadgetValue( _R(IDC_EDIT_BIAS), double(-1.0), double(+1.0) ) );
01379     BiasGain.SetBias( BiasMinus1ToPlus1 );
01380 
01381     const AFp  GainMinus1ToPlus1  =  AFp( GetDoubleGadgetValue( _R(IDC_EDIT_GAIN), double(-1.0), double(+1.0) ) );
01382     BiasGain.SetGain( GainMinus1ToPlus1 );
01383 
01384     // write the clamped-into-range values back into the edit boxes
01385     WriteEditBoxes( BiasGain );
01386 
01387 }

AFp CBiasGainDlg::ReadOneSlider CGadgetID  GadgetID  )  [protected]
 

Function : CBiasGainDlg::ReadOneSlider Author : Mikhail Tatarnikov Purpose : Reads the value from a slider Returns : AFp - the slider value. Exceptions: Parameters: [in] CGadgetID GadgetID - the slider to read from. Notes : Return value is in the range [-1,+1]

Definition at line 1319 of file biasdlg.cpp.

01320 {
01321 
01322     const INT32 iSliderValue       =  GetLongGadgetValue( GadgetID, kSliderMin_s, kSliderMax_s );
01323     const AFp   ValueMinus1ToPlus1 =  AFp(iSliderValue) / AFp(kSliderHalfLength_s);
01324 
01325     return  ValueMinus1ToPlus1;
01326 
01327 }

void CBiasGainDlg::ReadSliders CProfileBiasGain BiasGain  )  [protected, virtual]
 

Function : CBiasGainDlg::ReadSliders Author : Mikhail Tatarnikov Purpose : Reads slider values Returns : void Exceptions: Parameters: [out] CProfileBiasGain& BiasGain - the bias/gain value to read from sliders to. Notes :

Definition at line 1269 of file biasdlg.cpp.

01270 {
01271     BiasGain.SetBias( ReadOneSlider( _R(IDC_SLIDER_BIAS) ) );
01272     BiasGain.SetGain( ReadOneSlider( _R(IDC_SLIDER_GAIN) ) );
01273 }

void CBiasGainDlg::ReInitialiseDialog CProfileBiasGain ReInitOn,
BOOL  bMany
 

Function : CBiasGainDlg::ReInitialiseDialog Author : Mikhail Tatarnikov Purpose : Initializes the dialog with new bias/gain value Returns : void Exceptions: Parameters: [in] CProfileBiasGain* ReInitOn - a bias/gain value to initialize with; [in] BOOL bMany - Notes :

Definition at line 1145 of file biasdlg.cpp.

01146 {
01147     if (ReInitOn != NULL)                   // woopey!!!!  we have a profile - lets display it ....
01148     {
01149         BiasGain_m = *ReInitOn;             // this line does everything for us!
01150 
01151         // the rest is just tidying up ....
01152 
01153         if (manyDisabledControls == TRUE)
01154         {
01155             EnableAllControls ();
01156         }
01157     
01158         // reinitialise gadgets ....
01159         InitSliders( BiasGain_m );
01160         InitEditBoxes( BiasGain_m );
01161         InitiProfileCombobox();
01162         InitBiasGainGadget ( BiasGain_m );
01163 
01164         // redraw profile ....
01165         InvalidateGadget( _R(IDC_CURVE) );
01166         InvalidateGadget( _R(IDC_CURVEINTERPOLATE) );
01167     }
01168     else if (bMany == TRUE)                 // we need to display the many setting ....
01169     {
01170 //      SetCustomComboGadgetValue ( _R(IDC_BIASGAINCOMBO), (CustomComboBoxControlDataItem*) NULL, TRUE, -1);
01171         m_pobddStandardProfile->SetSelected(-1);
01172         
01173         // and disable all other controls ....
01174         DisableAllControls ();
01175     }
01176 }

void CBiasGainDlg::ToggleFillProfile  )  [inline]
 

Definition at line 177 of file biasdlg.h.

00177 { useFillProfile = TRUE; }

void CBiasGainDlg::ToggleTranspFillProfile  )  [inline]
 

Definition at line 178 of file biasdlg.h.

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

Function : CBiasGainDlg::WriteEditBoxes Author : Mikhail Tatarnikov Purpose : Update the edit boxes Returns : void Exceptions: Parameters: [in] CProfileBiasGain const& BiasGain - the value to update the edit boxes with. Notes :

Definition at line 1356 of file biasdlg.cpp.

01357 {
01358     const AFp  BiasMinus1ToPlus1  =  BiasGain.GetBias();
01359     SetDoubleGadgetValue( _R(IDC_EDIT_BIAS),  BiasMinus1ToPlus1 );
01360 
01361     const AFp  GainMinus1ToPlus1  =  BiasGain.GetGain();
01362     SetDoubleGadgetValue( _R(IDC_EDIT_GAIN),  GainMinus1ToPlus1 );
01363 }

void CBiasGainDlg::WriteOneSlider AFp  ValueMinus1ToPlus1,
CGadgetID  GadgetID
[protected]
 

Function : CBiasGainDlg::WriteOneSlider Author : Mikhail Tatarnikov Purpose : Set a value to a slider. Returns : void Exceptions: Parameters: [in] AFp ValueMinus1ToPlus1 - a new slider value; [in] CGadgetID GadgetID - a slider to update. Notes :

Definition at line 1304 of file biasdlg.cpp.

01305 {
01306     const INT32  SliderValue  =  INT32( ValueMinus1ToPlus1 * AFp( kSliderHalfLength_s ) + AFp(0.5) );
01307     SetLongGadgetValue( GadgetID,  SliderValue );
01308 }

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

Function : CBiasGainDlg::WriteSliders Author : Mikhail Tatarnikov Purpose : Updates slider to display the supplied bias/gain value Returns : void Exceptions: Parameters: [in] CProfileBiasGain const& BiasGain - the value to initialize sliders with. Notes :

Definition at line 1087 of file biasdlg.cpp.

01088 {
01089 
01090     WriteOneSlider( BiasGain.GetBias(), _R(IDC_SLIDER_BIAS) );
01091 
01092     WriteOneSlider( BiasGain.GetGain(), _R(IDC_SLIDER_GAIN) );
01093 
01094 }


Member Data Documentation

CProfileBiasGain CBiasGainDlg::BiasGain_m [private]
 

Definition at line 240 of file biasdlg.h.

CBiasGainGadget CBiasGainDlg::BiasGainGadget [private]
 

Definition at line 232 of file biasdlg.h.

CGadgetID CBiasGainDlg::Id_m [private]
 

Definition at line 235 of file biasdlg.h.

const UINT32 CBiasGainDlg::IDD = _R(IDD_BIASGAIN) [static]
 

Definition at line 154 of file biasdlg.h.

const INT32 CBiasGainDlg::kSliderHalfLength_s = kSliderLength_s / INT32( 2 ) [static, protected]
 

Definition at line 201 of file biasdlg.h.

const INT32 CBiasGainDlg::kSliderLength_s = INT32( 200 ) [static, protected]
 

Definition at line 200 of file biasdlg.h.

const INT32 CBiasGainDlg::kSliderMax_s = +( kSliderHalfLength_s ) [static, protected]
 

Definition at line 203 of file biasdlg.h.

const INT32 CBiasGainDlg::kSliderMin_s = -( kSliderHalfLength_s ) [static, protected]
 

Definition at line 202 of file biasdlg.h.

CBitmapGridDropDown* CBiasGainDlg::m_pobddStandardProfile [private]
 

Definition at line 237 of file biasdlg.h.

BOOL CBiasGainDlg::manyDisabledControls [private]
 

Definition at line 244 of file biasdlg.h.

const CDlgMode CBiasGainDlg::Mode = MODELESS [static]
 

Definition at line 155 of file biasdlg.h.

CBiasGainGadget* CBiasGainDlg::pOwningGadget_m [private]
 

Definition at line 229 of file biasdlg.h.

BOOL CBiasGainDlg::useFillProfile [private]
 

Definition at line 248 of file biasdlg.h.

BOOL CBiasGainDlg::useTranspFillProfile [private]
 

Definition at line 252 of file biasdlg.h.


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