GradInfoBarOp Class Reference

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

#include <filltool.h>

Inheritance diagram for GradInfoBarOp:

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

Public Member Functions

 GradInfoBarOp (ResourceID r=_R(IDD_GRADTOOLBAR))
MsgResult Message (Msg *Msg)
 Gradfill info bar dialog message handler.
void InitControls ()
 Inits all the controls in the info bar. Called immediately after the bar is created when the gradfill 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 ()
 Shows 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 fill.
void ShowNoiseInfo ()
 Show info on a noise fill.
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 ShowCommonEffect (BOOL ShowDataAndNotSet=TRUE)
 Show any Common Fill 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 Noise scale in the selection.

Public Attributes

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

Static Public Attributes

static INT32 CurrentGeometryIndex
static INT32 CurrentMappingIndex
static INT32 CurrentEffectIndex
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. Notes: NeedsForceToSimpleMapping added for new fill types (Gerry 22/8/96).
void ChangeFillMapping ()
 Called when a new fill mapping or tesselation is selected from the menu.
void ChangeFillEffect ()
 Called when a new fill effect is selected from the menu.
void ChangeDPI ()
 Called when the dpi of a bitmap is changed by the user.
void ChangeFractalGrain ()
 Called when the Graininess of a fractal is changed by the user.
void ChangeNoiseScale ()
 Called when the Scale of a noise fill is changed by the user.
void ChangeBitmapName ()
 Called when a new bitmap is selected from the menu.
void SetGadgetWritable (INT32, BOOL)
 Sets the state of the 'Read Only' flag of an edit field or combo box.
BOOL GetGadgetWritable (INT32)
 Returns whether the control is writable (i.e. read only, or not). void GradInfoBarOp::EnableControls() needs to make use of this to control its 'dynamic' toolbar correctly (both of which were also written by me).
INT32 FindCommonTesselate ()
 Find any Common Fill Tesselation in the selection.
String_256 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.
String_64 GetSelectedPoint (AttrFillGeometry *)
 Gets a textual description of a fills contol point selection state.
String_64 GetSelectedColour (AttrFillGeometry *)
 Gets a textual description of a fills contol point colour.
String_64 GetColourName (DocColour &)
 Gets a name of a colour.
void ScanSelectionForControlPoints (String_64 *, String_64 *)
AttrFillGeometryGetCurrentGeometry ()
 Gets the current Fill Geometry from the Attribute manager.
AttrFillMappingGetCurrentMapping ()
 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 InitEffect ()
 Initialise the Effect Control.
void InitMapping ()
 Initialise the Mapping Control.
void InitBitmapName ()
 Initialise the Bitmap Name Control.
void InitTesselate ()
 Initialise the Tesselation Control.

Private Attributes

FillMode Mode
FillMode OldMode
BOOL BitmapListChanged
BOOL MappingDisabled
BOOL EffectDisabled
BOOL AllowForceToSimpleMapping
AttrFillGeometryCommonGeometry
AttrFillMappingCommonMapping
AttrFillEffectCommonEffect
INT32 SelGeometryIndex
INT32 SelMappingIndex
INT32 SelEffectIndex
INT32 SelPointIndex
INT32 SliderMax

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 437 of file filltool.h.


Constructor & Destructor Documentation

GradInfoBarOp::GradInfoBarOp ResourceID  r = _R(IDD_GRADTOOLBAR)  )  [inline]
 

Definition at line 441 of file filltool.h.

00441 {DlgResID=r;}               // Dummy default constructor for DYNCREATE


Member Function Documentation

void GradInfoBarOp::ChangeBitmapName  )  [private]
 

Called when a new bitmap is selected from the menu.

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

Definition at line 5444 of file filltool.cpp.

05445 {
05446     AttrValueChange* NewBitmap = new AttrBitmapChange;
05447     if (NewBitmap == NULL)
05448     {
05449         InformError();
05450         return;
05451     }
05452 
05453     Document* pDoc = Document::GetSelected();
05454 
05455     // Get the bitmap list
05456     BitmapList* Bitmaps = NULL;
05457     if (pDoc) Bitmaps = pDoc->GetBitmapList();
05458 
05459     if (Bitmaps == NULL)
05460         return;
05461 
05462     INT32 BmpIndex = -1;
05463     ListItem* pBmp = Bitmaps->GetHead();
05464 
05465     while (pBmp != NULL)
05466     {
05467         if (!((KernelBitmap*)pBmp)->HasBeenDeleted())
05468             BmpIndex++;
05469 
05470         if (BmpIndex == CurrentEffectIndex)
05471             break;
05472 
05473         pBmp = Bitmaps->GetNext(pBmp);
05474     }
05475 
05476     ((AttrBitmapChange*)NewBitmap)->AttachBitmap((KernelBitmap*)pBmp);
05477     AttributeManager::AttributeSelected(NULL, NewBitmap);
05478 }

void GradInfoBarOp::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 5491 of file filltool.cpp.

05492 {
05493     BOOL Valid;
05494     String_256 Str = GetStringGadgetValue(_R(IDC_SELPOINT), &Valid);
05495 
05496     if (Valid)
05497     {
05498         TRACEUSER( "Will", _T("String = %s\n"),(TCHAR*)Str);
05499 
05500         INT32 Length = Str.Length();
05501         TCHAR* StrText = (TCHAR*)Str;
05502 
05503         INT32 FirstNum = -1;
05504         INT32 Count = 0;
05505 
05506         for (INT32 i = 0; i < Length; ++i)
05507         {
05508             TCHAR chr = StrText[i];
05509             if (FirstNum == -1 && StringBase::IsNumeric(chr))
05510                 FirstNum = i;
05511 
05512             if (FirstNum != -1)
05513             {
05514                 if (StringBase::IsNumeric(chr))
05515                     Count++;
05516                 else
05517                     break;
05518             }
05519         }
05520 
05521         String_256 DpiStr;
05522         INT32 Dpi;
05523 
05524         if (FirstNum != -1 && Count > 0)
05525         {
05526             Str.Mid(&DpiStr, FirstNum, Count);
05527             Convert::StringToLong(DpiStr, &Dpi);
05528             TRACEUSER( "Will", _T("Dpi = %d\n"),Dpi);
05529 
05530             if (Dpi == 0)
05531                 Dpi = 1;
05532 
05533             AttrValueChange* NewDpi = new AttrBitmapDpiChange;
05534             if (NewDpi == NULL)
05535             {
05536                 InformError();
05537                 return;
05538             }
05539 
05540             ((AttrBitmapDpiChange*)NewDpi)->SetDPI(Dpi);
05541 
05542             AttributeManager::AttributeSelected(NULL, NewDpi);
05543         }
05544         else
05545         {
05546             TRACEUSER( "Will", _T("That was rubbish\n"));
05547             ShowCommonBitmapDpi();
05548         }
05549     }
05550     else
05551         TRACEUSER( "Will", _T("String was invalid\n"));
05552 }

void GradInfoBarOp::ChangeFillEffect  )  [private]
 

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

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

Definition at line 5402 of file filltool.cpp.

05403 {
05404     AttrFillEffect* FillEffect = NULL;
05405 
05406     switch (CurrentEffectIndex)
05407     {
05408         case (FEMENU_FADE):
05409             FillEffect = new AttrFillEffectFade;
05410             break;
05411     
05412         case (FEMENU_RAINBOW):
05413             FillEffect = new AttrFillEffectRainbow;
05414             break;
05415 
05416         case (FEMENU_ALTRAINBOW):
05417             FillEffect = new AttrFillEffectAltRainbow;
05418             break;
05419 
05420         default:
05421             FillEffect = new AttrFillEffectFade;
05422             break;
05423     }
05424 
05425     if (FillEffect == NULL)
05426     {
05427         InformError();
05428         return;
05429     }
05430 
05431     AttributeManager::AttributeSelected(FillEffect);
05432 }

void GradInfoBarOp::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 5323 of file filltool.cpp.

05324 {
05325     if (Mode != BITMAPFILL && 
05326         Mode != FRACTALFILL && 
05327         Mode != GRADREPEATFILL &&
05328 // Mark Howitt, 6/10/97. Enable Gradual fill repeating/simple switching.
05329 #ifdef NEW_FEATURES
05330         Mode != GRADFILL &&         // also include gradual fills
05331 #endif
05332         Mode != NOISEFILL)
05333     {
05334         return;
05335     }
05336 
05337     INT32 Tesselation;
05338 
05339     switch (CurrentMappingIndex)
05340     {
05341         case (FTMENU_SIMPLE):
05342             Tesselation = 1;
05343             break;
05344     
05345         case (FTMENU_REPEAT):
05346 //Mark Howitt, 8/10/97. Check to see if gradfill is repeating and then set repeat value to 4 to show it`s special
05347 #ifdef NEW_FEATURES
05348             if(Mode==GRADFILL)
05349             {
05350                 Tesselation = 4;
05351             }
05352             else
05353 #endif
05354             {
05355                 Tesselation = 2;
05356             }
05357             break;
05358 
05359         case (FTMENU_REPEATINV):
05360             Tesselation = 3;
05361             break;
05362 
05363         default:
05364             Tesselation = 1;
05365             break;
05366     }
05367 
05368 /*
05369     AttrBitmapTessChange* TessChange = new AttrBitmapTessChange;
05370     if (TessChange == NULL)
05371     {
05372         InformError();
05373         return;
05374     }
05375 
05376     TessChange->SetTesselation(Tesselation);
05377 
05378     AttributeManager::AttributeSelected(NULL, TessChange);
05379 */
05380 
05381     AttrFillMappingLinear* NewMapping = new AttrFillMappingLinear;
05382     if (NewMapping == NULL)
05383     {
05384         InformError();
05385         return;
05386     }
05387 
05388     NewMapping->SetRepeat(Tesselation);
05389     AttributeManager::AttributeSelected(NewMapping);
05390 }

void GradInfoBarOp::ChangeFillType  )  [private]
 

Called when a new fill type is selected from the menu. Notes: NeedsForceToSimpleMapping added for new fill types (Gerry 22/8/96).

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

Definition at line 5283 of file filltool.cpp.

05284 {
05285     // Get the current fill type, and pass a new fill of that type into
05286     // the attribute manager, as a mutator.
05287     AttrFillGeometry* Mutator = MakeFillMutator();
05288 
05289     if (Mutator == NULL)
05290     {
05291         InformError();
05292         return;
05293     }
05294 
05295     // If the mutator requires a simple mapping but the current fill doesn't
05296     // then we need to set ForceToSimple to TRUE
05297     // Need to check this before we select the attribute
05298 
05299     //BOOL ForceToSimple = Mutator->NeedsForceToSimpleMapping() && AllowForceToSimpleMapping;
05300 
05301     // This call deletes the Mutator so I'll set the pointer to NULL
05302     AttributeManager::AttributeSelected(NULL, Mutator);     // cause this gives us our undoable !!!!
05303     Mutator = NULL;
05304 
05305     //if (ForceToSimple)
05306     //{
05307 //      CurrentMappingIndex = FMMENU_SIMPLE;
05308 //      ChangeFillMapping ();                   // we push two bits of undo here, but this is
05309                                                 // unavoidable at present ....
05310     //}
05311 }

void GradInfoBarOp::ChangeFractalGrain  )  [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 5564 of file filltool.cpp.

05565 {
05566     BOOL Valid;
05567     String_256 Str = GetStringGadgetValue(_R(IDC_SELCOLOUR), &Valid);
05568 
05569     if (Valid)
05570     {
05571         TRACEUSER( "Will", _T("String = %s\n"),(TCHAR*)Str);
05572 
05573         double Grain = 1.0;
05574         UnitType Units;
05575 
05576         if (Convert::StringToComponents(Str, &Grain, &Units))
05577         {
05578             TRACEUSER( "Will", _T("Graininess = %f\n"),Grain);
05579 
05580             if (Grain < 0.1)
05581                 Grain = 0.1;
05582 
05583             if (Grain > 16384)
05584                 Grain = 16384;
05585 
05586             AttrValueChange* NewGrain = new AttrFractalGrainChange;
05587             if (NewGrain == NULL)
05588             {
05589                 InformError();
05590                 return;
05591             }
05592 
05593             ((FractalFillAttribute*)NewGrain->GetAttributeValue())->Graininess = FIXED16(Grain);
05594 
05595             AttributeManager::AttributeSelected(NULL, NewGrain);
05596         }
05597         else
05598         {
05599             TRACEUSER( "Will", _T("That was rubbish\n"));
05600             ShowCommonFractalGrain();
05601         }
05602     }
05603 }

void GradInfoBarOp::ChangeNoiseScale  )  [private]
 

Called when the Scale of a noise fill is changed by the user.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/01/95

Definition at line 5615 of file filltool.cpp.

05616 {
05617     BOOL Valid;
05618     String_256 Str = GetStringGadgetValue(_R(IDC_SELCOLOUR), &Valid);
05619 
05620     if (Valid)
05621     {
05622         TRACEUSER( "Will", _T("String = %s\n"),(TCHAR*)Str);
05623 
05624         double Scale = 1.0;
05625         UnitType Units;
05626 
05627         if (Convert::StringToComponents(Str, &Scale, &Units))
05628         {
05629             TRACEUSER( "Mike", _T("Noise scale = %f\n"),Scale);
05630 
05631             if (Scale < 1)
05632                 Scale = 1;
05633 
05634             if (Scale > 100)
05635                 Scale = 100;
05636 
05637             AttrValueChange* NewScale = new AttrNoiseScaleChange;
05638             if (NewScale == NULL)
05639             {
05640                 InformError();
05641                 return;
05642             }
05643 
05644             FIXED16 Grain = FIXED16(Scale);
05645             ((NoiseFillAttribute*)NewScale->GetAttributeValue())->SetGraininess(Grain);
05646 
05647             AttributeManager::AttributeSelected(NULL, NewScale);
05648         }
05649         else
05650         {
05651             TRACEUSER( "Will", _T("That was rubbish\n"));
05652             ShowCommonNoiseScale();
05653         }
05654     }
05655 }

void GradInfoBarOp::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 2941 of file filltool.cpp.

02942 {
02943     OpDescriptor* pOpDesc = OpDescriptor::FindOpDescriptor(OPTOKEN_FILLPROFILE);
02944     if (pOpDesc != NULL)
02945     {           
02946         BOOL FireOp = TRUE;
02947 
02948         // we only want to generate one bit of undo information - so decided whether
02949         // we have to fire the above op, or whether we just 'pump' the values into
02950         // our nodes (thereby nolonger generating infinite undo information) ....
02951 
02952         Operation* pLastOp = NULL;
02953 
02954         if (Profile->GetGeneratesInfiniteUndo ())   // only do if they didn't select a preset profile
02955         {
02956             pLastOp = Document::GetSelected()->GetOpHistory().FindLastOp();
02957         }
02958 
02959         if (pLastOp)
02960         {
02961             if (pLastOp->GetRuntimeClass() == CC_RUNTIME_CLASS(OpChangeFillProfile))
02962             {
02963                 FireOp = FALSE;
02964             }
02965         }
02966 
02967         if (FireOp == TRUE)
02968         {
02969             FillProfileOpParam Param;
02970             Param.Profile = *Profile;
02971         
02972             pOpDesc->Invoke(&Param);
02973         }
02974         else
02975         {
02976             // we don't need/want any undo information - so just change the value ....
02977             
02978             //OpChangeFillProfile Op;
02979             ChangeFillProfileAction Action;
02980             Action.ChangeFillProfileWithNoUndo (/*&Op,*/ *Profile);
02981         }
02982     }
02983 }

void GradInfoBarOp::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 5090 of file filltool.cpp.

05091 {
05092     if (Document::GetSelected() == NULL)
05093     {   
05094         EnableGadget(_R(IDC_GEOMETRY),      FALSE);
05095         EnableGadget(_R(IDC_MAPPING),       FALSE);
05096         EnableGadget(_R(IDC_EFFECT),        FALSE);
05097         EnableGadget(_R(IDC_SELPOINT),      FALSE);
05098         EnableGadget(_R(IDC_BITMAPEFFECT),  FALSE);
05099         EnableGadget(_R(IDC_BIASGAIN),      FALSE);
05100         EnableGadget(_R(IDC_SELCOLOUR),     FALSE);
05101         
05102         //HideDisableGadgetAndResuffleBar (GetDlgItem ((HWND) GetReadWriteWindowID (), _R(IDC_BITMAPEFFECT)));
05103         //HideDisableGadgetAndResuffleBar (GetDlgItem ((HWND) GetReadWriteWindowID (), _R(IDC_BIASGAIN)));
05104         //HideDisableGadgetAndResuffleBar (GetDlgItem ((HWND) GetReadWriteWindowID (), _R(IDC_SELCOLOUR)));
05105     }
05106     else
05107     {
05108         EnableGadget (_R(IDC_GEOMETRY), TRUE);
05109 
05110         if (Mode != BITMAPFILL) { EnableGadget(_R(IDC_BITMAPEFFECT), FALSE); }
05111         
05112         if ((Mode != FRACTALFILL) && (Mode != NOISEFILL)) { EnableGadget(_R(IDC_SELCOLOUR), FALSE); }
05113 
05114         // fill profile exceptions ....
05115 
05116         BOOL EnableBiasGain = TRUE;     // only for fills that have not been multistage!
05117         BOOL EnableBiasGain2 = FALSE;   // only for bitmap fills that are not contoned!
05118         BOOL EnableAffect = FALSE;      // only for bitmap fills that are not contoned!
05119 
05120         List FillList;
05121 //      FillTools::BuildListOfSelectedNodes(&FillList, CC_RUNTIME_CLASS(AttrFillGeometry));
05122 //      FillTools::BuildListOfSelectedAttrs(&FillList, CC_RUNTIME_CLASS(AttrFillGeometry));
05123         FillTools::GetSelectedAttrList(&FillList, CC_RUNTIME_CLASS(AttrFillGeometry), TRUE, FALSE);
05124 
05125         AttrFillGeometry* pNodeFill = NULL;
05126 
05127         if (!(FillList.IsEmpty()))
05128         {
05129             NodeListItem * pItem = (NodeListItem *)FillList.GetHead();
05130 
05131             while (pItem)
05132             {
05133                 pNodeFill = (AttrFillGeometry*) pItem->pNode;
05134 
05135                 // firstly check for multistage fills ....
05136                 
05137                 if (pNodeFill->GetFillRamp () != NULL)
05138                 {
05139                 //  if (pNodeFill->GetFillRamp ()->GetCount () > 0)
05140                 //  {
05141                         EnableBiasGain = FALSE;     // only for fills that have not been multistaged!
05142                 //  }
05143                 }
05144 
05145                 // secondly check for a contoned bitmap fill
05146                 
05147                 if ((pNodeFill->IsABitmapFill ()) && (pNodeFill->GetStartColour () != NULL) && (pNodeFill->GetEndColour () != NULL))
05148                 {
05149                     EnableBiasGain2 = TRUE;
05150                     EnableAffect = TRUE;
05151                 }
05152             
05153                 pItem = (NodeListItem *)FillList.GetNext(pItem);
05154 
05155                 //if (EnableBiasGain == FALSE)
05156                 //{
05157                 //  pItem = NULL;               // breakout as soon as possible !!!!
05158                 //}
05159             }
05160 
05161             FillList.DeleteAll();
05162         }
05163         
05164         switch (Mode)
05165         {   
05166             // I'm NOT sure if the NOFILL case is ever called for this tool (never fired off
05167             // the MessageBox during testing) - so for safety sake, we had best handle it ....
05168             case NOFILL:
05169                 EnableGadget(_R(IDC_MAPPING),       FALSE);
05170                 EnableGadget(_R(IDC_EFFECT),        FALSE);
05171                 EnableGadget(_R(IDC_BIASGAIN),      FALSE);
05172                 EnableGadget(_R(IDC_SELPOINT),      FALSE);
05173             break;
05174             
05175             case MANYFILLS:
05176             case FLATFILL:
05177                 // implicitly handles (FGMENU_FLATTRANSP)
05178                 // nothing else to enable ....
05179                 EnableGadget (_R(IDC_MAPPING), FALSE);
05180                 EnableGadget (_R(IDC_EFFECT), FALSE);
05181                 EnableGadget (_R(IDC_BIASGAIN), FALSE);
05182                 EnableGadget (_R(IDC_SELPOINT), FALSE);
05183                 EnableGadget (_R(IDC_SELCOLOUR), FALSE);
05184                 
05185                 // CGS:  don't ask me why this different to the transparency infobar, BUT for somereason,
05186                 // unless  I do the following test - the damn dialog is always closed!
05187                 // NOTE:  this is the code that closes the profile dialog when you have it open for a single
05188                 // fill; and then shift select a different fill ....
05189                 if (Mode == MANYFILLS)
05190                     CloseProfileDialog (m_BiasGainGadget);      // cause fill type cannot be profiled!
05191             break;
05192 
05193             case GRADFILL:
05194             case GRADREPEATFILL:
05195                 switch (CurrentGeometryIndex)
05196                 {
05197                     case FGMENU_LINEAR:
05198                     case FGMENU_CIRCULAR:
05199                     case FGMENU_RADIAL:
05200                     // the following is really fg_diamond ....
05201                     case FGMENU_SQUARE:
05202                         EnableGadget (_R(IDC_MAPPING), TRUE);
05203                         // if (2 colour)
05204                         EnableGadget (_R(IDC_BIASGAIN), EnableBiasGain);
05205                         EnableGadget (_R(IDC_SELPOINT), FALSE);
05206                         EnableGadget (_R(IDC_SELCOLOUR), FALSE);
05207                     break;
05208                     
05209                     case FGMENU_CONICAL:
05210                         EnableGadget (_R(IDC_MAPPING), FALSE);
05211                         //if (2 colour)
05212                         EnableGadget (_R(IDC_BIASGAIN), EnableBiasGain);
05213                         EnableGadget (_R(IDC_SELPOINT), FALSE);
05214                         EnableGadget (_R(IDC_SELCOLOUR), FALSE);
05215                     break;
05216                     
05217                     case FGMENU_THREECOL:
05218                     case FGMENU_FOURCOL:
05219                         EnableGadget (_R(IDC_MAPPING), TRUE);
05220                         EnableGadget (_R(IDC_EFFECT), FALSE);
05221                         EnableGadget (_R(IDC_BIASGAIN), FALSE);
05222                         EnableGadget (_R(IDC_SELPOINT), FALSE);
05223                         EnableGadget (_R(IDC_SELCOLOUR), FALSE);
05224                     break;
05225 
05226                 }
05227             break;
05228 
05229             case BITMAPFILL:
05230                 EnableGadget (_R(IDC_MAPPING), TRUE);
05231                 EnableGadget (_R(IDC_EFFECT), EnableAffect);//FALSE);
05232                 EnableGadget (_R(IDC_BITMAPEFFECT), TRUE);
05233                 //if (2 colour)
05234                 EnableGadget (_R(IDC_BIASGAIN), EnableBiasGain2);
05235 
05236                 if (GetGadgetWritable (_R(IDC_SELPOINT))) { EnableGadget (_R(IDC_SELPOINT), FALSE); }
05237                 else { EnableGadget (_R(IDC_SELPOINT), TRUE); }
05238                 
05239                 EnableGadget (_R(IDC_SELCOLOUR), FALSE);
05240             break;
05241 
05242             case FRACTALFILL:
05243             case NOISEFILL:
05244                 EnableGadget (_R(IDC_MAPPING), TRUE);
05245                 //if (2 colour)
05246                 EnableGadget (_R(IDC_BIASGAIN), TRUE);
05247 
05248                 if (GetGadgetWritable (_R(IDC_SELPOINT))) { EnableGadget (_R(IDC_SELPOINT), FALSE); }
05249                 else { EnableGadget (_R(IDC_SELPOINT), TRUE); }
05250                 
05251                 if (GetGadgetWritable (_R(IDC_SELCOLOUR))) { EnableGadget (_R(IDC_SELCOLOUR), FALSE); }
05252                 else
05253                 {
05254                     EnableGadget (_R(IDC_SELCOLOUR), TRUE);     // for selection bug !!!!
05255 
05256                     EnableGadget (_R(IDC_SELCOLOUR), TRUE);
05257                 }
05258             break;
05259 
05260             default:
05261             break;
05262         }
05263 
05264         if ((Mode != BITMAPFILL) && (Mode != NOFILL) && (Mode != MANYFILLS) && (Mode != FLATFILL)
05265             && (CurrentGeometryIndex != FGMENU_THREECOL) && (CurrentGeometryIndex != FGMENU_FOURCOL))
05266         {
05267             EnableGadget (_R(IDC_EFFECT), TRUE);
05268         }
05269     }
05270 }           

INT32 GradInfoBarOp::FindCommonBitmapDpi  )  [private]
 

Find any Common Bitmap Dpi in the selection.

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

Definition at line 4339 of file filltool.cpp.

04340 {
04341     if (Selection->Count() == 0)
04342     {
04343         AttrFillGeometry* pCurrentFill = GetCurrentGeometry();
04344 
04345         if (pCurrentFill && pCurrentFill->IsABitmapFill())
04346         {
04347             return pCurrentFill->GetDPI();
04348         }
04349 
04350         return 0;
04351     }
04352 
04353     // Find the first Fill Attribute in the selection
04354     AttrFillGeometry* pAttrNode = AttrFillGeometry::FindFirstSelectedAttr();
04355 
04356     // Return if there aren't any
04357     if (pAttrNode == NULL)
04358         return 0;
04359 
04360     INT32 CommonDpi = 0;
04361     INT32 Dpi = 0;
04362 
04363     while (pAttrNode != NULL)
04364     {
04365         if (pAttrNode->IsKindOf(CC_RUNTIME_CLASS(AttrBitmapFill)))
04366         {
04367             if (pAttrNode->IsKindOf(CC_RUNTIME_CLASS(AttrTextureColourFill)) ||
04368                 pAttrNode->IsKindOf(CC_RUNTIME_CLASS(AttrBitmapColourFill))  )
04369             {
04370                 Dpi = pAttrNode->GetDPI();
04371 
04372                 if (CommonDpi == 0)
04373                     CommonDpi = Dpi;
04374 
04375                 if (Dpi != CommonDpi)
04376                 {
04377                     return -1; // Many
04378                 }
04379             }
04380         }
04381 
04382         // Check the next fill
04383         pAttrNode = AttrFillGeometry::FindNextSelectedAttr();
04384     }
04385 
04386     return CommonDpi;
04387 }

String_256 GradInfoBarOp::FindCommonBitmapName  )  [private]
 

Find any Common Bitmap Name in the selection.

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

Definition at line 4143 of file filltool.cpp.

04144 {
04145     String_256 CommonName;
04146     CommonName.Load(_R(IDS_FILLTOOL_NONE));
04147 
04148     String_256 Name;
04149     Name.Load(_R(IDS_FILLTOOL_NONE));
04150     
04151     String_256 None;
04152     None.Load(_R(IDS_FILLTOOL_NONE));
04153 
04154     String_256 Many;
04155     Many.Load(_R(IDS_FILLTOOL_MANY));
04156 
04157     if (Selection->Count() == 0)
04158     {
04159         AttrFillGeometry* pCurrentFill = GetCurrentGeometry();
04160 
04161         if (pCurrentFill && pCurrentFill->IsABitmapFill())
04162         {
04163             KernelBitmap* pBitmap = pCurrentFill->GetBitmap();
04164             if (pBitmap)
04165             {
04166                 OILBitmap* pOilBitmap = pBitmap->ActualBitmap;
04167                 if (pOilBitmap)
04168                 {
04169                     return pOilBitmap->GetName();
04170                 }
04171             }
04172         }
04173 
04174         return None;
04175     }
04176 
04177     // Find the first Fill Attribute in the selection
04178     AttrFillGeometry* pAttrNode = AttrFillGeometry::FindFirstSelectedAttr();
04179 
04180     // Return if there aren't any
04181     if (pAttrNode == NULL)
04182         return None;
04183 
04184     while (pAttrNode != NULL)
04185     {
04186         if (pAttrNode->IsKindOf(CC_RUNTIME_CLASS(AttrBitmapColourFill)))
04187         {
04188             Name = None;
04189             KernelBitmap* pBitmap = pAttrNode->GetBitmap();
04190             if (pBitmap)
04191             {
04192                 OILBitmap* pOilBitmap = pBitmap->ActualBitmap;
04193                 if (pOilBitmap)
04194                 {
04195                     Name = pOilBitmap->GetName();
04196                 }
04197             }
04198 
04199             if (CommonName == None)
04200                 CommonName = Name;
04201 
04202             if (Name != CommonName)
04203             {
04204                 return Many;
04205             }
04206         }
04207 
04208         // Check the next fill
04209         pAttrNode = AttrFillGeometry::FindNextSelectedAttr();
04210     }
04211 
04212     return CommonName;
04213 }

double GradInfoBarOp::FindCommonFractalGrain  )  [private]
 

Find any Common Fractal Graininess in the selection.

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

Definition at line 4427 of file filltool.cpp.

04428 {
04429     if (Selection->Count() == 0)
04430     {
04431         AttrFillGeometry* pCurrentFill = GetCurrentGeometry();
04432 
04433         if (pCurrentFill && pCurrentFill->IsAFractalFill())
04434         {
04435             return ((FractalFillAttribute*)pCurrentFill->GetAttributeValue())->Graininess.MakeDouble();
04436         }
04437 
04438         return 0;
04439     }
04440 
04441     // Find the first Fill Attribute in the selection
04442     AttrFillGeometry* pAttrNode = AttrFillGeometry::FindFirstSelectedAttr();
04443 
04444     // Return if there aren't any
04445     if (pAttrNode == NULL)
04446         return 0;
04447 
04448     double CommonGrain = 0;
04449 
04450     while (pAttrNode != NULL)
04451     {
04452         if (pAttrNode->IsKindOf(CC_RUNTIME_CLASS(AttrFractalColourFill)))
04453         {
04454             double Grain = ((FractalFillAttribute*)pAttrNode->GetAttributeValue())->Graininess.MakeDouble();
04455 
04456             if (CommonGrain == 0)
04457                 CommonGrain = Grain;
04458 
04459             if (Grain != CommonGrain)
04460             {
04461                 return -1; // Many
04462             }
04463         }
04464 
04465         // Check the next fill
04466         pAttrNode = AttrFillGeometry::FindNextSelectedAttr();
04467     }
04468 
04469     return CommonGrain;
04470 }

double GradInfoBarOp::FindCommonNoiseScale  )  [private]
 

Find any common noise scale in the selection.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/01/97

Definition at line 4509 of file filltool.cpp.

04510 {
04511     if (Selection->Count() == 0)
04512     {
04513         AttrFillGeometry* pCurrentFill = GetCurrentGeometry();
04514 
04515         if (pCurrentFill && IS_A(pCurrentFill, AttrNoiseColourFill))
04516         {
04517             return ((NoiseFillAttribute*)pCurrentFill->GetAttributeValue())->GetGraininess().MakeDouble();
04518         }
04519 
04520         return 0;
04521     }
04522 
04523     // Find the first Fill Attribute in the selection
04524     AttrFillGeometry* pAttrNode = AttrFillGeometry::FindFirstSelectedAttr();
04525 
04526     // Return if there aren't any
04527     if (pAttrNode == NULL)
04528         return 0;
04529 
04530     double CommonScale = 0;
04531 
04532     while (pAttrNode != NULL)
04533     {
04534         if (pAttrNode->IsKindOf(CC_RUNTIME_CLASS(AttrNoiseColourFill)))
04535         {
04536             double Scale = ((NoiseFillAttribute*)pAttrNode->GetAttributeValue())->GetGraininess().MakeDouble();
04537 
04538             if (CommonScale == 0)
04539                 CommonScale = Scale;
04540 
04541             if (Scale != CommonScale)
04542             {
04543                 return -1; // Many
04544             }
04545         }
04546 
04547         // Check the next fill
04548         pAttrNode = AttrFillGeometry::FindNextSelectedAttr();
04549     }
04550 
04551     return CommonScale;
04552 }

INT32 GradInfoBarOp::FindCommonTesselate  )  [private]
 

Find any Common Fill Tesselation in the selection.

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

Definition at line 4067 of file filltool.cpp.

04068 {
04069     INT32 CommonTess = 0;
04070     Node* pNode;
04071     NodeAttribute* pChild;
04072 
04073     if (Selection->Count() == 0)
04074     {
04075         AttrFillMapping* pCurrentMapping = GetCurrentMapping();
04076 
04077         if (pCurrentMapping != NULL)
04078         {
04079             return pCurrentMapping->GetRepeat();
04080         }
04081 
04082         return 0;
04083     }
04084 
04085     // Are there any selected Objects ?
04086     if (Selection != NULL)
04087     {
04088         // Find the first Object
04089         pNode = Selection->FindFirst();
04090         while (pNode != NULL)
04091         {
04092             BOOL FoundAttr = ((NodeRenderableInk*)pNode)->FindAppliedAttribute(CC_RUNTIME_CLASS(AttrFillMapping), &pChild);
04093             
04094             if (FoundAttr)
04095             {
04096                 INT32 Tess = ((AttrFillMapping*)pChild)->GetRepeat();
04097 
04098                 if (CommonTess == 0)
04099                     CommonTess = Tess;
04100 
04101                 if (Tess != CommonTess)
04102                 {
04103                     return -1; // Many
04104                 }
04105             }
04106 
04107             pNode = Selection->FindNext(pNode);
04108         }
04109     }
04110 
04111     //if (CommonTess == 0)
04112     //  return RT_Repeating;
04113 
04114     return CommonTess;
04115 }

String_64 GradInfoBarOp::GetColourName DocColour Col  )  [private]
 

Gets a name of a colour.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/8/94
Parameters:
- [INPUTS]
Returns:
-
See also:
-

Definition at line 5036 of file filltool.cpp.

05037 {
05038     String_64 Str;
05039     Str.Load(_R(IDS_FILLTOOL_NONE));
05040 
05041     IndexedColour* IndexCol = Col.FindParentIndexedColour();
05042 
05043     // Is this an Index Colour ?
05044     if (IndexCol != NULL)
05045     {
05046         // Yep, so get it's name
05047         Str = *(IndexCol->GetName());
05048     }
05049     else
05050     {
05051         // Check for a colour that we know about
05052         if (Col == COLOUR_NONE)
05053         {
05054             Str.Load(_R(IDS_FILLTOOL_NOCOLOUR));
05055         }
05056         else if (Col == COLOUR_WHITE)
05057         {
05058             Str.Load(_R(IDS_FILLTOOL_WHITE));
05059         }
05060         else if (Col == COLOUR_BLACK)
05061         {
05062             Str.Load(_R(IDS_FILLTOOL_BLACK));
05063         }
05064         else
05065         {
05066 //          Str.Load(_R(IDS_FILLTOOL_LOCAL));
05067             Str.Load(_R(IDS_FILLTOOL_LOCALCOLOUR));
05068         }
05069     }
05070 
05071     return Str;
05072 }

AttrFillGeometry * GradInfoBarOp::GetCurrentGeometry  )  [private]
 

Gets the current Fill Geometry from the Attribute manager.

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

Definition at line 5755 of file filltool.cpp.

05756 {
05757     CCRuntimeClass* CurrentAttribGroup = 
05758         Tool::GetCurrent()->Parent->m_ToolInfo.CurrentAttributeGroup;
05759 
05760     Document* CurrentDoc = Document::GetSelected();
05761 
05762     if (CurrentDoc == NULL)
05763         return NULL; // We are not going to be able to do anything if there is no document
05764 
05765     return (AttrFillGeometry*)CurrentDoc->GetAttributeMgr()
05766                                 .GetCurrentAttribute(CurrentAttribGroup, 
05767                                             CC_RUNTIME_CLASS(AttrFillGeometry));
05768 }

AttrFillMapping * GradInfoBarOp::GetCurrentMapping  )  [private]
 

Gets the current Fill Geometry from the Attribute manager.

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

Definition at line 5781 of file filltool.cpp.

05782 {
05783     CCRuntimeClass* CurrentAttribGroup = 
05784         Tool::GetCurrent()->Parent->m_ToolInfo.CurrentAttributeGroup;
05785 
05786     Document* CurrentDoc = Document::GetSelected();
05787 
05788     if (CurrentDoc == NULL)
05789         return NULL; // We are not going to be able to do anything if there is no document
05790 
05791     return (AttrFillMapping*)CurrentDoc->GetAttributeMgr()
05792                                 .GetCurrentAttribute(CurrentAttribGroup, 
05793                                             CC_RUNTIME_CLASS(AttrFillMapping));
05794 }

BOOL GradInfoBarOp::GetGadgetWritable INT32  id  )  [private]
 

Returns whether the control is writable (i.e. read only, or not). void GradInfoBarOp::EnableControls() needs to make use of this to control its 'dynamic' toolbar correctly (both of which were also written by me).

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
6/11/99
Parameters:
id,the 'IDC_?' of the control. [INPUTS]
Returns:
TRUE if writable, FALSE otherwise

Definition at line 4303 of file filltool.cpp.

04304 {
04305     PORTNOTETRACE("other","GradInfoBarOp::SetGadgetWritable - disabled");
04306 #ifndef EXCLUDE_FROM_XARALX
04307     // Get the window handle of the gadget, from the gadget ID
04308     HWND gadget = ::GetDlgItem (WindowID, id);
04309 
04310     // See if it's got a child window (it may be a Combo Box)
04311     HWND hEdit = ::ChildWindowFromPoint (gadget, CPoint(1,1));
04312 
04313     if (hEdit)              // Was there a child window ?
04314         gadget = hEdit;     // Yes, so send the message to it
04315 
04316     if (GetWindowLong (gadget, GWL_STYLE) & ES_READONLY)
04317     {
04318         return (TRUE);
04319     }
04320     else
04321     {
04322         return (FALSE);
04323     }
04324 #else
04325     return TRUE;
04326 #endif
04327 }

CProfileBiasGain * GradInfoBarOp::GetProfileFromSelection CGadgetID  GadgetID,
BOOL *  bMany,
BOOL *  bAllSameType
[private, virtual]
 

See InformationBarOp::GetProfileFromSelection () for a description of this function.

Author:
Chris_Snook (Xara Group Ltd) <camelotdev@xara.com>
Date:
7/2/2000
Parameters:
The GadgetID of the CBiasGainGadget that we are dealing with. [INPUTS]
bMany - returned as TRUE if we have MANY profiles selected. [OUTPUTS] bAllSameType - returned as TRUE if objects within selection are all of the same type. returns Ptr to common CProfileBiasGain, or NULL if there is NOT one.

Reimplemented from InformationBarOp.

Definition at line 3003 of file filltool.cpp.

03004 {
03005     BOOL ok = (GadgetID == _R(IDC_BIASGAIN));
03006 
03007     ERROR2IF(ok==FALSE, FALSE, "Invalid gadgetID passed");
03008     
03009     UINT32 TotalNumberSelected = (GetApplication()->FindSelection()->Count ());
03010     
03011     // get the list of all the shadows
03012     List ShadowList;
03013 //  FillTools::BuildListOfSelectedNodes(&ShadowList, CC_RUNTIME_CLASS(AttrFillGeometry));
03014     FillTools::GetSelectedAttrList(&ShadowList, CC_RUNTIME_CLASS(AttrFillGeometry), TRUE, FALSE);
03015 
03016     AttrFillGeometry* pFirstNodeShadow = NULL;
03017     FillGeometryAttribute* pFirstFillGeoAttr = NULL;
03018 
03019     //CProfileBiasGain Profile;
03020     CProfileBiasGain* pFirstProfile = NULL;
03021 
03022     /*if (TotalNumberSelected != (UINT32) ShadowList.GetCount ())
03023     {
03024         // totals differ - so the user MUST have selected someother type of node as well
03025         *bAllSameType = FALSE;
03026         ShadowList.DeleteAll();
03027         return (NULL);
03028     }*/
03029 
03030     NodeListItem * pItem = (NodeListItem *)ShadowList.GetHead();
03031 
03032     while (pItem)
03033     {
03034         if (pFirstNodeShadow == NULL)
03035         {
03036             pFirstNodeShadow = (AttrFillGeometry*) pItem->pNode;
03037             pFirstFillGeoAttr = (FillGeometryAttribute*) pFirstNodeShadow->GetAttributeValue ();
03038 
03039             pFirstProfile = pFirstFillGeoAttr->GetProfilePtr ();
03040 
03041             if (pFirstNodeShadow->GetFillRamp () != NULL)
03042             {
03043                 *bAllSameType = FALSE;
03044             }
03045         }
03046         else
03047         {       
03048             if (((AttrFillGeometry*)pItem->pNode)->GetFillRamp () != NULL)
03049             {
03050                 *bAllSameType = FALSE;
03051             }
03052 
03053             CProfileBiasGain* pOtherProfile = NULL;
03054 
03055             pOtherProfile = ((FillGeometryAttribute*) ((AttrFillGeometry*)pItem->pNode)->GetAttributeValue ())->GetProfilePtr ();
03056 
03057             if (pOtherProfile)
03058             {
03059                 if (*pFirstProfile == *pOtherProfile)
03060                 {
03061                     // all ok
03062                 }
03063                 else
03064                 {
03065                     *bMany = TRUE;
03066                 }
03067             }
03068         }
03069 
03070         pItem = (NodeListItem *)ShadowList.GetNext(pItem);
03071     }
03072 
03073     if (TotalNumberSelected != (UINT32) ShadowList.GetCount ())
03074     {
03075         // totals differ - so the user MUST have selected someother type of node as well
03076         
03077         if ((pFirstProfile) && (*bMany == FALSE))
03078         {
03079             // scan each node in the list, and see if they have the attribute applied ....
03080 
03081             SelRange* range = GetApplication()->FindSelection();
03082 
03083             NodeRenderableInk* pNode = (NodeRenderableInk*) range->FindFirst ();
03084             NodeAttribute* pAttr;
03085 
03086             while (pNode)
03087             {
03088                 if (pNode->FindAppliedAttribute (CC_RUNTIME_CLASS (AttrFillGeometry), &pAttr))
03089                 {
03090                     pNode = (NodeRenderableInk*) (range->FindNext (pNode));
03091                 }
03092                 else
03093                 {
03094                     // the node ain't got one
03095 
03096                     *bAllSameType = FALSE;
03097                     ShadowList.DeleteAll();
03098                     return (NULL);
03099                 }
03100             }
03101         }
03102         else
03103         {   
03104             *bAllSameType = FALSE;
03105             ShadowList.DeleteAll();
03106             return (NULL);
03107         }
03108     }
03109     if (m_BiasGainGadget.GetUseFillProfile () == FALSE)     // biasgain dialog is configured
03110     {                                                       // as an 'object' spacing
03111         ShadowList.DeleteAll();
03112         if (*bMany == TRUE)
03113         {
03114             return (NULL);
03115         }
03116         else
03117         {
03118             return (pFirstProfile);
03119         }
03120     }
03121     else        // biasgain dialog is configured as an interpolation (between two colours)
03122     {
03123         // so we had best attempt to get them ....
03124         if (*bMany == TRUE)             // don't matter in this case anyway
03125         {
03126             ShadowList.DeleteAll();
03127             return (NULL);
03128         }
03129         else
03130         {
03131             // BUT it does here ....
03132             // NOTE:  we can only be 'context' sensitive for a single fill within the
03133             // selection - so lets just choose the first one that we came accross ....
03134 
03135             if (pFirstNodeShadow)
03136             {   
03137                 m_BiasGainGadget.SetStartColour (pFirstNodeShadow->GetStartColour ());
03138                 m_BiasGainGadget.SetEndColour (pFirstNodeShadow->GetEndColour ());
03139 
03140                 // we also need to find ourselves an effect type (i.e.  fade, rainbow or alt rainbow)
03141 
03142                 String_64 Str;
03143 
03144                 CommonAttrEffect = SelRange::ATTR_NONE;
03145                 Str.Load(_R(IDS_FILLTOOL_NONE));
03146 
03147                 if (Selection != NULL)
03148                 {
03149                     // Try and find a common Attribute within the selection.
03150                     // All objects in the selection must have an Identical fill for this
03151                     // to find anything.
03152                     CommonAttrEffect = Selection->FindCommonAttribute(CC_RUNTIME_CLASS(AttrFillEffect), 
03153                                                                 (NodeAttribute**)&CommonEffect);
03154                     CCRuntimeClass* EffectType;
03155 
03156                     // Try and find a common Attribute Type within the selection.
03157                     // The fills need not be identical. Just of the same type.
03158                     SelRange::CommonAttribResult CommonType = 
03159                             Selection->FindCommonAttributeType(CC_RUNTIME_CLASS(AttrFillEffect), 
03160                                                                 &EffectType);
03161 
03162                     if (CommonAttrEffect == SelRange::ATTR_NONE &&
03163                         CommonEffect != NULL)
03164                     {
03165                         CommonAttrEffect = SelRange::ATTR_COMMON;
03166                     }
03167 
03168                     if (CommonType == SelRange::ATTR_NONE &&
03169                         EffectType != NULL)
03170                     {
03171                         CommonType = SelRange::ATTR_COMMON;
03172                     }
03173 
03174                     FillEffectAttribute* TheEffect = NULL;
03175     
03176                     // Make the menu show any Common Fill Type
03177                     // or failing that, 'None' or 'Many'.
03178                     if (CommonType == SelRange::ATTR_COMMON)
03179                     {   
03180                         if (EffectType == CC_RUNTIME_CLASS(AttrFillEffectFade))
03181                         {
03182                             TheEffect = new FillEffectFadeAttribute ();
03183                         }
03184                         else if (EffectType == CC_RUNTIME_CLASS(AttrFillEffectRainbow))
03185                         {
03186                             TheEffect = new FillEffectRainbowAttribute ();
03187                         }
03188                         else if (EffectType == CC_RUNTIME_CLASS(AttrFillEffectAltRainbow))
03189                         {
03190                             TheEffect = new FillEffectAltRainbowAttribute ();
03191                         }
03192                     }
03193 
03194                     if (CommonEffect != NULL)
03195                         m_BiasGainGadget.SetFillEffect (TheEffect);
03196 
03197             //      delete (TheEffect);
03198                 }
03199                 // else we can't alter the fill effect
03200 
03201                 ShadowList.DeleteAll();
03202             }
03203             
03204             return (pFirstProfile);
03205         }
03206     }
03207 }

String_64 GradInfoBarOp::GetSelectedColour AttrFillGeometry pGeometry  )  [private]
 

Gets a textual description of a fills contol point colour.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/8/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
A String_64, "None", "Many", or "Colour Name".

Definition at line 4933 of file filltool.cpp.

04934 {
04935     String_64 Str;
04936 
04937     // fill the string with nothing at the moment
04938     Str.Load(_R(IDS_FILLTOOL_NONE));
04939     // how many happen to be selected at the moment?
04940     UINT32 SelCount = pGeometry->GetSelectionCount();
04941     
04942     // if there's nothing selected then we're done
04943     if (SelCount<1)
04944         return Str;
04945 
04946     // single selected end point?
04947     if (SelCount==1)
04948     {
04949         // then find the name of the colour
04950         DocColour *pColour = pGeometry->GetFirstSelectedColour();
04951         if (pColour)
04952             Str=GetColourName(*pColour);
04953         return Str; 
04954     }
04955 
04956     // more that one selected blob so go figure.
04957     Str.Load(_R(IDS_FILLTOOL_MANY));
04958     return Str;
04959 }

String_64 GradInfoBarOp::GetSelectedPoint AttrFillGeometry pGeometry  )  [private]
 

Gets a textual description of a fills contol point selection state.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
9/8/94
Parameters:
- [INPUTS]
- [OUTPUTS]
Returns:
A String_64, "None", "Many", or "Start Colour", "End Colour" etc.

Definition at line 4809 of file filltool.cpp.

04810 {
04811     String_64 Str;
04812 
04813     // how many happen to be selected at the moment?
04814     UINT32 SelCount = pGeometry->GetSelectionCount();
04815 
04816     // if there's nothing selected then we're done
04817     if (SelCount<1)
04818     {
04819         Str.Load(_R(IDS_FILLTOOL_NONE));
04820         return Str;
04821     }
04822 
04823     // more than one?   
04824     if (SelCount>1)
04825     {
04826         Str.Load(_R(IDS_FILLTOOL_MANY));
04827         return Str;
04828     }
04829 
04830     // ramp blobs have negative indexes
04831     INT32 i = pGeometry->GetFirstSelectedIndex();
04832     if (ISA_RAMPINDEX(i))
04833     {
04834         Str.Load(_R(IDS_FILLTOOL_RAMPCOL));
04835         return Str;
04836     }
04837 
04838     // ok its an end blob so which one is it?
04839     switch (i)
04840     {
04841         case FILLCONTROL_STARTPOINT:
04842             Str.Load(_R(IDS_FILLTOOL_STARTCOL));
04843             break;
04844 
04845         case FILLCONTROL_ENDPOINT:
04846         case FILLCONTROL_SECONDARYPOINT:
04847             Str.Load(_R(IDS_FILLTOOL_ENDCOL));
04848             break;
04849 
04850         case FILLCONTROL_ENDPOINT2:
04851             Str.Load(_R(IDS_FILLTOOL_ENDCOL2));
04852             break;
04853 
04854         case FILLCONTROL_ENDPOINT3:
04855             Str.Load(_R(IDS_FILLTOOL_ENDCOL3));
04856             break;
04857         
04858         default:
04859             Str.Load(_R(IDS_FILLTOOL_NONE));
04860             break;
04861     }
04862 
04863     return Str;
04864 }

void GradInfoBarOp::InitBitmapName  )  [private]
 

Initialise the Bitmap Name Control.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/5/95
See also:
-

Definition at line 3409 of file filltool.cpp.

03410 {
03411 //  DeleteAllValues(_R(IDC_BITMAPEFFECT));
03412     m_oBitmapDropDown.Clear();
03413     EnableGadget (_R(IDC_BITMAPEFFECT), TRUE);
03414     
03415     EffectDisabled = FALSE;
03416 
03417     Document* pDoc = Document::GetSelected();
03418 
03419     // Get the bitmap list
03420     BitmapList* Bitmaps = NULL;
03421     if (pDoc) Bitmaps = pDoc->GetBitmapList();
03422 
03423     if (Bitmaps == NULL)
03424         return;
03425 
03426     String_256 Str;
03427 
03428     if (Bitmaps->GetCount() > 0)
03429     {
03430         INT32 Index = 0;
03431 
03432         ListItem* pBmp = Bitmaps->GetHead();
03433 
03434 
03435         while (pBmp != NULL)
03436         {
03437             if (!((KernelBitmap*)pBmp)->HasBeenDeleted())   // Ignore deleted bitmaps
03438             {
03439                 Str = ((KernelBitmap*)pBmp)->ActualBitmap->GetName();
03440 
03441                 KernelBitmap* bitmap = ((KernelBitmap*)pBmp);
03442                 m_oBitmapDropDown.AddItem(bitmap, FALSE, Str);
03443                 
03444                 Index++;
03445             }
03446 
03447             pBmp = Bitmaps->GetNext(pBmp);
03448         }
03449 
03450     }
03451 }

void GradInfoBarOp::InitControls void   ) 
 

Inits all the controls in the info bar. Called immediately after the bar is created when the gradfill tool becomes the current tool.

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

Definition at line 3224 of file filltool.cpp.

03225 {
03226     // Don't do anything if the Info bar isn't displayed
03227     if (!GradFillTool::IsCurrentTool() || !IsVisible()) return;
03228 
03229     DeleteAllValues(_R(IDC_GEOMETRY));
03230     DeleteAllValues(_R(IDC_EFFECT));
03231 //  DeleteAllValues(_R(IDC_BITMAPEFFECT));
03232     DeleteAllValues(_R(IDC_MAPPING));
03233 
03234     m_oBitmapDropDown.Init(WindowID, _R(IDC_BITMAPEFFECT));
03235     m_oBitmapDropDown.SetColumns(3);
03236     m_oBitmapDropDown.SetItemSize(wxSize(50, 50));
03237 
03238     String_64 Str;
03239 
03240     // Setup the Menu Item text entries
03241     for ( INT32 i=0; i<FillGeometryMenuCount; i++ )
03242     {
03243         Str.Load( FillGeometryMenu[i].StringID );
03244         SetStringGadgetValue( _R(IDC_GEOMETRY), Str, TRUE, FillGeometryMenu[i].Geometry );
03245     }
03246 
03247     // Ensure the drop-downs are the correct length
03248     SetComboListLength(_R(IDC_GEOMETRY));
03249 
03250     SetGadgetWritable(_R(IDC_GEOMETRY), FALSE);
03251     SetGadgetWritable(_R(IDC_MAPPING), FALSE);
03252     SetGadgetWritable(_R(IDC_EFFECT), FALSE);
03253     SetGadgetWritable(_R(IDC_SELPOINT), FALSE);
03254     SetGadgetWritable(_R(IDC_SELCOLOUR), FALSE);
03255 
03256     SetGadgetHelp(_R(IDC_GEOMETRY),     _R(IDBBL_FILLTOOL_FILLTYPE),        _R(IDS_FILLTOOL_FILLTYPE));
03257     SetGadgetHelp(_R(IDC_EFFECT),       _R(IDBBL_FILLTOOL_FILLEFFECT),      _R(IDS_FILLTOOL_FILLEFFECT));
03258     SetGadgetHelp(_R(IDC_BITMAPEFFECT), _R(IDBBL_FILLTOOL_BITMAPNAME),      _R(IDS_FILLTOOL_BITMAPNAME));
03259     SetGadgetHelp(_R(IDC_MAPPING),      _R(IDBBL_FILLTOOL_FILLTILING),      _R(IDS_FILLTOOL_FILLTILING));
03260     SetGadgetHelp(_R(IDC_SELPOINT),     _R(IDBBL_FILLTOOL_FILLHANDLE),      _R(IDS_FILLTOOL_FILLHANDLE));
03261 
03262     // Default to the first items in each list
03263     SelGeometryIndex = 0;
03264     SelMappingIndex = 0;
03265     SelEffectIndex = 0;
03266     SelPointIndex = 0;
03267 
03268     CommonGeometry = NULL;
03269     CommonMapping = NULL;
03270     CommonEffect = NULL;
03271 
03272     MappingDisabled = FALSE;
03273     EffectDisabled = FALSE;
03274     AllowForceToSimpleMapping = TRUE;
03275 
03276     Mode = NOFILL;
03277 
03278     m_BiasGainGadget.Init(this, _R(IDC_BIASGAIN), _R(IDBBL_BIASGAIN),  _R(IDS_BIASGAINDLG));
03279     m_BiasGainGadget.ToggleFillProfile ();
03280 
03281     ShowInfo();
03282 }           

void GradInfoBarOp::InitEffect  )  [private]
 

Initialise the Effect Control.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/5/95
See also:
-

Definition at line 3352 of file filltool.cpp.

03353 {
03354     DeleteAllValues(_R(IDC_EFFECT));
03355     EnableGadget(_R(IDC_EFFECT), TRUE);
03356     EffectDisabled = FALSE;
03357 
03358     String_64 Str;
03359 
03360     Str.Load(_R(IDS_FILLTOOL_FADE));
03361     SetStringGadgetValue(_R(IDC_EFFECT),Str,FALSE, FEMENU_FADE);
03362     Str.Load(_R(IDS_FILLTOOL_RAINBOW));
03363     SetStringGadgetValue(_R(IDC_EFFECT),Str,FALSE, FEMENU_RAINBOW);
03364     Str.Load(_R(IDS_FILLTOOL_ALTRAINBOW));
03365     SetStringGadgetValue(_R(IDC_EFFECT),Str,TRUE, FEMENU_ALTRAINBOW);
03366 
03367     SetComboListLength(_R(IDC_EFFECT));
03368 }

void GradInfoBarOp::InitMapping  )  [private]
 

Initialise the Mapping Control.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/5/95
See also:
-

Definition at line 3381 of file filltool.cpp.

03382 {
03383     DeleteAllValues(_R(IDC_MAPPING));
03384     EnableGadget(_R(IDC_MAPPING), TRUE);
03385     MappingDisabled = FALSE;
03386 
03387     String_64 Str;
03388 
03389     Str.Load(_R(IDS_FILLTOOL_MAPSIMPLE));
03390     SetStringGadgetValue(_R(IDC_MAPPING),Str,FALSE, FMMENU_SIMPLE);
03391     Str.Load(_R(IDS_FILLTOOL_MAPREPEAT));
03392     SetStringGadgetValue(_R(IDC_MAPPING),Str,TRUE, FMMENU_REPEATING);
03393 
03394 //  SetSelectedValueIndex(_R(IDC_MAPPING), 0);
03395     SetComboListLength(_R(IDC_MAPPING));
03396 }

void GradInfoBarOp::InitTesselate  )  [private]
 

Initialise the Tesselation Control.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/5/95
See also:
-

Definition at line 3465 of file filltool.cpp.

03466 {
03467     DeleteAllValues(_R(IDC_MAPPING));
03468     EnableGadget(_R(IDC_MAPPING), TRUE);
03469     MappingDisabled = FALSE;
03470 
03471     String_64 Str;
03472 
03473     Str.Load(_R(IDS_FILLTOOL_TESS_SIMPLE));
03474     SetStringGadgetValue(_R(IDC_MAPPING),Str,FALSE, FTMENU_SIMPLE);
03475     Str.Load(_R(IDS_FILLTOOL_TESS_REPEAT));
03476     SetStringGadgetValue(_R(IDC_MAPPING),Str,FALSE, FTMENU_REPEAT);
03477     Str.Load(_R(IDS_FILLTOOL_TESS_REPEATINV));
03478     SetStringGadgetValue(_R(IDC_MAPPING),Str,TRUE, FTMENU_REPEATINV);
03479 
03480     SetComboListLength(_R(IDC_MAPPING));
03481 }

AttrFillGeometry * GradInfoBarOp::MakeFillMutator  )  [private]
 

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.

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

Definition at line 5669 of file filltool.cpp.

05670 {
05671     AttrFillGeometry* Fill = NULL;
05672     KernelBitmap* Default;
05673 
05674     switch (CurrentGeometryIndex)
05675     {
05676         case (FGMENU_FLAT):
05677             Fill = new AttrFlatColourFill;
05678             break;
05679 
05680         case (FGMENU_LINEAR):
05681             Fill = new AttrLinearColourFill;
05682             break;
05683     
05684         case (FGMENU_CIRCULAR):
05685             Fill = new AttrRadialColourFill;
05686             if (Fill != NULL)
05687                 ((AttrRadialFill*)Fill)->MakeCircular();
05688             break;
05689     
05690         case (FGMENU_RADIAL):
05691             Fill = new AttrRadialColourFill;
05692             if (Fill != NULL)
05693                 ((AttrRadialFill*)Fill)->MakeElliptical();
05694             break;
05695     
05696         case (FGMENU_CONICAL):
05697             Fill = new AttrConicalColourFill;
05698             break;
05699     
05700         case (FGMENU_SQUARE):
05701             Fill = new AttrSquareColourFill;
05702             break;
05703     
05704         case (FGMENU_THREECOL):
05705             Fill = new AttrThreeColColourFill;
05706             CloseProfileDialog (m_BiasGainGadget);      // cause fill type cannot be profiled!
05707             break;
05708     
05709         case (FGMENU_FOURCOL):
05710             Fill = new AttrFourColColourFill;
05711             CloseProfileDialog (m_BiasGainGadget);      // cause fill type cannot be profiled!
05712             break;
05713     
05714         case (FGMENU_BITMAP):
05715             Fill = new AttrBitmapColourFill;
05716             CloseProfileDialog (m_BiasGainGadget);      // cause fill type cannot be profiled!
05717 
05718             Default = KernelBitmap::MakeKernelBitmap();
05719             if (Default == NULL)
05720             {
05721                 delete Fill;
05722                 return NULL;
05723             }
05724 
05725             Fill->AttachBitmap(Default);
05726             break;
05727 
05728         case (FGMENU_FRACTAL):
05729             Fill = new AttrFractalColourFill;
05730             break;
05731 
05732         case (FGMENU_NOISE):
05733             Fill = new AttrNoiseColourFill;
05734             break;
05735 
05736         default:
05737             // Er .. Dunno what kind of fill this is ?
05738             Fill = new AttrFlatColourFill;
05739             break;
05740     }
05741 
05742     return Fill;
05743 }

MsgResult GradInfoBarOp::Message Msg Message  )  [virtual]
 

Gradfill info bar dialog message handler.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
3/8/94
Parameters:
Message,: The message to handle [INPUTS]
- [OUTPUTS]
Returns:
-

Errors: -

See also:
-

Reimplemented from InformationBarOp.

Definition at line 2636 of file filltool.cpp.

02637 {
02638     if (!GradFillTool::IsCurrentTool() || !IsVisible())
02639     {
02640         return (InformationBarOp::Message(Message));
02641     }
02642 
02643     if (IS_OUR_DIALOG_MSG(Message))
02644     {
02645         DialogMsg* Msg = (DialogMsg*)Message;
02646 
02647         // Check if the message is a CANCEL
02648         if (Msg->DlgMsg == DIM_CANCEL)
02649         {
02650             Close(); // Close the dialog 
02651         }
02652         else if (Msg->DlgMsg == DIM_CREATE)
02653         {
02654             // Initialise the controls 
02655             InitControls();
02656         }
02657         else
02658         {
02659             if (Msg->GadgetID == _R(IDC_GEOMETRY))
02660             {
02661                 switch (Msg->DlgMsg)
02662                 {
02663                     case DIM_SELECTION_CHANGED :
02664                     {
02665                         ShowCommonType (FALSE);     // specifying false means that this
02666                                                     // gets (but does not show) CurrentGeometryIndex
02667                         
02668                         // Someone selected a new Fill Geometry
02669                         INT32 Index;
02670                         GetValueIndex(_R(IDC_GEOMETRY),&Index);
02671 
02672                         BOOL AllowFractal = FALSE;  // we need to still allow the user to
02673                                                     // select the same fractal fill
02674                                                     // again and again - since we apply a new
02675                                                     // seed on each occaison ....
02676 
02677                         if (Index == FGMENU_FRACTAL)
02678                         {
02679                             if (CurrentGeometryIndex == Index)
02680                             {
02681                                 AllowFractal = TRUE;
02682                             }
02683                         }
02684 
02685                         if (Index == FGMENU_NOISE)
02686                         {
02687                             if (CurrentGeometryIndex == Index)
02688                             {
02689                                 AllowFractal = TRUE;
02690                             }
02691                         }
02692                         
02693                         if ((CurrentGeometryIndex != Index) || (AllowFractal))
02694                         {
02695                             // Change the Fill Geometry Here
02696                             CurrentGeometryIndex = FillGeometryMenu[Index].Geometry;
02697 
02698                             // CGS - need to deselect all mult-stage fill blobs before
02699                             // chnaging the fill type - otherwise we get redraw problems ....
02700                             // Karim 30/11/2000 - rewritten to not use BevelTools,
02701                             // which is slower and carries memory-leak risks.
02702                             Range* pSelRange = GetApplication()->FindSelection();
02703                             if (pSelRange != NULL)
02704                             {
02705                                 for ( Node* pSelNode =  pSelRange->FindFirst();
02706                                             pSelNode != NULL;
02707                                             pSelNode =  pSelRange->FindNext(pSelNode) )
02708                                 {
02709                                     if (pSelNode->IsAnAttribute() &&
02710                                         pSelNode->IS_KIND_OF(AttrFillGeometry))
02711                                     {
02712                                         FillRamp* pRamp = ((AttrFillGeometry*)pSelNode)->GetFillRamp();
02713                                         if (pRamp != NULL)
02714                                             pRamp->DeselectAll();
02715                                     }
02716                                 }
02717                             }
02718                             
02719                             ChangeFillType();
02720                             EnableControls();
02721                         }
02722                     }
02723                     break;
02724 
02725                     default:
02726                         break;
02727                 }
02728             }
02729 
02730             else if (Msg->GadgetID == _R(IDC_MAPPING))
02731             {
02732                 switch (Msg->DlgMsg)
02733                 {
02734                     case DIM_SELECTION_CHANGED:
02735                     {
02736                         ShowCommonMapping (FALSE);      // specifying false means that this
02737                                                         // gets (but does not show) CurrentMappingIndex
02738                         
02739                         // Someone selected a new Fill Mapping
02740                         INT32 Index;  
02741                         GetValueIndex(_R(IDC_MAPPING),&Index);
02742 
02743                         if (CurrentMappingIndex != Index)
02744                         {
02745                             // Change the Fill Mapping Here
02746                             CurrentMappingIndex = Index;
02747                             ChangeFillMapping();
02748                         }
02749                     }
02750                     break;
02751 
02752                     default:
02753                         break;
02754                 }
02755             }
02756 
02757             else if (Msg->GadgetID == _R(IDC_EFFECT))
02758             {
02759                 switch (Msg->DlgMsg)
02760                 {
02761                     case DIM_SELECTION_CHANGED:
02762                     {
02763                         ShowCommonEffect (FALSE);   // specifying false means that this
02764                                                     // gets (but does not show) CurrentEffectIndex
02765                         
02766                         // Someone selected a new Fill Effect
02767                         INT32 Index;  
02768                         GetValueIndex(_R(IDC_EFFECT),&Index);
02769 
02770                         if (CurrentEffectIndex != Index)
02771                         {
02772                             // Change the Fill Effect Here
02773                             CurrentEffectIndex = Index;
02774                             ChangeFillEffect();
02775                         }
02776                     }
02777                     break;
02778 
02779                     default:
02780                         break;
02781                 }
02782             }
02783 
02784             else if (Msg->GadgetID == _R(IDC_BITMAPEFFECT))
02785             {
02786                 switch (Msg->DlgMsg)
02787                 {
02788                     case DIM_SELECTION_CHANGED:
02789                     {
02790                         // Someone selected a new bitmap Fill Effect
02791                         INT32 iIndex = m_oBitmapDropDown.GetSelected();
02792                         // GetValueIndex (_R(IDC_BITMAPEFFECT), &Index);
02793 
02794 
02795                         //if (CurrentEffectIndex != Index)
02796                         //{
02797                             // Change the bitmap Fill Effect Here
02798                             // (we use CurrentEffectIndex because of the days when
02799                             // _R(IDC_EFFECT) handled this as well; thus we avoid having
02800                             // to change all of the code that relates to this
02801                             CurrentEffectIndex = iIndex;
02802                             ChangeBitmapName ();
02803                         //}
02804                     }
02805                     break;
02806 
02807                     default:
02808                         break;
02809                 }
02810             }
02811 
02812             else if (Msg->GadgetID == _R(IDC_BIASGAIN))
02813             {
02814                 switch (Msg->DlgMsg)
02815                 {
02816                     case DIM_LFT_BN_CLICKED:
02817                         HandleProfileButtonClick (m_BiasGainGadget, _R(IDC_BIASGAIN));
02818                         break;
02819 
02820                     default:
02821                         ProfileSelectionChange( Msg, Msg->GadgetID );
02822                         break;
02823                 }
02824             }
02825 
02826             else if (Msg->GadgetID == _R(IDC_SELPOINT))
02827             {
02828                 switch (Msg->DlgMsg)
02829                 {
02830                     case DIM_SELECTION_CHANGED:
02831                     {
02832                         if (AttrFillGeometry::SelectionCount == 0)
02833                         {
02834                             if (Mode == BITMAPFILL || 
02835                                 Mode == FRACTALFILL || 
02836                                 Mode == NOISEFILL ) 
02837                             {
02838                                 ChangeDPI();
02839                             }
02840                         }
02841                     }
02842                     break;
02843                     default:
02844                         break;
02845                 }
02846             }
02847 
02848             else if (Msg->GadgetID == _R(IDC_SELCOLOUR))
02849             {
02850                 switch (Msg->DlgMsg)
02851                 {
02852                     case DIM_SELECTION_CHANGED:
02853                     {
02854                         if (AttrFillGeometry::SelectionCount == 0)
02855                         {
02856                             if (Mode == FRACTALFILL)
02857                                 ChangeFractalGrain();
02858                             if (Mode == NOISEFILL)
02859                                 ChangeNoiseScale();
02860                         }
02861                     }
02862                     break;
02863 
02864                     default:
02865                         break;
02866                 }
02867             }
02868         }
02869     }
02870 
02871     if (MESSAGE_IS_A(Message, SelChangingMsg) ||
02872         MESSAGE_IS_A(Message, CurrentAttrChangedMsg))
02873     {
02874         // The selection has changed in some way
02875         // Re-Count the number of selected fill control points
02876         AttrFillGeometry::SetSelectionCount(AttrFillGeometry::CountSelectionControlPoints());
02877 
02878         if (AttrFillGeometry::SelectionCount > 0)
02879         {
02880             GradFillTool::EnableFillNudge();
02881         }
02882         else
02883         {
02884             GradFillTool::DisableFillNudge();
02885         }
02886 
02887         HandleProfileSelChangingMsg (m_BiasGainGadget, _R(IDC_BIASGAIN));
02888 
02889         ShowInfo();
02890 /*
02891         SelChangingMsg* Msg = (SelChangingMsg*)Message;
02892         switch (Msg->State)
02893         {
02894             case SelChangingMsg::COLOURATTCHANGED:
02895                 // The colour of an attribute has changed
02896                 TRACEUSER( "Will", _T("ColourAttChanged\n"));
02897                 InitControls();
02898                 break;
02899 
02900             case SelChangingMsg::NONCOLOURATTCHANGED:
02901                 // The selection state or control points of an attribute have changed
02902                 TRACEUSER( "Will", _T("NonColourAttChanged\n"));
02903                 InitControls();
02904                 break;
02905         }
02906 */
02907     }
02908 
02909     // do we have a selection change message? 
02910     if (MESSAGE_IS_A(Message, SelChangingMsg))
02911     {
02912         //ShowInfo();       // done in above call anyway - so not needed here ....
02913         HandleProfileSelChangingMsg (m_BiasGainGadget, _R(IDC_BIASGAIN));
02914         ShowInfo();
02915     }
02916 
02917     if (MESSAGE_IS_A(Message, BitmapListChangedMsg) &&
02918         Document::GetSelected() != NULL)
02919     {   
02920         InitBitmapName();
02921         ShowInfo();
02922     }
02923     
02924     // Pass the message on
02925     return (InformationBarOp::Message(Message));
02926 }    

void GradInfoBarOp::ScanSelectionForControlPoints String_64 ,
String_64
[private]
 

Definition at line 4598 of file filltool.cpp.

04600 {
04601     *PointString = _T("");
04602     *ColourString = _T("");
04603 
04604     AttrFillGeometry* pAttrNode;
04605     UINT32 count = Selection->Count();
04606 
04607     // Find the first Fill Attribute in the selection
04608     if (count == 0)
04609     {
04610         pAttrNode = GetCurrentGeometry();
04611     }
04612     else
04613     {
04614         pAttrNode = AttrFillGeometry::FindFirstSelectedAttr();
04615     }
04616 
04617     AllowForceToSimpleMapping = TRUE;
04618     
04619     // Return if there aren't any
04620     if (pAttrNode == NULL)
04621     {
04622         (*PointString).Load(_R(IDS_FILLTOOL_NONE));
04623         (*ColourString).Load(_R(IDS_FILLTOOL_NONE));
04624         return;
04625     }
04626     
04627     INT32 SelCount = 0;
04628     BOOL CommonColour = TRUE;
04629     BOOL CommonPoint  = TRUE;
04630 
04631     BOOL AllFlat = TRUE;
04632     BOOL AnyNeedSimple = FALSE;
04633 
04634     while (pAttrNode != NULL)
04635     {
04636         if (AttrFillGeometry::FillSelectionCount() > 0)
04637         {
04638             if (!(pAttrNode->GetRuntimeClass() == CC_RUNTIME_CLASS(AttrFlatColourFill)))
04639             {
04640                 // Get the selection state and colours of this fill
04641                 String_64 PointStr = GetSelectedPoint(pAttrNode);
04642                 String_64 ColourStr = GetSelectedColour(pAttrNode);
04643 
04644                 String_64 Str;
04645                 Str.Load(_R(IDS_FILLTOOL_NONE));
04646 
04647                 // Where there any points selected ?
04648                 if (PointStr != Str)
04649                 {
04650                     // Update and keep a count
04651                     *PointString = PointStr;
04652                     SelCount++;
04653 
04654                     if (*PointString == String_64(_T("")))
04655                         *PointString = PointStr;
04656 
04657                     if (*PointString != PointStr)
04658                         CommonPoint = FALSE;
04659 
04660                     if (*ColourString == String_64(_T("")))
04661                         *ColourString = ColourStr;
04662 
04663                     if (*ColourString != ColourStr)
04664                         CommonColour = FALSE;
04665     
04666                     AllFlat = FALSE;
04667                 }
04668             }
04669         }
04670         else 
04671         {
04672             if (pAttrNode->GetRuntimeClass() == CC_RUNTIME_CLASS(AttrFlatColourFill))
04673             {
04674                 if ( pAttrNode->GetStartColour() != NULL )
04675                 {
04676                     (*PointString).Load(_R(IDS_FILLTOOL_FLATFILL));
04677 
04678                     if (*ColourString == String_64(_T("")))
04679                         *ColourString = GetColourName(*pAttrNode->GetStartColour());
04680 
04681                     if (*ColourString != GetColourName(*pAttrNode->GetStartColour()))
04682                         CommonColour = FALSE;
04683 
04684                     SelCount++;
04685                 }
04686             }
04687             else
04688             {
04689                 if (SelCount > 0)
04690                     AllFlat = FALSE;
04691             }
04692         }
04693 
04694         // If this is a colour fill attribute and doesn't need simple mapping then set FALSE
04695         if (pAttrNode->IsAColourFill() && pAttrNode->NeedsForceToSimpleMapping())
04696             AnyNeedSimple = TRUE;
04697             
04698         // Check the next fill
04699         if (count > 0)
04700             pAttrNode = AttrFillGeometry::FindNextSelectedAttr();
04701         else
04702             pAttrNode = NULL;
04703     }
04704 
04705     if (AnyNeedSimple)
04706         AllowForceToSimpleMapping = FALSE;
04707 
04708     if (AttrFillGeometry::FillSelectionCount() == 0 && !AllFlat)
04709     {
04710         (*PointString).Load(_R(IDS_FILLTOOL_MANY));
04711     }
04712 
04713     if (SelCount == 0)
04714     {
04715         (*PointString).Load(_R(IDS_FILLTOOL_NONE));
04716         (*ColourString).Load(_R(IDS_FILLTOOL_NONE));
04717     }
04718 
04719     // Was there more than one fill with points selected ?
04720     if (!CommonPoint)
04721     {
04722         // Status indicating many points selected
04723         (*PointString).Load(_R(IDS_FILLTOOL_MANY));
04724     }
04725 
04726     if (!CommonColour)
04727     {
04728         (*ColourString).Load(_R(IDS_FILLTOOL_MANY));
04729     }
04730 
04731 /*
04732     *PointString = "";
04733     *ColourString = "";
04734 
04735     // Find the first Fill Attribute in the selection
04736     AttrFillGeometry* pAttrNode = AttrFillGeometry::FindFirstSelectedAttr();
04737 
04738     // Return if there aren't any
04739     if (pAttrNode == NULL)
04740         return;
04741     
04742     INT32 SelCount = 0;
04743     BOOL CommonPoint = TRUE;
04744     BOOL CommonColour = TRUE;
04745 
04746     while (pAttrNode != NULL)
04747     {
04748         // Get the selection state and colours of this fill
04749         String_64 PointStr = GetSelectedPoint(pAttrNode);
04750         String_64 ColourStr = GetSelectedColour(pAttrNode);
04751 
04752         // Where there any points selected ?
04753         String_64 Str;
04754         Str.Load(_R(IDS_FILLTOOL_NONE));
04755 
04756         if (PointStr != Str)
04757         {
04758             if (*PointString == String_64(""))
04759             {
04760                 // Update and keep a count
04761                 *PointString = PointStr;
04762                 *ColourString = ColourStr;
04763                 SelCount++;
04764             }                   
04765             else
04766             {
04767                 if (CommonPoint && *PointString != PointStr)
04768                 {
04769                     CommonPoint = FALSE;
04770                     (*PointString).Load(_R(IDS_FILLTOOL_MANY));
04771                 }
04772 
04773                 if (CommonColour && *ColourString != ColourStr)
04774                 {
04775                     CommonColour = FALSE;
04776                     (*ColourString).Load(_R(IDS_FILLTOOL_MANY));
04777                 }
04778             }
04779         
04780             if (!CommonPoint && !CommonColour)
04781                 return;
04782         }
04783 
04784         // Check the next fill
04785         pAttrNode = AttrFillGeometry::FindNextSelectedAttr();
04786     }
04787 
04788     if (SelCount == 0)
04789     {
04790         (*PointString).Load(_R(IDS_FILLTOOL_NONE));
04791         (*ColourString).Load(_R(IDS_FILLTOOL_NONE));
04792     }
04793 */
04794 }

BOOL GradInfoBarOp::SetGadgetString CGadgetID  Gadget,
StringBase StrValue
[private]
 

Set the string displayed by a Gadget. This version only updates the gadget if it has changed.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/5/95
See also:
-

Definition at line 3495 of file filltool.cpp.

03496 {
03497     if (Gadget == _R(IDC_EFFECT) && EffectDisabled)
03498         return TRUE;
03499 
03500     if (Gadget == _R(IDC_MAPPING) && MappingDisabled)
03501         return TRUE;
03502 
03503     if (GetStringGadgetValue(Gadget, NULL, -1) != *StrValue)
03504     {
03505         return SetStringGadgetValue(Gadget, *StrValue, FALSE, -1);
03506     }
03507 
03508     return TRUE;
03509 }

void GradInfoBarOp::SetGadgetWritable INT32  id,
BOOL  enable
[private]
 

Sets the state of the 'Read Only' flag of an edit field or combo box.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
15/11/94
Parameters:
id,the 'IDC_?' of the control. [INPUTS] enable, TRUE to allow the control to be typed into. FALSE to make it read only.

Definition at line 4265 of file filltool.cpp.

04266 {
04267     PORTNOTETRACE("other","GradInfoBarOp::SetGadgetWritable - disabled");
04268 #ifndef EXCLUDE_FROM_XARALX
04269     // Get the window handle of the gadget, from the gadget ID
04270     HWND gadget = ::GetDlgItem(WindowID, id);
04271 
04272     // See if it's got a child window (it may be a Combo Box)
04273     HWND hEdit = ::ChildWindowFromPoint(gadget, CPoint(1,1));
04274 
04275     if (hEdit)              // Was there a child window ?
04276         gadget = hEdit;     // Yes, so send the message to it
04277 
04278     if (enable)
04279     {
04280         ::SendMessage(gadget, EM_SETREADONLY, FALSE, 0);    // Clear the Read Only Flag
04281     }
04282     else
04283     {
04284         ::SendMessage(gadget, EM_SETREADONLY, TRUE, 0);     // Set the Read Only Flag
04285     }
04286 #endif
04287 }

void GradInfoBarOp::ShowBitmapInfo  ) 
 

Show info on a bitmap fill.

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

Definition at line 3577 of file filltool.cpp.

03578 {
03579     if (OldMode != BITMAPFILL)
03580     {
03581         InitTesselate ();
03582         InitEffect ();              // we need to do this because of the possibility of contoned bitmaps ....
03583         InitBitmapName ();
03584 
03585         SetGadgetHelp(_R(IDC_BITMAPEFFECT), _R(IDBBL_FILLTOOL_BITMAPNAME),      _R(IDS_FILLTOOL_BITMAPNAME));
03586         SetGadgetHelp(_R(IDC_MAPPING),      _R(IDBBL_FILLTOOL_FILLTILING),      _R(IDS_FILLTOOL_FILLTILING));
03587         //SetGadgetHelp(_R(IDC_SELCOLOUR),  _R(IDBBL_FILLTOOL_FILLCOLOUR),      _R(IDS_FILLTOOL_FILLCOLOUR));
03588     }
03589 
03590     if (AttrFillGeometry::SelectionCount == 0)
03591     {
03592         SetGadgetHelp(_R(IDC_SELPOINT),  _R(IDBBL_FILLTOOL_BITMAPRES),  _R(IDS_FILLTOOL_BITMAPRES));
03593         SetGadgetWritable(_R(IDC_SELPOINT), TRUE);
03594     }
03595     else
03596     {
03597         SetGadgetHelp(_R(IDC_SELPOINT),  _R(IDBBL_FILLTOOL_FILLHANDLE), _R(IDS_FILLTOOL_FILLHANDLE));
03598         SetGadgetWritable(_R(IDC_SELPOINT), FALSE);
03599     }
03600 
03601     ShowCommonTesselate();
03602     ShowCommonEffect ();
03603     ShowCommonBitmapName();
03604     ShowControlPointInfo();
03605 
03606     if (AttrFillGeometry::SelectionCount == 0)
03607         ShowCommonBitmapDpi();
03608 }

void GradInfoBarOp::ShowCommonBitmapDpi  ) 
 

Show any Common Bitmap Dpi in the selection.

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

Definition at line 4225 of file filltool.cpp.

04226 {
04227     INT32 dpi = FindCommonBitmapDpi();
04228 
04229     String_64 DpiStr;
04230 
04231     if (dpi == 0)
04232     {
04233         DpiStr.Load(_R(IDS_FILLTOOL_NODPI));
04234     }
04235 
04236     if (dpi == -1)
04237     {
04238         DpiStr.Load(_R(IDS_FILLTOOL_MANYDPI));
04239     }
04240 
04241     if (dpi > 0)
04242     {
04243         // use the conversion functions rather than trying to do it ourselves
04244         Convert::LongToString(dpi, &DpiStr);
04245         DpiStr += String_64(_R(IDS_FILLTOOL_DPI));
04246     }
04247 
04248     SetGadgetString(_R(IDC_SELPOINT),&DpiStr);
04249     SetGadgetWritable(_R(IDC_SELPOINT), TRUE);
04250 }

void GradInfoBarOp::ShowCommonBitmapName  ) 
 

Show any Common Bitmap Name in the selection.

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

Definition at line 4127 of file filltool.cpp.

04128 {
04129     String_64 strName = FindCommonBitmapName();
04130     m_oBitmapDropDown.SelectByLabel(strName);
04131 }

void GradInfoBarOp::ShowCommonEffect BOOL  ShowDataAndNotSet = TRUE  ) 
 

Show any Common Fill Type in the selection.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com> (altered by Chris Snook)
Date:
25/8/94
Parameters:
if ShowDataAndNotSet is FALSE, then data members will be set (for controlling [INPUTS] menu selection logic) and data will not be shown in the relevant control.

Definition at line 3936 of file filltool.cpp.

03937 {
03938     String_64 Str;
03939 
03940     CommonAttrEffect = SelRange::ATTR_NONE;
03941     Str.Load(_R(IDS_FILLTOOL_NONE));
03942 
03943     if (Selection != NULL)
03944     {
03945         // Try and find a common Attribute within the selection.
03946         // All objects in the selection must have an Identical fill for this
03947         // to find anything.
03948         CommonAttrEffect = Selection->FindCommonAttribute(CC_RUNTIME_CLASS(AttrFillEffect), 
03949                                                     (NodeAttribute**)&CommonEffect);
03950         CCRuntimeClass* EffectType;
03951 
03952         // Try and find a common Attribute Type within the selection.
03953         // The fills need not be identical. Just of the same type.
03954         SelRange::CommonAttribResult CommonType = 
03955                 Selection->FindCommonAttributeType(CC_RUNTIME_CLASS(AttrFillEffect), 
03956                                                     &EffectType);
03957 
03958         if (CommonAttrEffect == SelRange::ATTR_NONE &&
03959             CommonEffect != NULL)
03960         {
03961             CommonAttrEffect = SelRange::ATTR_COMMON;
03962         }
03963 
03964         if (CommonType == SelRange::ATTR_NONE &&
03965             EffectType != NULL)
03966         {
03967             CommonType = SelRange::ATTR_COMMON;
03968         }
03969     
03970         // Make the menu show any Common Fill Type
03971         // or failing that, 'None' or 'Many'.
03972         if (CommonType == SelRange::ATTR_COMMON)
03973         {   
03974             if (EffectType == CC_RUNTIME_CLASS(AttrFillEffectFade))
03975             {
03976                 Str.Load(_R(IDS_FILLTOOL_FADE));
03977                 CurrentEffectIndex = FEMENU_FADE;
03978             }
03979             else if (EffectType == CC_RUNTIME_CLASS(AttrFillEffectRainbow))
03980             {
03981                 Str.Load(_R(IDS_FILLTOOL_RAINBOW));
03982                 CurrentEffectIndex = FEMENU_RAINBOW;
03983             }
03984             else if (EffectType == CC_RUNTIME_CLASS(AttrFillEffectAltRainbow))
03985             {
03986                 Str.Load(_R(IDS_FILLTOOL_ALTRAINBOW));
03987                 CurrentEffectIndex = FEMENU_ALTRAINBOW;
03988             }
03989         }
03990         else
03991         {
03992             if (CommonType == SelRange::ATTR_MANY)
03993             {
03994                 // There are many different types of fill selected
03995                 Str.Load(_R(IDS_FILLTOOL_MANY));
03996                 CurrentEffectIndex = -1;
03997             }
03998         }
03999     }
04000 
04001     // Update the Menus
04002     if (ShowDataAndNotSet)
04003     {
04004         SetGadgetString(_R(IDC_EFFECT),&Str);
04005     }
04006 }

void GradInfoBarOp::ShowCommonFractalGrain  ) 
 

Show any Common Fractal Graininess in the selection.

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

Definition at line 4400 of file filltool.cpp.

04401 {
04402     double Grain = FindCommonFractalGrain();
04403 
04404     String_64 GrainStr;
04405 
04406     if (Grain == 0)
04407         GrainStr.Load(_R(IDS_FILLTOOL_NOGRAIN));
04408     if (Grain == -1)
04409         GrainStr.Load(_R(IDS_FILLTOOL_MANYGRAIN));
04410     if (Grain > 0)
04411         Convert::DoubleToString(Grain, &GrainStr, 1);
04412 
04413     SetGadgetString(_R(IDC_SELCOLOUR),&GrainStr);
04414     SetGadgetWritable(_R(IDC_SELCOLOUR), TRUE);
04415 }

void GradInfoBarOp::ShowCommonMapping BOOL  ShowDataAndNotSet = TRUE  ) 
 

Show any Common Fill Mapping in the selection.

Author:
Gerry_Iles (Xara Group Ltd) <camelotdev@xara.com> (altered by Chris Snook)
Date:
22/8/96
Parameters:
if ShowDataAndNotSet is FALSE, then data members will be set (for controlling [INPUTS] menu selection logic) and data will not be shown in the relevant control.

Definition at line 3871 of file filltool.cpp.

03872 {
03873     String_64 Str;
03874 
03875     INT32 CommTess = FindCommonTesselate();
03876 
03877     switch (CommTess)
03878     {
03879         case -1:
03880             Str.Load(_R(IDS_FILLTOOL_MANY));
03881             CurrentMappingIndex = -2;//FMMENU_REPEATING;
03882             break;
03883 
03884         case 0:
03885             Str.Load(_R(IDS_FILLTOOL_NONE));
03886             CurrentMappingIndex = -1;//FMMENU_REPEATING;
03887             break;
03888 
03889         case 1:
03890             Str.Load(_R(IDS_FILLTOOL_MAPSIMPLE));
03891             CurrentMappingIndex = FMMENU_SIMPLE;
03892             break;
03893 
03894         case 2:
03895 //Mark Howitt, 8/10/97. If were using the new grad fills and repeat is set to 2, this doesn`t mean repeating
03896 //                      grad fills. Make sure it only shows it as simple! 
03897 #ifdef NEW_FEATURES
03898             if(Mode == GRADFILL)
03899             {
03900                 Str.Load(_R(IDS_FILLTOOL_MAPSIMPLE));
03901                 CurrentMappingIndex = FMMENU_SIMPLE;
03902                 break;
03903             }
03904             else
03905             {
03906                 Str.Load(_R(IDS_FILLTOOL_MAPREPEAT));
03907                 CurrentMappingIndex = FMMENU_REPEATING;
03908                 break;
03909             }
03910         case 4:     // Must be a repeating grad fill!
03911 #endif
03912         case 3:
03913             Str.Load(_R(IDS_FILLTOOL_MAPREPEAT));
03914             CurrentMappingIndex = 2;//FMMENU_REPEATING;
03915             break;
03916     }
03917 
03918     if (ShowDataAndNotSet)
03919     {
03920         SetGadgetString(_R(IDC_MAPPING),&Str);
03921     }
03922 }

void GradInfoBarOp::ShowCommonNoiseScale  ) 
 

Show any Common Noise scale in the selection.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/01/97

Definition at line 4482 of file filltool.cpp.

04483 {
04484     double Scale = FindCommonNoiseScale();
04485 
04486     String_64 ScaleStr;
04487 
04488     if (Scale == 0)  
04489         ScaleStr.Load(_R(IDS_FILLTOOL_NOGRAIN));            // evaluates to 'None'
04490     if (Scale == -1) 
04491         ScaleStr.Load(_R(IDS_FILLTOOL_MANYGRAIN));          // evaluates to 'Many'
04492     if (Scale > 0)   
04493         Convert::DoubleToString(Scale, &ScaleStr, 1);
04494 
04495     SetGadgetString(_R(IDC_SELCOLOUR),&ScaleStr);
04496     SetGadgetWritable(_R(IDC_SELCOLOUR), TRUE);
04497 }

void GradInfoBarOp::ShowCommonTesselate  ) 
 

Show any Common Fill Tesselation in the selection.

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

Definition at line 4019 of file filltool.cpp.

04020 {
04021     String_64 Str;
04022 
04023     INT32 CommTess = FindCommonTesselate();
04024 
04025     switch (CommTess)
04026     {
04027         case -1:
04028             Str.Load(_R(IDS_FILLTOOL_MANY));
04029             CurrentMappingIndex = FTMENU_REPEAT;
04030             break;
04031 
04032         case 0:
04033             Str.Load(_R(IDS_FILLTOOL_NONE));
04034             CurrentMappingIndex = FTMENU_REPEAT;
04035             break;
04036 
04037         case 1:
04038             Str.Load(_R(IDS_FILLTOOL_TESS_SIMPLE));
04039             CurrentMappingIndex = FTMENU_SIMPLE;
04040             break;
04041 
04042         case 2:
04043             Str.Load(_R(IDS_FILLTOOL_TESS_REPEAT));
04044             CurrentMappingIndex = FTMENU_REPEAT;
04045             break;
04046 
04047         case 3:
04048             Str.Load(_R(IDS_FILLTOOL_TESS_REPEATINV));
04049             CurrentMappingIndex = FTMENU_REPEATINV;
04050             break;
04051     }
04052 
04053     SetGadgetString(_R(IDC_MAPPING),&Str);
04054     EnableGadget(_R(IDC_MAPPING), TRUE);
04055 }

void GradInfoBarOp::ShowCommonType BOOL  ShowDataAndNotSet = TRUE  ) 
 

Show any Common Fill Type in the selection.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com> (altered by Chris Snook)
Date:
25/8/94
Parameters:
if ShowDataAndNotSet is FALSE, then data members will be set (for controlling [INPUTS] menu selection logic) and data will not be shown in the relevant control.

Definition at line 3726 of file filltool.cpp.

03727 {
03728     String_64 Str;
03729 
03730     CommonAttr = SelRange::ATTR_NONE;
03731     Str.Load(_R(IDS_FILLTOOL_NONE));
03732 
03733     if (Selection != NULL)
03734     {
03735         Document* pCurrentDoc = Document::GetCurrent();
03736         if (Document::GetSelected())
03737             Document::GetSelected()->SetCurrent();
03738 
03739         // Try and find a common Attribute within the selection.
03740         // All objects in the selection must have an Identical fill for this
03741         // to find anything.
03742         CommonAttr = Selection->FindCommonAttribute(CC_RUNTIME_CLASS(AttrFillGeometry), 
03743                                                     (NodeAttribute**)&CommonGeometry);
03744         CCRuntimeClass* GeometryType;
03745 
03746         // Try and find a common Attribute Type within the selection.
03747         // The fills need not be identical. Just of the same type.
03748         SelRange::CommonAttribResult CommonType = 
03749                 Selection->FindCommonAttributeType(CC_RUNTIME_CLASS(AttrFillGeometry), 
03750                                                    &GeometryType);
03751 
03752         if (CommonAttr == SelRange::ATTR_NONE &&
03753             CommonGeometry != NULL)
03754         {
03755             CommonAttr = SelRange::ATTR_COMMON;
03756         }
03757 
03758         if (CommonType == SelRange::ATTR_NONE &&
03759             GeometryType != NULL)
03760         {
03761             CommonType = SelRange::ATTR_COMMON;
03762         }
03763     
03764         // Make the menu show any Common Fill Type
03765         // or failing that, 'None' or 'Many'.
03766         if (CommonType == SelRange::ATTR_COMMON)
03767         {   
03768             if (GeometryType == CC_RUNTIME_CLASS(AttrFlatColourFill))
03769             {
03770                 Str.Load(_R(IDS_FILLTOOL_FLATFILL));
03771                 Mode = FLATFILL;
03772                 CurrentGeometryIndex = FGMENU_FLAT;
03773             }
03774             else if (GeometryType == CC_RUNTIME_CLASS(AttrLinearColourFill))
03775             {
03776                 Str.Load(_R(IDS_FILLTOOL_LINEAR));
03777                 Mode = GRADFILL;
03778                 CurrentGeometryIndex = FGMENU_LINEAR;
03779             }
03780             else if (GeometryType == CC_RUNTIME_CLASS(AttrCircularColourFill))
03781             {
03782                 Str.Load(_R(IDS_FILLTOOL_CIRCULAR));
03783                 Mode = GRADFILL;
03784                 CurrentGeometryIndex = FGMENU_CIRCULAR;
03785             }
03786             else if (GeometryType == CC_RUNTIME_CLASS(AttrRadialColourFill))
03787             {
03788                 Str.Load(_R(IDS_FILLTOOL_ELLIPTICAL));
03789                 Mode = GRADFILL;
03790                 CurrentGeometryIndex = FGMENU_RADIAL;
03791             }
03792             else if (GeometryType == CC_RUNTIME_CLASS(AttrConicalColourFill))
03793             {
03794                 Str.Load(_R(IDS_FILLTOOL_CONICAL));
03795                 Mode = GRADFILL;
03796                 CurrentGeometryIndex = FGMENU_CONICAL;
03797             }
03798             else if (GeometryType == CC_RUNTIME_CLASS(AttrSquareColourFill))
03799             {
03800                 Str.Load(_R(IDS_FILLTOOL_SQUARE));
03801                 Mode = GRADFILL;
03802                 CurrentGeometryIndex = FGMENU_SQUARE;
03803             }
03804             else if (GeometryType == CC_RUNTIME_CLASS(AttrThreeColColourFill))
03805             {
03806                 Str.Load(_R(IDS_FILLTOOL_THREECOL));
03807                 Mode = GRADREPEATFILL;
03808                 CurrentGeometryIndex = FGMENU_THREECOL;
03809             }
03810             else if (GeometryType == CC_RUNTIME_CLASS(AttrFourColColourFill))
03811             {
03812                 Str.Load(_R(IDS_FILLTOOL_FOURCOL));
03813                 Mode = GRADREPEATFILL;
03814                 CurrentGeometryIndex = FGMENU_FOURCOL;
03815             }
03816             else if (GeometryType == CC_RUNTIME_CLASS(AttrBitmapColourFill))
03817             {
03818                 Str.Load(_R(IDS_FILLTOOL_BITMAP));
03819                 Mode = BITMAPFILL;
03820                 CurrentGeometryIndex = FGMENU_BITMAP;
03821             }
03822             else if (GeometryType == CC_RUNTIME_CLASS(AttrFractalColourFill))
03823             {
03824                 Str.Load(_R(IDS_FILLTOOL_FRACTAL));
03825                 Mode = FRACTALFILL;
03826                 CurrentGeometryIndex = FGMENU_FRACTAL;
03827             }
03828             else if (GeometryType == CC_RUNTIME_CLASS(AttrNoiseColourFill))
03829             {
03830                 Str.Load(_R(IDS_FILLTOOL_NOISE));
03831                 Mode = NOISEFILL;
03832                 CurrentGeometryIndex = FGMENU_NOISE;
03833             }
03834         }
03835         else
03836         {
03837             if (CommonAttr == SelRange::ATTR_MANY)
03838             {
03839                 // There are many different types of fill selected
03840                 Str.Load(_R(IDS_FILLTOOL_MANY));
03841                 Mode = MANYFILLS;
03842                 CurrentGeometryIndex = FGMENU_MANY;
03843             }
03844         }
03845         
03846         if (pCurrentDoc)
03847             pCurrentDoc->SetCurrent();
03848     }
03849 
03850     // Update the Menus
03851     if (ShowDataAndNotSet)
03852     {
03853         SetGadgetString(_R(IDC_GEOMETRY),&Str);
03854     }
03855 }

void GradInfoBarOp::ShowControlPointInfo  ) 
 

Show Info about selected control points.

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

Definition at line 4564 of file filltool.cpp.

04565 {
04566     String_64 PointStr;
04567     String_64 ColourStr;
04568 
04569     // Look though the selection for any selected control points
04570     ScanSelectionForControlPoints(&PointStr, &ColourStr);
04571 
04572     // PointStr and ColourStr will be updated if we find any
04573 
04574     // Show the selected control points state
04575     SetStringGadgetValue(_R(IDC_SELPOINT), PointStr);
04576     SetStringGadgetValue(_R(IDC_SELCOLOUR), ColourStr);
04577 
04578     if ((Mode != BITMAPFILL && 
04579          Mode != FRACTALFILL && 
04580          Mode != NOISEFILL ) || AttrFillGeometry::SelectionCount > 0)
04581     {
04582         SetGadgetString(_R(IDC_SELPOINT),&PointStr);
04583     }
04584 
04585     SetGadgetString(_R(IDC_SELCOLOUR),&ColourStr);
04586 }

void GradInfoBarOp::ShowFlatInfo  ) 
 

Show info on a flat fill.

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

Definition at line 3521 of file filltool.cpp.

03522 {
03523     if (OldMode != FLATFILL)
03524     {   
03525         InitMapping();
03526         InitEffect();
03527 
03528         SetGadgetHelp(_R(IDC_EFFECT),       _R(IDBBL_FILLTOOL_FILLEFFECT),      _R(IDS_FILLTOOL_FILLEFFECT));
03529         SetGadgetHelp(_R(IDC_MAPPING),      _R(IDBBL_FILLTOOL_FILLTILING),      _R(IDS_FILLTOOL_FILLTILING));
03530         SetGadgetHelp(_R(IDC_SELPOINT),     _R(IDBBL_FILLTOOL_FILLHANDLE),      _R(IDS_FILLTOOL_FILLHANDLE));
03531         //SetGadgetHelp(_R(IDC_SELCOLOUR),  _R(IDBBL_FILLTOOL_FILLCOLOUR),      _R(IDS_FILLTOOL_FILLCOLOUR));
03532     }
03533 
03534     ShowCommonEffect();
03535     ShowCommonMapping();
03536     ShowControlPointInfo();
03537 }

void GradInfoBarOp::ShowFractalInfo  ) 
 

Show info on a fractal fill.

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

Definition at line 3622 of file filltool.cpp.

03623 {
03624     if (OldMode != FRACTALFILL)
03625     {   
03626 //      InitTransType ();
03627         InitTesselate();
03628         InitEffect();
03629 
03630         SetGadgetHelp(_R(IDC_EFFECT),    _R(IDBBL_FILLTOOL_FILLEFFECT), _R(IDS_FILLTOOL_FILLEFFECT));
03631         SetGadgetHelp(_R(IDC_MAPPING),   _R(IDBBL_FILLTOOL_FILLTILING), _R(IDS_FILLTOOL_FILLTILING));
03632     }
03633 
03634     if (AttrFillGeometry::SelectionCount == 0)
03635     {
03636         SetGadgetHelp(_R(IDC_SELPOINT),  _R(IDBBL_FILLTOOL_FRACTALRES),  _R(IDS_FILLTOOL_FRACTALRES));
03637         SetGadgetHelp(_R(IDC_SELCOLOUR), _R(IDBBL_FILLTOOL_GRAININESS), _R(IDS_FILLTOOL_GRAININESS));
03638         SetGadgetWritable(_R(IDC_SELPOINT), TRUE);
03639         SetGadgetWritable(_R(IDC_SELCOLOUR), TRUE);
03640     }
03641     else
03642     {
03643         SetGadgetHelp(_R(IDC_SELPOINT),  _R(IDBBL_FILLTOOL_FILLHANDLE), _R(IDS_FILLTOOL_FILLHANDLE));
03644         SetGadgetHelp(_R(IDC_SELCOLOUR), _R(IDBBL_FILLTOOL_FILLCOLOUR), _R(IDS_FILLTOOL_FILLCOLOUR));
03645         SetGadgetWritable(_R(IDC_SELPOINT), FALSE);
03646         SetGadgetWritable(_R(IDC_SELCOLOUR), FALSE);
03647     }
03648 
03649 //  ShowCommonTranspType();
03650     ShowCommonTesselate();
03651     ShowCommonEffect();
03652 
03653     if (AttrFillGeometry::SelectionCount == 0)
03654     {
03655         ShowCommonBitmapDpi();
03656         ShowCommonFractalGrain();
03657     }
03658     else
03659     {
03660         ShowControlPointInfo();
03661     }
03662 }

void GradInfoBarOp::ShowGraduatedInfo  ) 
 

Show info on a graduated fill.

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

Definition at line 3549 of file filltool.cpp.

03550 {
03551     if (OldMode != GRADFILL && OldMode != GRADREPEATFILL)
03552     {   
03553         InitMapping();
03554         InitEffect();
03555 
03556         SetGadgetHelp(_R(IDC_EFFECT),       _R(IDBBL_FILLTOOL_FILLEFFECT),      _R(IDS_FILLTOOL_FILLEFFECT));
03557         SetGadgetHelp(_R(IDC_MAPPING),      _R(IDBBL_FILLTOOL_FILLTILING),      _R(IDS_FILLTOOL_FILLTILING));
03558         SetGadgetHelp(_R(IDC_SELPOINT),     _R(IDBBL_FILLTOOL_FILLHANDLE),      _R(IDS_FILLTOOL_FILLHANDLE));
03559         //SetGadgetHelp(_R(IDC_SELCOLOUR),  _R(IDBBL_FILLTOOL_FILLCOLOUR),      _R(IDS_FILLTOOL_FILLCOLOUR));
03560     }
03561 
03562     ShowCommonEffect();
03563     ShowCommonMapping();
03564     ShowControlPointInfo();
03565 }

void GradInfoBarOp::ShowInfo  ) 
 

Shows Info on the current selection.

Author:
Will_Cowling (Xara Group Ltd) <camelotdev@xara.com>
Date:
8/5/95
See also:
-

Definition at line 3295 of file filltool.cpp.

03296 {
03297     // Don't do anything if the Info bar isn't displayed
03298     if (!GradFillTool::IsCurrentTool() || !IsVisible()) return;
03299 
03300     // Now have a look at the selected objects
03301     Selection = GetApplication()->FindSelection();
03302 
03303     OldMode = Mode;
03304 
03305     ShowCommonType();
03306 
03307     // Now show different info depending on the type ...
03308     // (Well we will do eventually)
03309 
03310     switch (Mode)
03311     {
03312         case FLATFILL:
03313             ShowFlatInfo();
03314             break;
03315 
03316         case GRADFILL:
03317         case GRADREPEATFILL:
03318             ShowGraduatedInfo();
03319             break;
03320 
03321         case BITMAPFILL:
03322             ShowBitmapInfo();
03323             break;
03324 
03325         case FRACTALFILL:
03326             ShowFractalInfo();
03327             break;
03328 
03329         case NOISEFILL:
03330             ShowNoiseInfo();
03331             break;
03332 
03333         default:
03334             ShowGraduatedInfo();
03335             break;
03336     }
03337 
03338     EnableControls();
03339 }

void GradInfoBarOp::ShowNoiseInfo  ) 
 

Show info on a noise fill.

Author:
Mike_Kenny (Xara Group Ltd) <camelotdev@xara.com>
Date:
20/01/97

Definition at line 3674 of file filltool.cpp.

03675 {
03676     if (OldMode != NOISEFILL)
03677     {   
03678         InitTesselate();
03679         InitEffect();
03680 
03681         SetGadgetHelp(_R(IDC_EFFECT),       _R(IDBBL_FILLTOOL_FILLEFFECT),      _R(IDS_FILLTOOL_FILLEFFECT));
03682         SetGadgetHelp(_R(IDC_MAPPING),      _R(IDBBL_FILLTOOL_FILLTILING),      _R(IDS_FILLTOOL_FILLTILING));
03683     }
03684 
03685     if (AttrFillGeometry::SelectionCount == 0)
03686     {
03687         SetGadgetHelp(_R(IDC_SELPOINT),  _R(IDBBL_FILLTOOL_NOISERES),   _R(IDS_FILLTOOL_NOISERES));
03688         SetGadgetHelp(_R(IDC_SELCOLOUR), _R(IDBBL_FILLTOOL_NOISESCALE), _R(IDS_FILLTOOL_NOISESCALE));
03689         SetGadgetWritable(_R(IDC_SELPOINT), TRUE);
03690         SetGadgetWritable(_R(IDC_SELCOLOUR), TRUE);
03691     }
03692     else
03693     {
03694         SetGadgetHelp(_R(IDC_SELPOINT),  _R(IDBBL_FILLTOOL_FILLHANDLE), _R(IDS_FILLTOOL_FILLHANDLE));
03695         SetGadgetHelp(_R(IDC_SELCOLOUR), _R(IDBBL_FILLTOOL_FILLCOLOUR), _R(IDS_FILLTOOL_FILLCOLOUR));
03696         SetGadgetWritable(_R(IDC_SELPOINT), FALSE);
03697         SetGadgetWritable(_R(IDC_SELCOLOUR), FALSE);
03698     }
03699 
03700     ShowCommonTesselate();
03701     ShowCommonEffect();
03702 
03703     if (AttrFillGeometry::SelectionCount == 0)
03704     {
03705         ShowCommonBitmapDpi();
03706         ShowCommonNoiseScale();
03707     }
03708     else
03709     {
03710         ShowControlPointInfo();
03711     }
03712 }


Member Data Documentation

BOOL GradInfoBarOp::AllowForceToSimpleMapping [private]
 

Definition at line 528 of file filltool.h.

BOOL GradInfoBarOp::BitmapListChanged [private]
 

Definition at line 524 of file filltool.h.

SelRange::CommonAttribResult GradInfoBarOp::CommonAttr
 

Definition at line 516 of file filltool.h.

SelRange::CommonAttribResult GradInfoBarOp::CommonAttrEffect
 

Definition at line 517 of file filltool.h.

SelRange::CommonAttribResult GradInfoBarOp::CommonAttrMap
 

Definition at line 518 of file filltool.h.

AttrFillEffect* GradInfoBarOp::CommonEffect [private]
 

Definition at line 532 of file filltool.h.

AttrFillGeometry* GradInfoBarOp::CommonGeometry [private]
 

Definition at line 530 of file filltool.h.

AttrFillMapping* GradInfoBarOp::CommonMapping [private]
 

Definition at line 531 of file filltool.h.

INT32 GradInfoBarOp::CurrentBitmapIndex [static]
 

Definition at line 513 of file filltool.h.

INT32 GradInfoBarOp::CurrentEffectIndex [static]
 

Definition at line 510 of file filltool.h.

INT32 GradInfoBarOp::CurrentGeometryIndex [static]
 

Definition at line 508 of file filltool.h.

INT32 GradInfoBarOp::CurrentMappingIndex [static]
 

Definition at line 509 of file filltool.h.

INT32 GradInfoBarOp::CurrentTesselateIndex [static]
 

Definition at line 512 of file filltool.h.

BOOL GradInfoBarOp::EffectDisabled [private]
 

Definition at line 527 of file filltool.h.

CBiasGainGadget GradInfoBarOp::m_BiasGainGadget
 

Definition at line 542 of file filltool.h.

CBitmapGridDropDown GradInfoBarOp::m_oBitmapDropDown
 

Definition at line 543 of file filltool.h.

BOOL GradInfoBarOp::MappingDisabled [private]
 

Definition at line 526 of file filltool.h.

FillMode GradInfoBarOp::Mode [private]
 

Definition at line 521 of file filltool.h.

FillMode GradInfoBarOp::OldMode [private]
 

Definition at line 522 of file filltool.h.

SelRange* GradInfoBarOp::Selection
 

Definition at line 515 of file filltool.h.

INT32 GradInfoBarOp::SelEffectIndex [private]
 

Definition at line 536 of file filltool.h.

INT32 GradInfoBarOp::SelGeometryIndex [private]
 

Definition at line 534 of file filltool.h.

INT32 GradInfoBarOp::SelMappingIndex [private]
 

Definition at line 535 of file filltool.h.

INT32 GradInfoBarOp::SelPointIndex [private]
 

Definition at line 538 of file filltool.h.

INT32 GradInfoBarOp::SliderMax [private]
 

Definition at line 539 of file filltool.h.


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