From 9ce59d21d58a3bae5de116767bf81ee313208ff1 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Mon, 4 Jun 2018 10:36:57 +0000 Subject: [PATCH] tvplanit: Remove calls to DoubleBuffered in the units (flicker fixed in Laz trunk) git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6455 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/tvplanit/source/design/vpreg.pas | 32 +++++++++++++++++-- components/tvplanit/source/vpbase.pas | 17 +++++++--- components/tvplanit/source/vpbaseds.pas | 4 +-- components/tvplanit/source/vpcontactgrid.pas | 4 +-- components/tvplanit/source/vpdayview.pas | 4 +-- .../tvplanit/source/vpdayviewpainter.pas | 5 ++- components/tvplanit/source/vpmonthview.pas | 2 +- components/tvplanit/source/vptasklist.pas | 4 +-- components/tvplanit/source/vpweekview.pas | 4 +-- 9 files changed, 57 insertions(+), 19 deletions(-) diff --git a/components/tvplanit/source/design/vpreg.pas b/components/tvplanit/source/design/vpreg.pas index 7f8ce12dc..c974755e0 100644 --- a/components/tvplanit/source/design/vpreg.pas +++ b/components/tvplanit/source/design/vpreg.pas @@ -38,7 +38,7 @@ interface uses {$IFDEF LCL} LCLProc, LCLType, LCLIntf, LazFileUtils, - PropEdits, LazarusPackageIntf, FieldsEditor, ComponentEditors, + PropEdits, GraphPropEdits, LazarusPackageIntf, FieldsEditor, ComponentEditors, {$ELSE} Windows, {$IFDEF VERSION6} @@ -47,10 +47,16 @@ uses DsgnIntf, {$ENDIF} {$ENDIF} - Dialogs, Classes, Controls, TypInfo, Forms, SysUtils, + Dialogs, Classes, Controls, TypInfo, Forms, SysUtils, ImgList, VpDatePropEdit; type + { TVpCategoryInfoImageIndexProperty } + TVpCategoryInfoImageIndexProperty = class(TImageIndexPropertyEditor) + protected + function GetImageList: TCustomImageList; overload; + end; + {TDBStringProperty} TDBStringProperty = class(TStringProperty) public @@ -202,6 +208,25 @@ uses VpFlxDSEd1; { Field mapper component editor for the FlexDS } +(*****************************************************************************) +{ TVpCategoryInfoImageIndexProperty } + +function TVpCategoryInfoImageIndexProperty.GetImageList: TCustomImageList; +var + P: TPersistent; +begin + P := GetComponent(0); + if P is TVpCategoryInfo then begin + if TVpCategoryInfo(P).Owner is TVpCustomDatastore then begin + P := TVpCategoryInfo(P).Owner; + Result := TVpCustomDataStore(P).Images; + exit; + end; + end; + Result := nil; +end; + + (*****************************************************************************) { TDBStringProperty } @@ -615,6 +640,9 @@ begin 'DefaultEventSound', TWavFilenameProperty); {$ENDIF} + RegisterPropertyEditor(TypeInfo(TImageIndex), TVpCategoryInfo, + 'ImageIndex', TVpCategoryInfoImageIndexProperty); + RegisterPropertyEditor(TypeInfo(String), TVpCustomDatastore, 'DefaultEventSound', TVpWavFilenameProperty); diff --git a/components/tvplanit/source/vpbase.pas b/components/tvplanit/source/vpbase.pas index fcf8075ab..cc9a4a3fe 100644 --- a/components/tvplanit/source/vpbase.pas +++ b/components/tvplanit/source/vpbase.pas @@ -198,8 +198,11 @@ type end; {TVpCategoryColorMap} + TVpCategoryColorMap = class; + TVpCategoryInfo= class(TPersistent) private + FOwner: TComponent; // This is the DataStore. FCategoryIndex: Integer; protected FBackgroundColor: TColor; @@ -214,8 +217,9 @@ type procedure SetDescription(Value: string); procedure SetImageIndex(Value: TImageIndex); public - constructor Create; + constructor Create(AOwner: TComponent); destructor Destroy; override; + property Owner: TComponent read FOwner; published property BackgroundColor: TColor read FBackgroundColor write SetBackgroundColor default clWindow; @@ -228,10 +232,11 @@ type TVpCategoryColorMap = class(TPersistent) protected + FOwner: TComponent; FCat: array[0..9] of TVpCategoryInfo; procedure SetCat(AIndex: Integer; AValue: TVpCategoryInfo); public - constructor Create; + constructor Create(AOwner: TComponent); destructor Destroy; override; function GetColor(Index: Integer): TColor; function GetName(Index: Integer):string; @@ -695,7 +700,7 @@ end; (*****************************************************************************) { TVpCategoryColorMap } -constructor TVpCategoryColorMap.Create; +constructor TVpCategoryColorMap.Create(AOwner: TComponent); const CAT_COLORS: Array[0..9] of TColor = ( clNavy, clRed, clYellow, clLime, clPurple, clTeal, clFuchsia, clOlive, clAqua, clMaroon @@ -704,9 +709,10 @@ var i: Integer; begin inherited Create; + FOwner := AOwner; for i:=0 to High(FCat) do begin - FCat[i] := TVpCategoryInfo.Create; + FCat[i] := TVpCategoryInfo.Create(FOwner); FCat[i].FIndex := i; FCat[i].Color := CAT_COLORS[i]; FCat[i].Description := Format(RSCategoryDesc, [i]); @@ -751,9 +757,10 @@ end; (*****************************************************************************) { TVpCategoryInfo } -constructor TVpCategoryInfo.Create; +constructor TVpCategoryInfo.Create(AOwner: TComponent); begin inherited Create; + FOwner := AOwner; FBitmap := TBitmap.Create; FBackgroundColor := clWindow; FImageIndex := -1; diff --git a/components/tvplanit/source/vpbaseds.pas b/components/tvplanit/source/vpbaseds.pas index 8a488b1ca..56483b1ef 100644 --- a/components/tvplanit/source/vpbaseds.pas +++ b/components/tvplanit/source/vpbaseds.pas @@ -456,8 +456,8 @@ begin FResources := TVpResources.Create(Self); FTimeRange := TVpTimeRange.Create(Self); - FCategoryColorMap := TVpCategoryColorMap.Create; - FHiddenCategories := TVpCategoryInfo.Create; + FCategoryColorMap := TVpCategoryColorMap.Create(Self); + FHiddenCategories := TVpCategoryInfo.Create(Self); with FHiddenCategories do begin BackgroundColor := clSilver; Color := clGray; diff --git a/components/tvplanit/source/vpcontactgrid.pas b/components/tvplanit/source/vpcontactgrid.pas index 84b5afdb6..ca8e80ab8 100644 --- a/components/tvplanit/source/vpcontactgrid.pas +++ b/components/tvplanit/source/vpcontactgrid.pas @@ -351,7 +351,7 @@ begin TabStop := False; BorderStyle := bsNone; {$IFDEF VERSION4} - DoubleBuffered := False; +// DoubleBuffered := False; {$ENDIF} { make it tiny } Height := 1; @@ -446,7 +446,7 @@ begin { Set styles and initialize internal variables } {$IFDEF VERSION4} - DoubleBuffered := true; +// DoubleBuffered := true; {$ENDIF} FVisibleContacts := 0; FAllowInPlaceEdit := true; diff --git a/components/tvplanit/source/vpdayview.pas b/components/tvplanit/source/vpdayview.pas index d7a0e40cf..8430da033 100644 --- a/components/tvplanit/source/vpdayview.pas +++ b/components/tvplanit/source/vpdayview.pas @@ -540,7 +540,7 @@ begin inherited Create(AOwner); TabStop := False; BorderStyle := bsNone; - DoubleBuffered := False; +// DoubleBuffered := False; end; {=====} @@ -804,7 +804,7 @@ begin { Set styles and initialize internal variables } {$IFDEF VERSION4} - DoubleBuffered := true; +// DoubleBuffered := true; {$ENDIF} NumDays := 1; dvInLinkHandler := false; diff --git a/components/tvplanit/source/vpdayviewpainter.pas b/components/tvplanit/source/vpdayviewpainter.pas index 8b3d343e0..2a8857e6a 100644 --- a/components/tvplanit/source/vpdayviewpainter.pas +++ b/components/tvplanit/source/vpdayviewpainter.pas @@ -1599,7 +1599,10 @@ begin ppi := FDayView.Font.PixelsPerInch; f := FDayView.GetCanvasScaleFactor; w96 := FDayView.DataStore.ImagesWidth; - w := imgList.SizeForPPI[w96, ppi].CX; + if imgList <> nil then + w := imgList.SizeForPPI[w96, ppi].CX + else + w := w96; {$IFEND} {$ENDIF} diff --git a/components/tvplanit/source/vpmonthview.pas b/components/tvplanit/source/vpmonthview.pas index 2b3120ae5..efce3748c 100644 --- a/components/tvplanit/source/vpmonthview.pas +++ b/components/tvplanit/source/vpmonthview.pas @@ -457,7 +457,7 @@ begin { Set styles and initialize internal variables } {$IFDEF VERSION4} - DoubleBuffered := true; +// DoubleBuffered := true; {$ENDIF} FShowEvents := true; FEventDayStyle := []; diff --git a/components/tvplanit/source/vptasklist.pas b/components/tvplanit/source/vptasklist.pas index 880e2201b..b76c93008 100644 --- a/components/tvplanit/source/vptasklist.pas +++ b/components/tvplanit/source/vptasklist.pas @@ -426,7 +426,7 @@ begin TabStop := False; BorderStyle := bsNone; {$IFDEF VERSION4} - DoubleBuffered := False; +// DoubleBuffered := False; {$ENDIF} end; {=====} @@ -501,7 +501,7 @@ begin { Set styles and initialize internal variables } {$IFDEF VERSION4} - DoubleBuffered := true; +// DoubleBuffered := true; {$ENDIF} tlItemsBefore := 0; tlItemsAfter := 0; diff --git a/components/tvplanit/source/vpweekview.pas b/components/tvplanit/source/vpweekview.pas index 19144117e..2345d392d 100644 --- a/components/tvplanit/source/vpweekview.pas +++ b/components/tvplanit/source/vpweekview.pas @@ -333,7 +333,7 @@ begin TabStop := False; BorderStyle := bsNone; {$IFDEF VERSION4} - DoubleBuffered := False; +// DoubleBuffered := False; {$ENDIF} end; {=====} @@ -472,7 +472,7 @@ begin { Set styles and initialize internal variables } {$IFDEF VERSION4} - DoubleBuffered := true; +// DoubleBuffered := true; {$ENDIF} FWeekStartsOn := dtMonday;