You've already forked lazarus-ccr
jvcllaz: Add examples for full color dialogs
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6685 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -0,0 +1,72 @@
|
||||
object JvFullColorCircleDlgMainFrm: TJvFullColorCircleDlgMainFrm
|
||||
Left = 498
|
||||
Height = 394
|
||||
Top = 236
|
||||
Width = 343
|
||||
BorderStyle = bsDialog
|
||||
Caption = 'JvFullColorCircleDlgMainFrm'
|
||||
ClientHeight = 394
|
||||
ClientWidth = 343
|
||||
Color = clBtnFace
|
||||
Font.Color = clWindowText
|
||||
KeyPreview = True
|
||||
OnCreate = FormCreate
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '2.1.0.0'
|
||||
object Bevel: TBevel
|
||||
Left = 16
|
||||
Height = 108
|
||||
Top = 48
|
||||
Width = 108
|
||||
Style = bsRaised
|
||||
end
|
||||
object Image: TImage
|
||||
Left = 20
|
||||
Height = 100
|
||||
Top = 52
|
||||
Width = 100
|
||||
Center = True
|
||||
end
|
||||
object LabelImage: TLabel
|
||||
Left = 24
|
||||
Height = 15
|
||||
Top = 16
|
||||
Width = 39
|
||||
Caption = 'Image :'
|
||||
Layout = tlCenter
|
||||
ParentColor = False
|
||||
end
|
||||
object Memo: TMemo
|
||||
Left = 8
|
||||
Height = 65
|
||||
Top = 160
|
||||
Width = 129
|
||||
Alignment = taCenter
|
||||
BorderStyle = bsNone
|
||||
Lines.Strings = (
|
||||
'Original image'
|
||||
)
|
||||
OnKeyDown = MemoKeyDown
|
||||
OnKeyPress = MemoKeyPress
|
||||
ParentColor = True
|
||||
TabOrder = 0
|
||||
end
|
||||
object ComboBoxFileName: TComboBox
|
||||
Left = 72
|
||||
Height = 23
|
||||
Top = 16
|
||||
Width = 257
|
||||
DropDownCount = 24
|
||||
ItemHeight = 15
|
||||
OnClick = ComboBoxFileNameSelect
|
||||
OnSelect = ComboBoxFileNameSelect
|
||||
Style = csDropDownList
|
||||
TabOrder = 1
|
||||
end
|
||||
object JvFullColorCircleDialog: TJvFullColorCircleDialog
|
||||
HelpContext = 0
|
||||
OnApply = JvFullColorCircleDialogApply
|
||||
left = 184
|
||||
top = 80
|
||||
end
|
||||
end
|
@ -0,0 +1,382 @@
|
||||
{******************************************************************
|
||||
|
||||
JEDI-VCL Demo
|
||||
|
||||
Copyright (C) 2004 Project JEDI
|
||||
|
||||
Original author: Florent Ouchet [ouchet dott florent att laposte dott net]
|
||||
|
||||
Contributor(s):
|
||||
|
||||
You may retrieve the latest version of this file at the JEDI-JVCL
|
||||
home page, located at http://jvcl.delphi-jedi.org
|
||||
|
||||
The contents of this file are used with permission, subject to
|
||||
the Mozilla Public License Version 1.1 (the "License"); you may
|
||||
not use this file except in compliance with the License. You may
|
||||
obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/MPL-1_1Final.html
|
||||
|
||||
Software distributed under the License is distributed on an
|
||||
"AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
implied. See the License for the specific language governing
|
||||
rights and limitations under the License.
|
||||
|
||||
******************************************************************}
|
||||
|
||||
unit JvFullColorCircleDialogMainForm;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, ExtCtrls, StdCtrls, JvFullColorSpaces, JvFullColorCircleForm,
|
||||
JvFullColorDialogs, JvFullColorRotate;
|
||||
|
||||
type
|
||||
|
||||
{ TJvFullColorCircleDlgMainFrm }
|
||||
|
||||
TJvFullColorCircleDlgMainFrm = class(TForm)
|
||||
Image: TImage;
|
||||
Bevel: TBevel;
|
||||
Memo: TMemo;
|
||||
LabelImage: TLabel;
|
||||
ComboBoxFileName: TComboBox;
|
||||
JvFullColorCircleDialog: TJvFullColorCircleDialog;
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure MemoKeyDown(Sender: TObject; var Key: Word;
|
||||
Shift: TShiftState);
|
||||
procedure MemoKeyPress(Sender: TObject; var Key: Char);
|
||||
procedure ComboBoxFileNameSelect(Sender: TObject);
|
||||
procedure JvFullColorCircleDialogApply(Sender: TObject);
|
||||
public
|
||||
Images: array [0..6] of TImage;
|
||||
Memos: array [0..6] of TMemo;
|
||||
procedure CustomizeDblClick(Sender: TObject);
|
||||
procedure RotateCustomValues;
|
||||
procedure FormatMemo(AMemo: TMemo; const Delta: TJvColorDelta);
|
||||
end;
|
||||
|
||||
var
|
||||
JvFullColorCircleDlgMainFrm: TJvFullColorCircleDlgMainFrm;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
uses Contnrs;
|
||||
|
||||
resourcestring
|
||||
RsCustomize = 'Dbl-click to customize';
|
||||
|
||||
var
|
||||
ImgDir: String = '';
|
||||
|
||||
type
|
||||
TJvColorDeltaList = class (TObjectList)
|
||||
private
|
||||
function GetItems(Index: Integer): TJvColorDelta;
|
||||
procedure SetItems(Index: Integer; const Value: TJvColorDelta);
|
||||
public
|
||||
property Items[Index: Integer]: TJvColorDelta read GetItems write SetItems; default;
|
||||
end;
|
||||
|
||||
var
|
||||
ColorDeltas: TJvColorDeltaList;
|
||||
|
||||
procedure TJvFullColorCircleDlgMainFrm.FormCreate(Sender: TObject);
|
||||
var
|
||||
X, Y: Integer;
|
||||
PitchX, PitchY: Integer;
|
||||
LImage: TImage;
|
||||
LMemo: TMemo;
|
||||
LBevel: TBevel;
|
||||
Index: Integer;
|
||||
LSearchRec: TSearchRec;
|
||||
begin
|
||||
ImgDir := IncludeTrailingPathDelimiter(GetCurrentDir) + '..\..\design\JvCtrls\images\';
|
||||
if FindFirst(ImgDir + '*.png', faAnyFile, LSearchRec) = 0 then
|
||||
repeat
|
||||
ComboBoxFileName.Items.Add(LSearchRec.Name);
|
||||
until FindNext(LSearchRec) <> 0;
|
||||
FindClose(LSearchRec);
|
||||
|
||||
PitchX := Memo.Width + 32;
|
||||
PitchY := Memo.Top + Memo.Height - Image.Top + 31;
|
||||
Index := 0;
|
||||
Image.Picture.Bitmap := TBitmap.Create;
|
||||
for X := 0 to 3 do
|
||||
for Y := 0 to 1 do
|
||||
if (X <> 0) or (Y <> 0) then
|
||||
begin
|
||||
LBevel := TBevel.Create(Self);
|
||||
LBevel.Parent := Self;
|
||||
LBevel.Style := bsRaised;
|
||||
LBevel.SetBounds(Bevel.Left+X*PitchX, Bevel.Top+Y*PitchY, Bevel.Width, Bevel.Height);
|
||||
LImage := TImage.Create(Self);
|
||||
LImage.Parent := Self;
|
||||
LImage.Stretch := False;
|
||||
LImage.Center := true;
|
||||
LImage.Picture.Bitmap := TBitmap.Create;
|
||||
LImage.SetBounds(Image.Left+X*PitchX, Image.Top+Y*PitchY, Image.Width, Image.Height);
|
||||
LMemo := TMemo.Create(Self);
|
||||
LMemo.Parent := Self;
|
||||
LMemo.BorderStyle := bsNone;
|
||||
LMemo.ParentColor := True;
|
||||
LMemo.OnKeyDown := @MemoKeyDown;
|
||||
LMemo.OnKeyPress := @MemoKeyPress;
|
||||
LMemo.SetBounds(Memo.Left+X*PitchX, Memo.Top+Y*PitchY, Memo.Width, Memo.Height);
|
||||
LMemo.Alignment := taCenter;
|
||||
if (X = 3) and (Y = 1) then
|
||||
begin
|
||||
LImage.OnDblClick := @CustomizeDblClick;
|
||||
LMemo.OnDblClick := @CustomizeDblClick;
|
||||
ClientWidth := LMemo.Left+LMemo.Width-1+Memo.Left;
|
||||
ClientHeight := LMemo.Top+LMemo.Height-1+Image.Top;
|
||||
end;
|
||||
Memos[Index] := LMemo;
|
||||
Images[Index] := LImage;
|
||||
Inc(Index);
|
||||
end;
|
||||
ComboBoxFileName.ItemIndex := 0;
|
||||
ComboBoxFileNameSelect(ComboBoxFileName);
|
||||
end;
|
||||
|
||||
procedure TJvFullColorCircleDlgMainFrm.CustomizeDblClick(Sender: TObject);
|
||||
begin
|
||||
if JvFullColorCircleDialog.Execute then
|
||||
RotateCustomValues;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorCircleDlgMainFrm.MemoKeyDown(Sender: TObject; var Key: Word;
|
||||
Shift: TShiftState);
|
||||
begin
|
||||
Key := 0; // discard any key but Enabled=False affects the text rendering
|
||||
end;
|
||||
|
||||
procedure TJvFullColorCircleDlgMainFrm.MemoKeyPress(Sender: TObject; var Key: Char);
|
||||
begin
|
||||
Key := #0; // discard any key but Enabled=False affects the text rendering
|
||||
end;
|
||||
|
||||
procedure TJvFullColorCircleDlgMainFrm.ComboBoxFileNameSelect(Sender: TObject);
|
||||
var
|
||||
Index: Integer;
|
||||
fn: String;
|
||||
begin
|
||||
if ComboboxFileName.ItemIndex = -1 then
|
||||
exit;
|
||||
|
||||
if Image.Picture.Bitmap <> nil then begin
|
||||
fn := ImgDir + ComboboxFileName.Items[ComboboxFileName.ItemIndex];
|
||||
if FileExists(fn) then
|
||||
Image.Picture.LoadFromFile(fn)
|
||||
else
|
||||
MessageDlg(Format('File "%s" not found.', [fn]), mtError, [mbOK], 0);
|
||||
end;
|
||||
|
||||
// Image.Picture.Bitmap := TBitmap.Create;
|
||||
// Image.Picture.Bitmap.LoadFromFile(ComboBoxFileName.Items[ComboBoxFileName.ItemIndex]);
|
||||
with Memos[6].Lines do
|
||||
begin
|
||||
Clear;
|
||||
Add(RsCustomize);
|
||||
end;
|
||||
Images[6].Picture.Bitmap.FreeImage;
|
||||
for Index := Low(Images) to High(Images)-1 do
|
||||
begin
|
||||
Images[Index].Picture.Bitmap.FreeImage;
|
||||
RotateBitmap(Image.Picture.Bitmap,Images[Index].Picture.Bitmap,ColorDeltas[Index]);
|
||||
FormatMemo(Memos[Index],ColorDeltas[Index]);
|
||||
end;
|
||||
RotateCustomValues;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorCircleDlgMainFrm.RotateCustomValues;
|
||||
begin
|
||||
RotateBitmap(Image.Picture.Bitmap,Images[6].Picture.Bitmap,JvFullColorCircleDialog.Delta);
|
||||
FormatMemo(Memos[6],JvFullColorCircleDialog.Delta);
|
||||
end;
|
||||
|
||||
procedure TJvFullColorCircleDlgMainFrm.FormatMemo(AMemo: TMemo; const Delta: TJvColorDelta);
|
||||
var
|
||||
Index: TJvAxisIndex;
|
||||
begin
|
||||
AMemo.Lines.Clear;
|
||||
with ColorSpaceManager, ColorSpace[Delta.ColorID], AMemo.Lines do
|
||||
begin
|
||||
Add(Format('%s (%s)',[Name, ShortName]));
|
||||
for Index := Low(TJvAxisIndex) to High(TJvAxisIndex) do
|
||||
Add(Format('%s : %d, %d, %d',[AxisName[Index],Delta.AxisRed[Index].Value,
|
||||
Delta.AxisGreen[Index].Value,Delta.AxisBlue[Index].Value]));
|
||||
if AMemo = Memos[6] then
|
||||
Add(RsCustomize);
|
||||
end;
|
||||
end;
|
||||
|
||||
{ TJvColorDeltaList }
|
||||
|
||||
function TJvColorDeltaList.GetItems(Index: Integer): TJvColorDelta;
|
||||
begin
|
||||
Result := TJvColorDelta(TObjectList(Self).Items[Index]);
|
||||
end;
|
||||
|
||||
procedure TJvColorDeltaList.SetItems(Index: Integer;
|
||||
const Value: TJvColorDelta);
|
||||
begin
|
||||
TObjectList(Self).Items[Index] := Value;
|
||||
end;
|
||||
|
||||
procedure FillColorDeltas;
|
||||
var
|
||||
Delta : TJvColorDelta;
|
||||
begin
|
||||
Delta := TJvColorDelta.Create;
|
||||
Delta.ColorID := csRGB;
|
||||
Delta.AxisRed[axIndex0].Value := 100;
|
||||
Delta.AxisRed[axIndex0].SaturationMethod := smRange;
|
||||
Delta.AxisRed[axIndex1].Value := 0;
|
||||
Delta.AxisRed[axIndex1].SaturationMethod := smRange;
|
||||
Delta.AxisRed[axIndex2].Value := 0;
|
||||
Delta.AxisRed[axIndex2].SaturationMethod := smRange;
|
||||
Delta.AxisGreen[axIndex0].Value := 0;
|
||||
Delta.AxisGreen[axIndex0].SaturationMethod := smRange;
|
||||
Delta.AxisGreen[axIndex1].Value := 0;
|
||||
Delta.AxisGreen[axIndex1].SaturationMethod := smRange;
|
||||
Delta.AxisGreen[axIndex2].Value := 0;
|
||||
Delta.AxisGreen[axIndex2].SaturationMethod := smRange;
|
||||
Delta.AxisBlue[axIndex0].Value := 0;
|
||||
Delta.AxisBlue[axIndex0].SaturationMethod := smRange;
|
||||
Delta.AxisBlue[axIndex1].Value := 0;
|
||||
Delta.AxisBlue[axIndex1].SaturationMethod := smRange;
|
||||
Delta.AxisBlue[axIndex2].Value := 50;
|
||||
Delta.AxisBlue[axIndex2].SaturationMethod := smRange;
|
||||
ColorDeltas.Add(Delta);
|
||||
|
||||
Delta := TJvColorDelta.Create;
|
||||
Delta.ColorID := csHLS;
|
||||
Delta.AxisRed[axIndex0].Value := 0;
|
||||
Delta.AxisRed[axIndex0].SaturationMethod := smRange;
|
||||
Delta.AxisRed[axIndex1].Value := 0;
|
||||
Delta.AxisRed[axIndex1].SaturationMethod := smRange;
|
||||
Delta.AxisRed[axIndex2].Value := 0;
|
||||
Delta.AxisRed[axIndex2].SaturationMethod := smRange;
|
||||
Delta.AxisGreen[axIndex0].Value := 40;
|
||||
Delta.AxisGreen[axIndex0].SaturationMethod := smRange;
|
||||
Delta.AxisGreen[axIndex1].Value := 0;
|
||||
Delta.AxisGreen[axIndex1].SaturationMethod := smRange;
|
||||
Delta.AxisGreen[axIndex2].Value := 0;
|
||||
Delta.AxisGreen[axIndex2].SaturationMethod := smRange;
|
||||
Delta.AxisBlue[axIndex0].Value := 0;
|
||||
Delta.AxisBlue[axIndex0].SaturationMethod := smRange;
|
||||
Delta.AxisBlue[axIndex1].Value := 0;
|
||||
Delta.AxisBlue[axIndex1].SaturationMethod := smRange;
|
||||
Delta.AxisBlue[axIndex2].Value := 0;
|
||||
Delta.AxisBlue[axIndex2].SaturationMethod := smRange;
|
||||
ColorDeltas.Add(Delta);
|
||||
|
||||
Delta := TJvColorDelta.Create;
|
||||
Delta.ColorID := csHSV;
|
||||
Delta.AxisRed[axIndex0].Value := 0;
|
||||
Delta.AxisRed[axIndex0].SaturationMethod := smRange;
|
||||
Delta.AxisRed[axIndex1].Value := -176;
|
||||
Delta.AxisRed[axIndex1].SaturationMethod := smRange;
|
||||
Delta.AxisRed[axIndex2].Value := -180;
|
||||
Delta.AxisRed[axIndex2].SaturationMethod := smRange;
|
||||
Delta.AxisGreen[axIndex0].Value := 0;
|
||||
Delta.AxisGreen[axIndex0].SaturationMethod := smRange;
|
||||
Delta.AxisGreen[axIndex1].Value := 0;
|
||||
Delta.AxisGreen[axIndex1].SaturationMethod := smRange;
|
||||
Delta.AxisGreen[axIndex2].Value := 0;
|
||||
Delta.AxisGreen[axIndex2].SaturationMethod := smRange;
|
||||
Delta.AxisBlue[axIndex0].Value := 0;
|
||||
Delta.AxisBlue[axIndex0].SaturationMethod := smRange;
|
||||
Delta.AxisBlue[axIndex1].Value := 0;
|
||||
Delta.AxisBlue[axIndex1].SaturationMethod := smRange;
|
||||
Delta.AxisBlue[axIndex2].Value := 0;
|
||||
Delta.AxisBlue[axIndex2].SaturationMethod := smRange;
|
||||
ColorDeltas.Add(Delta);
|
||||
|
||||
Delta := TJvColorDelta.Create;
|
||||
Delta.ColorID := csYUV;
|
||||
Delta.AxisRed[axIndex0].Value := 0;
|
||||
Delta.AxisRed[axIndex0].SaturationMethod := smRange;
|
||||
Delta.AxisRed[axIndex1].Value := 38;
|
||||
Delta.AxisRed[axIndex1].SaturationMethod := smRange;
|
||||
Delta.AxisRed[axIndex2].Value := 0;
|
||||
Delta.AxisRed[axIndex2].SaturationMethod := smRange;
|
||||
Delta.AxisGreen[axIndex0].Value := 0;
|
||||
Delta.AxisGreen[axIndex0].SaturationMethod := smRange;
|
||||
Delta.AxisGreen[axIndex1].Value := 68;
|
||||
Delta.AxisGreen[axIndex1].SaturationMethod := smRange;
|
||||
Delta.AxisGreen[axIndex2].Value := 0;
|
||||
Delta.AxisGreen[axIndex2].SaturationMethod := smRange;
|
||||
Delta.AxisBlue[axIndex0].Value := 0;
|
||||
Delta.AxisBlue[axIndex0].SaturationMethod := smRange;
|
||||
Delta.AxisBlue[axIndex1].Value := 0;
|
||||
Delta.AxisBlue[axIndex1].SaturationMethod := smRange;
|
||||
Delta.AxisBlue[axIndex2].Value := 0;
|
||||
Delta.AxisBlue[axIndex2].SaturationMethod := smRange;
|
||||
ColorDeltas.Add(Delta);
|
||||
|
||||
Delta := TJvColorDelta.Create;
|
||||
Delta.ColorID := csHLS;
|
||||
Delta.AxisRed[axIndex0].Value := 0;
|
||||
Delta.AxisRed[axIndex0].SaturationMethod := smRange;
|
||||
Delta.AxisRed[axIndex1].Value := -30;
|
||||
Delta.AxisRed[axIndex1].SaturationMethod := smRange;
|
||||
Delta.AxisRed[axIndex2].Value := 0;
|
||||
Delta.AxisRed[axIndex2].SaturationMethod := smRange;
|
||||
Delta.AxisGreen[axIndex0].Value := 0;
|
||||
Delta.AxisGreen[axIndex0].SaturationMethod := smRange;
|
||||
Delta.AxisGreen[axIndex1].Value := -30;
|
||||
Delta.AxisGreen[axIndex1].SaturationMethod := smRange;
|
||||
Delta.AxisGreen[axIndex2].Value := 0;
|
||||
Delta.AxisGreen[axIndex2].SaturationMethod := smRange;
|
||||
Delta.AxisBlue[axIndex0].Value := 0;
|
||||
Delta.AxisBlue[axIndex0].SaturationMethod := smRange;
|
||||
Delta.AxisBlue[axIndex1].Value := -30;
|
||||
Delta.AxisBlue[axIndex1].SaturationMethod := smRange;
|
||||
Delta.AxisBlue[axIndex2].Value := 0;
|
||||
Delta.AxisBlue[axIndex2].SaturationMethod := smRange;
|
||||
ColorDeltas.Add(Delta);
|
||||
|
||||
Delta := TJvColorDelta.Create;
|
||||
Delta.ColorID := csXYZ;
|
||||
Delta.AxisRed[axIndex0].Value := 0;
|
||||
Delta.AxisRed[axIndex0].SaturationMethod := smRange;
|
||||
Delta.AxisRed[axIndex1].Value := 0;
|
||||
Delta.AxisRed[axIndex1].SaturationMethod := smRange;
|
||||
Delta.AxisRed[axIndex2].Value := 0;
|
||||
Delta.AxisRed[axIndex2].SaturationMethod := smRange;
|
||||
Delta.AxisGreen[axIndex0].Value := 0;
|
||||
Delta.AxisGreen[axIndex0].SaturationMethod := smRange;
|
||||
Delta.AxisGreen[axIndex1].Value := 0;
|
||||
Delta.AxisGreen[axIndex1].SaturationMethod := smRange;
|
||||
Delta.AxisGreen[axIndex2].Value := 0;
|
||||
Delta.AxisGreen[axIndex2].SaturationMethod := smRange;
|
||||
Delta.AxisBlue[axIndex0].Value := 80;
|
||||
Delta.AxisBlue[axIndex0].SaturationMethod := smRange;
|
||||
Delta.AxisBlue[axIndex1].Value := 0;
|
||||
Delta.AxisBlue[axIndex1].SaturationMethod := smRange;
|
||||
Delta.AxisBlue[axIndex2].Value := 0;
|
||||
Delta.AxisBlue[axIndex2].SaturationMethod := smRange;
|
||||
ColorDeltas.Add(Delta);
|
||||
end;
|
||||
|
||||
procedure TJvFullColorCircleDlgMainFrm.JvFullColorCircleDialogApply(Sender: TObject);
|
||||
begin
|
||||
RotateCustomValues;
|
||||
end;
|
||||
|
||||
initialization
|
||||
ColorDeltas := TJvColorDeltaList.Create;
|
||||
FillColorDeltas;
|
||||
|
||||
finalization
|
||||
ColorDeltas.Free;
|
||||
|
||||
end.
|
@ -0,0 +1,84 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<Flags>
|
||||
<UseDefaultCompilerOptions Value="True"/>
|
||||
</Flags>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<Title Value="JvFullColorCircleDialogPrj"/>
|
||||
<Scaled Value="True"/>
|
||||
<ResourceType Value="res"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
<XPManifest>
|
||||
<DpiAware Value="True"/>
|
||||
</XPManifest>
|
||||
<Icon Value="0"/>
|
||||
</General>
|
||||
<BuildModes Count="1">
|
||||
<Item1 Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<UseFileFilters Value="True"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
<Modes Count="0"/>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="2">
|
||||
<Item1>
|
||||
<PackageName Value="JvMMLazR"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item2>
|
||||
</RequiredPackages>
|
||||
<Units Count="2">
|
||||
<Unit0>
|
||||
<Filename Value="JvFullColorCircleDialogPrj.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="JvFullColorCircleDialogMainForm.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="JvFullColorCircleDlgMainFrm"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="JvFullColorCircleDialogPrj"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Linking>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions Count="3">
|
||||
<Item1>
|
||||
<Name Value="EAbort"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item3>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
@ -0,0 +1,15 @@
|
||||
program JvFullColorCircleDialogPrj;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
Interfaces, Forms,
|
||||
JvFullColorCircleDialogMainForm in 'JvFullColorCircleDialogMainForm.pas' {JvFullColorCircleDlgMainFrm};
|
||||
|
||||
{$R *.res}
|
||||
|
||||
begin
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TJvFullColorCircleDlgMainFrm, JvFullColorCircleDlgMainFrm);
|
||||
Application.Run;
|
||||
end.
|
@ -0,0 +1,42 @@
|
||||
object JvFullColorDialogMainFrm: TJvFullColorDialogMainFrm
|
||||
Left = 419
|
||||
Height = 295
|
||||
Top = 367
|
||||
Width = 723
|
||||
Caption = 'TJvFullColorDialog example'
|
||||
ClientHeight = 295
|
||||
ClientWidth = 723
|
||||
Color = clBtnFace
|
||||
Font.Color = clWindowText
|
||||
OnCreate = FormCreate
|
||||
OnShow = FormShow
|
||||
Position = poScreenCenter
|
||||
LCLVersion = '2.1.0.0'
|
||||
Visible = True
|
||||
object JvFullColorLabel: TJvFullColorLabel
|
||||
Left = 16
|
||||
Height = 17
|
||||
Top = 32
|
||||
Width = 257
|
||||
LabelColor = 67108864
|
||||
Brush.Color = clBlack
|
||||
Caption = 'JvFullColorLabel'
|
||||
Font.Color = clWindowText
|
||||
ParentFont = False
|
||||
OnDblClick = JvFullColorLabelDblClick
|
||||
end
|
||||
object LabelInfo: TLabel
|
||||
Left = 16
|
||||
Height = 15
|
||||
Top = 8
|
||||
Width = 192
|
||||
Caption = 'Double-click on a label to customize'
|
||||
ParentColor = False
|
||||
end
|
||||
object JvFullColorDialog: TJvFullColorDialog
|
||||
FullColor = 83886079
|
||||
OnApply = JvFullColorDialogApply
|
||||
left = 232
|
||||
top = 128
|
||||
end
|
||||
end
|
@ -0,0 +1,187 @@
|
||||
{******************************************************************
|
||||
|
||||
JEDI-VCL Demo
|
||||
|
||||
Copyright (C) 2004 Project JEDI
|
||||
|
||||
Original author: Florent Ouchet [ouchet dott florent att laposte dott net]
|
||||
|
||||
Contributor(s):
|
||||
|
||||
You may retrieve the latest version of this file at the JEDI-JVCL
|
||||
home page, located at http://jvcl.delphi-jedi.org
|
||||
|
||||
The contents of this file are used with permission, subject to
|
||||
the Mozilla Public License Version 1.1 (the "License"); you may
|
||||
not use this file except in compliance with the License. You may
|
||||
obtain a copy of the License at
|
||||
http://www.mozilla.org/MPL/MPL-1_1Final.html
|
||||
|
||||
Software distributed under the License is distributed on an
|
||||
"AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
implied. See the License for the specific language governing
|
||||
rights and limitations under the License.
|
||||
|
||||
******************************************************************}
|
||||
|
||||
unit JvFullColorDialogMainForm;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
//Windows, Messages,
|
||||
SysUtils, Variants, Classes, Graphics, Controls, Forms,
|
||||
Dialogs, JvFullColorSpaces, JvFullColorCtrls, StdCtrls, JvFullColorForm,
|
||||
JvFullColorDialogs;
|
||||
|
||||
type
|
||||
|
||||
{ TJvFullColorDialogMainFrm }
|
||||
|
||||
TJvFullColorDialogMainFrm = class(TForm)
|
||||
JvFullColorLabel: TJvFullColorLabel;
|
||||
LabelInfo: TLabel;
|
||||
JvFullColorDialog: TJvFullColorDialog;
|
||||
procedure Button1Click(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure JvFullColorLabelDblClick(Sender: TObject);
|
||||
procedure JvFullColorDialogApply(Sender: TObject; AFullColor: TJvFullColor);
|
||||
public
|
||||
procedure UpdateCaption (ALabel: TJvFullColorLabel);
|
||||
procedure UpdateAllCaptions;
|
||||
end;
|
||||
|
||||
var
|
||||
JvFullColorDialogMainFrm: TJvFullColorDialogMainFrm;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
uses
|
||||
Math;
|
||||
|
||||
procedure TJvFullColorDialogMainFrm.Button1Click(Sender: TObject);
|
||||
begin
|
||||
JvFullColorLabel.Caption := 'test';
|
||||
end;
|
||||
|
||||
procedure TJvFullColorDialogMainFrm.FormCreate(Sender: TObject);
|
||||
var
|
||||
Index: Integer;
|
||||
LDEFColorSpace: TJvDEFColorSpace;
|
||||
LColorLabel: TJvFullColorLabel;
|
||||
X, Y: Integer;
|
||||
|
||||
procedure CreateLabel(AFullColor: TJvFullColor);
|
||||
begin
|
||||
Inc(Y,JvFullColorLabel.Height+10);
|
||||
if Y > ClientHeight then
|
||||
begin
|
||||
Y := JvFullColorLabel.Top;
|
||||
Inc(X,JvFullColorLabel.Width+10);
|
||||
end;
|
||||
LColorLabel := TJvFullColorLabel.Create(Self);
|
||||
LColorLabel.Parent := Self;
|
||||
LColorLabel.SetBounds(X,Y,JvFullColorLabel.Width,JvFullColorLabel.Height);
|
||||
LColorLabel.LabelColor := AFullColor;
|
||||
LColorLabel.AutoSize := true;
|
||||
LColorLabel.BorderSpacing.Around := 8;
|
||||
LColorLabel.OnDblClick := @JvFullColorLabelDblClick;
|
||||
end;
|
||||
|
||||
begin
|
||||
X := JvFullColorLabel.Left;
|
||||
Y := JvFullColorLabel.Top;
|
||||
with ColorSpaceManager do
|
||||
begin
|
||||
LDEFColorSpace := TJvDEFColorSpace(ColorSpace[csDEF]);
|
||||
for Index := 1 to Min(LDEFColorSpace.ColorCount-1,9) do
|
||||
CreateLabel(ConvertFromColor(LDEFColorSpace.ColorValue[Index]));
|
||||
with ColorSpace[csHLS] do
|
||||
begin
|
||||
CreateLabel(ConvertFromColor(clRed));
|
||||
CreateLabel(ConvertFromColor(clLime));
|
||||
CreateLabel(ConvertFromColor(clBlue));
|
||||
CreateLabel(ConvertFromColor(clYellow));
|
||||
end;
|
||||
CreateLabel(ColorSpace[csYUV].ConvertFromColor(clWhite));
|
||||
CreateLabel(ColorSpace[csYCC].ConvertFromColor(clPurple));
|
||||
CreateLabel(ColorSpace[csHSV].ConvertFromColor(clAqua));
|
||||
CreateLabel(ColorSpace[csYIQ].ConvertFromColor(clOlive));
|
||||
CreateLabel(ColorSpace[csLAB].ConvertFromColor(clMaroon));
|
||||
CreateLabel(ColorSpace[csDEF].ConvertFromColor(clAppWorkSpace));
|
||||
end;
|
||||
UpdateAllCaptions;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorDialogMainFrm.FormShow(Sender: TObject);
|
||||
begin
|
||||
AutoSize := true;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorDialogMainFrm.UpdateAllCaptions;
|
||||
var
|
||||
Index: Integer;
|
||||
begin
|
||||
for Index := 0 to ControlCount-1 do
|
||||
if Controls[Index] is TJvFullColorLabel then
|
||||
UpdateCaption(TJvFullColorLabel(Controls[Index]));
|
||||
end;
|
||||
|
||||
procedure TJvFullColorDialogMainFrm.UpdateCaption(ALabel: TJvFullColorLabel);
|
||||
var
|
||||
Index: Cardinal;
|
||||
LColor: TColor;
|
||||
begin
|
||||
with ColorSpaceManager, ColorSpace[GetColorSpaceID(ALabel.LabelColor)] do
|
||||
if ID = csDEF then
|
||||
begin
|
||||
with TJvDEFColorSpace(ColorSpace[csDEF]) do
|
||||
begin
|
||||
LColor := ConvertToColor(ALabel.LabelColor);
|
||||
for Index:=0 to ColorCount-1 do
|
||||
if ColorValue[Index]=LColor then
|
||||
begin
|
||||
ALabel.Caption := Format('%s : %s',[ShortName,ColorPrettyName[Index]]);
|
||||
Break;
|
||||
end;
|
||||
if Index = ColorCount then
|
||||
ALabel.Caption := ShortName+' : Invalid color';
|
||||
end;
|
||||
end
|
||||
else
|
||||
ALabel.Caption := Format('%s : %s=%d ; %s=%d ; %s=%d',[ShortName,
|
||||
AxisName[axIndex0],GetAxisValue(ALabel.LabelColor,axIndex0),
|
||||
AxisName[axIndex1],GetAxisValue(ALabel.LabelColor,axIndex1),
|
||||
AxisName[axIndex2],GetAxisValue(ALabel.LabelColor,axIndex2)]);
|
||||
end;
|
||||
|
||||
procedure TJvFullColorDialogMainFrm.JvFullColorLabelDblClick(Sender: TObject);
|
||||
begin
|
||||
with TJvFullColorLabel(Sender) do
|
||||
begin
|
||||
JvFullColorDialog.FullColor := LabelColor;
|
||||
JvFullColorDialog.Tag := Integer(Sender);
|
||||
if JvFullColorDialog.Execute then
|
||||
begin
|
||||
LabelColor := JvFullColorDialog.FullColor;
|
||||
UpdateCaption(TJvFullColorLabel(Sender));
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorDialogMainFrm.JvFullColorDialogApply(Sender: TObject;
|
||||
AFullColor: TJvFullColor);
|
||||
begin
|
||||
with TJvFullColorDialog(Sender) do
|
||||
begin
|
||||
TJvFullColorLabel(Tag).LabelColor := FullColor;
|
||||
UpdateCaption(TJvFullColorLabel(Tag));
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
@ -0,0 +1,84 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<Flags>
|
||||
<UseDefaultCompilerOptions Value="True"/>
|
||||
</Flags>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<MainUnit Value="0"/>
|
||||
<Title Value="JvFullColorDialogPrj"/>
|
||||
<Scaled Value="True"/>
|
||||
<ResourceType Value="res"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
<XPManifest>
|
||||
<DpiAware Value="True"/>
|
||||
</XPManifest>
|
||||
<Icon Value="0"/>
|
||||
</General>
|
||||
<BuildModes Count="1">
|
||||
<Item1 Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<UseFileFilters Value="True"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
<Modes Count="0"/>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="2">
|
||||
<Item1>
|
||||
<PackageName Value="JvMMLazR"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item2>
|
||||
</RequiredPackages>
|
||||
<Units Count="2">
|
||||
<Unit0>
|
||||
<Filename Value="JvFullColorDialogPrj.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit0>
|
||||
<Unit1>
|
||||
<Filename Value="JvFullColorDialogMainForm.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="JvFullColorDialogMainFrm"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
</Unit1>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="JvFullColorDialogPrj"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Linking>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions Count="3">
|
||||
<Item1>
|
||||
<Name Value="EAbort"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item3>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
@ -0,0 +1,16 @@
|
||||
program JvFullColorDialogPrj;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
Interfaces,
|
||||
Forms,
|
||||
JvFullColorDialogMainForm in 'JvFullColorDialogMainForm.pas' {JvFullColorDialogMainFrm};
|
||||
|
||||
{$R *.res}
|
||||
|
||||
begin
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TJvFullColorDialogMainFrm, JvFullColorDialogMainFrm);
|
||||
Application.Run;
|
||||
end.
|
Reference in New Issue
Block a user