TranspInfoBarOp Class Reference

Class for handling the gradfill tool's information bar. More...

#include <filltool.h>

Inheritance diagram for TranspInfoBarOp:

InformationBarOp DialogBarOp DialogOp Operation MessageHandler ListItem CCObject SimpleCCObject List of all members.

Public Member Functions

 TranspInfoBarOp (ResourceID r=_R(IDD_ZOOMTOOLBAR))
MsgResult Message (Msg *Msg)
 Transpfill info bar dialog message handler.
void InitControls ()
 Inits all the controls in the info bar. Called immediately after the bar is created when the Transpfill tool becomes the current tool.
void EnableControls ()
 Enables or disables the controls depending on the current context, i.e. the controls are disabled if there is no selection, etc. Actually more complicated than this now, cause my function calls now hide/show various controls; and dynamically reshuffle the infobar.
void ShowInfo ()
 Show Transparency Info on the current selection.
void ShowFlatInfo ()
 Show info on a flat fill.
void ShowGraduatedInfo ()
 Show info on a graduated fill.
void ShowBitmapInfo ()
 Show info on a bitmap fill.
void ShowFractalInfo ()
 Show info on a fractal transparency.
void ShowNoiseInfo ()
 Show info on a noise transparency.
void ShowCommonType (BOOL ShowDataAndNotSet=TRUE)
 Show any Common Fill Type in the selection.
void ShowCommonMapping (BOOL ShowDataAndNotSet=TRUE)
 Show any Common Fill Mapping in the selection.
void ShowCommonTranspType (BOOL ShowDataAndNotSet=TRUE)
 Show any Common Transparency type in the selection.
void ShowCommonTesselate ()
 Show any Common Fill Tesselation in the selection.
void ShowCommonBitmapName ()
 Show any Common Bitmap Name in the selection.
void ShowCommonBitmapDpi ()
 Show any Common Bitmap Dpi in the selection.
void ShowControlPointInfo ()
 Show Info about selected control points.
void ShowCommonFractalGrain ()
 Show any Common Fractal Graininess in the selection.
void ShowCommonNoiseScale ()
 Show any Common Fractal Graininess in the selection.
UINT32 GetTranspType ()

Public Attributes

SelRangeSelection
SelRange::CommonAttribResult CommonAttr
SelRange::CommonAttribResult CommonAttrMap
CBiasGainGadget m_BiasGainGadget
CBitmapGridDropDown m_oBitmapDropDown

Static Public Attributes

static INT32 CurrentGeometryIndex
static INT32 CurrentTransTypeIndex
static INT32 CurrentMappingIndex
static INT32 CurrentTypeIndex
static INT32 CurrentTesselateIndex
static INT32 CurrentBitmapIndex

Private Member Functions

void ChangeProfile (CProfileBiasGain *Profile, CGadgetID GadgetID)
 See InformationBarOp::ChangeProfile () for an explanation of this function. See Also: InformationBarOp::ChangeProfile ().
CProfileBiasGainGetProfileFromSelection (CGadgetID GadgetID, BOOL *bMany, BOOL *bAllSameType)
 See InformationBarOp::GetProfileFromSelection () for a description of this function.
void ChangeFillType ()
 Called when a new fill type is selected from the menu.
void ChangeFillMapping ()
 Called when a new fill mapping or tesselation is selected from the menu.
BOOL ChangeBitmapName ()
 Called when a new bitmap is selected from the menu.
void ChangeTranspType ()
 Called when a new fill type is selected from the menu.
void ChangeDPI ()
 Called when the dpi of a bitmap is changed by the user.
void ChangeTransparencyValue ()
 Called when the transparency value is changed by the user.
void ChangeFractalGrain (BOOL useEditbox=FALSE)
 Called when the Graininess of a fractal is changed by the user.
void ChangeNoiseScale (BOOL useEditbox=FALSE)
 Called when the scale of a transparency is changed by the user.
void SetGadgetWritable (INT32, BOOL)
BOOL GetGadgetWritable (INT32)
 Returns whether the control is writable (i.e. read only, or not). void TranspInfoBarOp::EnableControls() needs to make use of this to control its 'dynamic' toolbar correctly (both of which were also written by me).
String_64 GetSelectedPoint (AttrFillGeometry *)
 Gets a textual description of a fills contol point selection state.
UINT32 GetSelectedTransp (AttrFillGeometry *)
 Gets a textual description of a fills contol point colour.
void ScanSelectionForControlPoints (String_64 *, INT32 *)
INT32 FindCommonTranspType ()
 Tries to find a common transparency type within the selection. This now makes use of camelots new AttrPaintingMode (which I also wrote).
INT32 FindCommonTesselate ()
 Find any Common Fill Tesselation in the selection.
String_64 FindCommonBitmapName ()
 Find any Common Bitmap Name in the selection.
INT32 FindCommonBitmapDpi ()
 Find any Common Bitmap Dpi in the selection.
double FindCommonFractalGrain ()
 Find any Common Fractal Graininess in the selection.
double FindCommonNoiseScale ()
 Find any Common Noise Scale in the selection.
void SetTranspValue (UINT32, BOOL bIntermediateStep=FALSE, BOOL bFirstStep=FALSE)
 Called when a the transparency slider is changed.
AttrFillGeometryGetCurrentGeometry ()
 Gets the current Fill Geometry from the Attribute manager.
AttrTranspFillMappingGetCurrentMapping ()
 Gets the current painting mode from the Attribute manager.Gets the current Fill Geometry from the Attribute manager.
AttrFillGeometryMakeFillMutator ()
 Make a fill that will be used to Mutate another fill, changing it's type while retaining it's existing points and colours. The fill type returned depends on the fill type menu state.
BOOL SetGadgetString (CGadgetID Gadget, StringBase *StrValue)
 Set the string displayed by a Gadget. This version only updates the gadget if it has changed.
void InitMapping ()
 Initialise the Mapping Control.
void InitBitmapName ()
 Initialise the Bitmap Name Control.
void InitTesselate ()
 Initialise the Tesselation Control.
void InitTransType ()
 Initialise the Transparency Type Control.
void DisplayTransparencyPercentString (double value)
 Sorts out the transparency value that is actually displayed (as a string). It actually calculates the percentage value that has been/ is being applied. This is calculated in 0.5% intervals.
void UpdateBrushAttributes ()
 Called when a new transparency is selected. This function goes through all brush attributes in the selection and tells them to use the local transparency rather than their cached one.

Private Attributes

FillMode Mode
FillMode OldMode
BOOL BitmapListChanged
BOOL MappingDisabled
BOOL TypeDisabled
BOOL AllowForceToSimpleMapping
AttrFillGeometryCommonGeometry
AttrFillMappingCommonMapping
INT32 SelGeometryIndex
INT32 SelMappingIndex
INT32 SelTypeIndex
BOOL SliderDragged
INT32 SliderMax
INT32 LastSliderPos
OpApplyAttrInteractivem_pAttrApplyOp
AttrValueChangem_pDragTransp

Detailed Description

Class for handling the gradfill tool's information bar.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/8/94

Definition at line 574 of file filltool.h.


Constructor & Destructor Documentation

TranspInfoBarOp::TranspInfoBarOp ResourceID  r = _R(IDD_ZOOMTOOLBAR)  )  [inline]
 

Definition at line 578 of file filltool.h.


Member Function Documentation

BOOL TranspInfoBarOp::ChangeBitmapName  )  [private]
 

Called when a new bitmap is selected from the menu.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com> (ported to the transparency tool by Chris Snook 12/10/99)
Date:
14/12/94

Definition at line 9168 of file filltool.cpp.

09169 {
09170     NodeAttribute *Attrib = new AttrBitmapTranspFill;
09171     if (Attrib == NULL)
09172     {
09173         InformError();
09174         return (FALSE);
09175     }
09176 
09177     Document* pDoc = Document::GetSelected();
09178 
09179     // Get the bitmap list
09180     BitmapList* Bitmaps = NULL;
09181     if (pDoc) Bitmaps = pDoc->GetBitmapList();
09182 
09183     if (Bitmaps == NULL)
09184         return (FALSE);
09185 
09186     INT32 BmpIndex = -1;
09187     ListItem* pBmp = Bitmaps->GetHead();
09188 
09189     while (pBmp != NULL)
09190     {
09191         if (!((KernelBitmap*)pBmp)->HasBeenDeleted())
09192             BmpIndex++;
09193 
09194         if (BmpIndex == CurrentBitmapIndex)
09195             break;
09196 
09197         pBmp = Bitmaps->GetNext(pBmp);
09198     }
09199 
09200     KernelBitmap* pkBmp = (KernelBitmap*) pBmp;
09201 
09202     // CGS:  check for a 32-bit bitmap being applied here as a transparency, since we convert
09203     // this permantly to 24-bit we should ask the user if they wish to continue ....
09204 
09205     if (pkBmp->ActualBitmap->GetBitmapInfoHeader()->biBitCount == 32)
09206     {
09207         // Ask the user wether or not they want to use a 24bit copy of the BMP or use the Default Bitmap?
09208         //InformWarning(_R(IDS_BFX_BMP_CONVERT_MSG),_R(IDS_OK),0,0,0,1,2);
09209 
09210         // Load and build the question text.
09211         String_256 QueryString(_R(IDS_QUERYTRANSP321));
09212                     
09213         // The only way of bringing up a box with a string in it
09214         Error::SetError(0, QueryString, 0);
09215         INT32 DlgResult = InformMessage(FALSE, _R(IDS_YES), _R(IDS_NO));
09216         Error::ClearError();
09217 
09218         switch (DlgResult)
09219         {
09220             case 1:             // YES
09221                                 // apply attribute ....
09222             break;
09223             case 2:             // NO
09224                 delete (Attrib);
09225                 Attrib = NULL;
09226                 return (FALSE);         // break out of this stuff!
09227         }
09228     }
09229 
09230     ((AttrBitmapChange*)Attrib)->AttachBitmap((KernelBitmap*)pBmp);
09231     AttributeManager::AttributeSelected(NULL, Attrib);
09232 
09233     return (TRUE);
09234 }

void TranspInfoBarOp::ChangeDPI  )  [private]
 

Called when the dpi of a bitmap is changed by the user.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/11/94

Definition at line 9348 of file filltool.cpp.

09349 {
09350     BOOL Valid;
09351     String_256 Str = GetStringGadgetValue(_R(IDC_SELPOINT), &Valid);
09352 
09353     if (Valid)
09354     {
09355         TRACEUSER( "Will", _T("String = %s\n"),(TCHAR*)Str);
09356 
09357         INT32 Length = Str.Length();
09358         TCHAR* StrText = (TCHAR*)Str;
09359 
09360         INT32 FirstNum = -1;
09361         INT32 Count = 0;
09362 
09363         for (INT32 i = 0; i < Length; ++i)
09364         {
09365             TCHAR chr = StrText[i];
09366             if (FirstNum == -1 && StringBase::IsNumeric(chr))
09367                 FirstNum = i;
09368 
09369             if (FirstNum != -1)
09370             {
09371                 if (StringBase::IsNumeric(chr))
09372                     Count++;
09373                 else
09374                     break;
09375             }
09376         }
09377 
09378         String_256 DpiStr;
09379         INT32 Dpi;
09380 
09381         if (FirstNum != -1 && Count > 0)
09382         {
09383             Str.Mid(&DpiStr, FirstNum, Count);
09384             Convert::StringToLong(DpiStr, &Dpi);
09385             TRACEUSER( "Will", _T("Dpi = %d\n"),Dpi);
09386 
09387             if (Dpi == 0)
09388                 Dpi = 1;
09389 
09390             AttrValueChange* NewDpi = new AttrBitmapDpiChange;
09391             if (NewDpi == NULL)
09392             {
09393                 InformError();
09394                 return;
09395             }
09396 
09397             NewDpi->MutateTranspFills(TRUE);
09398             ((AttrBitmapDpiChange*)NewDpi)->SetDPI(Dpi);
09399 
09400             AttributeManager::AttributeSelected(NULL, NewDpi);
09401         }
09402         else
09403         {
09404             TRACEUSER( "Will", _T("That was rubbish\n"));
09405             ShowCommonBitmapDpi();
09406         }
09407     }
09408     else
09409         TRACEUSER( "Will", _T("String was invalid\n"));
09410 }

void TranspInfoBarOp::ChangeFillMapping  )  [private]
 

Called when a new fill mapping or tesselation is selected from the menu.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/11/94

Definition at line 9069 of file filltool.cpp.

09070 {
09071     if (Mode != BITMAPFILL && 
09072         Mode != FRACTALFILL && 
09073         Mode != GRADREPEATFILL &&
09074 //Mark Howitt, 14/10/97. Exclude transparent grad fills as well
09075 #ifdef NEW_FEATURES
09076         Mode != GRADFILL &&
09077 #endif
09078         Mode != NOISEFILL)
09079     {
09080         return;
09081     }
09082 
09083     INT32 Tesselation;
09084 
09085     switch (CurrentMappingIndex)
09086     {
09087         case (FTMENU_SIMPLE):
09088             Tesselation = 1;
09089             break;
09090     
09091         case (FTMENU_REPEAT):
09092 //Mark Howitt, 14/10/97. Repeating grad fills are now 4.
09093 #ifdef NEW_FEATURES
09094             if(Mode == GRADFILL)
09095             {
09096                 Tesselation = 4;
09097             }
09098             else
09099 #endif
09100             {
09101                 Tesselation = 2;
09102             }
09103             break;
09104 
09105         case (FTMENU_REPEATINV):
09106             Tesselation = 3;
09107             break;
09108 
09109         default:
09110             Tesselation = 1;
09111             break;
09112     }
09113 
09114     AttrTranspFillMappingLinear* NewMapping = new AttrTranspFillMappingLinear;
09115     if (NewMapping == NULL)
09116     {
09117         InformError();
09118         return;
09119     }
09120 
09121     NewMapping->SetRepeat(Tesselation);
09122     AttributeManager::AttributeSelected(NewMapping, NULL);
09123 }

void TranspInfoBarOp::ChangeFillType  )  [private]
 

Called when a new fill type is selected from the menu.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/8/94

Definition at line 9002 of file filltool.cpp.

09003 {
09004     if (CurrentGeometryIndex == FGMENU_NOTRANSP)
09005     {
09006         AttrFillGeometry* NoTransp = new AttrRemoveTransp;
09007         if (NoTransp == NULL)
09008 
09009         {
09010             InformError();
09011             return;
09012         }
09013 
09014         AttributeManager::AttributeSelected(NULL, NoTransp);
09015     }   
09016     else if (CurrentGeometryIndex == FGMENU_FLATTRANSP)
09017     {
09018         AttrFillGeometry* FlatTransp = new AttrMakeFlatTransp;
09019         if (FlatTransp == NULL)
09020         {
09021             InformError();
09022             return;
09023         }
09024 
09025         AttributeManager::AttributeSelected(NULL, FlatTransp);
09026     }   
09027     else
09028     {
09029         // Get the current fill type, and pass a new fill of that type into
09030         // the attribute manager, as a mutator.
09031         AttrFillGeometry* Mutator = MakeFillMutator();
09032         if (Mutator == NULL)
09033         {
09034             InformError();
09035             return;
09036         }
09037 
09038         // If the mutator requires a simple mapping but the current fill doesn't
09039         // then we need to set ForceToSimple to TRUE
09040 
09041         //BOOL ForceToSimple = Mutator->NeedsForceToSimpleMapping() && AllowForceToSimpleMapping;
09042 
09043         // This call deletes the Mutator so I'll set the pointer to NULL
09044         AttributeManager::AttributeSelected(NULL, Mutator);
09045         Mutator = NULL;
09046 
09047         //if (ForceToSimple)
09048         //{
09049     //      CurrentMappingIndex = FMMENU_SIMPLE;
09050     //      ChangeFillMapping ();           // we push two bits of undo here, but this is
09051                                             // unavoidable at present ....
09052         //}
09053     }
09054 
09055     if (CurrentGeometryIndex != FGMENU_NOTRANSP)
09056         UpdateBrushAttributes();
09057 }

void TranspInfoBarOp::ChangeFractalGrain BOOL  useEditbox = FALSE  )  [private]
 

Called when the Graininess of a fractal is changed by the user.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/11/94

Definition at line 9511 of file filltool.cpp.

09512 {
09513     if (!useEditbox)
09514     {
09515         BOOL Valid;
09516         INT32 Result = GetLongGadgetValue(_R(IDC_TRANSPSLIDE), 0, SliderMax, 0, &Valid);
09517 
09518         if (Valid)
09519         {
09520             double Grain = GetDoubleGrain(Result);  
09521 
09522             TRACEUSER( "Will", _T("Graininess = %f\n"),Grain);
09523 
09524             if (Grain < 0.1)
09525                 Grain = 0.1;
09526 
09527             if (Grain > 16384)
09528                 Grain = 16384;
09529 
09530             AttrValueChange* NewGrain = new AttrFractalGrainChange;
09531             if (NewGrain == NULL)
09532             {
09533                 InformError();
09534                 return;
09535             }
09536             
09537             NewGrain->MutateTranspFills(TRUE);
09538             ((FractalFillAttribute*)NewGrain->GetAttributeValue())->Graininess = FIXED16(Grain);
09539 
09540             AttributeManager::AttributeSelected(NULL, NewGrain);
09541         }
09542     }
09543     else
09544     {
09545         BOOL Valid;
09546         String_256 Str = GetStringGadgetValue(_R(IDC_SELCOLOUR), &Valid);
09547 
09548         if (Valid)
09549         {
09550             INT32 Length = Str.Length();
09551             TCHAR* StrText = (TCHAR*)Str;
09552 
09553             INT32 FirstNum = -1;
09554             INT32 Count = 0;
09555 
09556             BOOL FoundDp = FALSE;
09557 
09558             for (INT32 i = 0; i < Length; ++i)
09559             {
09560                 TCHAR chr = StrText[i];
09561                 if (FirstNum == -1 && StringBase::IsNumeric(chr))
09562                     FirstNum = i;
09563 
09564                 if (FirstNum != -1)
09565                 {
09566                     if (StringBase::IsNumeric(chr))
09567                     {
09568                         Count++;
09569                         
09570                         //if (FoundDp == TRUE) { break; }
09571                     }
09572                     else if ((chr == '.') && (FoundDp == FALSE))
09573                     {
09574                         FoundDp = TRUE;
09575                         Count++;
09576                     }
09577                     else
09578                         break;
09579                 }
09580             }
09581 
09582             String_256 TranspValStr;
09583             double TranspVal;
09584 
09585             if (FirstNum != -1 && Count > 0)
09586             {
09587                 Str.Mid(&TranspValStr, FirstNum, Count);
09588                 Convert::StringToDouble(TranspValStr, &TranspVal);
09589                 
09590                 // check for out of range stuff ....
09591 
09592                 if (TranspVal < 0.0) { TranspVal = 0.0; }
09593                 if (TranspVal > 128.0) { TranspVal = 128.0; }
09594                 
09595                 // convert data ....
09596 
09597                 UINT32 Rounded = (UINT32) TranspVal;
09598                 double Diff = TranspVal - Rounded;
09599 
09600                 if (Diff < 0.5)
09601                 {
09602                     if (Diff < 0.25) { TranspVal = (double) Rounded; }
09603                     else { TranspVal = (double) Rounded + 0.5; }
09604                 }
09605                 else
09606                 {
09607                     if (Diff < 0.75) { TranspVal = (double) Rounded + 0.5; }
09608                     else { TranspVal = (double) ++Rounded; }
09609                 }
09610 
09611                 //double AccurateNewVal = ((TranspVal * (double) 128) / 128.0) + 0.5;
09612                 //double AccurateNewVal = TranspVal; //+ 0.5;
09613 
09614                 //UINT32 newVal = static_cast<UINT32>(AccurateNewVal);
09615 
09616                 AttrValueChange* NewGrain = new AttrFractalGrainChange;
09617                 if (NewGrain == NULL)
09618                 {
09619                     InformError();
09620                     return;
09621                 }
09622                 
09623                 NewGrain->MutateTranspFills(TRUE);
09624                 ((FractalFillAttribute*)NewGrain->GetAttributeValue())->Graininess = FIXED16(/*(INT32)*/ TranspVal);
09625 
09626                 AttributeManager::AttributeSelected(NULL, NewGrain);
09627             }
09628             else
09629             {
09630                 ShowFractalInfo ();
09631             }       
09632         }
09633     }
09634 }

void TranspInfoBarOp::ChangeNoiseScale BOOL  useEditbox = FALSE  )  [private]
 

Called when the scale of a transparency is changed by the user.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
11/11/94

Definition at line 9646 of file filltool.cpp.

09647 {
09648     if (!useEditbox)
09649     {
09650         BOOL Valid;
09651         INT32 Result = GetLongGadgetValue(_R(IDC_TRANSPSLIDE), 0, SliderMax, 0, &Valid);
09652 
09653         if (Valid)
09654         {
09655             double Scale = GetDoubleScale(Result);
09656 
09657             TRACEUSER( "Mike", _T("Scale = %f\n"),Scale);
09658 
09659             if (Scale < 0)
09660                 Scale = 0;
09661 
09662             if (Scale > 100)
09663                 Scale = 100;
09664 
09665             AttrValueChange* NewScale = new AttrNoiseScaleChange;
09666             if (NewScale == NULL)
09667             {
09668                 InformError();
09669                 return;
09670             }
09671             
09672             FIXED16 Grain = FIXED16(Scale);
09673             NewScale->MutateTranspFills(TRUE);
09674             ((NoiseFillAttribute*)NewScale->GetAttributeValue())->SetGraininess(Grain);
09675 
09676             AttributeManager::AttributeSelected(NULL, NewScale);
09677         }
09678     }
09679     else
09680     {
09681         BOOL Valid;
09682         String_256 Str = GetStringGadgetValue(_R(IDC_SELCOLOUR), &Valid);
09683 
09684         if (Valid)
09685         {
09686             INT32 Length = Str.Length();
09687             TCHAR* StrText = (TCHAR*)Str;
09688 
09689             INT32 FirstNum = -1;
09690             INT32 Count = 0;
09691 
09692             BOOL FoundDp = FALSE;
09693 
09694             for (INT32 i = 0; i < Length; ++i)
09695             {
09696                 TCHAR chr = StrText[i];
09697                 if (FirstNum == -1 && StringBase::IsNumeric(chr))
09698                     FirstNum = i;
09699 
09700                 if (FirstNum != -1)
09701                 {
09702                     if (StringBase::IsNumeric(chr))
09703                     {
09704                         Count++;
09705                         
09706                         //if (FoundDp == TRUE) { break; }
09707                     }
09708                     else if ((chr == '.') && (FoundDp == FALSE))
09709                     {
09710                         FoundDp = TRUE;
09711                         Count++;
09712                     }
09713                     else
09714                         break;
09715                 }
09716             }
09717 
09718             String_256 TranspValStr;
09719             double TranspVal;
09720 
09721             if (FirstNum != -1 && Count > 0)
09722             {
09723                 Str.Mid(&TranspValStr, FirstNum, Count);
09724                 Convert::StringToDouble(TranspValStr, &TranspVal);
09725                 
09726                 // check for out of range stuff ....
09727 
09728                 if (TranspVal < 0.0) { TranspVal = 0.0; }
09729                 if (TranspVal > 100.0) { TranspVal = 100.0; }
09730                 
09731                 // convert data ....
09732 
09733                 UINT32 Rounded = (UINT32) TranspVal;
09734                 double Diff = TranspVal - Rounded;
09735 
09736                 if (Diff < 0.5)
09737                 {
09738                     if (Diff < 0.25) { TranspVal = (double) Rounded; }
09739                     else { TranspVal = (double) Rounded + 0.5; }
09740                 }
09741                 else
09742                 {
09743                     if (Diff < 0.75) { TranspVal = (double) Rounded + 0.5; }
09744                     else { TranspVal = (double) ++Rounded; }
09745                 }
09746 
09747                 double AccurateNewVal = ((TranspVal * (double) SliderMax) / 100.0) + 0.5;
09748 
09749                 UINT32 newVal = static_cast<UINT32>(AccurateNewVal);
09750                 
09751                 //  SetTranspValue (static_cast<UINT32>(AccurateNewVal));
09752 
09753                 AttrValueChange* NewScale = new AttrNoiseScaleChange;
09754                 if (NewScale == NULL)
09755                 {
09756                     InformError();
09757                     return;
09758                 }
09759                 
09760                 FIXED16 Grain = FIXED16((INT32) newVal);
09761                 NewScale->MutateTranspFills(TRUE);
09762                 ((NoiseFillAttribute*)NewScale->GetAttributeValue())->SetGraininess(Grain);
09763 
09764                 AttributeManager::AttributeSelected(NULL, NewScale);
09765             }
09766             else
09767             {
09768                 ShowNoiseInfo ();
09769             }       
09770         }
09771     }
09772 }

void TranspInfoBarOp::ChangeProfile CProfileBiasGain Profile,
CGadgetID  GadgetID
[private, virtual]
 

See InformationBarOp::ChangeProfile () for an explanation of this function. See Also: InformationBarOp::ChangeProfile ().

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/2/2000

Reimplemented from DialogOp.

Definition at line 6386 of file filltool.cpp.

06387 {
06388     OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_TRANSPFILLPROFILE);
06389     if (pOpDesc != NULL)
06390     {
06391         BOOL FireOp = TRUE;
06392 
06393         // we only want to generate one bit of undo information - so decided whether
06394         // we have to fire the above op, or whether we just 'pump' the values into
06395         // our nodes (thereby nolonger generating infinite undo information) ....
06396 
06397         Operation* pLastOp = NULL;
06398 
06399         if (Profile->GetGeneratesInfiniteUndo ())   // only do if they didn't select a preset profile
06400         {
06401             pLastOp = Document::GetSelected()->GetOpHistory().FindLastOp();
06402         }
06403 
06404         if (pLastOp)
06405         {
06406             if (pLastOp->GetRuntimeClass() == CC_RUNTIME_CLASS(OpChangeTranspFillProfile))
06407             {
06408                 FireOp = FALSE;
06409             }
06410         }
06411 
06412         if (FireOp == TRUE)
06413         {
06414             TranspFillProfileOpParam Param;
06415             Param.Profile = *Profile;
06416         
06417             pOpDesc->Invoke(&Param);
06418         }
06419         else
06420         {
06421             // we don't need/want any undo information - so just change the value ....
06422             
06423             //OpChangeFillProfile Op;
06424             ChangeTranspFillProfileAction Action;
06425             Action.ChangeTranspFillProfileWithNoUndo (/*&Op,*/ *Profile);
06426         }
06427         
06428         /*AFp BiasValue = Profile->GetBias();
06429         AFp GainValue = Profile->GetGain();
06430         
06431         TranspFillProfileOpParam Param;
06432         Param.Profile.SetBias(BiasValue);
06433         Param.Profile.SetGain(GainValue);
06434         
06435         pOpDesc->Invoke(&Param);*/
06436     }
06437 }

void TranspInfoBarOp::ChangeTransparencyValue  )  [private]
 

Called when the transparency value is changed by the user.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/12/99

Definition at line 9422 of file filltool.cpp.

09423 {
09424     BOOL Valid;
09425     String_256 Str = GetStringGadgetValue(_R(IDC_SELCOLOUR), &Valid);
09426 
09427     if (Valid)
09428     {
09429         INT32 Length = Str.Length();
09430         TCHAR* StrText = (TCHAR*)Str;
09431 
09432         INT32 FirstNum = -1;
09433         INT32 Count = 0;
09434 
09435         BOOL FoundDp = FALSE;
09436 
09437         for (INT32 i = 0; i < Length; ++i)
09438         {
09439             TCHAR chr = StrText[i];
09440             if (FirstNum == -1 && StringBase::IsNumeric(chr))
09441                 FirstNum = i;
09442 
09443             if (FirstNum != -1)
09444             {
09445                 if (StringBase::IsNumeric(chr))
09446                 {
09447                     Count++;
09448                     
09449                     //if (FoundDp == TRUE) { break; }
09450                 }
09451                 else if ((chr == '.') && (FoundDp == FALSE))
09452                 {
09453                     FoundDp = TRUE;
09454                     Count++;
09455                 }
09456                 else
09457                     break;
09458             }
09459         }
09460 
09461         String_256 TranspValStr;
09462         double TranspVal;
09463 
09464         if (FirstNum != -1 && Count > 0)
09465         {
09466             Str.Mid(&TranspValStr, FirstNum, Count);
09467             Convert::StringToDouble(TranspValStr, &TranspVal);
09468             
09469             // check for out of range stuff ....
09470 
09471             if (TranspVal < 0.0) { TranspVal = 0.0; }
09472             if (TranspVal > 100.0) { TranspVal = 100.0; }
09473             
09474             // convert data ....
09475 
09476             UINT32 Rounded = (UINT32) TranspVal;
09477             double Diff = TranspVal - Rounded;
09478 
09479             if (Diff < 0.5)
09480             {
09481                 if (Diff < 0.25) { TranspVal = (double) Rounded; }
09482                 else { TranspVal = (double) Rounded + 0.5; }
09483             }
09484             else
09485             {
09486                 if (Diff < 0.75) { TranspVal = (double) Rounded + 0.5; }
09487                 else { TranspVal = (double) ++Rounded; }
09488             }
09489 
09490             double AccurateNewVal = ((TranspVal * (double) SliderMax) / 100.0) + 0.5;
09491 
09492             SetTranspValue (static_cast<UINT32>(AccurateNewVal));
09493         }
09494         else
09495         {
09496             ShowControlPointInfo ();
09497         }
09498     }
09499 }

void TranspInfoBarOp::ChangeTranspType  )  [private]
 

Called when a new fill type is selected from the menu.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/8/94

Definition at line 9246 of file filltool.cpp.

09247 {
09248     // Get the current fill type, and pass a new fill of that type into
09249     // the attribute manager, as a mutator.
09250     AttrFillGeometry* TypeChange = new AttrTranspTypeChange();
09251 
09252     
09253     //AttrPaintingMode* TypeChange = new AttrPaintingMode ();
09254     //AttrTranspTypeChange* TypeChnage = new AttrTranspTypeChange ();
09255     if (TypeChange == NULL)
09256     {
09257         InformError();
09258         return;
09259     }
09260 
09261     UINT32 TType = GetTranspType() - 1;
09262     UINT32 Index = 0;
09263     
09264     switch(TType)
09265     {
09266     case FTMENU_REFLECT:
09267     case FTMENU_SUB:
09268     case FTMENU_ADD:
09269         {
09270             Index = TType + TT_Mix;
09271             break;
09272         }
09273     case FTMENU_CON:
09274         {
09275             Index = TT_CONTRAST;
09276             break;
09277         }
09278     case FTMENU_SAT:
09279         {
09280             Index = TT_SATURATION;
09281             break;
09282         }
09283     case FTMENU_DARK:
09284         {
09285             Index = TT_DARKEN;
09286             break;
09287         }
09288     case FTMENU_LIGHT:
09289         {
09290             Index = TT_LIGHTEN;
09291             break;
09292         }
09293     case FTMENU_BRI:
09294         {
09295             Index = TT_BRIGHTNESS;
09296             break;
09297         }
09298     case FTMENU_LUM:
09299         {
09300             Index = TT_LUMINOSITY;
09301             break;
09302         }
09303     case FTMENU_HUE:
09304         {
09305             Index = TT_HUE;
09306             break;
09307         }
09308     default:
09309         {
09310             Index = TT_NoTranspType;
09311         }
09312     }
09313 
09314     TypeChange->SetTranspType(Index);
09315 
09316     //TypeChange->SetValue (Index);
09317 
09318     //AttributeManager::AttributeSelected(TypeChange, NULL);
09319     AttributeManager::AttributeSelected(NULL, TypeChange);
09320 
09321 
09322 /*
09323     // And also change the line transparency type
09324     TypeChange = new AttrStrokeTranspTypeChange();
09325     if (TypeChange == NULL)
09326     {
09327         InformError();
09328         return;
09329     }
09330 
09331     TypeChange->SetTranspType(GetTranspType());
09332 
09333     AttributeManager::AttributeSelected(NULL, TypeChange);
09334 */
09335 }

void TranspInfoBarOp::DisplayTransparencyPercentString double  value  )  [private]
 

Sorts out the transparency value that is actually displayed (as a string). It actually calculates the percentage value that has been/ is being applied. This is calculated in 0.5% intervals.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
21/12/99
Parameters:
value - the (double) value that is to be converted/displayed as percent. [INPUTS] To get the correct results, the value supplied for value MUST be in the range 0-255; and NOT 0-100!
See also:
-

Definition at line 6939 of file filltool.cpp.

06940 {
06941     if (value == (double) 1) { value = 0; }         // cause of the way the slider is bodged
06942     
06943     double TranspVal = ((double) value * 100) / (double) SliderMax;
06944 
06945     UINT32 Rounded = (UINT32) TranspVal;
06946     double Diff = TranspVal - Rounded;
06947 
06948     if (Diff < 0.5)
06949     {
06950         if (Diff < 0.25) { TranspVal = (double) Rounded; }
06951         else { TranspVal = (double) Rounded + 0.5; }
06952     }
06953     else
06954     {
06955         if (Diff < 0.75) { TranspVal = (double) Rounded + 0.5; }
06956         else { TranspVal = (double) ++Rounded; }
06957     }
06958 
06959     String_64 Str;
06960 
06961     Convert::DoubleToString( TranspVal, &Str, 1 );
06962 
06963     if (Str.FindNextChar ((TCHAR) '.') == -1)
06964     {
06965         // need to wack a .0 in ....
06966 
06967         Str += _T(".0");
06968     }
06969     
06970     Str.MakePercent ((TCHAR*) Str);
06971 
06972     String_64 PercentStr(Str);
06973     SetGadgetString(_R(IDC_SELCOLOUR), &PercentStr);
06974 }

void TranspInfoBarOp::EnableControls  ) 
 

Enables or disables the controls depending on the current context, i.e. the controls are disabled if there is no selection, etc. Actually more complicated than this now, cause my function calls now hide/show various controls; and dynamically reshuffle the infobar.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com> (rewritten by Chris Snook)
Date:
3/8/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
-

Definition at line 8594 of file filltool.cpp.

08595 {
08596     // DMc - check for nodes which transparency can't be applied to
08597     BOOL allowed = TRUE;
08598 
08599     SelRange * pSel = GetApplication()->FindSelection();
08600 
08601     Node * pNode = pSel->FindFirst(FALSE);
08602 
08603     while (pNode && allowed)
08604     {
08605         if (pNode->IsKindOf(CC_RUNTIME_CLASS(NodeShadow)))
08606         {
08607             allowed = FALSE;
08608         }
08609 
08610         pNode = pSel->FindNext(pNode, FALSE);
08611     }
08612     
08613     if (Document::GetSelected() == NULL || !allowed)
08614     {
08615         EnableGadget (_R(IDC_GEOMETRY),     FALSE);
08616         EnableGadget (_R(IDC_MAPPING),      FALSE);
08617         EnableGadget(_R(IDC_TRANSPTYPE),    FALSE);
08618         EnableGadget (_R(IDC_BITMAPEFFECT), FALSE);
08619         EnableGadget (_R(IDC_BIASGAIN),     FALSE);
08620         EnableGadget (_R(IDC_SELPOINT),     FALSE);
08621         EnableGadget (_R(IDC_TRANSPSLIDE),  FALSE);
08622         EnableGadget (_R(IDC_SELCOLOUR),    FALSE);
08623         //EnableGadget(_R(IDC_GRADCOORDS),  FALSE);
08624     }
08625     else
08626     {
08627 
08628         EnableGadget (_R(IDC_GEOMETRY), TRUE);
08629         EnableGadget (_R(IDC_TRANSPTYPE),   TRUE);
08630         EnableGadget (_R(IDC_TRANSPSLIDE), TRUE);
08631         EnableGadget (_R(IDC_SELCOLOUR), TRUE);
08632                 
08633         switch (Mode)
08634         {
08635             case NOFILL:
08636 
08637                 EnableGadget (_R(IDC_MAPPING), FALSE);
08638                 EnableGadget (_R(IDC_BITMAPEFFECT), FALSE);
08639                 EnableGadget (_R(IDC_BIASGAIN), FALSE);
08640                 EnableGadget (_R(IDC_SELPOINT), FALSE);
08641                 EnableGadget (_R(IDC_TRANSPSLIDE), TRUE);
08642                 EnableGadget (_R(IDC_SELCOLOUR), TRUE);
08643             break;
08644             
08645             case MANYFILLS:
08646             case FLATFILL:
08647                 // nothing else to enable ....
08648                 EnableGadget (_R(IDC_MAPPING), FALSE);
08649                 EnableGadget (_R(IDC_BITMAPEFFECT), FALSE);
08650                 EnableGadget (_R(IDC_BIASGAIN), FALSE);
08651                 EnableGadget (_R(IDC_SELPOINT), FALSE);
08652 
08653                 if (Mode == MANYFILLS)
08654                 {
08655                     EnableGadget (_R(IDC_TRANSPSLIDE), FALSE);
08656                     EnableGadget (_R(IDC_SELCOLOUR), FALSE);
08657                 }
08658 
08659                 CloseProfileDialog (m_BiasGainGadget);      // cause fill type cannot be profiled!
08660             break;
08661 
08662             case GRADFILL:
08663             case GRADREPEATFILL:
08664                 switch (CurrentGeometryIndex)
08665                 {
08666                     case FGMENU_LINEARTRANSP:
08667                     case FGMENU_CIRCULARTRANSP:
08668                     case FGMENU_RADIALTRANSP:
08669                     // the following is really fg_diamond ....
08670                     case FGMENU_SQUARETRANSP:
08671 
08672                         EnableGadget (_R(IDC_MAPPING), TRUE);
08673                         EnableGadget (_R(IDC_BITMAPEFFECT), FALSE);
08674 
08675                         //if (2 colour)
08676                         //{
08677                             EnableGadget (_R(IDC_BIASGAIN), TRUE);
08678                         //}
08679                         //else
08680                         //{
08681                         //  EnableGadget (_R(IDC_BIASGAIN), FALSE);
08682                         //}
08683 
08684                         EnableGadget (_R(IDC_SELPOINT), FALSE);
08685                     break;
08686                     
08687                     case FGMENU_CONICALTRANSP:
08688                         EnableGadget (_R(IDC_MAPPING), FALSE);
08689                         EnableGadget (_R(IDC_BITMAPEFFECT), FALSE);
08690 
08691                         //if (2 colour)
08692                         //{
08693                             EnableGadget (_R(IDC_BIASGAIN), TRUE);
08694                         //}
08695                         //else
08696                         //{
08697                         //  EnableGadget (_R(IDC_BIASGAIN), FALSE);
08698                         //}
08699                         
08700                         EnableGadget (_R(IDC_SELPOINT), FALSE);
08701                     break;
08702                     
08703                     case FGMENU_THREECOLTRANSP:
08704                     case FGMENU_FOURCOLTRANSP:
08705                         EnableGadget (_R(IDC_MAPPING), TRUE);
08706                         EnableGadget (_R(IDC_BITMAPEFFECT), FALSE);
08707                         EnableGadget (_R(IDC_BIASGAIN), FALSE);
08708                         EnableGadget (_R(IDC_SELPOINT), FALSE);
08709                     break;
08710                 }
08711             break;
08712 
08713             case BITMAPFILL:
08714                 EnableGadget (_R(IDC_MAPPING), TRUE);
08715                 EnableGadget (_R(IDC_BITMAPEFFECT),