From: <mar...@us...> - 2007-07-19 06:59:29
|
Revision: 11423 http://svn.sourceforge.net/jvcl/?rev=11423&view=rev Author: marquardt Date: 2007-07-18 23:59:25 -0700 (Wed, 18 Jul 2007) Log Message: ----------- style cleaning Modified Paths: -------------- trunk/jvcl/run/JvLED.pas trunk/jvcl/run/JvProgressForm.pas trunk/jvcl/run/JvScreenSaver.pas trunk/jvcl/run/JvScrollPanel.pas trunk/jvcl/run/JvSpacer.pas trunk/jvcl/run/JvSpin.pas Modified: trunk/jvcl/run/JvLED.pas =================================================================== --- trunk/jvcl/run/JvLED.pas 2007-07-18 19:42:41 UTC (rev 11422) +++ trunk/jvcl/run/JvLED.pas 2007-07-19 06:59:25 UTC (rev 11423) @@ -37,8 +37,7 @@ {$IFDEF UNITVERSIONING} JclUnitVersioning, {$ENDIF UNITVERSIONING} - Windows, Messages, Controls, Forms, Graphics, ExtCtrls, - Classes, + Windows, Messages, Controls, Forms, Graphics, ExtCtrls, Classes, JvComponent; type @@ -177,9 +176,9 @@ Canvas.CopyMode := cmSrcAnd; with Canvas do begin - CopyRect( DestRect, FImgMask.Canvas, SrcRect); + CopyRect(DestRect, FImgMask.Canvas, SrcRect); CopyMode := cmSrcPaint; - CopyRect( DestRect, FImgPict.Canvas, SrcRect); + CopyRect(DestRect, FImgPict.Canvas, SrcRect); end; end; Modified: trunk/jvcl/run/JvProgressForm.pas =================================================================== --- trunk/jvcl/run/JvProgressForm.pas 2007-07-18 19:42:41 UTC (rev 11422) +++ trunk/jvcl/run/JvProgressForm.pas 2007-07-19 06:59:25 UTC (rev 11423) @@ -208,10 +208,6 @@ end; end; - - - - function TfrmProgress.ShowModal: Integer; begin // (p3) put topmost but only if not debugging Modified: trunk/jvcl/run/JvScreenSaver.pas =================================================================== --- trunk/jvcl/run/JvScreenSaver.pas 2007-07-18 19:42:41 UTC (rev 11422) +++ trunk/jvcl/run/JvScreenSaver.pas 2007-07-19 06:59:25 UTC (rev 11423) @@ -65,45 +65,46 @@ implementation - procedure TJvScreenSaver.Loaded; +type + TScreenSaverStyle = (ssConfigure, ssPassword, ssPreview, ssStart); var S: string; - Style: Integer; + Style: TScreenSaverStyle; H: THandle; begin inherited Loaded; - Style := 0; + Style := ssConfigure; if ParamCount <> 0 then begin S := UpperCase(ParamStr(1)); if S = 'C' then - Style := 0 + Style := ssConfigure else if S = 'A' then - Style := 1 + Style := ssPassword else if S = 'P' then - Style := 2 + Style := ssPreview else - Style := 3; + Style := ssStart; end; - if Style in [1, 2] then + if Style in [ssPassword, ssPreview] then H := StrToInt(ParamStr(2)) else H := 0; case Style of - 0: + ssConfigure: if Assigned(FOnConfigure) then FOnConfigure(Self); - 1: + ssPassword: if Assigned(FOnPasswordChange) then FOnPasswordChange(Self, H); - 2: + ssPreview: if Assigned(FOnPreview) then FOnPreview(Self, H); - 3: + ssStart: if Assigned(FOnStart) then FOnStart(Self); end; Modified: trunk/jvcl/run/JvScrollPanel.pas =================================================================== --- trunk/jvcl/run/JvScrollPanel.pas 2007-07-18 19:42:41 UTC (rev 11422) +++ trunk/jvcl/run/JvScrollPanel.pas 2007-07-19 06:59:25 UTC (rev 11423) @@ -72,7 +72,7 @@ FRepeat: Boolean; FFlat: Boolean; FAutoRepeat: Boolean; - FScrollAmount: Word; + FIncrement: Word; FTimer: TTimer; FKind: TJvScrollKind; procedure SetKind(Value: TJvScrollKind); @@ -83,18 +83,17 @@ procedure Paint; override; procedure Click; override; procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override; - procedure MouseUp(Button: TMouseButton; Shift: TShiftState; - X, Y: Integer); override; + procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override; procedure MouseEnter(Control: TControl); override; procedure MouseLeave(Control: TControl); override; procedure EnabledChanged; override; public constructor Create(AOwner: TComponent); override; published - property AutoRepeat: Boolean read FAutoRepeat write FAutoRepeat; - property Flat: Boolean read FFlat write SetFlat; - property Kind: TJvScrollKind read FKind write SetKind; - property Increment: Word read FScrollAmount write FScrollAmount; + property AutoRepeat: Boolean read FAutoRepeat write FAutoRepeat default False; + property Flat: Boolean read FFlat write SetFlat default False; + property Kind: TJvScrollKind read FKind write SetKind default sbUp; + property Increment: Word read FIncrement write FIncrement default 16; property Width default 16; property Height default 16; end; @@ -310,8 +309,10 @@ inherited Create(AOwner); ControlStyle := ControlStyle - [csDoubleClicks, csSetCaption]; FDown := False; - FScrollAmount := 16; + FIncrement := 16; FAutoRepeat := False; + FFlat := False; + FKind := sbUp; Width := 16; Height := 16; end; @@ -427,8 +428,7 @@ Repaint; end; -procedure TJvScrollButton.MouseUp(Button: TMouseButton; Shift: TShiftState; - X, Y: Integer); +procedure TJvScrollButton.MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin if not FRepeat then SetPosition; @@ -455,13 +455,13 @@ case FKind of sbUp: - Sp.ScrollBy(0, FScrollAmount); + Sp.ScrollBy(0, FIncrement); sbDown: - Sp.ScrollBy(0, -FScrollAmount); + Sp.ScrollBy(0, -FIncrement); sbLeft: - Sp.ScrollBy(FScrollAmount, 0); + Sp.ScrollBy(FIncrement, 0); sbRight: - Sp.ScrollBy(-FScrollAmount, 0); + Sp.ScrollBy(-FIncrement, 0); end; if Assigned(Sp.OnScrolled) then Sp.OnScrolled(Self, FKind); @@ -597,18 +597,15 @@ procedure TJvCustomScrollPanel.ArrangeChildren; var - i: Integer; + I: Integer; begin if FUpLeft = nil then Exit; DisableAlign; try - for i := 0 to ControlCount - 1 do - begin - if (Controls[i] = FUpLeft) or (Controls[i] = FDownRight) then - Continue; - Controls[i].SetBounds(Controls[i].Top, Controls[i].Left, Controls[i].Height, Controls[i].Width); - end; + for I := 0 to ControlCount - 1 do + if (Controls[I] <> FUpLeft) and (Controls[I] <> FDownRight) then + Controls[I].SetBounds(Controls[I].Top, Controls[I].Left, Controls[I].Height, Controls[I].Width); if not (csLoading in ComponentState) and (Align = alNone) then SetBounds(0, 0, Height, Width); finally @@ -618,7 +615,7 @@ procedure TJvCustomScrollPanel.UpdateVisible; var - Less, More, i: Integer; + Less, More, I: Integer; begin if FUpLeft = nil then Exit; @@ -630,13 +627,12 @@ begin Less := ClientWidth; More := 0; - for i := 0 to ControlCount - 1 do - begin - if (Controls[i] = FUpLeft) or (Controls[i] = FDownRight) or (Not Controls[i].Visible) then - Continue; - Less := Min(Controls[i].Top, Less); - More := Max(Controls[i].Top + Controls[i].Height, More); - end; + for I := 0 to ControlCount - 1 do + if (Controls[I] <> FUpLeft) and (Controls[I] <> FDownRight) and Controls[I].Visible then + begin + Less := Min(Controls[I].Top, Less); + More := Max(Controls[I].Top + Controls[I].Height, More); + end; FUpLeft.Visible := Less < 0; FDownRight.Visible := More > ClientHeight; end @@ -645,13 +641,12 @@ begin Less := ClientHeight; More := 0; - for i := 0 to ControlCount - 1 do - begin - if (Controls[i] = FUpLeft) or (Controls[i] = FDownRight) or (Not Controls[i].Visible) then - Continue; - Less := Min(Controls[i].Left, Less); - More := Max(Controls[i].Left + Controls[i].Width, More); - end; + for I := 0 to ControlCount - 1 do + if (Controls[I] <> FUpLeft) and (Controls[I] <> FDownRight) and Controls[I].Visible then + begin + Less := Min(Controls[I].Left, Less); + More := Max(Controls[I].Left + Controls[I].Width, More); + end; FUpLeft.Visible := Less < 0; FDownRight.Visible := More > ClientWidth; end @@ -711,8 +706,7 @@ FDownRight.Visible := True; end; -procedure TJvCustomScrollPanel.Notification(AComponent: TComponent; - Operation: TOperation); +procedure TJvCustomScrollPanel.Notification(AComponent: TComponent; Operation: TOperation); begin inherited Notification(AComponent, Operation); if Operation = opRemove then @@ -759,6 +753,8 @@ begin inherited Create(AComponent); AutoHide := True; + AutoRepeat := False; + ScrollDirection := sdHorizontal; end; {$IFDEF UNITVERSIONING} Modified: trunk/jvcl/run/JvSpacer.pas =================================================================== --- trunk/jvcl/run/JvSpacer.pas 2007-07-18 19:42:41 UTC (rev 11422) +++ trunk/jvcl/run/JvSpacer.pas 2007-07-19 06:59:25 UTC (rev 11423) @@ -81,7 +81,6 @@ implementation - constructor TJvSpacer.Create(AOwner: TComponent); begin inherited Create(AOwner); Modified: trunk/jvcl/run/JvSpin.pas =================================================================== --- trunk/jvcl/run/JvSpin.pas 2007-07-18 19:42:41 UTC (rev 11422) +++ trunk/jvcl/run/JvSpin.pas 2007-07-19 06:59:25 UTC (rev 11423) @@ -40,9 +40,7 @@ JclUnitVersioning, {$ENDIF UNITVERSIONING} SysUtils, Classes, - Windows, - Messages, CommCtrl, - ComCtrls, Controls, ExtCtrls, Graphics, Forms, + Windows, Messages, CommCtrl, ComCtrls, Controls, ExtCtrls, Graphics, Forms, JvEdit, JvExMask, JvMaskEdit, JvComponent; const @@ -89,13 +87,10 @@ procedure CheckButtonBitmaps; procedure RemoveButtonBitmaps; procedure Paint; override; - procedure MouseDown(Button: TMouseButton; Shift: TShiftState; - X, Y: Integer); override; + procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override; procedure MouseMove(Shift: TShiftState; X, Y: Integer); override; - procedure MouseUp(Button: TMouseButton; Shift: TShiftState; - X, Y: Integer); override; - procedure Notification(AComponent: TComponent; - Operation: TOperation); override; + procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override; + procedure Notification(AComponent: TComponent; Operation: TOperation); override; function MouseInBottomBtn(const P: TPoint): Boolean; {$IFDEF JVCLThemesEnabled} @@ -115,6 +110,8 @@ property DragMode; property Enabled; property Visible; + property Height default 20; + property Width default 20; property DownGlyph: TBitmap read GetDownGlyph write SetDownGlyph; property UpGlyph: TBitmap read GetUpGlyph write SetUpGlyph; property FocusControl: TWinControl read FFocusControl write SetFocusControl; @@ -254,7 +251,8 @@ property Increment: Extended read FIncrement write FIncrement stored IsIncrementStored; property MaxValue: Extended read FMaxValue write SetMaxValue stored IsMaxStored; property MinValue: Extended read FMinValue write SetMinValue stored IsMinStored; - property CheckOptions: TJvCheckOptions read FCheckOptions write FCheckOptions default [coCheckOnChange, coCheckOnExit, coCropBeyondLimit]; + property CheckOptions: TJvCheckOptions read FCheckOptions write FCheckOptions default + [coCheckOnChange, coCheckOnExit, coCropBeyondLimit]; property CheckMinValue: Boolean read FCheckMinValue write SetCheckMinValue stored StoreCheckMinValue; property CheckMaxValue: Boolean read FCheckMaxValue write SetCheckMaxValue stored StoreCheckMaxValue; property ValueType: TValueType read FValueType write SetValueType @@ -503,7 +501,7 @@ The face bitmaps of a spin button are stored in a TSpinButtonBitmaps object. Multiple spin buttons can use the same TSpinButtonBitmaps object. (That is, identical spin buttons (same height, width, button kind etc.) use the - same TSpinButtonbitmaps objects) The TSpinButtonBitmaps objects are managed + same TSpinButtonBitmaps objects) The TSpinButtonBitmaps objects are managed by a single TSpinButtonBitmapsManager object. } @@ -613,6 +611,40 @@ //=== { TJvCustomSpinEdit } ================================================== +constructor TJvCustomSpinEdit.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + + FThousands := False; //new + + //Polaris + FFocused := False; + FCheckOptions := [coCheckOnChange, coCheckOnExit, coCropBeyondLimit]; + FLCheckMinValue := True; + FLCheckMaxValue := True; + FCheckMinValue := False; + FCheckMaxValue := False; + //Polaris + ControlStyle := ControlStyle - [csSetCaption]; + FIncrement := 1.0; + FDecimal := 2; + FEditorEnabled := True; + FButtonKind := bkDiagonal; + FArrowKeys := True; + FShowButton := True; + RecreateButton; +end; + +destructor TJvCustomSpinEdit.Destroy; +begin + Destroying; + FChanging := True; + FreeAndNil(FButton); + FreeAndNil(FBtnWindow); + FreeAndNil(FUpDown); + inherited Destroy; +end; + procedure TJvCustomSpinEdit.Change; var OldText: string; @@ -649,8 +681,8 @@ // (outchy) only shift SelStart by the difference in number of ThousandSeparator BEFORE SelStart // do not shift if SelStart was clamped (new text length is shorter than OldSelText) if Thousands and (SelStart = OldSelStart) then - SelStart := SelStart + StrCharCount(Copy(Text, 1, SelStart), ThousandSeparator) - - StrCharCount(Copy(OldText, 1, SelStart),ThousandSeparator); + SelStart := SelStart + StrCharCount(Copy(Text, 1, SelStart), ThousandSeparator) - + StrCharCount(Copy(OldText, 1, SelStart), ThousandSeparator); inherited Change; FOldValue := Value; @@ -692,8 +724,6 @@ raise ERangeError.CreateResFmt(@RsEOutOfRangeFloat, [FMinValue, FMaxValue]); end; - - procedure TJvCustomSpinEdit.CMBiDiModeChanged(var Msg: TMessage); begin inherited; @@ -708,33 +738,6 @@ SetEditRect; end; - - -constructor TJvCustomSpinEdit.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - - FThousands := False; //new - - //Polaris - FFocused := False; - FCheckOptions := [coCheckOnChange, coCheckOnExit, coCropBeyondLimit]; - FLCheckMinValue := True; - FLCheckMaxValue := True; - FCheckMinValue := False; - FCheckMaxValue := False; - //Polaris - ControlStyle := ControlStyle - [csSetCaption]; - FIncrement := 1.0; - FDecimal := 2; - FEditorEnabled := True; - FButtonKind := bkDiagonal; - FArrowKeys := True; - FShowButton := True; - RecreateButton; -end; - - procedure TJvCustomSpinEdit.CreateParams(var Params: TCreateParams); const Alignments: array [Boolean, TAlignment] of DWORD = @@ -743,8 +746,7 @@ inherited CreateParams(Params); // Polaris: // or ES_MULTILINE - Params.Style := Params.Style or WS_CLIPCHILDREN or - Alignments[UseRightToLeftAlignment, FAlignment]; + Params.Style := Params.Style or WS_CLIPCHILDREN or Alignments[UseRightToLeftAlignment, FAlignment]; end; procedure TJvCustomSpinEdit.CreateWnd; @@ -753,7 +755,6 @@ SetEditRect; end; - procedure TJvCustomSpinEdit.DataChanged; var EditFormat: string; @@ -779,25 +780,6 @@ Result := ',0.##'; end; -destructor TJvCustomSpinEdit.Destroy; -begin - Destroying; - FChanging := True; - if FButton <> nil then - begin - FButton.Free; - FButton := nil; - FBtnWindow.Free; - FBtnWindow := nil; - end; - if FUpDown <> nil then - begin - FUpDown.Free; - FUpDown := nil; - end; - inherited Destroy; -end; - procedure TJvCustomSpinEdit.BoundsChanged; var MinHeight: Integer; @@ -868,13 +850,12 @@ procedure TJvCustomSpinEdit.FocusKilled(NextWnd: THandle); begin - if ([coCropBeyondLimit, coCheckOnExit] <= CheckOptions) and - not (csDesigning in ComponentState) then + if ([coCropBeyondLimit, coCheckOnExit] <= CheckOptions) and not (csDesigning in ComponentState) then SetValue(CheckValue(Value)); inherited FocusKilled(NextWnd); end; -function TJvCustomSpinEdit.DoMouseWheel(Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint): Boolean; +function TJvCustomSpinEdit.DoMouseWheel(Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint): Boolean; begin if WheelDelta > 0 then UpClick(nil) @@ -1089,7 +1070,7 @@ I: Integer; begin //Polaris - // (outchy) moved at the begining, hittinh '.' now behaves like hitting the decimal separator + // (outchy) moved at the beginning, hitting '.' now behaves like hitting the decimal separator if (Key = '.') and (not Thousands or (ThousandSeparator <> '.')) then Key := DecimalSeparator; @@ -1118,7 +1099,7 @@ inherited KeyPress(Key); if (Key = Cr) or (Key = Esc) then begin - { must catch and remove this, since is actually multi-line } + { must catch and remove this, since it is actually multi-line } GetParentForm(Self).Perform(CM_DIALOGKEY, Byte(Key), 0); if Key = Cr then Key := #0; @@ -1342,17 +1323,17 @@ procedure TJvCustomSpinEdit.SetMaxValue(NewValue: Extended); var Z: Boolean; - b: Boolean; + B: Boolean; begin if NewValue <> FMaxValue then begin - b := not StoreCheckMaxValue; + B := not StoreCheckMaxValue; Z := (FMaxValue = 0) <> (NewValue = 0); FMaxValue := NewValue; if Z and FLCheckMaxValue then begin SetCheckMaxValue(CheckDefaultRange(True)); - if b and FLCheckMinValue then + if B and FLCheckMinValue then SetCheckMinValue(CheckDefaultRange(False)); end; SetValue(Value); @@ -1362,17 +1343,17 @@ procedure TJvCustomSpinEdit.SetMinValue(NewValue: Extended); var Z: Boolean; - b: Boolean; + B: Boolean; begin if NewValue <> FMinValue then begin - b := not StoreCheckMinValue; + B := not StoreCheckMinValue; Z := (FMinValue = 0) <> (NewValue = 0); FMinValue := NewValue; if Z and FLCheckMinValue then begin SetCheckMinValue(CheckDefaultRange(False)); - if b and FLCheckMaxValue then + if B and FLCheckMaxValue then SetCheckMaxValue(CheckDefaultRange(True)); end; SetValue(Value); @@ -1451,6 +1432,35 @@ //=== { TJvSpinButton } ====================================================== +constructor TJvSpinButton.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + FButtonStyle := sbsDefault; + FUpBitmap := TBitmap.Create; + FDownBitmap := TBitmap.Create; + FUpBitmap.OnChange := GlyphChanged; + FDownBitmap.OnChange := GlyphChanged; + Height := 20; + Width := 20; + FLastDown := sbNotDown; + FButtonBitmaps := nil; + FInitRepeatPause := DefaultInitRepeatPause; + FRepeatPause := DefaultRepeatPause; + + SpinButtonBitmapsManager.AddClient; +end; + +destructor TJvSpinButton.Destroy; +begin + RemoveButtonBitmaps; + SpinButtonBitmapsManager.RemoveClient; + + FUpBitmap.Free; + FDownBitmap.Free; + FRepeatTimer.Free; + inherited Destroy; +end; + procedure TJvSpinButton.BottomClick; begin if Assigned(FOnBottomClick) then @@ -1476,7 +1486,6 @@ end; end; - procedure TJvSpinButton.CMSysColorChange(var Msg: TMessage); begin // The buttons we draw are buffered, thus we need to repaint them to theme changes etc. @@ -1484,36 +1493,6 @@ TSpinButtonBitmaps(FButtonBitmaps).Reset; end; - -constructor TJvSpinButton.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - FButtonStyle := sbsDefault; - FUpBitmap := TBitmap.Create; - FDownBitmap := TBitmap.Create; - FUpBitmap.OnChange := GlyphChanged; - FDownBitmap.OnChange := GlyphChanged; - Height := 20; - Width := 20; - FLastDown := sbNotDown; - FButtonBitmaps := nil; - FInitRepeatPause := DefaultInitRepeatPause; - FRepeatPause := DefaultRepeatPause; - - SpinButtonBitmapsManager.AddClient; -end; - -destructor TJvSpinButton.Destroy; -begin - RemoveButtonBitmaps; - SpinButtonBitmapsManager.RemoveClient; - - FUpBitmap.Free; - FDownBitmap.Free; - FRepeatTimer.Free; - inherited Destroy; -end; - function TJvSpinButton.GetDownGlyph: TBitmap; begin Result := FDownBitmap; @@ -1527,13 +1506,12 @@ procedure TJvSpinButton.GlyphChanged(Sender: TObject); begin if Sender is TBitmap then - (Sender as TBitmap).Transparent := True; + TBitmap(Sender).Transparent := True; RemoveButtonBitmaps; Invalidate; end; -procedure TJvSpinButton.MouseDown(Button: TMouseButton; Shift: TShiftState; - X, Y: Integer); +procedure TJvSpinButton.MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin inherited MouseDown(Button, Shift, X, Y); if (Button = mbLeft) and Enabled then @@ -1576,7 +1554,7 @@ begin if csDesigning in ComponentState then Exit; - { (rb) only themed spin buttons have hot states, so it's not necessairy + { (rb) only themed spin buttons have hot states, so it's not necessary to calc FMouseInBottomBtn and FMouseInTopBtn for non-themed apps } if not FMouseInTopBtn and not FMouseInBottomBtn then begin @@ -1684,8 +1662,7 @@ {$ENDIF JVCLThemesEnabled} end; -procedure TJvSpinButton.MouseUp(Button: TMouseButton; Shift: TShiftState; - X, Y: Integer); +procedure TJvSpinButton.MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin inherited MouseUp(Button, Shift, X, Y); if FDragging then @@ -1700,8 +1677,7 @@ end; end; -procedure TJvSpinButton.Notification(AComponent: TComponent; - Operation: TOperation); +procedure TJvSpinButton.Notification(AComponent: TComponent; Operation: TOperation); begin inherited Notification(AComponent, Operation); if (Operation = opRemove) and (AComponent = FFocusControl) then @@ -1819,11 +1795,11 @@ vtFloat: begin if FDisplayFormat <> '' then - try - Result := StrToFloat(TextToValText(Text)); - except - Result := FMinValue; - end + try + Result := StrToFloat(TextToValText(Text)); + except + Result := FMinValue; + end else if not TextToFloat(PChar(RemoveThousands(Text)), Result, fvExtended) then Result := FMinValue; @@ -1898,8 +1874,6 @@ inherited Resize; end; - - procedure TJvUpDown.ScrollMessage(var Msg: TWMVScroll); begin if Msg.ScrollCode = SB_THUMBPOSITION then @@ -1932,34 +1906,8 @@ ScrollMessage(Msg); end; - - - - //=== { TSpinButtonBitmaps } ================================================= -procedure TSpinButtonBitmaps.AddClient; -begin - Inc(FClientCount); -end; - -function TSpinButtonBitmaps.CompareWith(const AWidth, AHeight: Integer; - const AStyle: TJvSpinButtonStyle; const ACustomGlyphs: Boolean): Integer; -begin - // used by the binary search - Result := Self.Width - AWidth; - if Result = 0 then - begin - Result := Self.Height - AHeight; - if Result = 0 then - begin - Result := Ord(Self.Style) - Ord(AStyle); - if Result = 0 then - Result := Ord(Self.CustomGlyphs) - Ord(ACustomGlyphs); - end; - end; -end; - constructor TSpinButtonBitmaps.Create(AManager: TSpinButtonBitmapsManager; const AWidth, AHeight: Integer; const AStyle: TJvSpinButtonStyle; const ACustomGlyphs: Boolean); begin @@ -1998,6 +1946,28 @@ inherited Destroy; end; +procedure TSpinButtonBitmaps.AddClient; +begin + Inc(FClientCount); +end; + +function TSpinButtonBitmaps.CompareWith(const AWidth, AHeight: Integer; + const AStyle: TJvSpinButtonStyle; const ACustomGlyphs: Boolean): Integer; +begin + // used by the binary search + Result := Self.Width - AWidth; + if Result = 0 then + begin + Result := Self.Height - AHeight; + if Result = 0 then + begin + Result := Ord(Self.Style) - Ord(AStyle); + if Result = 0 then + Result := Ord(Self.CustomGlyphs) - Ord(ACustomGlyphs); + end; + end; +end; + procedure TSpinButtonBitmaps.Draw(ACanvas: TCanvas; const ADown: TSpinButtonState; const AEnabled, AMouseInTopBtn, AMouseInBottomBtn: Boolean); begin @@ -2144,12 +2114,16 @@ CDetails: array [TButtonPartState] of TThemedButton = (tbPushButtonNormal, tbPushButtonHot, tbPushButtonPressed, tbPushButtonDisabled); var + I: TButtonPartState; TemplateButtons: array [TButtonPartState] of TBitmap; ThemeColors: array [0..2] of Cardinal; ButtonRect: TRect; PaintRect: TRect; TopRegion, BottomRegion: HRGN; UpBitmap, DownBitmap: TBitmap; + ptButton: array [0..2] of TPoint; + State: TButtonPartState; + Details: TThemedElementDetails; procedure ConstructThemedButton(ABitmap: TBitmap; const AUpState, ADownState: TButtonPartState); begin @@ -2192,15 +2166,9 @@ end; end; -var - ptButton: array [0..2] of TPoint; - State: TButtonPartState; - Details: TThemedElementDetails; begin - TemplateButtons[bpsNormal] := TBitmap.Create; - TemplateButtons[bpsHot] := TBitmap.Create; - TemplateButtons[bpsPressed] := TBitmap.Create; - TemplateButtons[bpsDisabled] := TBitmap.Create; + for I := Low(TemplateButtons) to High(TemplateButtons) do + TemplateButtons[I] := TBitmap.Create; try ButtonRect := Bounds(0, 0, Width, Height); PaintRect := ButtonRect; @@ -2264,17 +2232,14 @@ DownBitmap.Free; end; finally - TemplateButtons[bpsNormal].Free; - TemplateButtons[bpsHot].Free; - TemplateButtons[bpsPressed].Free; - TemplateButtons[bpsDisabled].Free; + for I := Low(TemplateButtons) to High(TemplateButtons) do + TemplateButtons[I].Free; end; end; {$ENDIF JVCLThemesEnabled} -procedure TSpinButtonBitmaps.DrawBitmap(ABitmap: TBitmap; - ADownState: TSpinButtonState; const Enabled: Boolean); +procedure TSpinButtonBitmaps.DrawBitmap(ABitmap: TBitmap; ADownState: TSpinButtonState; const Enabled: Boolean); const CColors: TColorArray = (clBtnShadow, clBtnHighlight, cl3DDkShadow); var @@ -2549,8 +2514,7 @@ begin H := Height div 2; R := Bounds(0, 0, Width, H); - if AState = sbTopDown then - else + if AState <> sbTopDown then R.Bottom := R.Bottom + 1; R1 := Bounds(0, H, Width, Height); R1.Bottom := Height; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |