jvcllaz: Fix full color component and property editors. Less hints and warnings.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6688 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2018-10-14 10:38:35 +00:00
parent 342ffe1313
commit 19f8c9b3b3
6 changed files with 79 additions and 92 deletions

View File

@ -30,11 +30,7 @@ unit JvFullColorEditors;
interface interface
uses uses
//Windows, Classes, ComCtrls, PropEdits;
Classes, propedits,
// DesignIntf, DesignEditors, VCLEditors,
ComCtrls,
JvFullColorCtrls;
type type
TJvColorIDEditor = class(TOrdinalProperty) TJvColorIDEditor = class(TOrdinalProperty)

View File

@ -25,16 +25,16 @@ Known Issues:
unit JvFullColorListForm; unit JvFullColorListForm;
{$I jvcl.inc} {$mode objfpc}{$H+}
interface interface
uses uses
Windows, Messages, SysUtils, // Windows, Messages,
Variants, SysUtils, //Variants,
Classes, Graphics, Controls, Forms, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ActnList, Buttons, ImgList, Dialogs, StdCtrls, ActnList, Buttons, ImgList,
JvFullColorForm, JvFullColorSpaces, JvFullColorDialogs, JvFullColorCtrls; JvFullColorSpaces, JvFullColorDialogs, JvFullColorCtrls;
type type
TJvFullColorListFrm = class(TForm) TJvFullColorListFrm = class(TForm)
@ -261,7 +261,6 @@ begin
begin begin
if odSelected in State then if odSelected in State then
Font.Color := clCaptionText; Font.Color := clCaptionText;
Pen.Style := psSolid; Pen.Style := psSolid;
Pen.Color := Brush.Color; Pen.Color := Brush.Color;
Brush.Style := bsSolid; Brush.Style := bsSolid;

View File

@ -30,10 +30,8 @@ unit JvFullColorSpacesEditors;
interface interface
uses uses
//Windows, LCLType,
Classes, Graphics, Classes, Graphics, StdCtrls, PropEdits,
PropEdits,
//DesignIntf, DesignEditors, DesignMenus, VCLEditors,
JvFullColorSpaces; JvFullColorSpaces;
type type
@ -53,8 +51,8 @@ type
procedure EditSpace(AColorID: TJvFullColorSpaceID); procedure EditSpace(AColorID: TJvFullColorSpaceID);
procedure SetColor(AFullColor: TJvFullColor); procedure SetColor(AFullColor: TJvFullColor);
// ICustomPropertyDrawing // ICustomPropertyDrawing
procedure PropDrawName(ACanvas: TCanvas; const ARect: TRect; ASelected: Boolean); procedure PropDrawName(ACanvas: TCanvas; const ARect: TRect; {%H-}AState: TPropEditDrawState); override;
procedure PropDrawValue(ACanvas: TCanvas; const ARect: TRect; ASelected: Boolean); procedure PropDrawValue(ACanvas: TCanvas; const ARect: TRect; {%H-}AState: TPropEditDrawState); override;
property IsColorProperty: Boolean read GetIsColorProperty; property IsColorProperty: Boolean read GetIsColorProperty;
end; end;
@ -62,12 +60,11 @@ type
private private
FColorSpace: TJvColorSpace; FColorSpace: TJvColorSpace;
FParent: TJvFullColorProperty; FParent: TJvFullColorProperty;
// FIsColorProperty: Boolean;
public public
constructor Create(AParent: TJvFullColorProperty; AColorSpace: TJvColorSpace; constructor Create(AParent: TJvFullColorProperty; AColorSpace: TJvColorSpace); reintroduce;
AIsColorProperty: Boolean); // AIsColorProperty: Boolean); reintroduce;
(************* NOT CONVERTED *** function GetName: ShortString; override; //string; override;
function GetName: string; override;
*******************************)
function GetAttributes: TPropertyAttributes; override; function GetAttributes: TPropertyAttributes; override;
function GetValue: string; override; function GetValue: string; override;
procedure GetProperties(Proc: TGetPropEditProc); override; //TGetPropProc); override; procedure GetProperties(Proc: TGetPropEditProc); override; //TGetPropProc); override;
@ -84,21 +81,19 @@ type
FParent:TJvFullColorSpaceProperty; FParent:TJvFullColorSpaceProperty;
public public
constructor Create(AParent: TJvFullColorSpaceProperty; constructor Create(AParent: TJvFullColorSpaceProperty;
AAxisIndex: TJvAxisIndex); AAxisIndex: TJvAxisIndex); reintroduce;
(**************** NOT CONVERTED *** function GetName: ShortString; override; //string; override;
function GetName: string; override;
**********************************)
function GetAttributes: TPropertyAttributes; override; function GetAttributes: TPropertyAttributes; override;
function GetValue: string; override; function GetValue: string; override;
procedure SetValue(const Value: string); override; procedure SetValue(const Value: string); override;
procedure GetValues(Proc: TGetStrProc); override; procedure GetValues(Proc: TGetStrProc); override;
// ICustomPropertyListDrawing // ICustomPropertyListDrawing
procedure ListMeasureHeight(const Value: string; ACanvas: TCanvas; procedure ListMeasureHeight(const AValue: ansistring; {%H-}AIndex: Integer;
var AHeight: Integer); ACanvas: TCanvas; var AHeight: Integer); override;
procedure ListMeasureWidth(const Value: string; ACanvas: TCanvas; procedure ListMeasureWidth(const AValue: ansistring; {%H-}AIndex: Integer;
var AWidth: Integer); ACanvas: TCanvas; var AWidth: Integer); override;
procedure ListDrawValue(const Value: string; ACanvas: TCanvas; procedure ListDrawValue(const AValue: ansistring; {%H-}AIndex: Integer;
const ARect: TRect; ASelected: Boolean); virtual; ACanvas: TCanvas; const ARect: TRect; AState: TPropEditDrawState); override;
property Parent: TJvFullColorSpaceProperty read FParent; property Parent: TJvFullColorSpaceProperty read FParent;
property AxisIndex: TJvAxisIndex read FAxisIndex; property AxisIndex: TJvAxisIndex read FAxisIndex;
end; end;
@ -114,21 +109,19 @@ type
FParent: TJvDEFColorSpaceProperty; FParent: TJvDEFColorSpaceProperty;
public public
constructor Create(AParent: TJvDEFColorSpaceProperty; constructor Create(AParent: TJvDEFColorSpaceProperty;
APredefinedFamily: TJvDEFFamily); APredefinedFamily: TJvDEFFamily); reintroduce;
(*******NOT CONVERTED *** function GetName: ShortString; override;
function GetName: string; override;
************************)
function GetAttributes: TPropertyAttributes; override; function GetAttributes: TPropertyAttributes; override;
function GetValue: string; override; function GetValue: string; override;
procedure SetValue(const Value: string); override; procedure SetValue(const Value: string); override;
procedure GetValues(Proc: TGetStrProc); override; procedure GetValues(Proc: TGetStrProc); override;
// ICustomPropertyListDrawing // ICustomPropertyListDrawing
procedure ListMeasureHeight(const Value: string; ACanvas: TCanvas; procedure ListMeasureHeight(const AValue: ansistring; {%H-}AIndex: Integer;
var AHeight: Integer); ACanvas: TCanvas; var AHeight: Integer); override;
procedure ListMeasureWidth(const Value: string; ACanvas: TCanvas; procedure ListMeasureWidth(const AValue: ansistring; {%H-}AIndex: Integer;
var AWidth: Integer); ACanvas: TCanvas; var AWidth: Integer); override;
procedure ListDrawValue(const Value: string; ACanvas: TCanvas; procedure ListDrawValue(const AValue: ansistring; {%H-}AIndex: Integer;
const ARect: TRect; ASelected: Boolean); virtual; ACanvas: TCanvas; const ARect: TRect; AState: TPropEditDrawState); override;
property Parent: TJvDEFColorSpaceProperty read FParent; property Parent: TJvDEFColorSpaceProperty read FParent;
property PredefinedFamily: TJvDEFFamily read FPredefinedFamily; property PredefinedFamily: TJvDEFFamily read FPredefinedFamily;
end; end;
@ -162,11 +155,12 @@ function FindFullColorSpaceEditor(AColorSpaceID: TJvFullColorSpaceID): TJvFullCo
var var
DefaultFullColorSpacePropertyClass: TJvFullColorSpacePropertyClass = TJvFullColorSpaceProperty; DefaultFullColorSpacePropertyClass: TJvFullColorSpacePropertyClass = TJvFullColorSpaceProperty;
implementation implementation
uses uses
Math, SysUtils, {DesignConst, }TypInfo, Forms; Math, SysUtils, TypInfo, Forms,
// JvFullColorDialogs, JvFullColorCtrls, JvFullColorListForm, JvJCLUtils; JvFullColorDialogs;
const const
COLOR_PREVIEW_RECT = 16; COLOR_PREVIEW_RECT = 16;
@ -186,7 +180,7 @@ begin
end; end;
procedure ColorPropertyListDrawValue(AColor: TColor; AValue: string; procedure ColorPropertyListDrawValue(AColor: TColor; AValue: string;
ACanvas: TCanvas; ARect: TRect; ASelected: Boolean); ACanvas: TCanvas; ARect: TRect; {%H-}ASelected: Boolean);
var var
OldBrushColor: TColor; OldBrushColor: TColor;
OldPenColor: TColor; OldPenColor: TColor;
@ -212,6 +206,7 @@ begin
end; end;
end; end;
//=== { TJvFullColorProperty } =============================================== //=== { TJvFullColorProperty } ===============================================
procedure TJvFullColorProperty.DialogApply(Sender: TObject; AFullColor: TJvFullColor); procedure TJvFullColorProperty.DialogApply(Sender: TObject; AFullColor: TJvFullColor);
@ -232,7 +227,6 @@ procedure TJvFullColorProperty.EditSpace(AColorID: TJvFullColorSpaceID);
var var
LColor: TJvFullColor; LColor: TJvFullColor;
begin begin
(******************** NOT CONVERTED ***
with ColorSpaceManager, TJvFullColorDialog.Create(nil) do with ColorSpaceManager, TJvFullColorDialog.Create(nil) do
try try
if IsColorProperty then if IsColorProperty then
@ -248,7 +242,7 @@ begin
FullColor := LColor; FullColor := LColor;
Title := ''; Title := '';
OnApply := DialogApply; OnApply := @DialogApply;
Options := [foFullOpen, foAllowSpaceChange, foShowNewPreview, foShowOldPreview, Options := [foFullOpen, foAllowSpaceChange, foShowNewPreview, foShowOldPreview,
foShowPredefined, foAllowVariable, foNoneAndDefault, foShowApply]; foShowPredefined, foAllowVariable, foNoneAndDefault, foShowApply];
@ -257,7 +251,6 @@ begin
finally finally
Free; Free;
end; end;
**********************)
end; end;
function TJvFullColorProperty.GetAttributes: TPropertyAttributes; function TJvFullColorProperty.GetAttributes: TPropertyAttributes;
@ -284,7 +277,7 @@ begin
for I := 0 to Count - 1 do for I := 0 to Count - 1 do
begin begin
CS := ColorSpaceByIndex[I]; CS := ColorSpaceByIndex[I];
Proc(FindFullColorSpaceEditor(CS.ID).Create(Self, CS, IsColorProperty)); Proc(FindFullColorSpaceEditor(CS.ID).Create(Self, CS)); //, IsColorProperty));
end; end;
end; end;
@ -311,15 +304,14 @@ begin
end; end;
procedure TJvFullColorProperty.PropDrawName(ACanvas: TCanvas; procedure TJvFullColorProperty.PropDrawName(ACanvas: TCanvas;
const ARect: TRect; ASelected: Boolean); const ARect: TRect; AState: TPropEditDrawState);
begin begin
(**************** NOT CONVERTED *** ACanvas.TextOut(ARect.Left, ARect.Top, GetName);
DefaultPropertyDrawName(Self, ACanvas, ARect); // DefaultPropertyDrawName(Self, ACanvas, ARect);
**********************************)
end; end;
procedure TJvFullColorProperty.PropDrawValue(ACanvas: TCanvas; procedure TJvFullColorProperty.PropDrawValue(ACanvas: TCanvas;
const ARect: TRect; ASelected: Boolean); const ARect: TRect; AState: TPropEditDrawState);
var var
OldPenColor, OldBrushColor: TColor; OldPenColor, OldBrushColor: TColor;
Right: Integer; Right: Integer;
@ -343,9 +335,8 @@ begin
Pen.Color := OldPenColor; Pen.Color := OldPenColor;
Brush.Color := OldBrushColor; Brush.Color := OldBrushColor;
end; end;
(******************** NOT CONVERTED *** ACanvas.TextOut(ARect.Left, ARect.Top, GetVisualValue);
DefaultPropertyDrawValue(Self, ACanvas, Rect(Right, ARect.Top, ARect.Right, ARect.Bottom)); // DefaultPropertyDrawValue(Self, ACanvas, Rect(Right, ARect.Top, ARect.Right, ARect.Bottom));
**************************************)
end; end;
procedure TJvFullColorProperty.SetColor(AFullColor: TJvFullColor); procedure TJvFullColorProperty.SetColor(AFullColor: TJvFullColor);
@ -380,11 +371,12 @@ end;
//=== { TJvFullColorSpaceProperty } ========================================== //=== { TJvFullColorSpaceProperty } ==========================================
constructor TJvFullColorSpaceProperty.Create(AParent: TJvFullColorProperty; constructor TJvFullColorSpaceProperty.Create(AParent: TJvFullColorProperty;
AColorSpace: TJvColorSpace; AIsColorProperty: Boolean); AColorSpace: TJvColorSpace); //; AIsColorProperty: Boolean);
begin begin
inherited Create(AParent); inherited Create(AParent);
FParent := AParent; FParent := AParent;
FColorSpace := AColorSpace; FColorSpace := AColorSpace;
// FIsColorProperty := AIsColorProperty;
end; end;
procedure TJvFullColorSpaceProperty.Edit; procedure TJvFullColorSpaceProperty.Edit;
@ -398,12 +390,10 @@ begin
paRevertable]; paRevertable];
end; end;
(******************* NOT CONVERTED *** function TJvFullColorSpaceProperty.GetName: ShortString;
function TJvFullColorSpaceProperty.GetName: string;
begin begin
Result := ColorSpace.ShortName; Result := ColorSpace.ShortName;
end; end;
************************************)
procedure TJvFullColorSpaceProperty.GetProperties(Proc: TGetPropEditProc); //TGetPropProc); procedure TJvFullColorSpaceProperty.GetProperties(Proc: TGetPropEditProc); //TGetPropProc);
var var
@ -433,12 +423,10 @@ begin
Result := [paValueList, paMultiSelect, paRevertable]; Result := [paValueList, paMultiSelect, paRevertable];
end; end;
(******************* NOT CONVERTED *** function TJvFullColorAxisProperty.GetName: ShortString;
function TJvFullColorAxisProperty.GetName: string;
begin begin
Result := Parent.ColorSpace.AxisName[AxisIndex]; Result := Parent.ColorSpace.AxisName[AxisIndex];
end; end;
************************************)
function TJvFullColorAxisProperty.GetValue: string; function TJvFullColorAxisProperty.GetValue: string;
begin begin
@ -455,28 +443,31 @@ begin
Proc(Format('$%.2x', [I])); Proc(Format('$%.2x', [I]));
end; end;
procedure TJvFullColorAxisProperty.ListDrawValue(const Value: string; procedure TJvFullColorAxisProperty.ListDrawValue(const AValue: ansistring;
ACanvas: TCanvas; const ARect: TRect; ASelected: Boolean); AIndex: Integer; ACanvas: TCanvas; const ARect: TRect;
AState: TPropEditDrawState);
var var
FullColor: TJvFullColor; FullColor: TJvFullColor;
LColor: TColor; lColor: TColor;
lSelected: Boolean;
begin begin
FullColor := ColorSpaceManager.ConvertToID(GetOrdValue, Parent.ColorSpace.ID); FullColor := ColorSpaceManager.ConvertToID(GetOrdValue, Parent.ColorSpace.ID);
FullColor := SetAxisValue(FullColor, AxisIndex, HexToInt(Value)); FullColor := SetAxisValue(FullColor, AxisIndex, HexToInt(AValue));
LColor := Parent.ColorSpace.ConvertToColor(FullColor); lColor := Parent.ColorSpace.ConvertToColor(FullColor);
ColorPropertyListDrawValue(LColor, Value, ACanvas, ARect, ASelected); lSelected := pedsSelected in AState;
ColorPropertyListDrawValue(lColor, AValue, ACanvas, ARect, lSelected);
end; end;
procedure TJvFullColorAxisProperty.ListMeasureHeight(const Value: string; procedure TJvFullColorAxisProperty.ListMeasureHeight(const AValue: string;
ACanvas: TCanvas; var AHeight: Integer); AIndex: Integer; ACanvas: TCanvas; var AHeight: Integer);
begin begin
AHeight := Max(ACanvas.TextHeight(Value), COLOR_PREVIEW_SIZE); AHeight := Max(ACanvas.TextHeight(AValue), COLOR_PREVIEW_SIZE);
end; end;
procedure TJvFullColorAxisProperty.ListMeasureWidth(const Value: string; procedure TJvFullColorAxisProperty.ListMeasureWidth(const AValue: string;
ACanvas: TCanvas; var AWidth: Integer); AIndex: Integer; ACanvas: TCanvas; var AWidth: Integer);
begin begin
AWidth := ACanvas.TextWidth(Value) + COLOR_PREVIEW_SIZE; AWidth := ACanvas.TextWidth(AValue) + COLOR_PREVIEW_SIZE;
end; end;
procedure TJvFullColorAxisProperty.SetValue(const Value: string); procedure TJvFullColorAxisProperty.SetValue(const Value: string);
@ -519,13 +510,11 @@ begin
Result := [paValueList, paMultiSelect, paRevertable]; Result := [paValueList, paMultiSelect, paRevertable];
end; end;
(*********************** NOT CONVERTED *** function TJvDEFColorSpaceIndentProperty.GetName: Shortstring;
function TJvDEFColorSpaceIndentProperty.GetName: string;
begin begin
Result := GetEnumName(TypeInfo(TJvDEFFamily), Ord(PredefinedFamily)); Result := GetEnumName(TypeInfo(TJvDEFFamily), Ord(PredefinedFamily));
Result := Copy(Result, 3, Length(Result) - 2); Result := Copy(Result, 3, Length(Result) - 2);
end; end;
****************************************)
function TJvDEFColorSpaceIndentProperty.GetValue: string; function TJvDEFColorSpaceIndentProperty.GetValue: string;
var var
@ -556,22 +545,25 @@ begin
end; end;
end; end;
procedure TJvDEFColorSpaceIndentProperty.ListDrawValue(const Value: string; procedure TJvDEFColorSpaceIndentProperty.ListDrawValue(const AValue: ansistring;
ACanvas: TCanvas; const ARect: TRect; ASelected: Boolean); AIndex: Integer; ACanvas: TCanvas; const ARect: TRect; AState: TPropEditDrawState);
var
lSelected: Boolean;
begin begin
ColorPropertyListDrawValue(PrettyNameToColor(Value), Value, ACanvas, ARect, ASelected); lSelected := pedsSelected in AState;
ColorPropertyListDrawValue(PrettyNameToColor(AValue), AValue, ACanvas, ARect, lSelected);
end; end;
procedure TJvDEFColorSpaceIndentProperty.ListMeasureHeight(const Value: string; procedure TJvDEFColorSpaceIndentProperty.ListMeasureHeight(const AValue: ansistring;
ACanvas: TCanvas; var AHeight: Integer); AIndex: Integer; ACanvas: TCanvas; var AHeight: Integer);
begin begin
AHeight := Max(ACanvas.TextHeight(Value), COLOR_PREVIEW_SIZE); AHeight := Max(ACanvas.TextHeight(AValue), COLOR_PREVIEW_SIZE);
end; end;
procedure TJvDEFColorSpaceIndentProperty.ListMeasureWidth(const Value: string; procedure TJvDEFColorSpaceIndentProperty.ListMeasureWidth(const AValue: ansistring;
ACanvas: TCanvas; var AWidth: Integer); AIndex: Integer; ACanvas: TCanvas; var AWidth: Integer);
begin begin
AWidth := ACanvas.TextWidth(Value) + COLOR_PREVIEW_SIZE; AWidth := ACanvas.TextWidth(AValue) + COLOR_PREVIEW_SIZE;
end; end;
procedure TJvDEFColorSpaceIndentProperty.SetValue(const Value: string); procedure TJvDEFColorSpaceIndentProperty.SetValue(const Value: string);

View File

@ -46,7 +46,7 @@ type
procedure FormShow(Sender: TObject); procedure FormShow(Sender: TObject);
procedure OkBtnClick(Sender: TObject); procedure OkBtnClick(Sender: TObject);
private private
FDesigner: TJvID3ControllerDesigner; //IDesigner; //FDesigner: TJvID3ControllerDesigner; //IDesigner;
FController: TJvID3Controller; FController: TJvID3Controller;
FFSDesigner: TJvID3ControllerDesigner; FFSDesigner: TJvID3ControllerDesigner;
FFrame: TJvID3Frame; FFrame: TJvID3Frame;

View File

@ -57,7 +57,7 @@ type
protected protected
procedure Commit; procedure Commit;
function CreateFramesEditor(ADesigner: TComponentEditorDesigner; function CreateFramesEditor(ADesigner: TComponentEditorDesigner;
AController: TJvID3Controller; var Shared: Boolean): TJvID3FramesEditor; AController: TJvID3Controller; out Shared: Boolean): TJvID3FramesEditor;
procedure RemoveTag; procedure RemoveTag;
procedure ShowFramesEditor(ADesigner: TComponentEditorDesigner; procedure ShowFramesEditor(ADesigner: TComponentEditorDesigner;
AController: TJvID3Controller); AController: TJvID3Controller);
@ -75,7 +75,7 @@ type
function GetFrameDescription(const FrameID: TJvID3FrameID): string; function GetFrameDescription(const FrameID: TJvID3FrameID): string;
public public
destructor Destroy; override; destructor Destroy; override;
procedure ID3Event(Event: TJvID3Event; Info: Longint); override; procedure ID3Event(Event: TJvID3Event; {%H-}Info: Longint); override;
property FramesEditor: TJvID3FramesEditor read FFramesEditor; property FramesEditor: TJvID3FramesEditor read FFramesEditor;
property FrameDescription[const FrameID: TJvID3FrameID]: string read GetFrameDescription; property FrameDescription[const FrameID: TJvID3FrameID]: string read GetFrameDescription;
end; end;
@ -572,7 +572,7 @@ begin
end; end;
function TJvID3ControllerEditor.CreateFramesEditor(ADesigner: TComponentEditorDesigner; function TJvID3ControllerEditor.CreateFramesEditor(ADesigner: TComponentEditorDesigner;
AController: TJvID3Controller; var Shared: Boolean): TJvID3FramesEditor; AController: TJvID3Controller; out Shared: Boolean): TJvID3FramesEditor;
begin begin
Shared := True; Shared := True;
if AController.Designer <> nil then if AController.Designer <> nil then

View File

@ -19,7 +19,7 @@ uses
JvId3v1, JvId3v2Base, JvId3v2, JvGradient, JvId3v2EditorForm, JvId3v1, JvId3v2Base, JvId3v2, JvGradient, JvId3v2EditorForm,
JvGradientHeaderPanel, JvSpecialProgress, JvGradientHeaderPanel, JvSpecialProgress,
JvFullColorSpaces, JvFullColorCtrls, JvFullColorEditors, JvFullColorSpacesEditors, JvFullColorSpaces, JvFullColorCtrls, JvFullColorEditors, JvFullColorSpacesEditors,
JvFullColorForm, JvFullColorDialogs, JvFullColorDialogs,
JvBmpAnimator; JvBmpAnimator;
procedure Register; procedure Register;