jvcllaz: Add full color controls and dialogs
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6684 8e941d3f-bd1b-0410-a28a-d453659cc2b4
@ -18,6 +18,8 @@ uses
|
||||
JvDsgnConsts,
|
||||
JvId3v1, JvId3v2Base, JvId3v2, JvGradient, JvId3v2EditorForm,
|
||||
JvGradientHeaderPanel, JvSpecialProgress,
|
||||
JvFullColorSpaces, JvFullColorCtrls, JvFullColorEditors, JvFullColorSpacesEditors,
|
||||
JvFullColorForm, JvFullColorDialogs,
|
||||
JvBmpAnimator;
|
||||
|
||||
procedure Register;
|
||||
@ -26,10 +28,25 @@ begin
|
||||
TJvId3v1, TJvId3v2,
|
||||
TJvBmpAnimator,
|
||||
TJvGradient, TJvGradientHeaderPanel,
|
||||
TJvSpecialProgress
|
||||
TJvSpecialProgress,
|
||||
TJvFullColorPanel, TJvFullColorTrackBar, TJvFullColorGroup, TJvFullColorLabel,
|
||||
TJvFullColorSpaceCombo, TJvFullColorAxisCombo, TJvFullColorCircle,
|
||||
TJvFullColorDialog, TJvFullColorCircleDialog
|
||||
]);
|
||||
|
||||
RegisterComponentEditor(TJvID3Controller, TJvID3ControllerEditor);
|
||||
RegisterPropertyEditor(TypeInfo(TJvID3FileInfo), nil, '', TJvID3FileInfoEditor);
|
||||
|
||||
RegisterPropertyEditor(TypeInfo(TJvFullColorSpaceID), nil, '', TJvColorIDEditor);
|
||||
RegisterPropertyEditor(TypeInfo(TJvFullColor), nil, '', TJvFullColorProperty);
|
||||
{
|
||||
RegisterPropertyEditor(TypeInfo(TJvFullColorList), nil, '', TJvFullColorListEditor);
|
||||
RegisterSelectionEditor(TJvFullColorPanel, TJvFullColorSelection);
|
||||
RegisterSelectionEditor(TJvFullColorCircle, TJvFullColorSelection);
|
||||
RegisterSelectionEditor(TJvFullColorLabel, TJvFullColorSelection);
|
||||
RegisterSelectionEditor(TJvFullColorSpaceCombo, TJvFullColorSelection);
|
||||
RegisterSelectionEditor(TJvFullColorAxisCombo, TJvFullColorSelection);
|
||||
}
|
||||
end;
|
||||
|
||||
end.
|
||||
|
@ -5,3 +5,12 @@ tjvgradientheaderpanel.bmp
|
||||
tjvspecialprogress.bmp
|
||||
tjvanimatedimage.bmp
|
||||
tjvbmpanimator.bmp
|
||||
tjvfullcoloraxiscombo.bmp
|
||||
tjvfullcolorcircle.bmp
|
||||
tjvfullcolorcircledialog.bmp
|
||||
tjvfullcolordialog.bmp
|
||||
tjvfullcolorgroup.bmp
|
||||
tjvfullcolorlabel.bmp
|
||||
tjvfullcolorpanel.bmp
|
||||
tjvfullcolorspacecombo.bmp
|
||||
tjvfullcolortrackbar.bmp
|
||||
|
BIN
components/jvcllaz/design/JvMM/images/tjvfullcoloraxiscombo.bmp
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
components/jvcllaz/design/JvMM/images/tjvfullcolorcircle.bmp
Normal file
After Width: | Height: | Size: 1.6 KiB |
After Width: | Height: | Size: 1.6 KiB |
BIN
components/jvcllaz/design/JvMM/images/tjvfullcolordialog.bmp
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
components/jvcllaz/design/JvMM/images/tjvfullcolorgroup.bmp
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
components/jvcllaz/design/JvMM/images/tjvfullcolorlabel.bmp
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
components/jvcllaz/design/JvMM/images/tjvfullcolorpanel.bmp
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
components/jvcllaz/design/JvMM/images/tjvfullcolorspacecombo.bmp
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
components/jvcllaz/design/JvMM/images/tjvfullcolortrackbar.bmp
Normal file
After Width: | Height: | Size: 1.6 KiB |
92
components/jvcllaz/design/JvMM/jvfullcoloreditors.pas
Normal file
@ -0,0 +1,92 @@
|
||||
{-----------------------------------------------------------------------------
|
||||
The contents of this file are 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.1.html
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for
|
||||
the specific language governing rights and limitations under the License.
|
||||
|
||||
The Original Code is: ColorEditors.pas, released on 2004-09-11.
|
||||
|
||||
The Initial Developer of the Original Code is Florent Ouchet [ouchet dott florent att laposte dott net]
|
||||
Portions created by Florent Ouchet are Copyright (C) 2004 Florent Ouchet.
|
||||
All Rights Reserved.
|
||||
|
||||
Contributor(s): -
|
||||
|
||||
You may retrieve the latest version of this file at the Project JEDI's JVCL home page,
|
||||
located at http://jvcl.delphi-jedi.org
|
||||
|
||||
Known Issues:
|
||||
-----------------------------------------------------------------------------}
|
||||
// $Id$
|
||||
|
||||
unit JvFullColorEditors;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
//Windows,
|
||||
Classes, propedits,
|
||||
// DesignIntf, DesignEditors, VCLEditors,
|
||||
ComCtrls,
|
||||
JvFullColorCtrls;
|
||||
|
||||
type
|
||||
TJvColorIDEditor = class(TOrdinalProperty)
|
||||
public
|
||||
function GetAttributes: TPropertyAttributes; override;
|
||||
procedure GetValues(Proc: TGetStrProc); override;
|
||||
procedure SetValue(const Value: string); override;
|
||||
function GetValue: string; override;
|
||||
end;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
SysUtils, TypInfo,
|
||||
JvFullColorSpaces, JvFullColorSpacesEditors;
|
||||
|
||||
//=== { TJvColorIDEEditor } ==================================================
|
||||
|
||||
function TJvColorIDEditor.GetAttributes: TPropertyAttributes;
|
||||
begin
|
||||
Result := [paValueList, paSortList, paRevertable, paNotNestable, paMultiSelect];
|
||||
end;
|
||||
|
||||
function TJvColorIDEditor.GetValue: string;
|
||||
begin
|
||||
Result := ColorSpaceManager.ColorSpace[TJvFullColorSpaceID(GetOrdValue)].ShortName;
|
||||
end;
|
||||
|
||||
procedure TJvColorIDEditor.GetValues(Proc: TGetStrProc);
|
||||
var
|
||||
I: Integer;
|
||||
begin
|
||||
with ColorSpaceManager do
|
||||
for I := 0 to Count - 1 do
|
||||
Proc(ColorSpaceByIndex[I].ShortName);
|
||||
end;
|
||||
|
||||
procedure TJvColorIDEditor.SetValue(const Value: string);
|
||||
var
|
||||
I: Integer;
|
||||
CS: TJvColorSpace;
|
||||
begin
|
||||
with ColorSpaceManager do
|
||||
for I := 0 to Count - 1 do
|
||||
begin
|
||||
CS := ColorSpaceByIndex[I];
|
||||
if CompareText(CS.ShortName, Value) = 0 then
|
||||
begin
|
||||
SetOrdValue(Ord(CS.ID));
|
||||
Exit;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
192
components/jvcllaz/design/JvMM/jvfullcolorlistform.lfm
Normal file
@ -0,0 +1,192 @@
|
||||
object JvFullColorListFrm: TJvFullColorListFrm
|
||||
Left = 389
|
||||
Top = 285
|
||||
BorderStyle = bsDialog
|
||||
Caption = 'Color list editor'
|
||||
ClientHeight = 398
|
||||
ClientWidth = 422
|
||||
Color = clBtnFace
|
||||
Font.Charset = DEFAULT_CHARSET
|
||||
Font.Color = clWindowText
|
||||
Font.Height = -11
|
||||
Font.Name = 'MS Sans Serif'
|
||||
Font.Style = []
|
||||
OldCreateOrder = False
|
||||
Position = poScreenCenter
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 13
|
||||
object ListBoxColors: TListBox
|
||||
Left = 8
|
||||
Top = 8
|
||||
Width = 313
|
||||
Height = 377
|
||||
Style = lbOwnerDrawFixed
|
||||
ItemHeight = 20
|
||||
MultiSelect = True
|
||||
TabOrder = 0
|
||||
OnDrawItem = ListBoxColorsDrawItem
|
||||
end
|
||||
object ButtonNew: TButton
|
||||
Left = 336
|
||||
Top = 8
|
||||
Width = 75
|
||||
Height = 25
|
||||
Action = ActionNew
|
||||
TabOrder = 1
|
||||
end
|
||||
object ButtonModify: TButton
|
||||
Left = 336
|
||||
Top = 88
|
||||
Width = 75
|
||||
Height = 25
|
||||
Action = ActionModify
|
||||
TabOrder = 2
|
||||
end
|
||||
object ButtonDelete: TButton
|
||||
Left = 336
|
||||
Top = 128
|
||||
Width = 75
|
||||
Height = 25
|
||||
Action = ActionDelete
|
||||
TabOrder = 3
|
||||
end
|
||||
object Button4: TButton
|
||||
Left = 336
|
||||
Top = 320
|
||||
Width = 75
|
||||
Height = 25
|
||||
Cancel = True
|
||||
Caption = '&Cancel'
|
||||
ModalResult = 2
|
||||
TabOrder = 4
|
||||
end
|
||||
object ButtonOK: TButton
|
||||
Left = 336
|
||||
Top = 280
|
||||
Width = 75
|
||||
Height = 25
|
||||
Caption = '&OK'
|
||||
ModalResult = 1
|
||||
TabOrder = 5
|
||||
end
|
||||
object BitBtnMoveUp: TBitBtn
|
||||
Left = 336
|
||||
Top = 208
|
||||
Width = 25
|
||||
Height = 25
|
||||
Action = ActionMoveUp
|
||||
TabOrder = 6
|
||||
Glyph.Data = {
|
||||
76010000424D7601000000000000760000002800000020000000100000000100
|
||||
04000000000000010000120B0000120B00001000000000000000000000000000
|
||||
800000800000008080008000000080008000808000007F7F7F00BFBFBF000000
|
||||
FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333000333
|
||||
3333333333777F33333333333309033333333333337F7F333333333333090333
|
||||
33333333337F7F33333333333309033333333333337F7F333333333333090333
|
||||
33333333337F7F33333333333309033333333333FF7F7FFFF333333000090000
|
||||
3333333777737777F333333099999990333333373F3333373333333309999903
|
||||
333333337F33337F33333333099999033333333373F333733333333330999033
|
||||
3333333337F337F3333333333099903333333333373F37333333333333090333
|
||||
33333333337F7F33333333333309033333333333337373333333333333303333
|
||||
333333333337F333333333333330333333333333333733333333}
|
||||
NumGlyphs = 2
|
||||
end
|
||||
object BitBtnMoveDown: TBitBtn
|
||||
Left = 336
|
||||
Top = 240
|
||||
Width = 25
|
||||
Height = 25
|
||||
Action = ActionMoveDown
|
||||
TabOrder = 7
|
||||
Glyph.Data = {
|
||||
76010000424D7601000000000000760000002800000020000000100000000100
|
||||
04000000000000010000120B0000120B00001000000000000000000000000000
|
||||
800000800000008080008000000080008000808000007F7F7F00BFBFBF000000
|
||||
FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333303333
|
||||
333333333337F33333333333333033333333333333373F333333333333090333
|
||||
33333333337F7F33333333333309033333333333337373F33333333330999033
|
||||
3333333337F337F33333333330999033333333333733373F3333333309999903
|
||||
333333337F33337F33333333099999033333333373333373F333333099999990
|
||||
33333337FFFF3FF7F33333300009000033333337777F77773333333333090333
|
||||
33333333337F7F33333333333309033333333333337F7F333333333333090333
|
||||
33333333337F7F33333333333309033333333333337F7F333333333333090333
|
||||
33333333337F7F33333333333300033333333333337773333333}
|
||||
NumGlyphs = 2
|
||||
end
|
||||
object ButtonApply: TButton
|
||||
Left = 336
|
||||
Top = 360
|
||||
Width = 75
|
||||
Height = 25
|
||||
Caption = '&Apply'
|
||||
TabOrder = 8
|
||||
OnClick = ButtonApplyClick
|
||||
end
|
||||
object Button1: TButton
|
||||
Left = 336
|
||||
Top = 168
|
||||
Width = 75
|
||||
Height = 25
|
||||
Action = ActionClear
|
||||
TabOrder = 9
|
||||
end
|
||||
object Button2: TButton
|
||||
Left = 336
|
||||
Top = 48
|
||||
Width = 75
|
||||
Height = 25
|
||||
Action = ActionInsert
|
||||
TabOrder = 10
|
||||
end
|
||||
object JvFullColorDialog: TJvFullColorDialog
|
||||
FullColor = 83886079
|
||||
HelpContext = 0
|
||||
OnApply = JvFullColorDialogApply
|
||||
Left = 88
|
||||
Top = 88
|
||||
end
|
||||
object ActionList: TActionList
|
||||
Left = 88
|
||||
Top = 128
|
||||
object ActionNew: TAction
|
||||
Caption = '&New ...'
|
||||
ShortCut = 16462
|
||||
OnExecute = ActionNewExecute
|
||||
OnUpdate = ActionNewUpdate
|
||||
end
|
||||
object ActionInsert: TAction
|
||||
Caption = '&Insert'
|
||||
ShortCut = 16457
|
||||
OnExecute = ActionInsertExecute
|
||||
OnUpdate = ActionInsertUpdate
|
||||
end
|
||||
object ActionModify: TAction
|
||||
Caption = '&Modify ...'
|
||||
ShortCut = 16461
|
||||
OnExecute = ActionModifyExecute
|
||||
OnUpdate = ActionModifyUpdate
|
||||
end
|
||||
object ActionDelete: TAction
|
||||
Caption = 'D&elete'
|
||||
ShortCut = 16453
|
||||
OnExecute = ActionDeleteExecute
|
||||
OnUpdate = ActionDeleteUpdate
|
||||
end
|
||||
object ActionClear: TAction
|
||||
Caption = '&Clear'
|
||||
ShortCut = 16451
|
||||
OnExecute = ActionClearExecute
|
||||
OnUpdate = ActionClearUpdate
|
||||
end
|
||||
object ActionMoveDown: TAction
|
||||
ShortCut = 16452
|
||||
OnExecute = ActionMoveDownExecute
|
||||
OnUpdate = ActionMoveDownUpdate
|
||||
end
|
||||
object ActionMoveUp: TAction
|
||||
ShortCut = 16469
|
||||
OnExecute = ActionMoveUpExecute
|
||||
OnUpdate = ActionMoveUpUpdate
|
||||
end
|
||||
end
|
||||
end
|
306
components/jvcllaz/design/JvMM/jvfullcolorlistform.pas
Normal file
@ -0,0 +1,306 @@
|
||||
{-----------------------------------------------------------------------------
|
||||
The contents of this file are 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.1.html
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for
|
||||
the specific language governing rights and limitations under the License.
|
||||
|
||||
The Original Code is: JvFullColorListFrm.pas, released on 2004-09-27.
|
||||
|
||||
The Initial Developer of the Original Code is Florent Ouchet [ouchet dott florent att laposte dott net]
|
||||
Portions created by Florent Ouchet are Copyright (C) 2004 Florent Ouchet.
|
||||
All Rights Reserved.
|
||||
|
||||
Contributor(s): -
|
||||
|
||||
You may retrieve the latest version of this file at the Project JEDI's JVCL home page,
|
||||
located at http://jvcl.delphi-jedi.org
|
||||
|
||||
Known Issues:
|
||||
-----------------------------------------------------------------------------}
|
||||
// $Id$
|
||||
|
||||
unit JvFullColorListForm;
|
||||
|
||||
{$I jvcl.inc}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Windows, Messages, SysUtils,
|
||||
Variants,
|
||||
Classes, Graphics, Controls, Forms,
|
||||
Dialogs, StdCtrls, ActnList, Buttons, ImgList,
|
||||
JvFullColorForm, JvFullColorSpaces, JvFullColorDialogs, JvFullColorCtrls;
|
||||
|
||||
type
|
||||
TJvFullColorListFrm = class(TForm)
|
||||
JvFullColorDialog: TJvFullColorDialog;
|
||||
ListBoxColors: TListBox;
|
||||
ActionList: TActionList;
|
||||
ActionNew: TAction;
|
||||
ActionModify: TAction;
|
||||
ActionDelete: TAction;
|
||||
ButtonNew: TButton;
|
||||
ButtonModify: TButton;
|
||||
ButtonDelete: TButton;
|
||||
Button4: TButton;
|
||||
ButtonOK: TButton;
|
||||
BitBtnMoveUp: TBitBtn;
|
||||
ActionMoveUp: TAction;
|
||||
ActionMoveDown: TAction;
|
||||
BitBtnMoveDown: TBitBtn;
|
||||
ButtonApply: TButton;
|
||||
Button1: TButton;
|
||||
ActionClear: TAction;
|
||||
Button2: TButton;
|
||||
ActionInsert: TAction;
|
||||
procedure ActionNewUpdate(Sender: TObject);
|
||||
procedure ActionModifyUpdate(Sender: TObject);
|
||||
procedure ActionDeleteUpdate(Sender: TObject);
|
||||
procedure ActionMoveUpUpdate(Sender: TObject);
|
||||
procedure ActionMoveDownUpdate(Sender: TObject);
|
||||
procedure ActionNewExecute(Sender: TObject);
|
||||
procedure ActionClearUpdate(Sender: TObject);
|
||||
procedure ActionModifyExecute(Sender: TObject);
|
||||
procedure ActionInsertUpdate(Sender: TObject);
|
||||
procedure ActionClearExecute(Sender: TObject);
|
||||
procedure ActionDeleteExecute(Sender: TObject);
|
||||
procedure ActionInsertExecute(Sender: TObject);
|
||||
procedure ActionMoveUpExecute(Sender: TObject);
|
||||
procedure ActionMoveDownExecute(Sender: TObject);
|
||||
procedure ButtonApplyClick(Sender: TObject);
|
||||
procedure JvFullColorDialogApply(Sender: TObject;
|
||||
AFullColor: TJvFullColor);
|
||||
procedure ListBoxColorsDrawItem(Control: TWinControl; Index: Integer;
|
||||
Rect: TRect; State: TOwnerDrawState);
|
||||
private
|
||||
FColorList: TJvFullColorList;
|
||||
FOnApply: TNotifyEvent;
|
||||
procedure SetColorList(const Value: TJvFullColorList);
|
||||
function GetColorList: TJvFullColorList;
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
function Execute: Boolean;
|
||||
property ColorList: TJvFullColorList read GetColorList write SetColorList;
|
||||
property OnApply: TNotifyEvent read FOnApply write FOnApply;
|
||||
end;
|
||||
|
||||
var
|
||||
JvFullColorListFrm: TJvFullColorListFrm;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
JvDsgnConsts;
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
constructor TJvFullColorListFrm.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
FColorList := TJvFullColorList.Create;
|
||||
end;
|
||||
|
||||
destructor TJvFullColorListFrm.Destroy;
|
||||
begin
|
||||
FColorList.Free;
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorListFrm.ActionClearExecute(Sender: TObject);
|
||||
begin
|
||||
ListBoxColors.Clear;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorListFrm.ActionClearUpdate(Sender: TObject);
|
||||
begin
|
||||
(Sender as TAction).Enabled := ListBoxColors.Items.Count > 0;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorListFrm.ActionDeleteExecute(Sender: TObject);
|
||||
begin
|
||||
ListBoxColors.DeleteSelected;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorListFrm.ActionDeleteUpdate(Sender: TObject);
|
||||
begin
|
||||
(Sender as TAction).Enabled := ListBoxColors.SelCount >= 1;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorListFrm.ActionInsertExecute(Sender: TObject);
|
||||
begin
|
||||
JvFullColorDialog.Options := JvFullColorDialog.Options - [foShowApply];
|
||||
if JvFullColorDialog.Execute then
|
||||
ListBoxColors.Items.InsertObject(ListBoxColors.ItemIndex, '',
|
||||
TObject(JvFullColorDialog.FullColor));
|
||||
end;
|
||||
|
||||
procedure TJvFullColorListFrm.ActionInsertUpdate(Sender: TObject);
|
||||
begin
|
||||
(Sender as TAction).Enabled := ListBoxColors.SelCount = 1;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorListFrm.ActionModifyExecute(Sender: TObject);
|
||||
begin
|
||||
JvFullColorDialog.Options := JvFullColorDialog.Options + [foShowApply];
|
||||
JvFullColorDialog.FullColor := TJvFullColor(ListBoxColors.Items.Objects[ListBoxColors.ItemIndex]);
|
||||
if JvFullColorDialog.Execute then
|
||||
ListBoxColors.Items.Objects[ListBoxColors.ItemIndex] := TObject(JvFullColorDialog.FullColor);
|
||||
end;
|
||||
|
||||
procedure TJvFullColorListFrm.ActionModifyUpdate(Sender: TObject);
|
||||
begin
|
||||
(Sender as TAction).Enabled := ListBoxColors.SelCount = 1;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorListFrm.ActionMoveDownExecute(Sender: TObject);
|
||||
var
|
||||
OldIndex: Integer;
|
||||
begin
|
||||
with ListBoxColors do
|
||||
begin
|
||||
OldIndex := ItemIndex;
|
||||
Items.Move(ItemIndex, ItemIndex + 1);
|
||||
Selected[OldIndex + 1] := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorListFrm.ActionMoveDownUpdate(Sender: TObject);
|
||||
begin
|
||||
with ListBoxColors do
|
||||
(Sender as TAction).Enabled := (SelCount = 1) and (ItemIndex < (Items.Count - 1));
|
||||
end;
|
||||
|
||||
procedure TJvFullColorListFrm.ActionMoveUpExecute(Sender: TObject);
|
||||
var
|
||||
OldIndex: Integer;
|
||||
begin
|
||||
with ListBoxColors do
|
||||
begin
|
||||
OldIndex := ItemIndex;
|
||||
Items.Move(ItemIndex, ItemIndex - 1);
|
||||
Selected[OldIndex - 1] := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorListFrm.ActionMoveUpUpdate(Sender: TObject);
|
||||
begin
|
||||
with ListBoxColors do
|
||||
(Sender as TAction).Enabled := (SelCount = 1) and (ItemIndex > 0);
|
||||
end;
|
||||
|
||||
procedure TJvFullColorListFrm.ActionNewExecute(Sender: TObject);
|
||||
begin
|
||||
JvFullColorDialog.Options := JvFullColorDialog.Options - [foShowApply];
|
||||
if JvFullColorDialog.Execute then
|
||||
ListBoxColors.Items.AddObject('', TObject(JvFullColorDialog.FullColor));
|
||||
end;
|
||||
|
||||
procedure TJvFullColorListFrm.ActionNewUpdate(Sender: TObject);
|
||||
begin
|
||||
(Sender as TAction).Enabled := True;
|
||||
end;
|
||||
|
||||
function TJvFullColorListFrm.Execute: Boolean;
|
||||
begin
|
||||
Result := (ShowModal = mrOK);
|
||||
end;
|
||||
|
||||
function TJvFullColorListFrm.GetColorList: TJvFullColorList;
|
||||
var
|
||||
Index: Integer;
|
||||
begin
|
||||
FColorList.BeginUpdate;
|
||||
FColorList.Clear;
|
||||
for Index := 0 to ListBoxColors.Items.Count - 1 do
|
||||
FColorList.Add(TJvFullColor(ListBoxColors.Items.Objects[Index]));
|
||||
FColorList.EndUpdate;
|
||||
Result := FColorList;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorListFrm.SetColorList(const Value: TJvFullColorList);
|
||||
var
|
||||
I: Integer;
|
||||
begin
|
||||
with ListBoxColors.Items, ColorSpaceManager do
|
||||
begin
|
||||
BeginUpdate;
|
||||
for I := 0 to Value.Count - 1 do
|
||||
AddObject('', TObject(Value.Items[I]));
|
||||
EndUpdate;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorListFrm.ButtonApplyClick(Sender: TObject);
|
||||
begin
|
||||
if Assigned(FOnApply) then
|
||||
FOnApply(Self);
|
||||
end;
|
||||
|
||||
procedure TJvFullColorListFrm.JvFullColorDialogApply(Sender: TObject;
|
||||
AFullColor: TJvFullColor);
|
||||
begin
|
||||
ListBoxColors.Items.Objects[ListBoxColors.ItemIndex] := TObject(JvFullColorDialog.FullColor);
|
||||
end;
|
||||
|
||||
procedure TJvFullColorListFrm.ListBoxColorsDrawItem(Control: TWinControl;
|
||||
Index: Integer; Rect: TRect; State: TOwnerDrawState);
|
||||
var
|
||||
AFullColor: TJvFullColor;
|
||||
AText: string;
|
||||
ColorIndex: Integer;
|
||||
AColor: TColor;
|
||||
AColorSpace: TJvColorSpace;
|
||||
begin
|
||||
with TListBox(Control), Canvas do
|
||||
begin
|
||||
if odSelected in State then
|
||||
Font.Color := clCaptionText;
|
||||
|
||||
Pen.Style := psSolid;
|
||||
Pen.Color := Brush.Color;
|
||||
Brush.Style := bsSolid;
|
||||
|
||||
Rectangle(Rect);
|
||||
|
||||
AFullColor := TJvFullColor(Items.Objects[Index]);
|
||||
|
||||
with ColorSpaceManager do
|
||||
begin
|
||||
AColorSpace := ColorSpace[GetColorSpaceID(AFullColor)];
|
||||
|
||||
if AColorSpace.ID = csDEF then
|
||||
with TJvDEFColorSpace(AColorSpace) do
|
||||
begin
|
||||
AColor := ConvertToColor(AFullColor);
|
||||
AText := Format(RsUnnamedColorFmt, [Name, AFullColor]);
|
||||
for ColorIndex := 0 to ColorCount - 1 do
|
||||
if AColor = ColorValue[ColorIndex] then
|
||||
begin
|
||||
AText := Format(RsUnnamedColorFmt, [Name, ColorName[ColorIndex], ColorPrettyName[ColorIndex]]);
|
||||
Break;
|
||||
end;
|
||||
end
|
||||
else
|
||||
with AColorSpace do
|
||||
AText := Format('%s: %s = $%.2x; %s = $%.2x; %s = $%.2x',
|
||||
[Name,
|
||||
AxisName[axIndex0], GetAxisValue(AFullColor, axIndex0),
|
||||
AxisName[axIndex1], GetAxisValue(AFullColor, axIndex1),
|
||||
AxisName[axIndex2], GetAxisValue(AFullColor, axIndex2)]);
|
||||
|
||||
TextOut(Rect.Left + Rect.Bottom - Rect.Top + 2, Rect.Top + 2, AText);
|
||||
end;
|
||||
|
||||
Brush.Color := ColorSpaceManager.ConvertToColor(AFullColor);
|
||||
Pen.Color := clBlack;
|
||||
Rectangle(Rect.Left + 2, Rect.Top + 2, Rect.Left + Rect.Bottom - Rect.Top - 2, Rect.Bottom - 2);
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
770
components/jvcllaz/design/JvMM/jvfullcolorspaceseditors.pas
Normal file
@ -0,0 +1,770 @@
|
||||
{-----------------------------------------------------------------------------
|
||||
The contents of this file are 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.1.html
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for
|
||||
the specific language governing rights and limitations under the License.
|
||||
|
||||
The Original Code is: ColorSpacesEditors.pas, released on 2004-09-11.
|
||||
|
||||
The Initial Developer of the Original Code is Florent Ouchet [ouchet dott florent att laposte dott net]
|
||||
Portions created by Florent Ouchet are Copyright (C) 2004 Florent Ouchet.
|
||||
All Rights Reserved.
|
||||
|
||||
Contributor(s): -
|
||||
|
||||
You may retrieve the latest version of this file at the Project JEDI's JVCL home page,
|
||||
located at http://jvcl.delphi-jedi.org
|
||||
|
||||
Known Issues:
|
||||
-----------------------------------------------------------------------------}
|
||||
// $Id$
|
||||
|
||||
unit JvFullColorSpacesEditors;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
//Windows,
|
||||
Classes, Graphics,
|
||||
PropEdits,
|
||||
//DesignIntf, DesignEditors, DesignMenus, VCLEditors,
|
||||
JvFullColorSpaces;
|
||||
|
||||
type
|
||||
TJvDEFFamily = (pfConstant, pfSystem);
|
||||
|
||||
TJvFullColorProperty = class(TPropertyEditor) //, ICustomPropertyDrawing)
|
||||
private
|
||||
function GetIsColorProperty: Boolean;
|
||||
procedure DialogApply(Sender: TObject; AFullColor: TJvFullColor);
|
||||
public
|
||||
function GetAttributes: TPropertyAttributes; override;
|
||||
procedure GetProperties(Proc: TGetPropEditProc); override; //TGetPropProc); override;
|
||||
procedure GetValues(Proc: TGetStrProc); override;
|
||||
function GetValue: string; override;
|
||||
procedure SetValue(const Value: string); override;
|
||||
procedure Edit; override;
|
||||
procedure EditSpace(AColorID: TJvFullColorSpaceID);
|
||||
procedure SetColor(AFullColor: TJvFullColor);
|
||||
// ICustomPropertyDrawing
|
||||
procedure PropDrawName(ACanvas: TCanvas; const ARect: TRect; ASelected: Boolean);
|
||||
procedure PropDrawValue(ACanvas: TCanvas; const ARect: TRect; ASelected: Boolean);
|
||||
property IsColorProperty: Boolean read GetIsColorProperty;
|
||||
end;
|
||||
|
||||
TJvFullColorSpaceProperty = class(TNestedProperty)
|
||||
private
|
||||
FColorSpace: TJvColorSpace;
|
||||
FParent: TJvFullColorProperty;
|
||||
public
|
||||
constructor Create(AParent: TJvFullColorProperty; AColorSpace: TJvColorSpace;
|
||||
AIsColorProperty: Boolean);
|
||||
(************* NOT CONVERTED ***
|
||||
function GetName: string; override;
|
||||
*******************************)
|
||||
function GetAttributes: TPropertyAttributes; override;
|
||||
function GetValue: string; override;
|
||||
procedure GetProperties(Proc: TGetPropEditProc); override; //TGetPropProc); override;
|
||||
procedure Edit; override;
|
||||
property ColorSpace: TJvColorSpace read FColorSpace;
|
||||
property Parent: TJvFullColorProperty read FParent;
|
||||
end;
|
||||
|
||||
TJvFullColorSpacePropertyClass = class of TJvFullColorSpaceProperty;
|
||||
|
||||
TJvFullColorAxisProperty = class(TNestedProperty) //, ICustomPropertyListDrawing)
|
||||
private
|
||||
FAxisIndex: TJvAxisIndex;
|
||||
FParent:TJvFullColorSpaceProperty;
|
||||
public
|
||||
constructor Create(AParent: TJvFullColorSpaceProperty;
|
||||
AAxisIndex: TJvAxisIndex);
|
||||
(**************** NOT CONVERTED ***
|
||||
function GetName: string; override;
|
||||
**********************************)
|
||||
function GetAttributes: TPropertyAttributes; override;
|
||||
function GetValue: string; override;
|
||||
procedure SetValue(const Value: string); override;
|
||||
procedure GetValues(Proc: TGetStrProc); override;
|
||||
// ICustomPropertyListDrawing
|
||||
procedure ListMeasureHeight(const Value: string; ACanvas: TCanvas;
|
||||
var AHeight: Integer);
|
||||
procedure ListMeasureWidth(const Value: string; ACanvas: TCanvas;
|
||||
var AWidth: Integer);
|
||||
procedure ListDrawValue(const Value: string; ACanvas: TCanvas;
|
||||
const ARect: TRect; ASelected: Boolean); virtual;
|
||||
property Parent: TJvFullColorSpaceProperty read FParent;
|
||||
property AxisIndex: TJvAxisIndex read FAxisIndex;
|
||||
end;
|
||||
|
||||
TJvDEFColorSpaceProperty = class(TJvFullColorSpaceProperty)
|
||||
public
|
||||
procedure GetProperties(Proc: TGetPropEditProc); override; //TGetPropProc); override;
|
||||
end;
|
||||
|
||||
TJvDEFColorSpaceIndentProperty = class(TNestedProperty) //, ICustomPropertyListDrawing)
|
||||
private
|
||||
FPredefinedFamily: TJvDEFFamily;
|
||||
FParent: TJvDEFColorSpaceProperty;
|
||||
public
|
||||
constructor Create(AParent: TJvDEFColorSpaceProperty;
|
||||
APredefinedFamily: TJvDEFFamily);
|
||||
(*******NOT CONVERTED ***
|
||||
function GetName: string; override;
|
||||
************************)
|
||||
function GetAttributes: TPropertyAttributes; override;
|
||||
function GetValue: string; override;
|
||||
procedure SetValue(const Value: string); override;
|
||||
procedure GetValues(Proc: TGetStrProc); override;
|
||||
// ICustomPropertyListDrawing
|
||||
procedure ListMeasureHeight(const Value: string; ACanvas: TCanvas;
|
||||
var AHeight: Integer);
|
||||
procedure ListMeasureWidth(const Value: string; ACanvas: TCanvas;
|
||||
var AWidth: Integer);
|
||||
procedure ListDrawValue(const Value: string; ACanvas: TCanvas;
|
||||
const ARect: TRect; ASelected: Boolean); virtual;
|
||||
property Parent: TJvDEFColorSpaceProperty read FParent;
|
||||
property PredefinedFamily: TJvDEFFamily read FPredefinedFamily;
|
||||
end;
|
||||
|
||||
(********************* NOT CONVERTED ***
|
||||
TJvFullColorSelection = class(TSelectionEditor)
|
||||
protected
|
||||
procedure RequireClass(Proc: TGetStrProc; AClass: TClass);
|
||||
public
|
||||
procedure ExecuteVerb(Index: Integer; const List: IDesignerSelections); override;
|
||||
function GetVerb(Index: Integer): string; override;
|
||||
function GetVerbCount: Integer; override;
|
||||
procedure RequiresUnits(Proc: TGetStrProc); override;
|
||||
procedure PrepareItem(Index: Integer; const AItem: IMenuItem); override;
|
||||
end;
|
||||
|
||||
TJvFullColorListEditor = class(TClassProperty)
|
||||
public
|
||||
function GetAttributes: TPropertyAttributes; override;
|
||||
procedure Edit; override;
|
||||
function AllEqual: Boolean; override;
|
||||
procedure FormApply(Sender: TObject);
|
||||
end;
|
||||
**********************)
|
||||
|
||||
procedure RegisterFullColorSpaceEditor(AColorSpaceID: TJvFullColorSpaceID;
|
||||
AEditorClass: TJvFullColorSpacePropertyClass);
|
||||
|
||||
function FindFullColorSpaceEditor(AColorSpaceID: TJvFullColorSpaceID): TJvFullColorSpacePropertyClass;
|
||||
|
||||
var
|
||||
DefaultFullColorSpacePropertyClass: TJvFullColorSpacePropertyClass = TJvFullColorSpaceProperty;
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
Math, SysUtils, {DesignConst, }TypInfo, Forms;
|
||||
// JvFullColorDialogs, JvFullColorCtrls, JvFullColorListForm, JvJCLUtils;
|
||||
|
||||
const
|
||||
COLOR_PREVIEW_RECT = 16;
|
||||
COLOR_PREVIEW_LINE = 1;
|
||||
COLOR_PREVIEW_SIZE = COLOR_PREVIEW_RECT + 2 * COLOR_PREVIEW_LINE;
|
||||
|
||||
function HexToInt(Value: string): Byte;
|
||||
begin
|
||||
if Value = '' then
|
||||
Result := 0
|
||||
else
|
||||
begin
|
||||
if Length(Value) > 3 then
|
||||
Value := Copy(Value, 1, 3);
|
||||
Result := StrToInt(Value);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure ColorPropertyListDrawValue(AColor: TColor; AValue: string;
|
||||
ACanvas: TCanvas; ARect: TRect; ASelected: Boolean);
|
||||
var
|
||||
OldBrushColor: TColor;
|
||||
OldPenColor: TColor;
|
||||
begin
|
||||
with ACanvas do
|
||||
begin
|
||||
OldBrushColor := Brush.Color;
|
||||
OldPenColor := Pen.Color;
|
||||
|
||||
Pen.Color := Brush.Color;
|
||||
Rectangle(ARect);
|
||||
|
||||
Brush.Color := AColor;
|
||||
Pen.Color := clBlack;
|
||||
Rectangle(ARect.Left + COLOR_PREVIEW_LINE,
|
||||
ARect.Top + COLOR_PREVIEW_LINE,
|
||||
ARect.Left + COLOR_PREVIEW_LINE + COLOR_PREVIEW_RECT,
|
||||
ARect.Top + COLOR_PREVIEW_LINE + COLOR_PREVIEW_RECT);
|
||||
|
||||
Pen.Color := OldPenColor;
|
||||
Brush.Color := OldBrushColor;
|
||||
TextOut(ARect.Left + COLOR_PREVIEW_SIZE, ARect.Top, AValue);
|
||||
end;
|
||||
end;
|
||||
|
||||
//=== { TJvFullColorProperty } ===============================================
|
||||
|
||||
procedure TJvFullColorProperty.DialogApply(Sender: TObject; AFullColor: TJvFullColor);
|
||||
begin
|
||||
SetColor(AFullColor);
|
||||
end;
|
||||
|
||||
procedure TJvFullColorProperty.Edit;
|
||||
begin
|
||||
if IsColorProperty then
|
||||
// a dummy param
|
||||
EditSpace(csRGB)
|
||||
else
|
||||
EditSpace(ColorSpaceManager.GetColorSpaceID(GetOrdValue));
|
||||
end;
|
||||
|
||||
procedure TJvFullColorProperty.EditSpace(AColorID: TJvFullColorSpaceID);
|
||||
var
|
||||
LColor: TJvFullColor;
|
||||
begin
|
||||
(******************** NOT CONVERTED ***
|
||||
with ColorSpaceManager, TJvFullColorDialog.Create(nil) do
|
||||
try
|
||||
if IsColorProperty then
|
||||
begin
|
||||
LColor := ColorSpaceManager.ConvertFromColor(TColor(GetOrdValue));
|
||||
// reset dummy param
|
||||
AColorID := ColorSpaceManager.GetColorSpaceID(LColor);
|
||||
end
|
||||
else
|
||||
LColor := TJvFullColor(GetOrdValue);
|
||||
if GetColorSpaceID(LColor) <> AColorID then
|
||||
LColor := ConvertToID(LColor, AColorID);
|
||||
|
||||
FullColor := LColor;
|
||||
Title := '';
|
||||
OnApply := DialogApply;
|
||||
Options := [foFullOpen, foAllowSpaceChange, foShowNewPreview, foShowOldPreview,
|
||||
foShowPredefined, foAllowVariable, foNoneAndDefault, foShowApply];
|
||||
|
||||
if Execute then
|
||||
SetColor(FullColor);
|
||||
finally
|
||||
Free;
|
||||
end;
|
||||
**********************)
|
||||
end;
|
||||
|
||||
function TJvFullColorProperty.GetAttributes: TPropertyAttributes;
|
||||
begin
|
||||
Result := [paSubProperties, paDialog, paMultiSelect, paVolatileSubProperties, {paVCL,}
|
||||
paRevertable];
|
||||
if IsColorProperty then
|
||||
Result := Result + [paReadOnly]
|
||||
else
|
||||
Result := Result + [paValueList, paSortList];
|
||||
end;
|
||||
|
||||
function TJvFullColorProperty.GetIsColorProperty: Boolean;
|
||||
begin
|
||||
Result := (GetPropType = TypeInfo(TColor));
|
||||
end;
|
||||
|
||||
procedure TJvFullColorProperty.GetProperties(Proc: TGetPropEditProc); //TGetPropProc);
|
||||
var
|
||||
I: Integer;
|
||||
CS: TJvColorSpace;
|
||||
begin
|
||||
with ColorSpaceManager do
|
||||
for I := 0 to Count - 1 do
|
||||
begin
|
||||
CS := ColorSpaceByIndex[I];
|
||||
Proc(FindFullColorSpaceEditor(CS.ID).Create(Self, CS, IsColorProperty));
|
||||
end;
|
||||
end;
|
||||
|
||||
function TJvFullColorProperty.GetValue: string;
|
||||
var
|
||||
Value: TJvFullColor;
|
||||
begin
|
||||
Value := GetOrdValue;
|
||||
|
||||
with ColorSpaceManager do
|
||||
if IsColorProperty then
|
||||
Result := {$IFDEF SUPPORTS_UNICODE}UTF8ToString{$ENDIF SUPPORTS_UNICODE}(GetPropType^.Name)
|
||||
else
|
||||
Result := Format('%s [%s]', [{$IFDEF SUPPORTS_UNICODE}UTF8ToString{$ENDIF SUPPORTS_UNICODE}(GetPropType^.Name), ColorSpace[GetColorSpaceID(Value)].ShortName]);
|
||||
end;
|
||||
|
||||
procedure TJvFullColorProperty.GetValues(Proc: TGetStrProc);
|
||||
var
|
||||
I: Integer;
|
||||
begin
|
||||
with ColorSpaceManager do
|
||||
for I := 0 to Count - 1 do
|
||||
Proc(ColorSpaceByIndex[I].ShortName);
|
||||
end;
|
||||
|
||||
procedure TJvFullColorProperty.PropDrawName(ACanvas: TCanvas;
|
||||
const ARect: TRect; ASelected: Boolean);
|
||||
begin
|
||||
(**************** NOT CONVERTED ***
|
||||
DefaultPropertyDrawName(Self, ACanvas, ARect);
|
||||
**********************************)
|
||||
end;
|
||||
|
||||
procedure TJvFullColorProperty.PropDrawValue(ACanvas: TCanvas;
|
||||
const ARect: TRect; ASelected: Boolean);
|
||||
var
|
||||
OldPenColor, OldBrushColor: TColor;
|
||||
Right: Integer;
|
||||
begin
|
||||
with ACanvas do
|
||||
begin
|
||||
Rectangle(ARect);
|
||||
|
||||
OldBrushColor := Brush.Color;
|
||||
if IsColorProperty then
|
||||
Brush.Color := GetOrdValue
|
||||
else
|
||||
Brush.Color := ColorSpaceManager.ConvertToColor(TJvFullColor(GetOrdValue));
|
||||
OldPenColor := Pen.Color;
|
||||
Pen.Color := clBlack;
|
||||
|
||||
Right := (ARect.Bottom - ARect.Top) + ARect.Left;
|
||||
|
||||
Rectangle(ARect.Left + 1, ARect.Top + 1, Right - 1, ARect.Bottom - 1);
|
||||
|
||||
Pen.Color := OldPenColor;
|
||||
Brush.Color := OldBrushColor;
|
||||
end;
|
||||
(******************** NOT CONVERTED ***
|
||||
DefaultPropertyDrawValue(Self, ACanvas, Rect(Right, ARect.Top, ARect.Right, ARect.Bottom));
|
||||
**************************************)
|
||||
end;
|
||||
|
||||
procedure TJvFullColorProperty.SetColor(AFullColor: TJvFullColor);
|
||||
begin
|
||||
with ColorSpaceManager do
|
||||
if IsColorProperty then
|
||||
SetOrdValue(Ord(ConvertToColor(AFullColor)))
|
||||
else
|
||||
SetOrdValue(Ord(AFullColor));
|
||||
end;
|
||||
|
||||
procedure TJvFullColorProperty.SetValue(const Value: string);
|
||||
var
|
||||
I: Integer;
|
||||
LColor: TJvFullColor;
|
||||
LColorSpace: TJvColorSpace;
|
||||
begin
|
||||
LColor := GetOrdValue;
|
||||
with ColorSpaceManager do
|
||||
for I := 0 to Count - 1 do
|
||||
begin
|
||||
LColorSpace := ColorSpaceByIndex[I];
|
||||
if LColorSpace.ShortName = Value then
|
||||
begin
|
||||
LColor := ColorSpaceManager.ConvertToID(LColor, LColorSpace.ID);
|
||||
SetOrdValue(Ord(LColor));
|
||||
Break;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
//=== { TJvFullColorSpaceProperty } ==========================================
|
||||
|
||||
constructor TJvFullColorSpaceProperty.Create(AParent: TJvFullColorProperty;
|
||||
AColorSpace: TJvColorSpace; AIsColorProperty: Boolean);
|
||||
begin
|
||||
inherited Create(AParent);
|
||||
FParent := AParent;
|
||||
FColorSpace := AColorSpace;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorSpaceProperty.Edit;
|
||||
begin
|
||||
Parent.EditSpace(ColorSpace.ID);
|
||||
end;
|
||||
|
||||
function TJvFullColorSpaceProperty.GetAttributes: TPropertyAttributes;
|
||||
begin
|
||||
Result := [paSubProperties, paDialog, paMultiSelect, paReadOnly, paVolatileSubProperties, //paVCL,
|
||||
paRevertable];
|
||||
end;
|
||||
|
||||
(******************* NOT CONVERTED ***
|
||||
function TJvFullColorSpaceProperty.GetName: string;
|
||||
begin
|
||||
Result := ColorSpace.ShortName;
|
||||
end;
|
||||
************************************)
|
||||
|
||||
procedure TJvFullColorSpaceProperty.GetProperties(Proc: TGetPropEditProc); //TGetPropProc);
|
||||
var
|
||||
I: TJvAxisIndex;
|
||||
begin
|
||||
for I := Low(TJvAxisIndex) to High(TJvAxisIndex) do
|
||||
Proc(TJvFullColorAxisProperty.Create(Self, I));
|
||||
end;
|
||||
|
||||
function TJvFullColorSpaceProperty.GetValue: string;
|
||||
begin
|
||||
Result := ColorSpace.Name;
|
||||
end;
|
||||
|
||||
//=== { TJvFullColorAxisProperty } ===========================================
|
||||
|
||||
constructor TJvFullColorAxisProperty.Create(AParent: TJvFullColorSpaceProperty;
|
||||
AAxisIndex: TJvAxisIndex);
|
||||
begin
|
||||
inherited Create(AParent.Parent);
|
||||
FParent := AParent;
|
||||
FAxisIndex := AAxisIndex;
|
||||
end;
|
||||
|
||||
function TJvFullColorAxisProperty.GetAttributes: TPropertyAttributes;
|
||||
begin
|
||||
Result := [paValueList, paMultiSelect, paRevertable];
|
||||
end;
|
||||
|
||||
(******************* NOT CONVERTED ***
|
||||
function TJvFullColorAxisProperty.GetName: string;
|
||||
begin
|
||||
Result := Parent.ColorSpace.AxisName[AxisIndex];
|
||||
end;
|
||||
************************************)
|
||||
|
||||
function TJvFullColorAxisProperty.GetValue: string;
|
||||
begin
|
||||
Result :=
|
||||
Format('$%.2x', [GetAxisValue(ColorSpaceManager.ConvertToID(GetOrdValue, Parent.ColorSpace.ID), AxisIndex)]);
|
||||
end;
|
||||
|
||||
procedure TJvFullColorAxisProperty.GetValues(Proc: TGetStrProc);
|
||||
var
|
||||
I: Byte;
|
||||
begin
|
||||
with Parent.ColorSpace do
|
||||
for I := AxisMin[AxisIndex] to AxisMax[AxisIndex] do
|
||||
Proc(Format('$%.2x', [I]));
|
||||
end;
|
||||
|
||||
procedure TJvFullColorAxisProperty.ListDrawValue(const Value: string;
|
||||
ACanvas: TCanvas; const ARect: TRect; ASelected: Boolean);
|
||||
var
|
||||
FullColor: TJvFullColor;
|
||||
LColor: TColor;
|
||||
begin
|
||||
FullColor := ColorSpaceManager.ConvertToID(GetOrdValue, Parent.ColorSpace.ID);
|
||||
FullColor := SetAxisValue(FullColor, AxisIndex, HexToInt(Value));
|
||||
LColor := Parent.ColorSpace.ConvertToColor(FullColor);
|
||||
ColorPropertyListDrawValue(LColor, Value, ACanvas, ARect, ASelected);
|
||||
end;
|
||||
|
||||
procedure TJvFullColorAxisProperty.ListMeasureHeight(const Value: string;
|
||||
ACanvas: TCanvas; var AHeight: Integer);
|
||||
begin
|
||||
AHeight := Max(ACanvas.TextHeight(Value), COLOR_PREVIEW_SIZE);
|
||||
end;
|
||||
|
||||
procedure TJvFullColorAxisProperty.ListMeasureWidth(const Value: string;
|
||||
ACanvas: TCanvas; var AWidth: Integer);
|
||||
begin
|
||||
AWidth := ACanvas.TextWidth(Value) + COLOR_PREVIEW_SIZE;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorAxisProperty.SetValue(const Value: string);
|
||||
var
|
||||
AxisValue: Byte;
|
||||
LColor: TJvFullColor;
|
||||
LColorID: TJvFullColorSpaceID;
|
||||
begin
|
||||
AxisValue := HexToInt(Value);
|
||||
LColor := TJvFullColor(GetOrdValue);
|
||||
LColorID := ColorSpaceManager.GetColorSpaceID(LColor);
|
||||
LColor := ColorSpaceManager.ConvertToID(LColor, Parent.ColorSpace.ID);
|
||||
LColor := SetAxisValue(LColor, AxisIndex, AxisValue);
|
||||
if not Parent.Parent.IsColorProperty then
|
||||
SetOrdValue(Ord(ColorSpaceManager.ConvertToID(LColor, LColorID)))
|
||||
else
|
||||
SetOrdValue(Ord(ColorSpaceManager.ConvertToColor(LColor)));
|
||||
end;
|
||||
|
||||
//=== { TJvDEFColorSpaceProperty } ===========================================
|
||||
|
||||
procedure TJvDEFColorSpaceProperty.GetProperties(Proc: TGetPropEditProc); //TGetPropProc);
|
||||
begin
|
||||
Proc(TJvDEFColorSpaceIndentProperty.Create(Self, pfConstant));
|
||||
Proc(TJvDEFColorSpaceIndentProperty.Create(Self, pfSystem));
|
||||
end;
|
||||
|
||||
//=== { TJvDEFColorSpaceIndentProperty } =====================================
|
||||
|
||||
constructor TJvDEFColorSpaceIndentProperty.Create(AParent: TJvDEFColorSpaceProperty;
|
||||
APredefinedFamily: TJvDEFFamily);
|
||||
begin
|
||||
inherited Create(AParent.Parent);
|
||||
FParent := AParent;
|
||||
FPredefinedFamily := APredefinedFamily;
|
||||
end;
|
||||
|
||||
function TJvDEFColorSpaceIndentProperty.GetAttributes: TPropertyAttributes;
|
||||
begin
|
||||
Result := [paValueList, paMultiSelect, paRevertable];
|
||||
end;
|
||||
|
||||
(*********************** NOT CONVERTED ***
|
||||
function TJvDEFColorSpaceIndentProperty.GetName: string;
|
||||
begin
|
||||
Result := GetEnumName(TypeInfo(TJvDEFFamily), Ord(PredefinedFamily));
|
||||
Result := Copy(Result, 3, Length(Result) - 2);
|
||||
end;
|
||||
****************************************)
|
||||
|
||||
function TJvDEFColorSpaceIndentProperty.GetValue: string;
|
||||
var
|
||||
AColor: TColor;
|
||||
begin
|
||||
if Parent.Parent.IsColorProperty then
|
||||
AColor := GetOrdValue
|
||||
else
|
||||
AColor := ColorSpaceManager.ConvertToColor(TJvFullColor(GetOrdValue));
|
||||
if ((AColor and JvSystemColorMask) <> 0) xor (PredefinedFamily = pfConstant) then
|
||||
Result := ColorToPrettyName(AColor)
|
||||
else
|
||||
Result := '';
|
||||
end;
|
||||
|
||||
procedure TJvDEFColorSpaceIndentProperty.GetValues(Proc: TGetStrProc);
|
||||
var
|
||||
I: Integer;
|
||||
AColor: TColor;
|
||||
CS: TJvDEFColorSpace;
|
||||
begin
|
||||
CS := TJvDEFColorSpace(Parent.ColorSpace);
|
||||
for I := 0 to CS.ColorCount - 1 do
|
||||
begin
|
||||
AColor := CS.ColorValue[I];
|
||||
if ((AColor and JvSystemColorMask) <> 0) xor (PredefinedFamily = pfConstant) then
|
||||
Proc(CS.ColorPrettyName[I]);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJvDEFColorSpaceIndentProperty.ListDrawValue(const Value: string;
|
||||
ACanvas: TCanvas; const ARect: TRect; ASelected: Boolean);
|
||||
begin
|
||||
ColorPropertyListDrawValue(PrettyNameToColor(Value), Value, ACanvas, ARect, ASelected);
|
||||
end;
|
||||
|
||||
procedure TJvDEFColorSpaceIndentProperty.ListMeasureHeight(const Value: string;
|
||||
ACanvas: TCanvas; var AHeight: Integer);
|
||||
begin
|
||||
AHeight := Max(ACanvas.TextHeight(Value), COLOR_PREVIEW_SIZE);
|
||||
end;
|
||||
|
||||
procedure TJvDEFColorSpaceIndentProperty.ListMeasureWidth(const Value: string;
|
||||
ACanvas: TCanvas; var AWidth: Integer);
|
||||
begin
|
||||
AWidth := ACanvas.TextWidth(Value) + COLOR_PREVIEW_SIZE;
|
||||
end;
|
||||
|
||||
procedure TJvDEFColorSpaceIndentProperty.SetValue(const Value: string);
|
||||
var
|
||||
I:Integer;
|
||||
CS: TJvDEFColorSpace;
|
||||
clPrefix: string;
|
||||
begin
|
||||
clPrefix := Copy(ColorToString(clBlack), 1, 2);
|
||||
CS := TJvDEFColorSpace(Parent.ColorSpace);
|
||||
for I := 0 to CS.ColorCount - 1 do
|
||||
if (CompareText(Value, CS.ColorName[I]) = 0) or
|
||||
(CompareText(Value, clPrefix + CS.ColorName[I]) = 0) or
|
||||
(CompareText(Value, CS.ColorPrettyName[I]) = 0) then
|
||||
begin
|
||||
if Parent.Parent.IsColorProperty then
|
||||
SetOrdValue(CS.ColorValue[I])
|
||||
else
|
||||
if (CS.ColorValue[I] and JvSystemColorMask) <> 0 then
|
||||
SetOrdValue(CS.ConvertFromColor(CS.ColorValue[I]))
|
||||
else
|
||||
with ColorSpaceManager do
|
||||
SetOrdValue(ConvertToID(ConvertFromColor(CS.ColorValue[I]), GetColorSpaceID(GetOrdValue)));
|
||||
Break;
|
||||
end;
|
||||
end;
|
||||
|
||||
(****************** NOT CONVERTED ***
|
||||
//=== { TJvColorSelection } ==================================================
|
||||
|
||||
procedure TJvFullColorSelection.ExecuteVerb(Index: Integer; const List: IDesignerSelections);
|
||||
begin
|
||||
// No execution
|
||||
inherited ExecuteVerb(Index, List);
|
||||
end;
|
||||
|
||||
function TJvFullColorSelection.GetVerb(Index: Integer): string;
|
||||
begin
|
||||
// No menu item
|
||||
Result := '';
|
||||
end;
|
||||
|
||||
function TJvFullColorSelection.GetVerbCount: Integer;
|
||||
begin
|
||||
// No menu item
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorSelection.PrepareItem(Index: Integer; const AItem: IMenuItem);
|
||||
begin
|
||||
// No menu item
|
||||
inherited PrepareItem(Index, AItem);
|
||||
end;
|
||||
|
||||
procedure TJvFullColorSelection.RequireClass(Proc: TGetStrProc; AClass: TClass);
|
||||
var
|
||||
LTypInfo: PTypeInfo;
|
||||
begin
|
||||
LTypInfo := AClass.ClassInfo;
|
||||
if LTypInfo <> nil then
|
||||
Proc({$IFDEF SUPPORTS_UNICODE}UTF8ToString{$ENDIF SUPPORTS_UNICODE}(GetTypeData(LTypInfo).UnitName));
|
||||
end;
|
||||
|
||||
procedure TJvFullColorSelection.RequiresUnits(Proc: TGetStrProc);
|
||||
var
|
||||
I: Integer;
|
||||
begin
|
||||
inherited RequiresUnits(Proc);
|
||||
|
||||
RequireClass(Proc, TJvColorSpace);
|
||||
|
||||
with ColorSpaceManager do
|
||||
for I := 0 to Count - 1 do
|
||||
RequireClass(Proc, ColorSpaceByIndex[I].ClassType);
|
||||
end;
|
||||
|
||||
//=== { TJvFullColorListEditor } =============================================
|
||||
|
||||
function TJvFullColorListEditor.AllEqual: Boolean;
|
||||
var
|
||||
IndexList, IndexColor: Integer;
|
||||
FullColorList: TJvFullColorList;
|
||||
begin
|
||||
Result := False;
|
||||
if PropCount > 1 then
|
||||
begin
|
||||
FullColorList := TJvFullColorList.Create;
|
||||
FullColorList.Assign(TJvFullColorList(GetOrdValue));
|
||||
|
||||
for IndexList := 1 to PropCount - 1 do
|
||||
with TJvFullColorList(GetOrdValueAt(IndexList)) do
|
||||
for IndexColor:=0 to Count - 1 do
|
||||
if FullColorList.Items[IndexColor] <> Items[IndexColor] then
|
||||
Exit;
|
||||
end;
|
||||
Result := True;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorListEditor.Edit;
|
||||
var
|
||||
FullColorListForm: TJvFullColorListFrm;
|
||||
FullColorList: TJvFullColorList;
|
||||
IndexList, IndexColor: Integer;
|
||||
begin
|
||||
FullColorListForm := TJvFullColorListFrm.Create(Application);
|
||||
try
|
||||
FullColorList:=TJvFullColorList.Create;
|
||||
try
|
||||
for IndexList := 0 to PropCount - 1 do
|
||||
with TJvFullColorList(GetOrdValueAt(IndexList)) do
|
||||
for IndexColor := 0 to Count - 1 do
|
||||
if FullColorList.IndexOf(Items[IndexColor]) = -1 then
|
||||
FullColorList.Add(Items[IndexColor]);
|
||||
|
||||
FullColorListForm.OnApply := FormApply;
|
||||
FullColorListForm.ColorList := FullColorList;
|
||||
if FullColorListForm.Execute then
|
||||
FormApply(FullColorListForm);
|
||||
finally
|
||||
FullColorList.Free;
|
||||
end;
|
||||
finally
|
||||
FullColorListForm.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorListEditor.FormApply(Sender: TObject);
|
||||
begin
|
||||
SetOrdValue(Cardinal((Sender as TJvFullColorListFrm).ColorList));
|
||||
end;
|
||||
|
||||
function TJvFullColorListEditor.GetAttributes: TPropertyAttributes;
|
||||
begin
|
||||
Result := [paDialog, paVCL, paMultiSelect];
|
||||
end;
|
||||
********************)
|
||||
|
||||
var
|
||||
GFullColorSpaceEditorArray: array of TJvFullColorSpacePropertyClass;
|
||||
|
||||
{procedure ModuleUnloadProc(HInstance: Integer);
|
||||
var
|
||||
Index: Integer;
|
||||
AEditorClass: TJvFullColorSpacePropertyClass;
|
||||
begin
|
||||
for Index := High(GFullColorSpaceEditorArray) downto 0 do
|
||||
begin
|
||||
AEditorClass := GFullColorSpaceEditorArray[Index];
|
||||
if (AEditorClass <> nil) and (AEditorClass <> TJvFullColorSpaceProperty) and IsClassInModule(HInstance, AEditorClass) then
|
||||
GFullColorSpaceEditorArray[Index] := nil;
|
||||
end;
|
||||
end;}
|
||||
|
||||
procedure InitFullColorSpaceEditorArray;
|
||||
var
|
||||
ACount: Integer;
|
||||
Index: Integer;
|
||||
begin
|
||||
ACount := (High(TJvFullColorSpaceID) - Low(TJvFullColorSpaceID) + 1) shr 2;
|
||||
SetLength(GFullColorSpaceEditorArray, ACount);
|
||||
for Index := 0 to High(GFullColorSpaceEditorArray) do
|
||||
GFullColorSpaceEditorArray[Index] := nil;
|
||||
end;
|
||||
|
||||
procedure RegisterFullColorSpaceEditor(AColorSpaceID: TJvFullColorSpaceID;
|
||||
AEditorClass: TJvFullColorSpacePropertyClass);
|
||||
begin
|
||||
if GFullColorSpaceEditorArray = nil then
|
||||
begin
|
||||
InitFullColorSpaceEditorArray;
|
||||
//RegisterFullColorSpaceEditor(csDEF, TJvDEFColorSpaceProperty);
|
||||
GFullColorSpaceEditorArray[csDEF shr 2] := TJvDEFColorSpaceProperty;
|
||||
end;
|
||||
|
||||
GFullColorSpaceEditorArray[AColorSpaceID shr 2] := AEditorClass;
|
||||
// todo (outchy) notification for changing
|
||||
end;
|
||||
|
||||
function FindFullColorSpaceEditor(AColorSpaceID: TJvFullColorSpaceID): TJvFullColorSpacePropertyClass;
|
||||
begin
|
||||
if GFullColorSpaceEditorArray = nil then
|
||||
InitFullColorSpaceEditorArray;
|
||||
Result := GFullColorSpaceEditorArray[AColorSpaceID shr 2];
|
||||
if Result = nil then
|
||||
Result := DefaultFullColorSpacePropertyClass;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
//initialization
|
||||
// AddModuleUnloadProc(ModuleUnloadProc);
|
||||
|
||||
//finalization
|
||||
// RemoveModuleUnloadProc(ModuleUnloadProc);
|
||||
|
||||
end.
|
@ -15,7 +15,7 @@
|
||||
</SearchPaths>
|
||||
</CompilerOptions>
|
||||
<Version Major="1" Release="4"/>
|
||||
<Files Count="3">
|
||||
<Files Count="5">
|
||||
<Item1>
|
||||
<Filename Value="..\design\JvMM\JvMMReg.pas"/>
|
||||
<HasRegisterProc Value="True"/>
|
||||
@ -29,6 +29,14 @@
|
||||
<Filename Value="..\design\JvMM\JvId3v2DefineForm.pas"/>
|
||||
<UnitName Value="JvId3v2DefineForm"/>
|
||||
</Item3>
|
||||
<Item4>
|
||||
<Filename Value="..\design\JvMM\jvfullcoloreditors.pas"/>
|
||||
<UnitName Value="JvFullColorEditors"/>
|
||||
</Item4>
|
||||
<Item5>
|
||||
<Filename Value="..\design\JvMM\jvfullcolorspaceseditors.pas"/>
|
||||
<UnitName Value="JvFullColorSpacesEditors"/>
|
||||
</Item5>
|
||||
</Files>
|
||||
<RequiredPkgs Count="4">
|
||||
<Item1>
|
||||
|
@ -16,7 +16,7 @@
|
||||
<Description Value="JVCL Multimedia Components (Runtime)."/>
|
||||
<License Value="The JVCL is released in accordance with the MPL 1.1 license. To get your own copy or read it, go to http://www.mozilla.org/MPL/MPL-1.1.html. "/>
|
||||
<Version Major="1" Release="4"/>
|
||||
<Files Count="8">
|
||||
<Files Count="15">
|
||||
<Item1>
|
||||
<Filename Value="..\run\JvMM\JvSpecialProgress.pas"/>
|
||||
<UnitName Value="JvSpecialProgress"/>
|
||||
@ -49,6 +49,34 @@
|
||||
<Filename Value="..\run\JvMM\jvbmpanimator.pas"/>
|
||||
<UnitName Value="JvBmpAnimator"/>
|
||||
</Item8>
|
||||
<Item9>
|
||||
<Filename Value="..\run\JvMM\jvfullcolorspaces.pas"/>
|
||||
<UnitName Value="JvFullColorSpaces"/>
|
||||
</Item9>
|
||||
<Item10>
|
||||
<Filename Value="..\run\JvMM\jvfullcolorrotate.pas"/>
|
||||
<UnitName Value="JvFullColorRotate"/>
|
||||
</Item10>
|
||||
<Item11>
|
||||
<Filename Value="..\run\JvMM\jvfullcolorctrls.pas"/>
|
||||
<UnitName Value="JvFullColorCtrls"/>
|
||||
</Item11>
|
||||
<Item12>
|
||||
<Filename Value="..\run\JvMM\jvfullcolorform.lfm"/>
|
||||
<Type Value="LFM"/>
|
||||
</Item12>
|
||||
<Item13>
|
||||
<Filename Value="..\run\JvMM\jvfullcolorform.pas"/>
|
||||
<UnitName Value="JvFullColorForm"/>
|
||||
</Item13>
|
||||
<Item14>
|
||||
<Filename Value="..\run\JvMM\jvfullcolorcircleform.pas"/>
|
||||
<UnitName Value="JvFullColorCircleForm"/>
|
||||
</Item14>
|
||||
<Item15>
|
||||
<Filename Value="..\run\JvMM\jvfullcolordialogs.pas"/>
|
||||
<UnitName Value="JvFullColorDialogs"/>
|
||||
</Item15>
|
||||
</Files>
|
||||
<RequiredPkgs Count="2">
|
||||
<Item1>
|
||||
|
972
components/jvcllaz/run/JvMM/jvfullcolorcircleform.lfm
Normal file
@ -0,0 +1,972 @@
|
||||
object JvFullColorCircleFrm: TJvFullColorCircleFrm
|
||||
Left = 274
|
||||
Height = 573
|
||||
Top = 219
|
||||
Width = 997
|
||||
AutoSize = True
|
||||
BorderStyle = bsDialog
|
||||
Caption = 'Color circle configurations'
|
||||
ClientHeight = 573
|
||||
ClientWidth = 997
|
||||
Color = clBtnFace
|
||||
Font.Color = clWindowText
|
||||
KeyPreview = True
|
||||
OnCreate = FormCreate
|
||||
OnShow = FormShow
|
||||
LCLVersion = '2.1.0.0'
|
||||
object LabelOld: TLabel
|
||||
AnchorSideLeft.Control = PanelImageOld
|
||||
AnchorSideTop.Control = JvColorSpaceCombo
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 72
|
||||
Height = 15
|
||||
Top = 58
|
||||
Width = 22
|
||||
BorderSpacing.Top = 8
|
||||
Caption = 'Old:'
|
||||
ParentColor = False
|
||||
end
|
||||
object LabelNew: TLabel
|
||||
AnchorSideLeft.Control = PanelImageNew
|
||||
AnchorSideTop.Control = LabelOld
|
||||
Left = 216
|
||||
Height = 15
|
||||
Top = 58
|
||||
Width = 27
|
||||
Caption = 'New:'
|
||||
ParentColor = False
|
||||
end
|
||||
object LabelColorSpace: TLabel
|
||||
AnchorSideLeft.Control = JvColorSpaceCombo
|
||||
AnchorSideTop.Control = Owner
|
||||
Left = 103
|
||||
Height = 15
|
||||
Top = 8
|
||||
Width = 66
|
||||
BorderSpacing.Top = 8
|
||||
Caption = '&Color Space:'
|
||||
ParentColor = False
|
||||
end
|
||||
object PanelGraphics: TPanel
|
||||
AnchorSideLeft.Control = PanelCommonSettings
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = LabelColorSpace
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = ButtonOK
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 412
|
||||
Height = 550
|
||||
Top = 8
|
||||
Width = 577
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
BorderSpacing.Right = 8
|
||||
BevelInner = bvRaised
|
||||
BevelOuter = bvLowered
|
||||
Caption = 'PanelGraphics'
|
||||
ClientHeight = 550
|
||||
ClientWidth = 577
|
||||
TabOrder = 5
|
||||
object LabelAxisSettings: TLabel
|
||||
AnchorSideLeft.Control = JvColorAxisConfigCombo
|
||||
AnchorSideTop.Control = PanelGraphics
|
||||
Left = 201
|
||||
Height = 15
|
||||
Top = 10
|
||||
Width = 69
|
||||
BorderSpacing.Top = 8
|
||||
Caption = 'A&xis Settings:'
|
||||
FocusControl = JvColorAxisConfigCombo
|
||||
ParentColor = False
|
||||
end
|
||||
object JvColorCircle: TJvFullColorCircle
|
||||
AnchorSideLeft.Control = Bevel10
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = JvColorAxisConfigCombo
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = PanelGraphics
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = PanelGraphics
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 100
|
||||
Height = 480
|
||||
Top = 60
|
||||
Width = 459
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Right = 16
|
||||
BorderSpacing.Bottom = 8
|
||||
FullColor = 83886079
|
||||
AxisConfig = acYZX
|
||||
TabOrder = 1
|
||||
OnColorChange = JvColorCircleColorChange
|
||||
OnColorSpaceChange = JvColorCircleColorSpaceChange
|
||||
CrossSize = 10
|
||||
CrossCenter = 3
|
||||
CrossStyle.Width = 3
|
||||
LineWidth = 0
|
||||
RedTrackBar = JvFullColorTrackBarRed
|
||||
GreenTrackBar = JvFullColorTrackBarGreen
|
||||
BlueTrackBar = JvFullColorTrackBarBlue
|
||||
CommonTrackBar = JvFullColorTrackBarCommon
|
||||
OnRedColorChange = JvColorCircleRedColorChange
|
||||
OnGreenColorChange = JvColorCircleGreenColorChange
|
||||
OnBlueColorChange = JvColorCircleBlueColorChange
|
||||
end
|
||||
object JvFullColorTrackBarCommon: TJvFullColorTrackBar
|
||||
AnchorSideTop.Control = JvColorCircle
|
||||
AnchorSideBottom.Control = Bevel10
|
||||
Left = 40
|
||||
Height = 237
|
||||
Top = 60
|
||||
Width = 21
|
||||
Anchors = [akTop, akLeft, akBottom]
|
||||
FullColor = 83886079
|
||||
AxisConfig = acYZX
|
||||
TabOrder = 2
|
||||
ArrowWidth = 10
|
||||
ColorOrientation = coInverse
|
||||
Orientation = trVertical
|
||||
end
|
||||
object JvFullColorTrackBarBlue: TJvFullColorTrackBar
|
||||
AnchorSideLeft.Control = JvFullColorTrackBarGreen
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = Bevel10
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideBottom.Control = JvFullColorTrackBarRed
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 68
|
||||
Height = 237
|
||||
Top = 303
|
||||
Width = 21
|
||||
Anchors = [akTop, akLeft, akBottom]
|
||||
BorderSpacing.Left = 8
|
||||
FullColor = 83820544
|
||||
AxisConfig = acYZX
|
||||
TabOrder = 5
|
||||
ArrowColor = clBlue
|
||||
ArrowWidth = 10
|
||||
ColorOrientation = coInverse
|
||||
Orientation = trVertical
|
||||
end
|
||||
object JvFullColorTrackBarGreen: TJvFullColorTrackBar
|
||||
AnchorSideLeft.Control = JvFullColorTrackBarRed
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = Bevel10
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideBottom.Control = JvFullColorTrackBarRed
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 39
|
||||
Height = 237
|
||||
Top = 303
|
||||
Width = 21
|
||||
Anchors = [akTop, akLeft, akBottom]
|
||||
BorderSpacing.Left = 8
|
||||
FullColor = 67174144
|
||||
AxisConfig = acYZX
|
||||
TabOrder = 4
|
||||
ArrowColor = clLime
|
||||
ArrowWidth = 10
|
||||
ColorOrientation = coInverse
|
||||
Orientation = trVertical
|
||||
end
|
||||
object JvFullColorTrackBarRed: TJvFullColorTrackBar
|
||||
AnchorSideLeft.Control = PanelGraphics
|
||||
AnchorSideTop.Control = Bevel10
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideBottom.Control = JvColorCircle
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 10
|
||||
Height = 237
|
||||
Top = 303
|
||||
Width = 21
|
||||
Anchors = [akTop, akLeft, akBottom]
|
||||
BorderSpacing.Left = 8
|
||||
FullColor = 67109119
|
||||
AxisConfig = acYZX
|
||||
TabOrder = 3
|
||||
ArrowColor = clRed
|
||||
ArrowWidth = 10
|
||||
ColorOrientation = coInverse
|
||||
Orientation = trVertical
|
||||
end
|
||||
object JvColorAxisConfigCombo: TJvFullColorAxisCombo
|
||||
AnchorSideLeft.Control = JvColorCircle
|
||||
AnchorSideLeft.Side = asrCenter
|
||||
AnchorSideTop.Control = LabelAxisSettings
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 201
|
||||
Height = 23
|
||||
Top = 29
|
||||
Width = 257
|
||||
Selected = acXYZ
|
||||
BorderSpacing.Top = 4
|
||||
ItemHeight = 15
|
||||
TabOrder = 0
|
||||
OnChange = JvColorAxisConfigComboChange
|
||||
end
|
||||
object Bevel10: TBevel
|
||||
AnchorSideLeft.Control = PanelGraphics
|
||||
AnchorSideTop.Control = JvColorCircle
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 2
|
||||
Height = 6
|
||||
Top = 297
|
||||
Width = 90
|
||||
end
|
||||
end
|
||||
object PanelCommonSettings: TPanel
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = PanelImageOld
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 16
|
||||
Height = 95
|
||||
Top = 211
|
||||
Width = 380
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 16
|
||||
BorderSpacing.Top = 16
|
||||
BorderSpacing.Right = 16
|
||||
BevelInner = bvRaised
|
||||
BevelOuter = bvLowered
|
||||
ClientHeight = 95
|
||||
ClientWidth = 380
|
||||
TabOrder = 2
|
||||
object LabelComAxis0: TLabel
|
||||
AnchorSideLeft.Control = SpinEditComAxis0
|
||||
AnchorSideTop.Control = PanelCommonSettings
|
||||
Left = 82
|
||||
Height = 15
|
||||
Top = 16
|
||||
Width = 81
|
||||
BorderSpacing.Top = 14
|
||||
Caption = 'LabelComAxis0'
|
||||
ParentColor = False
|
||||
end
|
||||
object LabelComAxis1: TLabel
|
||||
AnchorSideLeft.Control = SpinEditComAxis1
|
||||
AnchorSideTop.Control = LabelComAxis0
|
||||
Left = 178
|
||||
Height = 15
|
||||
Top = 16
|
||||
Width = 81
|
||||
Caption = 'LabelComAxis1'
|
||||
ParentColor = False
|
||||
end
|
||||
object LabelComAxis2: TLabel
|
||||
AnchorSideLeft.Control = SpinEditComAxis2
|
||||
AnchorSideTop.Control = LabelComAxis0
|
||||
Left = 274
|
||||
Height = 15
|
||||
Top = 16
|
||||
Width = 81
|
||||
Caption = 'LabelComAxis2'
|
||||
ParentColor = False
|
||||
end
|
||||
object LabelCommon: TLabel
|
||||
AnchorSideTop.Control = SpinEditComAxis0
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = LabelComAxis0
|
||||
Left = 20
|
||||
Height = 15
|
||||
Top = 39
|
||||
Width = 54
|
||||
Alignment = taRightJustify
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Left = 16
|
||||
BorderSpacing.Right = 8
|
||||
Caption = 'C&ommon:'
|
||||
FocusControl = SpinEditComAxis0
|
||||
ParentColor = False
|
||||
end
|
||||
object SpinEditComAxis0: TSpinEdit
|
||||
Tag = 48
|
||||
AnchorSideLeft.Control = Bevel2
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = LabelComAxis0
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 82
|
||||
Height = 23
|
||||
Top = 35
|
||||
Width = 57
|
||||
BorderSpacing.Top = 4
|
||||
Enabled = False
|
||||
OnChange = SpinEditSettingsValueChange
|
||||
TabOrder = 0
|
||||
end
|
||||
object SpinEditComAxis1: TSpinEdit
|
||||
Tag = 49
|
||||
AnchorSideLeft.Control = Bevel3
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = LabelComAxis1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 178
|
||||
Height = 23
|
||||
Top = 35
|
||||
Width = 57
|
||||
BorderSpacing.Top = 4
|
||||
OnChange = SpinEditSettingsValueChange
|
||||
TabOrder = 1
|
||||
end
|
||||
object SpinEditComAxis2: TSpinEdit
|
||||
Tag = 50
|
||||
AnchorSideLeft.Control = Bevel4
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = LabelComAxis2
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 274
|
||||
Height = 23
|
||||
Top = 35
|
||||
Width = 57
|
||||
BorderSpacing.Top = 4
|
||||
OnChange = SpinEditSettingsValueChange
|
||||
TabOrder = 2
|
||||
end
|
||||
object CheckBoxCom0: TCheckBox
|
||||
Tag = 48
|
||||
AnchorSideLeft.Control = SpinEditComAxis0
|
||||
AnchorSideTop.Control = SpinEditComAxis0
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 82
|
||||
Height = 19
|
||||
Top = 62
|
||||
Width = 104
|
||||
BorderSpacing.Top = 4
|
||||
Caption = 'CheckBoxCom0'
|
||||
OnClick = CheckBoxSettingsClick
|
||||
TabOrder = 3
|
||||
end
|
||||
object CheckBoxCom1: TCheckBox
|
||||
Tag = 49
|
||||
AnchorSideLeft.Control = SpinEditComAxis1
|
||||
AnchorSideTop.Control = CheckBoxCom0
|
||||
Left = 178
|
||||
Height = 19
|
||||
Top = 62
|
||||
Width = 104
|
||||
Caption = 'CheckBoxCom1'
|
||||
OnClick = CheckBoxSettingsClick
|
||||
TabOrder = 4
|
||||
end
|
||||
object CheckBoxCom2: TCheckBox
|
||||
Tag = 50
|
||||
AnchorSideLeft.Control = SpinEditComAxis2
|
||||
AnchorSideTop.Control = CheckBoxCom0
|
||||
Left = 274
|
||||
Height = 19
|
||||
Top = 62
|
||||
Width = 104
|
||||
Caption = 'CheckBoxCom2'
|
||||
OnClick = CheckBoxSettingsClick
|
||||
TabOrder = 5
|
||||
end
|
||||
object Bevel2: TBevel
|
||||
AnchorSideLeft.Control = PanelCommonSettings
|
||||
AnchorSideTop.Control = CheckBoxCom0
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 2
|
||||
Height = 12
|
||||
Top = 81
|
||||
Width = 80
|
||||
Constraints.MinWidth = 80
|
||||
Shape = bsSpacer
|
||||
end
|
||||
object Bevel3: TBevel
|
||||
AnchorSideLeft.Control = Bevel2
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = CheckBoxCom0
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 82
|
||||
Height = 12
|
||||
Top = 81
|
||||
Width = 96
|
||||
Constraints.MinWidth = 96
|
||||
Shape = bsSpacer
|
||||
end
|
||||
object Bevel4: TBevel
|
||||
AnchorSideLeft.Control = Bevel3
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = Bevel2
|
||||
Left = 178
|
||||
Height = 12
|
||||
Top = 81
|
||||
Width = 96
|
||||
Constraints.MinWidth = 96
|
||||
Shape = bsSpacer
|
||||
end
|
||||
object Bevel5: TBevel
|
||||
AnchorSideLeft.Control = Bevel4
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = Bevel2
|
||||
Left = 274
|
||||
Height = 12
|
||||
Top = 81
|
||||
Width = 80
|
||||
Constraints.MinWidth = 80
|
||||
Shape = bsSpacer
|
||||
end
|
||||
end
|
||||
object PanelAxisSettings: TPanel
|
||||
AnchorSideLeft.Control = PanelCommonSettings
|
||||
AnchorSideTop.Control = PanelCommonSettings
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = PanelCommonSettings
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 16
|
||||
Height = 203
|
||||
Top = 322
|
||||
Width = 380
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Top = 16
|
||||
BevelInner = bvRaised
|
||||
BevelOuter = bvLowered
|
||||
ClientHeight = 203
|
||||
ClientWidth = 380
|
||||
TabOrder = 4
|
||||
object LabelAxis0: TLabel
|
||||
AnchorSideLeft.Control = SpinEditRedAxis0
|
||||
AnchorSideTop.Control = PanelAxisSettings
|
||||
Left = 82
|
||||
Height = 15
|
||||
Top = 16
|
||||
Width = 55
|
||||
BorderSpacing.Top = 14
|
||||
Caption = 'LabelAxis0'
|
||||
ParentColor = False
|
||||
end
|
||||
object LabelAxis1: TLabel
|
||||
AnchorSideLeft.Control = SpinEditRedAxis1
|
||||
AnchorSideTop.Control = LabelAxis0
|
||||
Left = 178
|
||||
Height = 15
|
||||
Top = 16
|
||||
Width = 55
|
||||
Caption = 'LabelAxis1'
|
||||
ParentColor = False
|
||||
end
|
||||
object LabelAxis2: TLabel
|
||||
AnchorSideLeft.Control = SpinEditRedAxis2
|
||||
AnchorSideTop.Control = LabelAxis0
|
||||
Left = 274
|
||||
Height = 15
|
||||
Top = 16
|
||||
Width = 55
|
||||
Caption = 'LabelAxis2'
|
||||
ParentColor = False
|
||||
end
|
||||
object LabelRed: TLabel
|
||||
AnchorSideTop.Control = SpinEditRedAxis0
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = SpinEditRedAxis0
|
||||
Left = 51
|
||||
Height = 15
|
||||
Top = 39
|
||||
Width = 23
|
||||
Alignment = taRightJustify
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Right = 8
|
||||
Caption = '&Red:'
|
||||
FocusControl = SpinEditRedAxis0
|
||||
ParentBidiMode = False
|
||||
ParentColor = False
|
||||
end
|
||||
object LabelGreen: TLabel
|
||||
AnchorSideTop.Control = SpinEditGreenAxis0
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = SpinEditRedAxis0
|
||||
Left = 40
|
||||
Height = 15
|
||||
Top = 93
|
||||
Width = 34
|
||||
Alignment = taRightJustify
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Right = 8
|
||||
Caption = '&Green:'
|
||||
FocusControl = SpinEditGreenAxis0
|
||||
ParentColor = False
|
||||
end
|
||||
object LabelBlue: TLabel
|
||||
AnchorSideTop.Control = SpinEditBlueAxis0
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = SpinEditRedAxis0
|
||||
Left = 48
|
||||
Height = 15
|
||||
Top = 147
|
||||
Width = 26
|
||||
Alignment = taRightJustify
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Right = 8
|
||||
Caption = '&Blue:'
|
||||
FocusControl = SpinEditBlueAxis0
|
||||
ParentColor = False
|
||||
end
|
||||
object SpinEditRedAxis0: TSpinEdit
|
||||
AnchorSideLeft.Control = Bevel6
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = LabelAxis0
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 82
|
||||
Height = 23
|
||||
Top = 35
|
||||
Width = 57
|
||||
BorderSpacing.Top = 4
|
||||
OnChange = SpinEditSettingsValueChange
|
||||
TabOrder = 0
|
||||
end
|
||||
object SpinEditGreenAxis0: TSpinEdit
|
||||
Tag = 16
|
||||
AnchorSideLeft.Control = Bevel6
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = CheckBoxRed0
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 82
|
||||
Height = 23
|
||||
Top = 89
|
||||
Width = 57
|
||||
BorderSpacing.Top = 8
|
||||
OnChange = SpinEditSettingsValueChange
|
||||
TabOrder = 6
|
||||
end
|
||||
object SpinEditBlueAxis0: TSpinEdit
|
||||
Tag = 32
|
||||
AnchorSideLeft.Control = Bevel6
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = CheckBoxGreen0
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 82
|
||||
Height = 23
|
||||
Top = 143
|
||||
Width = 57
|
||||
BorderSpacing.Top = 8
|
||||
OnChange = SpinEditSettingsValueChange
|
||||
TabOrder = 12
|
||||
end
|
||||
object SpinEditRedAxis1: TSpinEdit
|
||||
Tag = 1
|
||||
AnchorSideLeft.Control = Bevel7
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = LabelAxis0
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 178
|
||||
Height = 23
|
||||
Top = 35
|
||||
Width = 57
|
||||
BorderSpacing.Top = 4
|
||||
OnChange = SpinEditSettingsValueChange
|
||||
TabOrder = 1
|
||||
end
|
||||
object SpinEditRedAxis2: TSpinEdit
|
||||
Tag = 2
|
||||
AnchorSideLeft.Control = Bevel8
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = LabelAxis0
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 274
|
||||
Height = 23
|
||||
Top = 35
|
||||
Width = 57
|
||||
BorderSpacing.Top = 4
|
||||
OnChange = SpinEditSettingsValueChange
|
||||
TabOrder = 2
|
||||
end
|
||||
object SpinEditGreenAxis1: TSpinEdit
|
||||
Tag = 17
|
||||
AnchorSideLeft.Control = Bevel7
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = CheckBoxRed0
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 178
|
||||
Height = 23
|
||||
Top = 89
|
||||
Width = 57
|
||||
BorderSpacing.Top = 8
|
||||
OnChange = SpinEditSettingsValueChange
|
||||
TabOrder = 7
|
||||
end
|
||||
object SpinEditGreenAxis2: TSpinEdit
|
||||
Tag = 18
|
||||
AnchorSideLeft.Control = Bevel8
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = CheckBoxRed0
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 274
|
||||
Height = 23
|
||||
Top = 89
|
||||
Width = 57
|
||||
BorderSpacing.Top = 8
|
||||
OnChange = SpinEditSettingsValueChange
|
||||
TabOrder = 8
|
||||
end
|
||||
object SpinEditBlueAxis1: TSpinEdit
|
||||
Tag = 33
|
||||
AnchorSideLeft.Control = Bevel7
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = CheckBoxGreen0
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 178
|
||||
Height = 23
|
||||
Top = 143
|
||||
Width = 57
|
||||
BorderSpacing.Top = 8
|
||||
OnChange = SpinEditSettingsValueChange
|
||||
TabOrder = 13
|
||||
end
|
||||
object SpinEditBlueAxis2: TSpinEdit
|
||||
Tag = 34
|
||||
AnchorSideLeft.Control = Bevel8
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = CheckBoxGreen0
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 274
|
||||
Height = 23
|
||||
Top = 143
|
||||
Width = 57
|
||||
BorderSpacing.Top = 8
|
||||
OnChange = SpinEditSettingsValueChange
|
||||
TabOrder = 14
|
||||
end
|
||||
object CheckBoxRed0: TCheckBox
|
||||
AnchorSideLeft.Control = SpinEditRedAxis0
|
||||
AnchorSideTop.Control = SpinEditRedAxis0
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 82
|
||||
Height = 19
|
||||
Top = 62
|
||||
Width = 98
|
||||
BorderSpacing.Top = 4
|
||||
Caption = 'CheckBoxRed0'
|
||||
OnClick = CheckBoxSettingsClick
|
||||
TabOrder = 3
|
||||
end
|
||||
object CheckBoxRed1: TCheckBox
|
||||
Tag = 1
|
||||
AnchorSideLeft.Control = SpinEditRedAxis1
|
||||
AnchorSideTop.Control = SpinEditRedAxis0
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 178
|
||||
Height = 19
|
||||
Top = 62
|
||||
Width = 98
|
||||
BorderSpacing.Top = 4
|
||||
Caption = 'CheckBoxRed1'
|
||||
OnClick = CheckBoxSettingsClick
|
||||
TabOrder = 4
|
||||
end
|
||||
object CheckBoxRed2: TCheckBox
|
||||
Tag = 2
|
||||
AnchorSideLeft.Control = SpinEditRedAxis2
|
||||
AnchorSideTop.Control = SpinEditRedAxis0
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 274
|
||||
Height = 19
|
||||
Top = 62
|
||||
Width = 98
|
||||
BorderSpacing.Top = 4
|
||||
Caption = 'CheckBoxRed2'
|
||||
OnClick = CheckBoxSettingsClick
|
||||
TabOrder = 5
|
||||
end
|
||||
object CheckBoxGreen0: TCheckBox
|
||||
Tag = 16
|
||||
AnchorSideLeft.Control = SpinEditRedAxis0
|
||||
AnchorSideTop.Control = SpinEditGreenAxis0
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 82
|
||||
Height = 19
|
||||
Top = 116
|
||||
Width = 109
|
||||
BorderSpacing.Top = 4
|
||||
Caption = 'CheckBoxGreen0'
|
||||
OnClick = CheckBoxSettingsClick
|
||||
TabOrder = 9
|
||||
end
|
||||
object CheckBoxGreen1: TCheckBox
|
||||
Tag = 17
|
||||
AnchorSideLeft.Control = SpinEditRedAxis1
|
||||
AnchorSideTop.Control = SpinEditGreenAxis0
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 178
|
||||
Height = 19
|
||||
Top = 116
|
||||
Width = 109
|
||||
BorderSpacing.Top = 4
|
||||
Caption = 'CheckBoxGreen1'
|
||||
OnClick = CheckBoxSettingsClick
|
||||
TabOrder = 10
|
||||
end
|
||||
object CheckBoxGreen2: TCheckBox
|
||||
Tag = 18
|
||||
AnchorSideLeft.Control = SpinEditRedAxis2
|
||||
AnchorSideTop.Control = SpinEditGreenAxis0
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 274
|
||||
Height = 19
|
||||
Top = 116
|
||||
Width = 109
|
||||
BorderSpacing.Top = 4
|
||||
Caption = 'CheckBoxGreen2'
|
||||
OnClick = CheckBoxSettingsClick
|
||||
TabOrder = 11
|
||||
end
|
||||
object CheckBoxBlue0: TCheckBox
|
||||
Tag = 32
|
||||
AnchorSideLeft.Control = SpinEditRedAxis0
|
||||
AnchorSideTop.Control = SpinEditBlueAxis0
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 82
|
||||
Height = 19
|
||||
Top = 170
|
||||
Width = 101
|
||||
BorderSpacing.Top = 4
|
||||
Caption = 'CheckBoxBlue0'
|
||||
OnClick = CheckBoxSettingsClick
|
||||
TabOrder = 15
|
||||
end
|
||||
object CheckBoxBlue1: TCheckBox
|
||||
Tag = 33
|
||||
AnchorSideLeft.Control = SpinEditRedAxis1
|
||||
AnchorSideTop.Control = SpinEditBlueAxis0
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 178
|
||||
Height = 19
|
||||
Top = 170
|
||||
Width = 101
|
||||
BorderSpacing.Top = 4
|
||||
Caption = 'CheckBoxBlue1'
|
||||
OnClick = CheckBoxSettingsClick
|
||||
TabOrder = 16
|
||||
end
|
||||
object CheckBoxBlue2: TCheckBox
|
||||
Tag = 34
|
||||
AnchorSideLeft.Control = SpinEditRedAxis2
|
||||
AnchorSideTop.Control = SpinEditBlueAxis0
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 274
|
||||
Height = 19
|
||||
Top = 170
|
||||
Width = 101
|
||||
BorderSpacing.Top = 4
|
||||
Caption = 'CheckBoxBlue2'
|
||||
OnClick = CheckBoxSettingsClick
|
||||
TabOrder = 17
|
||||
end
|
||||
object Bevel6: TBevel
|
||||
AnchorSideLeft.Control = PanelAxisSettings
|
||||
AnchorSideTop.Control = CheckBoxBlue0
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 2
|
||||
Height = 12
|
||||
Top = 189
|
||||
Width = 80
|
||||
Constraints.MinWidth = 80
|
||||
Shape = bsSpacer
|
||||
end
|
||||
object Bevel7: TBevel
|
||||
AnchorSideLeft.Control = Bevel6
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = CheckBoxBlue0
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 82
|
||||
Height = 12
|
||||
Top = 189
|
||||
Width = 96
|
||||
Constraints.MinWidth = 96
|
||||
Shape = bsSpacer
|
||||
end
|
||||
object Bevel8: TBevel
|
||||
AnchorSideLeft.Control = Bevel7
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = CheckBoxBlue0
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 178
|
||||
Height = 12
|
||||
Top = 189
|
||||
Width = 96
|
||||
Constraints.MinWidth = 96
|
||||
Shape = bsSpacer
|
||||
end
|
||||
object Bevel9: TBevel
|
||||
AnchorSideLeft.Control = Bevel8
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = CheckBoxBlue0
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 274
|
||||
Height = 12
|
||||
Top = 189
|
||||
Width = 80
|
||||
Constraints.MinWidth = 80
|
||||
Shape = bsSpacer
|
||||
end
|
||||
end
|
||||
object RadioButtonCommonSettings: TRadioButton
|
||||
AnchorSideLeft.Control = PanelCommonSettings
|
||||
AnchorSideTop.Control = PanelImageOld
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 24
|
||||
Height = 19
|
||||
Top = 203
|
||||
Width = 119
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 8
|
||||
Caption = 'Co&mmon Settings:'
|
||||
OnClick = RadioButtonAxisClick
|
||||
TabOrder = 1
|
||||
end
|
||||
object RadioButtonAxisSettings: TRadioButton
|
||||
AnchorSideLeft.Control = PanelAxisSettings
|
||||
AnchorSideTop.Control = PanelCommonSettings
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 24
|
||||
Height = 19
|
||||
Top = 314
|
||||
Width = 89
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 8
|
||||
Caption = '&Axis Settings:'
|
||||
OnClick = RadioButtonAxisClick
|
||||
TabOrder = 3
|
||||
end
|
||||
object ButtonGraphics: TButton
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = ButtonOK
|
||||
AnchorSideRight.Control = PanelAxisSettings
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 288
|
||||
Height = 25
|
||||
Top = 534
|
||||
Width = 108
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 1
|
||||
Caption = 'ButtonGraphics'
|
||||
Constraints.MinWidth = 75
|
||||
OnClick = ButtonGraphicsClick
|
||||
TabOrder = 9
|
||||
end
|
||||
object ButtonCancel: TButton
|
||||
AnchorSideLeft.Control = ButtonOK
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = ButtonOK
|
||||
Left = 99
|
||||
Height = 25
|
||||
Top = 534
|
||||
Width = 75
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 1
|
||||
Cancel = True
|
||||
Caption = 'Ca&ncel'
|
||||
Constraints.MinWidth = 75
|
||||
ModalResult = 2
|
||||
TabOrder = 7
|
||||
end
|
||||
object ButtonOK: TButton
|
||||
AnchorSideLeft.Control = PanelAxisSettings
|
||||
AnchorSideTop.Control = PanelAxisSettings
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 16
|
||||
Height = 25
|
||||
Top = 533
|
||||
Width = 75
|
||||
AutoSize = True
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Bottom = 16
|
||||
Caption = '&OK'
|
||||
Constraints.MinWidth = 75
|
||||
Default = True
|
||||
ModalResult = 1
|
||||
TabOrder = 6
|
||||
end
|
||||
object ButtonApply: TButton
|
||||
AnchorSideLeft.Control = ButtonCancel
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = ButtonOK
|
||||
Left = 182
|
||||
Height = 25
|
||||
Top = 534
|
||||
Width = 75
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 1
|
||||
Caption = '&Apply'
|
||||
OnClick = ButtonApplyClick
|
||||
TabOrder = 8
|
||||
end
|
||||
object JvColorSpaceCombo: TJvFullColorSpaceCombo
|
||||
AnchorSideLeft.Control = PanelCommonSettings
|
||||
AnchorSideLeft.Side = asrCenter
|
||||
AnchorSideTop.Control = LabelColorSpace
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 103
|
||||
Height = 23
|
||||
Top = 27
|
||||
Width = 206
|
||||
AllowVariable = False
|
||||
BorderSpacing.Top = 4
|
||||
ItemHeight = 15
|
||||
TabOrder = 0
|
||||
OnChange = JvColorSpaceComboChange
|
||||
end
|
||||
object Bevel1: TBevel
|
||||
AnchorSideLeft.Control = PanelCommonSettings
|
||||
AnchorSideLeft.Side = asrCenter
|
||||
Left = 196
|
||||
Height = 62
|
||||
Top = 77
|
||||
Width = 20
|
||||
end
|
||||
object PanelImageOld: TPanel
|
||||
AnchorSideLeft.Control = LabelOld
|
||||
AnchorSideTop.Control = LabelOld
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = Bevel1
|
||||
Left = 72
|
||||
Height = 118
|
||||
Top = 77
|
||||
Width = 124
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Top = 4
|
||||
BevelOuter = bvLowered
|
||||
ClientHeight = 118
|
||||
ClientWidth = 124
|
||||
TabOrder = 10
|
||||
object ImageOld: TImage
|
||||
Left = 3
|
||||
Height = 112
|
||||
Top = 3
|
||||
Width = 118
|
||||
Align = alClient
|
||||
BorderSpacing.Around = 2
|
||||
end
|
||||
end
|
||||
object PanelImageNew: TPanel
|
||||
AnchorSideLeft.Control = Bevel1
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = LabelOld
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = Bevel1
|
||||
Left = 216
|
||||
Height = 118
|
||||
Top = 77
|
||||
Width = 124
|
||||
BorderSpacing.Top = 4
|
||||
BevelOuter = bvLowered
|
||||
ClientHeight = 118
|
||||
ClientWidth = 124
|
||||
TabOrder = 11
|
||||
object ImageNew: TImage
|
||||
Left = 3
|
||||
Height = 112
|
||||
Top = 3
|
||||
Width = 118
|
||||
Align = alClient
|
||||
BorderSpacing.Around = 2
|
||||
end
|
||||
end
|
||||
end
|
1001
components/jvcllaz/run/JvMM/jvfullcolorcircleform.pas
Normal file
3886
components/jvcllaz/run/JvMM/jvfullcolorctrls.pas
Normal file
467
components/jvcllaz/run/JvMM/jvfullcolordialogs.pas
Normal file
@ -0,0 +1,467 @@
|
||||
{-----------------------------------------------------------------------------
|
||||
The contents of this file are 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.1.html
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for
|
||||
the specific language governing rights and limitations under the License.
|
||||
|
||||
The Original Code is: ColorDialogs.pas, released on 2004-09-11.
|
||||
|
||||
The Initial Developer of the Original Code is Florent Ouchet [ouchet dott florent att laposte dott net]
|
||||
Portions created by Florent Ouchet are Copyright (C) 2004 Florent Ouchet.
|
||||
All Rights Reserved.
|
||||
|
||||
Contributor(s): -
|
||||
|
||||
You may retrieve the latest version of this file at the Project JEDI's JVCL home page,
|
||||
located at http://jvcl.delphi-jedi.org
|
||||
|
||||
Known Issues:
|
||||
-----------------------------------------------------------------------------}
|
||||
// $Id$
|
||||
|
||||
unit JvFullColorDialogs;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, Graphics, Forms,
|
||||
JvFullColorSpaces, JvFullColorRotate;
|
||||
|
||||
type
|
||||
TJvFullColorDialogOption =
|
||||
(foFullOpen, foPreventExpand, foShowHelp,
|
||||
foAllowSpaceChange, foConvertToOriginalSpace,
|
||||
foShowNewPreview, foShowOldPreview,
|
||||
foShowPredefined, foAllowVariable,
|
||||
foNoneAndDefault, foShowApply);
|
||||
TJvFullColorDialogOptions = set of TJvFullColorDialogOption;
|
||||
|
||||
TJvFullColorCircleDialogOption =
|
||||
(coFullOpen, coPreventExpand,
|
||||
coShowHelp, coAllowSpaceChange,
|
||||
coShowNewPreview, coShowOldPreview,
|
||||
coCommon, coRed, coGreen, coBlue,
|
||||
coShowSaturation, coDefaultRange,
|
||||
coShowApply);
|
||||
TJvFullColorCircleDialogOptions = set of TJvFullColorCircleDialogOption;
|
||||
|
||||
const
|
||||
JvDefaultFullColorDialogOptions =
|
||||
[foFullOpen, foAllowSpaceChange, foAllowVariable,
|
||||
foShowNewPreview, foShowOldPreview, foShowPredefined, foShowApply];
|
||||
|
||||
JvDefaultColorCircleDialogOptions =
|
||||
[coFullOpen, coAllowSpaceChange,
|
||||
coShowNewPreview, coShowOldPreview,
|
||||
coCommon, coRed, coGreen, coBlue,
|
||||
coShowSaturation, coShowApply];
|
||||
|
||||
type
|
||||
TJvAxisType = (atCommon, atRed, atGreen, atBlue);
|
||||
|
||||
TJvFullColorEvent = procedure(Sender: TObject; AFullColor: TJvFullColor) of object;
|
||||
|
||||
TJvColorCircleEvent = procedure(Sender: TObject) of object;
|
||||
|
||||
TJvFullColorDialog = class;
|
||||
TJvFullColorCircleDialog = class;
|
||||
|
||||
TJvFullColorDialog = class(TComponent)
|
||||
private
|
||||
FOptions: TJvFullColorDialogOptions;
|
||||
FTitle: string;
|
||||
FFullColor: TJvFullColor;
|
||||
FOnApply: TJvFullColorEvent;
|
||||
FForm: TForm;
|
||||
FOnCloseQuery: TCloseQueryEvent;
|
||||
FOnShow: TNotifyEvent;
|
||||
FHelpContext: THelpContext;
|
||||
FOldColorSpace: TJvFullColorSpaceID;
|
||||
FDropDownCount: Integer;
|
||||
function GetColor: TColor;
|
||||
function GetFullColor: TJvFullColor;
|
||||
procedure SetFullColor(const Value: TJvFullColor);
|
||||
procedure SetHelpContext(const Value: THelpContext);
|
||||
procedure SetOptions(const Value: TJvFullColorDialogOptions);
|
||||
procedure SetTitle(const Value: string);
|
||||
protected
|
||||
procedure FormApply(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
|
||||
property OldColorSpace: TJvFullColorSpaceID read FOldColorSpace;
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
function Execute: Boolean;
|
||||
property Form: TForm read FForm;
|
||||
property Color: TColor read GetColor;
|
||||
published
|
||||
property DropDownCount: Integer read FDropDownCount write FDropDownCount default 8;
|
||||
property FullColor: TJvFullColor read GetFullColor write SetFullColor default fclRGBBlack;
|
||||
property Options: TJvFullColorDialogOptions read FOptions write SetOptions default JvDefaultFullColorDialogOptions;
|
||||
property Title: string read FTitle write SetTitle;
|
||||
property HelpContext: THelpContext read FHelpContext write SetHelpContext default 0;
|
||||
property OnApply: TJvFullColorEvent read FOnApply write FOnApply;
|
||||
property OnShow: TNotifyEvent read FOnShow write FOnShow;
|
||||
property OnCloseQuery: TCloseQueryEvent read FOnCloseQuery write FOnCloseQuery;
|
||||
end;
|
||||
|
||||
TJvFullColorCircleDialog = class(TComponent)
|
||||
private
|
||||
FTitle: string;
|
||||
FForm: TForm;
|
||||
FHelpContext: THelpContext;
|
||||
FOnCloseQuery: TCloseQueryEvent;
|
||||
FOnShow: TNotifyEvent;
|
||||
FOptions: TJvFullColorCircleDialogOptions;
|
||||
FOnApply: TJvColorCircleEvent;
|
||||
FDelta: TJvColorDelta;
|
||||
FDropdownCount: Integer;
|
||||
procedure SetHelpContext(const Value: THelpContext);
|
||||
procedure SetOptions(const Value: TJvFullColorCircleDialogOptions);
|
||||
procedure SetTitle(const Value: string);
|
||||
procedure SetColorID(const Value: TJvFullColorSpaceID);
|
||||
procedure SetBlueDelta(const Value: TJvAxisDelta);
|
||||
procedure SetGreenDelta(const Value: TJvAxisDelta);
|
||||
procedure SetRedDelta(const Value: TJvAxisDelta);
|
||||
function GetRedDelta: TJvAxisDelta;
|
||||
function GetGreenDelta: TJvAxisDelta;
|
||||
function GetBlueDelta: TJvAxisDelta;
|
||||
function GetColorID: TJvFullColorSpaceID;
|
||||
protected
|
||||
procedure FormApply(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
|
||||
function Execute: Boolean;
|
||||
property Form: TForm read FForm;
|
||||
property RedDelta: TJvAxisDelta read GetRedDelta write SetRedDelta;
|
||||
property GreenDelta: TJvAxisDelta read GetGreenDelta write SetGreenDelta;
|
||||
property BlueDelta: TJvAxisDelta read GetBlueDelta write SetBlueDelta;
|
||||
property ColorID: TJvFullColorSpaceID read GetColorID write SetColorID;
|
||||
property Delta: TJvColorDelta read FDelta;
|
||||
published
|
||||
// (rom) set default values
|
||||
property DropdownCount: Integer read FDropdownCount write FDropDownCount default 8;
|
||||
property Options: TJvFullColorCircleDialogOptions
|
||||
read FOptions write SetOptions default JvDefaultColorCircleDialogOptions;
|
||||
property Title: string read FTitle write SetTitle;
|
||||
property HelpContext: THelpContext read FHelpContext write SetHelpContext;
|
||||
property OnApply: TJvColorCircleEvent read FOnApply write FOnApply;
|
||||
property OnShow: TNotifyEvent read FOnShow write FOnShow;
|
||||
property OnCloseQuery: TCloseQueryEvent read FOnCloseQuery write FOnCloseQuery;
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
JvResources,
|
||||
Controls, SysUtils, JvFullColorForm, JvFullColorCircleForm;
|
||||
|
||||
//=== { TJvFullColorDialog } =================================================
|
||||
|
||||
constructor TJvFullColorDialog.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
FOptions := JvDefaultFullColorDialogOptions;
|
||||
FFullColor := fclRGBBlack;
|
||||
FDropDownCount := 8;
|
||||
end;
|
||||
|
||||
function TJvFullColorDialog.Execute: Boolean;
|
||||
var
|
||||
NewColor: TJvFullColor;
|
||||
begin
|
||||
FOldColorSpace := ColorSpaceManager.GetColorSpaceID(FullColor);
|
||||
|
||||
FForm := TJvFullColorFrm.Create(Application, FFullColor, FOptions);
|
||||
with TJvFullColorFrm(Form) do
|
||||
begin
|
||||
if Title <> '' then
|
||||
Caption := FTitle;
|
||||
DropdownCount := FDropDownCount;
|
||||
OnApply := @FormApply;
|
||||
OnClose := @FormClose;
|
||||
OnShow := @FormShow;
|
||||
HelpContext := Self.HelpContext;
|
||||
Result := (ShowModal = mrOk);
|
||||
NewColor := FullColor;
|
||||
end;
|
||||
FreeAndNil(FForm);
|
||||
|
||||
with ColorSpaceManager do
|
||||
if foConvertToOriginalSpace in Options then
|
||||
NewColor := ConvertToID(NewColor, OldColorSpace);
|
||||
FFullColor := NewColor;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorDialog.FormApply(Sender: TObject);
|
||||
var
|
||||
lColor: TJvFullColor;
|
||||
begin
|
||||
if Assigned(FForm) then
|
||||
begin
|
||||
lColor := TJvFullColorFrm(Form).FullColor;
|
||||
if foConvertToOriginalSpace in Options then
|
||||
lColor := ColorSpaceManager.ConvertToID(lColor, OldColorSpace);
|
||||
if Assigned(FOnApply) then
|
||||
FOnApply(Self, lColor);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorDialog.FormClose(Sender: TObject;
|
||||
var CloseAction: TCloseAction);
|
||||
var
|
||||
Allow: Boolean;
|
||||
begin
|
||||
Allow := True;
|
||||
|
||||
if Assigned(FOnCloseQuery) then
|
||||
FOnCloseQuery(Self, Allow);
|
||||
|
||||
if Allow then
|
||||
CloseAction := caFree
|
||||
else
|
||||
CloseAction := caNone;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorDialog.FormShow(Sender: TObject);
|
||||
begin
|
||||
if Assigned(FOnShow) then
|
||||
FOnShow(Self);
|
||||
end;
|
||||
|
||||
function TJvFullColorDialog.GetColor: TColor;
|
||||
begin
|
||||
Result := ColorSpaceManager.ConvertToColor(FullColor);
|
||||
end;
|
||||
|
||||
function TJvFullColorDialog.GetFullColor: TJvFullColor;
|
||||
begin
|
||||
if Form <> nil then
|
||||
FFullColor := TJvFullColorFrm(Form).FullColor;
|
||||
Result := FFullColor;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorDialog.SetFullColor(const Value: TJvFullColor);
|
||||
begin
|
||||
FFullColor := Value;
|
||||
if Form <> nil then
|
||||
TJvFullColorFrm(Form).FullColor := Value;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorDialog.SetHelpContext(const Value: THelpContext);
|
||||
begin
|
||||
if FHelpContext <> Value then
|
||||
begin
|
||||
FHelpContext := Value;
|
||||
if Assigned(FForm) then
|
||||
Form.HelpContext := Value;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorDialog.SetOptions(const Value: TJvFullColorDialogOptions);
|
||||
begin
|
||||
if FOptions <> Value then
|
||||
begin
|
||||
FOptions := Value;
|
||||
if Assigned(FForm) then
|
||||
TJvFullColorFrm(Form).Options := Value;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorDialog.SetTitle(const Value: string);
|
||||
begin
|
||||
if FTitle <> Value then
|
||||
begin
|
||||
FTitle := Value;
|
||||
if Assigned(FForm) then
|
||||
Form.Caption := Value;
|
||||
end;
|
||||
end;
|
||||
|
||||
//=== { TJvColorCircleDialog } ===============================================
|
||||
|
||||
constructor TJvFullColorCircleDialog.Create(AOwner: TComponent);
|
||||
procedure InitAxe (Value: TJvAxisDelta);
|
||||
var
|
||||
Index: TJvAxisIndex;
|
||||
begin
|
||||
for Index := Low(TJvAxisIndex) to High(TJvAxisIndex) do
|
||||
begin
|
||||
Value[Index].Value := 0;
|
||||
Value[Index].SaturationMethod := smLoop;
|
||||
end;
|
||||
end;
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
FOptions := JvDefaultColorCircleDialogOptions;
|
||||
FDelta := TJvColorDelta.Create;
|
||||
FDropdownCount := 8;
|
||||
|
||||
InitAxe(FDelta.AxisRed);
|
||||
InitAxe(FDelta.AxisGreen);
|
||||
InitAxe(FDelta.AxisBlue);
|
||||
FDelta.ColorID := csRGB;
|
||||
end;
|
||||
|
||||
destructor TJvFullColorCircleDialog.Destroy;
|
||||
begin
|
||||
FDelta.Free;
|
||||
|
||||
inherited;
|
||||
end;
|
||||
|
||||
function TJvFullColorCircleDialog.Execute: Boolean;
|
||||
begin
|
||||
FForm := TJvFullColorCircleFrm.Create(Application);
|
||||
with TJvFullColorCircleFrm(Form) do
|
||||
begin
|
||||
if Title <> '' then
|
||||
Caption := Title;
|
||||
DropdownCount := FDropdownCount;
|
||||
Options := Self.Options;
|
||||
Delta := Self.Delta;
|
||||
OnApply := @FormApply;
|
||||
OnClose := @FormClose;
|
||||
OnShow := @FormShow;
|
||||
HelpContext := Self.HelpContext;
|
||||
|
||||
Result := (ShowModal = mrOk);
|
||||
|
||||
Self.FDelta.AxisRed.Assign(RedDelta);
|
||||
Self.FDelta.AxisGreen.Assign(GreenDelta);
|
||||
Self.FDelta.AxisBlue.Assign(BlueDelta);
|
||||
Self.FDelta.ColorID := ColorID;
|
||||
end;
|
||||
FreeAndNil(FForm);
|
||||
end;
|
||||
|
||||
procedure TJvFullColorCircleDialog.FormApply(Sender: TObject);
|
||||
begin
|
||||
if FForm<>nil then
|
||||
begin
|
||||
FDelta.ColorID := TJvFullColorCircleFrm(FForm).ColorID;
|
||||
FDelta.AxisRed := TJvFullColorCircleFrm(FForm).RedDelta;
|
||||
FDelta.AxisGreen := TJvFullColorCircleFrm(FForm).GreenDelta;
|
||||
FDelta.AxisBlue := TJvFullColorCircleFrm(FForm).BlueDelta;
|
||||
if Assigned(FOnApply) then
|
||||
FOnApply(Self);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorCircleDialog.FormClose(Sender: TObject; var Action: TCloseAction);
|
||||
var
|
||||
Allow: Boolean;
|
||||
begin
|
||||
if FForm<>nil then
|
||||
begin
|
||||
FDelta.ColorID := TJvFullColorCircleFrm(FForm).ColorID;
|
||||
FDelta.AxisRed := TJvFullColorCircleFrm(FForm).RedDelta;
|
||||
FDelta.AxisGreen := TJvFullColorCircleFrm(FForm).GreenDelta;
|
||||
FDelta.AxisBlue := TJvFullColorCircleFrm(FForm).BlueDelta;
|
||||
Allow := True;
|
||||
if Assigned(FOnCloseQuery) then
|
||||
FOnCloseQuery(Self, Allow);
|
||||
if Allow then
|
||||
Action := caFree
|
||||
else
|
||||
Action := caNone;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorCircleDialog.FormShow(Sender: TObject);
|
||||
begin
|
||||
if FForm<>nil then
|
||||
begin
|
||||
FDelta.ColorID := TJvFullColorCircleFrm(FForm).ColorID;
|
||||
FDelta.AxisRed := TJvFullColorCircleFrm(FForm).RedDelta;
|
||||
FDelta.AxisGreen := TJvFullColorCircleFrm(FForm).GreenDelta;
|
||||
FDelta.AxisBlue := TJvFullColorCircleFrm(FForm).BlueDelta;
|
||||
if Assigned(FOnShow) then
|
||||
FOnShow(Self);
|
||||
end;
|
||||
end;
|
||||
|
||||
function TJvFullColorCircleDialog.GetBlueDelta: TJvAxisDelta;
|
||||
begin
|
||||
Result := FDelta.AxisBlue;
|
||||
end;
|
||||
|
||||
function TJvFullColorCircleDialog.GetColorID: TJvFullColorSpaceID;
|
||||
begin
|
||||
Result := FDelta.ColorID;
|
||||
end;
|
||||
|
||||
function TJvFullColorCircleDialog.GetGreenDelta: TJvAxisDelta;
|
||||
begin
|
||||
Result := FDelta.AxisGreen;
|
||||
end;
|
||||
|
||||
function TJvFullColorCircleDialog.GetRedDelta: TJvAxisDelta;
|
||||
begin
|
||||
Result := FDelta.AxisRed;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorCircleDialog.SetBlueDelta(const Value: TJvAxisDelta);
|
||||
begin
|
||||
FDelta.AxisBlue.Assign(Value);
|
||||
if FForm <> nil then
|
||||
TJvFullColorCircleFrm(FForm).BlueDelta := Value;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorCircleDialog.SetColorID(
|
||||
const Value: TJvFullColorSpaceID);
|
||||
begin
|
||||
FDelta.ColorID := Value;
|
||||
if FForm <> nil then
|
||||
TJvFullColorCircleFrm(FForm).ColorID :=Value;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorCircleDialog.SetGreenDelta(
|
||||
const Value: TJvAxisDelta);
|
||||
begin
|
||||
FDelta.AxisGreen.Assign(Value);
|
||||
if FForm <> nil then
|
||||
TJvFullColorCircleFrm(FForm).GreenDelta := Value;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorCircleDialog.SetHelpContext(const Value: THelpContext);
|
||||
begin
|
||||
FHelpContext := Value;
|
||||
if FForm <> nil then
|
||||
FForm.HelpContext := Value;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorCircleDialog.SetOptions(const Value: TJvFullColorCircleDialogOptions);
|
||||
begin
|
||||
FOptions := Value;
|
||||
if FForm <> nil then
|
||||
TJvFullColorCircleFrm(FForm).Options := Value;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorCircleDialog.SetRedDelta(const Value: TJvAxisDelta);
|
||||
begin
|
||||
FDelta.AxisRed.Assign(Value);
|
||||
if FForm <> nil then
|
||||
TJvFullColorCircleFrm(FForm).RedDelta := Value;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorCircleDialog.SetTitle(const Value: string);
|
||||
begin
|
||||
FTitle := Value;
|
||||
if FForm <> nil then
|
||||
FForm.Caption := Value;
|
||||
end;
|
||||
|
||||
|
||||
end.
|
464
components/jvcllaz/run/JvMM/jvfullcolorform.lfm
Normal file
@ -0,0 +1,464 @@
|
||||
object JvFullColorFrm: TJvFullColorFrm
|
||||
Left = 373
|
||||
Height = 388
|
||||
Top = 274
|
||||
Width = 712
|
||||
ActiveControl = ColorBox
|
||||
AutoSize = True
|
||||
BorderIcons = [biSystemMenu]
|
||||
BorderStyle = bsDialog
|
||||
Caption = 'Color Spaces Editor, Choose your color'
|
||||
ClientHeight = 388
|
||||
ClientWidth = 712
|
||||
Color = clBtnFace
|
||||
Font.Color = clWindowText
|
||||
KeyPreview = True
|
||||
OnCreate = FormCreate
|
||||
OnShow = FormShow
|
||||
LCLVersion = '2.1.0.0'
|
||||
object LabelColorSpace: TLabel
|
||||
AnchorSideLeft.Control = JvColorSpaceCombo
|
||||
AnchorSideTop.Control = Owner
|
||||
Left = 12
|
||||
Height = 15
|
||||
Top = 8
|
||||
Width = 112
|
||||
BorderSpacing.Top = 8
|
||||
Caption = '&Current Color Space :'
|
||||
ParentColor = False
|
||||
end
|
||||
object LabelDrawOld: TLabel
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = JvColorSpaceCombo
|
||||
AnchorSideRight.Control = LabelDrawNew
|
||||
AnchorSideBottom.Control = JvColorSpaceCombo
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 270
|
||||
Height = 23
|
||||
Top = 27
|
||||
Width = 61
|
||||
Anchors = [akTop, akRight, akBottom]
|
||||
AutoSize = False
|
||||
BorderSpacing.Left = 16
|
||||
Color = clBlack
|
||||
ParentColor = False
|
||||
Transparent = False
|
||||
OnClick = LabelDrawOldClick
|
||||
end
|
||||
object LabelDrawNew: TLabel
|
||||
AnchorSideLeft.Control = LabelDrawOld
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = LabelDrawOld
|
||||
AnchorSideRight.Control = GroupBoxSettings
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = JvColorSpaceCombo
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 331
|
||||
Height = 23
|
||||
Top = 27
|
||||
Width = 61
|
||||
Anchors = [akTop, akRight, akBottom]
|
||||
AutoSize = False
|
||||
Color = clWhite
|
||||
ParentColor = False
|
||||
Transparent = False
|
||||
end
|
||||
object LabelOld: TLabel
|
||||
AnchorSideLeft.Control = LabelDrawOld
|
||||
AnchorSideTop.Control = LabelColorSpace
|
||||
Left = 270
|
||||
Height = 15
|
||||
Top = 8
|
||||
Width = 22
|
||||
Caption = 'Old:'
|
||||
ParentColor = False
|
||||
end
|
||||
object LabelNew: TLabel
|
||||
AnchorSideLeft.Control = LabelDrawNew
|
||||
AnchorSideTop.Control = LabelColorSpace
|
||||
Left = 331
|
||||
Height = 15
|
||||
Top = 8
|
||||
Width = 27
|
||||
Caption = 'New:'
|
||||
ParentColor = False
|
||||
end
|
||||
object GroupBoxSettings: TGroupBox
|
||||
AnchorSideLeft.Control = JvColorSpaceCombo
|
||||
AnchorSideTop.Control = JvColorSpaceCombo
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 12
|
||||
Height = 246
|
||||
Top = 62
|
||||
Width = 380
|
||||
BorderSpacing.Top = 12
|
||||
BorderSpacing.Right = 16
|
||||
Caption = ' Settings ... '
|
||||
ClientHeight = 226
|
||||
ClientWidth = 376
|
||||
TabOrder = 1
|
||||
object LabelAxis0: TLabel
|
||||
AnchorSideLeft.Control = GroupBoxSettings
|
||||
AnchorSideTop.Control = GroupBoxSettings
|
||||
Left = 16
|
||||
Height = 15
|
||||
Top = 4
|
||||
Width = 55
|
||||
Alignment = taRightJustify
|
||||
BorderSpacing.Left = 16
|
||||
BorderSpacing.Top = 4
|
||||
Caption = 'LabelAxis0'
|
||||
ParentColor = False
|
||||
end
|
||||
object LabelAxis1: TLabel
|
||||
AnchorSideLeft.Control = LabelAxis0
|
||||
AnchorSideTop.Control = ScrollBarAxis0
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 16
|
||||
Height = 15
|
||||
Top = 59
|
||||
Width = 55
|
||||
Alignment = taRightJustify
|
||||
BorderSpacing.Top = 16
|
||||
Caption = 'LabelAxis1'
|
||||
ParentColor = False
|
||||
end
|
||||
object LabelAxis2: TLabel
|
||||
AnchorSideLeft.Control = LabelAxis0
|
||||
AnchorSideTop.Control = ScrollBarAxis1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 16
|
||||
Height = 15
|
||||
Top = 114
|
||||
Width = 55
|
||||
Alignment = taRightJustify
|
||||
BorderSpacing.Top = 16
|
||||
Caption = 'LabelAxis2'
|
||||
ParentColor = False
|
||||
end
|
||||
object LabelPredefined: TLabel
|
||||
AnchorSideLeft.Control = ColorBox
|
||||
AnchorSideTop.Control = ScrollBarAxis2
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 88
|
||||
Height = 15
|
||||
Top = 169
|
||||
Width = 95
|
||||
Alignment = taRightJustify
|
||||
Caption = '&Predefined colors:'
|
||||
FocusControl = ColorBox
|
||||
ParentColor = False
|
||||
end
|
||||
object ScrollBarAxis0: TScrollBar
|
||||
AnchorSideLeft.Control = LabelAxis0
|
||||
AnchorSideTop.Control = LabelAxis0
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = SpinEditAxis0
|
||||
Left = 16
|
||||
Height = 20
|
||||
Top = 23
|
||||
Width = 268
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 4
|
||||
BorderSpacing.Right = 16
|
||||
LargeChange = 16
|
||||
Max = 255
|
||||
PageSize = 0
|
||||
TabOrder = 0
|
||||
OnChange = ScrollBarChange
|
||||
end
|
||||
object ScrollBarAxis1: TScrollBar
|
||||
Tag = 1
|
||||
AnchorSideLeft.Control = LabelAxis1
|
||||
AnchorSideTop.Control = LabelAxis1
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = ScrollBarAxis0
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 16
|
||||
Height = 20
|
||||
Top = 78
|
||||
Width = 268
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 4
|
||||
LargeChange = 16
|
||||
Max = 255
|
||||
PageSize = 0
|
||||
TabOrder = 2
|
||||
OnChange = ScrollBarChange
|
||||
end
|
||||
object ScrollBarAxis2: TScrollBar
|
||||
Tag = 2
|
||||
AnchorSideLeft.Control = LabelAxis2
|
||||
AnchorSideTop.Control = LabelAxis2
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = ScrollBarAxis1
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 16
|
||||
Height = 20
|
||||
Top = 133
|
||||
Width = 268
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Top = 4
|
||||
BorderSpacing.Bottom = 16
|
||||
LargeChange = 16
|
||||
Max = 255
|
||||
PageSize = 0
|
||||
TabOrder = 4
|
||||
OnChange = ScrollBarChange
|
||||
end
|
||||
object SpinEditAxis0: TSpinEdit
|
||||
AnchorSideTop.Control = ScrollBarAxis0
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = GroupBoxSettings
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 300
|
||||
Height = 23
|
||||
Top = 22
|
||||
Width = 60
|
||||
Anchors = [akTop, akRight]
|
||||
BorderSpacing.Right = 16
|
||||
MaxValue = 255
|
||||
OnChange = SpinEditChange
|
||||
TabOrder = 1
|
||||
end
|
||||
object SpinEditAxis1: TSpinEdit
|
||||
Tag = 1
|
||||
AnchorSideLeft.Control = SpinEditAxis0
|
||||
AnchorSideTop.Control = ScrollBarAxis1
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = SpinEditAxis0
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 300
|
||||
Height = 23
|
||||
Top = 77
|
||||
Width = 60
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
MaxValue = 255
|
||||
OnChange = SpinEditChange
|
||||
TabOrder = 3
|
||||
end
|
||||
object SpinEditAxis2: TSpinEdit
|
||||
Tag = 2
|
||||
AnchorSideLeft.Control = SpinEditAxis1
|
||||
AnchorSideTop.Control = ScrollBarAxis2
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = SpinEditAxis0
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 300
|
||||
Height = 23
|
||||
Top = 132
|
||||
Width = 60
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
MaxValue = 255
|
||||
OnChange = SpinEditChange
|
||||
TabOrder = 5
|
||||
end
|
||||
object ColorBox: TColorBox
|
||||
AnchorSideLeft.Control = GroupBoxSettings
|
||||
AnchorSideLeft.Side = asrCenter
|
||||
AnchorSideTop.Control = LabelPredefined
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 88
|
||||
Height = 22
|
||||
Top = 188
|
||||
Width = 201
|
||||
Style = [cbStandardColors, cbExtendedColors, cbSystemColors, cbPrettyNames]
|
||||
BorderSpacing.Top = 4
|
||||
BorderSpacing.Bottom = 16
|
||||
ItemHeight = 16
|
||||
OnSelect = ComboBoxPredefinedSelect
|
||||
TabOrder = 6
|
||||
end
|
||||
end
|
||||
object JvFullColorGroup: TJvFullColorGroup
|
||||
AnchorSideLeft.Control = GroupBoxSettings
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = LabelColorSpace
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = ButtonOK
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 408
|
||||
Height = 341
|
||||
Top = 8
|
||||
Width = 296
|
||||
ColCount = 8
|
||||
SquareSize = 30
|
||||
OnChange = JvFullColorGroupChange
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
BorderSpacing.Right = 8
|
||||
Constraints.MinWidth = 288
|
||||
ParentShowHint = False
|
||||
ShowHint = True
|
||||
end
|
||||
object PanelGraphic: TPanel
|
||||
AnchorSideLeft.Control = GroupBoxSettings
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = LabelColorSpace
|
||||
AnchorSideRight.Control = Owner
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = ButtonOK
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 408
|
||||
Height = 341
|
||||
Top = 8
|
||||
Width = 296
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
BorderSpacing.Right = 8
|
||||
BevelInner = bvRaised
|
||||
BevelOuter = bvLowered
|
||||
ClientHeight = 341
|
||||
ClientWidth = 296
|
||||
TabOrder = 2
|
||||
Visible = False
|
||||
object LabelAxis: TLabel
|
||||
AnchorSideLeft.Control = PanelGraphic
|
||||
AnchorSideTop.Control = JvColorAxisConfigCombo
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 10
|
||||
Height = 15
|
||||
Top = 14
|
||||
Width = 24
|
||||
BorderSpacing.Left = 8
|
||||
Caption = '&Axis:'
|
||||
ParentColor = False
|
||||
end
|
||||
object JvColorPanel: TJvFullColorPanel
|
||||
AnchorSideLeft.Control = PanelGraphic
|
||||
AnchorSideTop.Control = JvColorAxisConfigCombo
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Control = PanelGraphic
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = JvFullColorTrackBar
|
||||
Left = 10
|
||||
Height = 263
|
||||
Top = 37
|
||||
Width = 268
|
||||
Anchors = [akTop, akLeft, akBottom]
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 4
|
||||
BorderSpacing.Right = 8
|
||||
BorderSpacing.Bottom = 4
|
||||
FullColor = 83886079
|
||||
TabOrder = 1
|
||||
OnColorChange = JvColorPanelColorChange
|
||||
CrossSize = 10
|
||||
CrossCenter = 3
|
||||
CrossStyle.Width = 3
|
||||
ColorTrackBar = JvFullColorTrackBar
|
||||
end
|
||||
object JvFullColorTrackBar: TJvFullColorTrackBar
|
||||
AnchorSideLeft.Control = JvColorPanel
|
||||
AnchorSideRight.Control = JvColorPanel
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = PanelGraphic
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 10
|
||||
Height = 27
|
||||
Top = 304
|
||||
Width = 268
|
||||
BorderSpacing.Bottom = 8
|
||||
FullColor = 83886079
|
||||
TabOrder = 2
|
||||
ArrowWidth = 8
|
||||
end
|
||||
object JvColorAxisConfigCombo: TJvFullColorAxisCombo
|
||||
AnchorSideLeft.Control = LabelAxis
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = PanelGraphic
|
||||
AnchorSideRight.Control = PanelGraphic
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 42
|
||||
Height = 23
|
||||
Top = 10
|
||||
Width = 244
|
||||
Selected = acXYZ
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Right = 8
|
||||
ItemHeight = 15
|
||||
TabOrder = 0
|
||||
OnChange = ComboBoxAxisChange
|
||||
end
|
||||
end
|
||||
object ButtonGraphics: TButton
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = ButtonOK
|
||||
AnchorSideRight.Control = GroupBoxSettings
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 284
|
||||
Height = 25
|
||||
Top = 324
|
||||
Width = 108
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
Caption = 'ButtonGraphics'
|
||||
Constraints.MinWidth = 75
|
||||
OnClick = ButtonGraphicsClick
|
||||
TabOrder = 6
|
||||
end
|
||||
object ButtonOK: TButton
|
||||
AnchorSideLeft.Control = GroupBoxSettings
|
||||
AnchorSideTop.Control = GroupBoxSettings
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 12
|
||||
Height = 25
|
||||
Top = 324
|
||||
Width = 75
|
||||
AutoSize = True
|
||||
BorderSpacing.Top = 16
|
||||
BorderSpacing.Bottom = 8
|
||||
Caption = '&OK'
|
||||
Constraints.MinWidth = 75
|
||||
Default = True
|
||||
ModalResult = 1
|
||||
TabOrder = 3
|
||||
end
|
||||
object ButtonCancel: TButton
|
||||
AnchorSideLeft.Control = ButtonOK
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = ButtonOK
|
||||
Left = 95
|
||||
Height = 25
|
||||
Top = 324
|
||||
Width = 75
|
||||
BorderSpacing.Left = 8
|
||||
Cancel = True
|
||||
Caption = 'Ca&ncel'
|
||||
ModalResult = 2
|
||||
TabOrder = 4
|
||||
end
|
||||
object ButtonApply: TButton
|
||||
AnchorSideLeft.Control = ButtonCancel
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = ButtonOK
|
||||
Left = 178
|
||||
Height = 25
|
||||
Top = 324
|
||||
Width = 75
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 8
|
||||
Caption = '&Apply'
|
||||
Constraints.MinWidth = 75
|
||||
OnClick = ButtonApplyClick
|
||||
TabOrder = 5
|
||||
end
|
||||
object JvColorSpaceCombo: TJvFullColorSpaceCombo
|
||||
AnchorSideLeft.Control = Owner
|
||||
AnchorSideTop.Control = LabelColorSpace
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 12
|
||||
Height = 23
|
||||
Top = 27
|
||||
Width = 244
|
||||
BorderSpacing.Left = 12
|
||||
BorderSpacing.Top = 4
|
||||
Constraints.MinWidth = 210
|
||||
ItemHeight = 15
|
||||
TabOrder = 0
|
||||
OnSelect = JvComboBoxColorSpaceSelect
|
||||
end
|
||||
end
|
506
components/jvcllaz/run/JvMM/jvfullcolorform.pas
Normal file
@ -0,0 +1,506 @@
|
||||
{-----------------------------------------------------------------------------
|
||||
The contents of this file are 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.1.html
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for
|
||||
the specific language governing rights and limitations under the License.
|
||||
|
||||
The Original Code is: FullColorFrm.pas, released on 2004-09-11.
|
||||
|
||||
The Initial Developer of the Original Code is Florent Ouchet [ouchet dott florent att laposte dott net]
|
||||
Portions created by Florent Ouchet are Copyright (C) 2004 Florent Ouchet.
|
||||
All Rights Reserved.
|
||||
|
||||
Contributor(s): -
|
||||
|
||||
You may retrieve the latest version of this file at the Project JEDI's JVCL home page,
|
||||
located at http://jvcl.delphi-jedi.org
|
||||
|
||||
Known Issues:
|
||||
-----------------------------------------------------------------------------}
|
||||
// $Id$
|
||||
|
||||
unit JvFullColorForm;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
//Windows, Messages,
|
||||
SysUtils, Classes, Controls, Forms, Graphics,
|
||||
Dialogs, StdCtrls, ExtCtrls, Spin, //Mask,
|
||||
ColorBox, // JvColorCombo
|
||||
JvFullColorCtrls, JvFullColorSpaces, JvFullColorDialogs;
|
||||
|
||||
//JvExMask,
|
||||
//JvSpin, JvExStdCtrls, JvCombobox, JvColorCombo, JvComponent;
|
||||
|
||||
type
|
||||
|
||||
{ TJvFullColorFrm }
|
||||
|
||||
TJvFullColorFrm = class(TForm) //TJvForm)
|
||||
LabelColorSpace: TLabel;
|
||||
GroupBoxSettings: TGroupBox;
|
||||
ScrollBarAxis0: TScrollBar;
|
||||
ScrollBarAxis1: TScrollBar;
|
||||
ScrollBarAxis2: TScrollBar;
|
||||
SpinEditAxis0: TSpinEdit; //TJvSpinEdit;
|
||||
SpinEditAxis1: TSpinEdit; //TJvSpinEdit;
|
||||
SpinEditAxis2: TSpinEdit; //TJvSpinEdit;
|
||||
LabelAxis0: TLabel;
|
||||
LabelAxis1: TLabel;
|
||||
LabelAxis2: TLabel;
|
||||
LabelPredefined: TLabel;
|
||||
PanelGraphic: TPanel;
|
||||
JvColorPanel: TJvFullColorPanel;
|
||||
JvFullColorTrackBar: TJvFullColorTrackBar;
|
||||
ButtonGraphics: TButton;
|
||||
ButtonOK: TButton;
|
||||
ButtonCancel: TButton;
|
||||
LabelDrawOld: TLabel;
|
||||
LabelDrawNew: TLabel;
|
||||
LabelOld: TLabel;
|
||||
LabelNew: TLabel;
|
||||
LabelAxis: TLabel;
|
||||
ButtonApply: TButton;
|
||||
JvColorAxisConfigCombo: TJvFullColorAxisCombo;
|
||||
JvColorSpaceCombo: TJvFullColorSpaceCombo;
|
||||
ColorBox: TColorBox; //TJvColorComboBox;
|
||||
JvFullColorGroup: TJvFullColorGroup;
|
||||
procedure ButtonApplyClick(Sender: TObject);
|
||||
procedure ButtonGraphicsClick(Sender: TObject);
|
||||
procedure ComboBoxAxisChange(Sender: TObject);
|
||||
procedure ComboBoxPredefinedSelect(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure JvColorPanelColorChange(Sender: TObject);
|
||||
procedure JvComboBoxColorSpaceSelect(Sender: TObject);
|
||||
procedure JvFullColorGroupChange(Sender: TObject);
|
||||
procedure LabelDrawOldClick(Sender: TObject);
|
||||
procedure ScrollBarChange(Sender: TObject);
|
||||
procedure SpinEditChange(Sender: TObject);
|
||||
private
|
||||
FUpdating: Boolean;
|
||||
FExpanded: Boolean;
|
||||
FExpandedWidth: Integer;
|
||||
FFullColor: TJvFullColor;
|
||||
FOptions: TJvFullColorDialogOptions;
|
||||
FOnApply: TNotifyEvent;
|
||||
FScrollBarAxes: array [TJvAxisIndex] of TScrollBar;
|
||||
FSpinEditAxes: array [TJvAxisIndex] of TSpinEdit; //TJvSpinEdit;
|
||||
FLabelAxes: array [TJvAxisIndex] of TLabel;
|
||||
FFilled: Boolean;
|
||||
procedure FillInternalArrays;
|
||||
function GetDropdownCount: Integer;
|
||||
procedure SetDropdownCount(AValue: Integer);
|
||||
protected
|
||||
procedure UpdateColorValue;
|
||||
procedure UpdateColorSpace;
|
||||
procedure SetFullColor(const Value: TJvFullColor);
|
||||
procedure SetOptions(const Value: TJvFullColorDialogOptions);
|
||||
procedure Loaded; override;
|
||||
property Expanded: Boolean read FExpanded;
|
||||
public
|
||||
constructor Create(AOwner: TComponent; AFullColor: TJvFullColor;
|
||||
AOptions: TJvFullColorDialogOptions); reintroduce;
|
||||
procedure Expand;
|
||||
procedure Collapse;
|
||||
property DropdownCount: Integer read GetDropDownCount write SetDropDownCount default 8;
|
||||
property Options: TJvFullColorDialogOptions read FOptions write SetOptions;
|
||||
property FullColor: TJvFullColor read FFullColor write SetFullColor;
|
||||
property OnApply: TNotifyEvent read FOnApply write FOnApply;
|
||||
end;
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
JvResources;
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
function AxisIndexFromTag(ATag: Integer): TJvAxisIndex;
|
||||
begin
|
||||
Result := TJvAxisIndex(ATag and $03);
|
||||
end;
|
||||
|
||||
constructor TJvFullColorFrm.Create(AOwner: TComponent;
|
||||
AFullColor: TJvFullColor; AOptions: TJvFullColorDialogOptions);
|
||||
begin
|
||||
inherited Create(AOwner);
|
||||
FOptions := AOptions;
|
||||
FFullColor := AFullColor;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorFrm.FormCreate(Sender: TObject);
|
||||
var
|
||||
CS: TJvDEFColorSpace;
|
||||
Index:Integer;
|
||||
begin
|
||||
with ColorSpaceManager do
|
||||
begin
|
||||
CS := TJvDEFColorSpace(ColorSpace[csDEF]);
|
||||
for Index := 0 to CS.ColorCount - 1 do
|
||||
JvFullColorGroup.Items.Add(CS.ConvertFromColor(CS.ColorValue[Index]));
|
||||
LabelDrawOld.Color := ConvertToColor(FullColor);
|
||||
JvColorSpaceCombo.ColorSpaceID := GetColorSpaceID(FullColor);
|
||||
end;
|
||||
SetFullColor(FullColor);
|
||||
SetOptions(Options);
|
||||
end;
|
||||
|
||||
procedure TJvFullColorFrm.FormShow(Sender: TObject);
|
||||
begin
|
||||
Position := poScreenCenter;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorFrm.Loaded;
|
||||
begin
|
||||
inherited Loaded;
|
||||
FExpandedWidth := Width;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorFrm.FillInternalArrays;
|
||||
begin
|
||||
if not FFilled then
|
||||
begin
|
||||
FScrollBarAxes[axIndex0] := ScrollBarAxis0;
|
||||
FScrollBarAxes[axIndex1] := ScrollBarAxis1;
|
||||
FScrollBarAxes[axIndex2] := ScrollBarAxis2;
|
||||
FSpinEditAxes[axIndex0] := SpinEditAxis0;
|
||||
FSpinEditAxes[axIndex1] := SpinEditAxis1;
|
||||
FSpinEditAxes[axIndex2] := SpinEditAxis2;
|
||||
FLabelAxes[axIndex0] := LabelAxis0;
|
||||
FLabelAxes[axIndex1] := LabelAxis1;
|
||||
FLabelAxes[axIndex2] := LabelAxis2;
|
||||
FFilled := True;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorFrm.ButtonGraphicsClick(Sender: TObject);
|
||||
begin
|
||||
if Expanded then
|
||||
Collapse
|
||||
else
|
||||
Expand;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorFrm.Collapse;
|
||||
begin
|
||||
Width := PanelGraphic.Left - 1;
|
||||
PanelGraphic.Visible := False;
|
||||
ButtonGraphics.Caption := RsCollapsedCaption;
|
||||
FExpanded := False;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorFrm.Expand;
|
||||
begin
|
||||
PanelGraphic.Visible := True;
|
||||
Width := FExpandedWidth;
|
||||
ButtonGraphics.Caption := RsExpandedCaption;
|
||||
FExpanded := True;
|
||||
end;
|
||||
|
||||
function TJvFullColorFrm.GetDropDownCount: Integer;
|
||||
begin
|
||||
Result := JvColorSpaceCombo.DropdownCount;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorFrm.SetDropdownCount(AValue: Integer);
|
||||
begin
|
||||
JvColorSpaceCombo.DropDownCount := AValue;
|
||||
JvColorAxisConfigCombo.DropDownCount := AValue;
|
||||
ColorBox.DropDownCount := AValue;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorFrm.SpinEditChange(Sender: TObject);
|
||||
var
|
||||
IntValue:Integer;
|
||||
begin
|
||||
if FUpdating then
|
||||
Exit;
|
||||
FUpdating := True;
|
||||
|
||||
// with Sender as TJvSpinEdit do
|
||||
with Sender as TSpinEdit do
|
||||
if TryStrToInt(Text,IntValue) then
|
||||
FullColor := SetAxisValue(FullColor, AxisIndexFromTag(Tag), IntValue);
|
||||
|
||||
FUpdating := False;
|
||||
UpdateColorValue;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorFrm.ScrollBarChange(Sender: TObject);
|
||||
begin
|
||||
if FUpdating then
|
||||
Exit;
|
||||
FUpdating := True;
|
||||
with Sender as TScrollBar do
|
||||
FullColor := SetAxisValue(FullColor, AxisIndexFromTag(Tag), Position);
|
||||
FUpdating := False;
|
||||
UpdateColorValue;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorFrm.JvColorPanelColorChange(Sender: TObject);
|
||||
begin
|
||||
if FUpdating then
|
||||
Exit;
|
||||
FUpdating := True;
|
||||
FullColor := (Sender as TJvFullColorPanel).FullColor;
|
||||
FUpdating := False;
|
||||
UpdateColorValue;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorFrm.JvFullColorGroupChange(Sender: TObject);
|
||||
begin
|
||||
if FUpdating then
|
||||
Exit;
|
||||
|
||||
FUpdating := True;
|
||||
with (Sender as TJvFullColorGroup), ColorSpaceManager do
|
||||
if (SelectedIndex>-1) then
|
||||
begin
|
||||
JvColorSpaceCombo.ColorSpaceID := GetColorSpaceID(Selected);
|
||||
FullColor := Selected;
|
||||
end;
|
||||
FUpdating := False;
|
||||
|
||||
UpdateColorSpace;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorFrm.JvComboBoxColorSpaceSelect(Sender: TObject);
|
||||
begin
|
||||
if FUpdating then
|
||||
Exit;
|
||||
FUpdating := True;
|
||||
with Sender as TJvFullColorSpaceCombo do
|
||||
FullColor := ColorSpaceManager.ConvertToID(FullColor, ColorSpaceID);
|
||||
FUpdating := False;
|
||||
UpdateColorSpace;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorFrm.ComboBoxPredefinedSelect(Sender: TObject);
|
||||
begin
|
||||
if FUpdating then
|
||||
Exit;
|
||||
FUpdating := True;
|
||||
// with Sender as TJvColorComboBox, ColorSpaceManager do
|
||||
with Sender as TColorBox, ColorSpaceManager do
|
||||
FullColor := ConvertToID(ConvertFromColor(Colors[ItemIndex]),
|
||||
GetColorSpaceID(FullColor));
|
||||
FUpdating := False;
|
||||
UpdateColorSpace;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorFrm.ComboBoxAxisChange(Sender: TObject);
|
||||
begin
|
||||
JvColorPanel.AxisConfig := (Sender as TJvFullColorAxisCombo).Selected;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorFrm.UpdateColorValue;
|
||||
var
|
||||
I: TJvAxisIndex;
|
||||
C: TColor;
|
||||
NewIndex: Integer;
|
||||
ValueAxes: array [TJvAxisIndex] of Byte;
|
||||
J: Integer;
|
||||
LColorID: TJvFullColorSpaceID;
|
||||
DefColorSpace: TJvColorSpace;
|
||||
begin
|
||||
if FUpdating then
|
||||
Exit;
|
||||
FillInternalArrays;
|
||||
|
||||
FUpdating := True;
|
||||
|
||||
LabelDrawNew.Color := ColorSpaceManager.ConvertToColor(FullColor);
|
||||
LabelDrawNew.Update;
|
||||
|
||||
LColorID := ColorSpaceManager.GetColorSpaceID(FullColor);
|
||||
|
||||
if (LColorID=csDEF) then
|
||||
begin
|
||||
JvFullColorGroup.Selected := FullColor;
|
||||
for I := Low(TJvAxisIndex) to High(TJvAxisIndex) do
|
||||
begin
|
||||
FScrollBarAxes[I].Enabled := False;
|
||||
FScrollBarAxes[I].Position := 0;
|
||||
FSpinEditAxes[I].Enabled := False;
|
||||
FSpinEditAxes[I].Value := 0;
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
JvColorPanel.FullColor := FullColor;
|
||||
for I := Low(TJvAxisIndex) to High(TJvAxisIndex) do
|
||||
begin
|
||||
FScrollBarAxes[I].Enabled := True;
|
||||
FSpinEditAxes[I].Enabled := True;
|
||||
ValueAxes[I] := GetAxisValue(FullColor, I);
|
||||
FScrollBarAxes[I].Position := ValueAxes[I];
|
||||
FSpinEditAxes[I].Value := ValueAxes[I];
|
||||
end;
|
||||
end;
|
||||
|
||||
JvColorSpaceCombo.ColorSpaceID := LColorID;
|
||||
|
||||
NewIndex := -1;
|
||||
DefColorSpace := ColorSpaceManager.ColorSpace[csDEF];
|
||||
with ColorBox, Items, ColorSpaceManager do
|
||||
begin
|
||||
for J := 0 to Items.Count - 1 do
|
||||
begin
|
||||
C := DefColorSpace.ConvertFromColor(Colors[J]);
|
||||
if ConvertToID(C, LColorID) = FullColor then
|
||||
begin
|
||||
NewIndex := J;
|
||||
Break;
|
||||
end;
|
||||
end;
|
||||
ItemIndex := NewIndex;
|
||||
end;
|
||||
|
||||
FUpdating := False;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorFrm.UpdateColorSpace;
|
||||
var
|
||||
I: TJvAxisIndex;
|
||||
AxisMin, AxisMax: Byte;
|
||||
lColorSpace: TJvColorSpace;
|
||||
begin
|
||||
if FUpdating then
|
||||
Exit;
|
||||
FillInternalArrays;
|
||||
FUpdating := True;
|
||||
LColorSpace := JvColorSpaceCombo.SelectedSpace;
|
||||
|
||||
AutoSize := false;
|
||||
if Assigned(LColorSpace) then
|
||||
begin
|
||||
if (LColorSpace.ID = csDEF) then
|
||||
begin
|
||||
PanelGraphic.Visible := False;
|
||||
JvFullColorGroup.Visible := Expanded;
|
||||
for I := Low(TJvAxisIndex) to High(TJvAxisIndex) do
|
||||
begin
|
||||
FScrollBarAxes[I].Enabled := False;
|
||||
FScrollBarAxes[I].Position := 0;
|
||||
FSpinEditAxes[I].Enabled := False;
|
||||
FSpinEditAxes[I].Value := 0;
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
PanelGraphic.Visible := Expanded;
|
||||
JvFullColorGroup.Visible := False;
|
||||
JvColorAxisConfigCombo.ColorID := LColorSpace.ID;
|
||||
for I := Low(TJvAxisIndex) to High(TJvAxisIndex) do
|
||||
begin
|
||||
FLabelAxes[I].Caption := LColorSpace.AxisName[I];
|
||||
AxisMin := LColorSpace.AxisMin[I];
|
||||
AxisMax := LColorSpace.AxisMax[I];
|
||||
FScrollBarAxes[I].Min := AxisMin;
|
||||
FScrollBarAxes[I].Max := AxisMax;
|
||||
FSpinEditAxes[I].MinValue := AxisMin;
|
||||
FSpinEditAxes[I].MaxValue := AxisMax;
|
||||
end;
|
||||
|
||||
JvColorPanel.FullColor := FullColor;
|
||||
JvFullColorTrackBar.FullColor := FullColor;
|
||||
end;
|
||||
end;
|
||||
|
||||
FUpdating := False;
|
||||
UpdateColorValue;
|
||||
AutoSize := true;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorFrm.ButtonApplyClick(Sender: TObject);
|
||||
begin
|
||||
if Assigned(OnApply) then
|
||||
OnApply(Sender);
|
||||
end;
|
||||
|
||||
procedure TJvFullColorFrm.SetFullColor(const Value: TJvFullColor);
|
||||
begin
|
||||
FFullColor := Value;
|
||||
if not FUpdating then
|
||||
begin
|
||||
with ColorSpaceManager do
|
||||
JvColorSpaceCombo.ColorSpaceID := GetColorSpaceID(Value);
|
||||
UpdateColorSpace;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorFrm.SetOptions(const Value: TJvFullColorDialogOptions);
|
||||
var
|
||||
LVisible: Boolean;
|
||||
LColor: TColor;
|
||||
begin
|
||||
FOptions := Value;
|
||||
|
||||
if foFullOpen in Options then
|
||||
Expand
|
||||
else
|
||||
Collapse;
|
||||
|
||||
ButtonGraphics.Enabled := not (foPreventExpand in Options);
|
||||
|
||||
ButtonApply.Visible := (foShowApply in Options);
|
||||
|
||||
if foShowHelp in Options then
|
||||
BorderIcons := BorderIcons + [biHelp]
|
||||
else
|
||||
BorderIcons := BorderIcons - [biHelp];
|
||||
|
||||
JvColorSpaceCombo.Enabled := foAllowSpaceChange in Options;
|
||||
|
||||
LVisible := foShowOldPreview in Options;
|
||||
LabelDrawOld.Visible := LVisible;
|
||||
LabelOld.Visible := LVisible;
|
||||
|
||||
LVisible := foShowNewPreview in Options;
|
||||
LabelDrawNew.Visible := LVisible;
|
||||
LabelNew.Visible := LVisible;
|
||||
|
||||
LVisible := foShowPredefined in Options;
|
||||
ColorBox.Visible := LVisible;
|
||||
LabelPredefined.Visible := LVisible;
|
||||
|
||||
JvColorSpaceCombo.AllowVariable := foAllowVariable in Options;
|
||||
if foAllowVariable in Options then
|
||||
// ColorBox.Options := ColorBox.Options + [coSysColors]
|
||||
ColorBox.Style := ColorBox.style + [cbSystemColors]
|
||||
else
|
||||
// ColorBox.Options := ColorBox.Options - [coSysColors];
|
||||
ColorBox.Style := ColorBox.Style - [cbSystemColors];
|
||||
|
||||
{ if foNoneAndDefault in Options then
|
||||
ColorBox.Style := ColorBox.Style + [cbIncludeNone, cbIncludeDefault]
|
||||
else
|
||||
ColorBox.Style := ColorBox.Style - [cbIncludeNone, cbIncludeDefault];}
|
||||
|
||||
UpdateColorSpace;
|
||||
|
||||
LColor := ColorSpaceManager.ConvertToColor(FullColor);
|
||||
|
||||
LabelDrawNew.Color := LColor;
|
||||
LabelDrawOld.Color := LColor;
|
||||
end;
|
||||
|
||||
procedure TJvFullColorFrm.LabelDrawOldClick(Sender: TObject);
|
||||
begin
|
||||
with ColorSpaceManager do
|
||||
FullColor := ConvertToID(
|
||||
ConvertFromColor(LabelDrawOld.Color),
|
||||
GetColorSpaceID(FullColor)
|
||||
);
|
||||
end;
|
||||
|
||||
end.
|
385
components/jvcllaz/run/JvMM/jvfullcolorrotate.pas
Normal file
@ -0,0 +1,385 @@
|
||||
{-----------------------------------------------------------------------------
|
||||
The contents of this file are 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.1.html
|
||||
|
||||
Software distributed under the License is distributed on an "AS IS" basis,
|
||||
WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for
|
||||
the specific language governing rights and limitations under the License.
|
||||
|
||||
The Original Code is: ColorRotate.pas, released on 2004-09-11.
|
||||
|
||||
The Initial Developer of the Original Code is Florent Ouchet [ouchet dott florent att laposte dott net]
|
||||
Portions created by Florent Ouchet are Copyright (C) 2004 Florent Ouchet.
|
||||
All Rights Reserved.
|
||||
|
||||
Contributor(s): -
|
||||
|
||||
You may retrieve the latest version of this file at the Project JEDI's JVCL home page,
|
||||
located at http://jvcl.delphi-jedi.org
|
||||
|
||||
Known Issues:
|
||||
-----------------------------------------------------------------------------}
|
||||
// $Id$
|
||||
|
||||
unit JvFullColorRotate;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
//Windows,
|
||||
Classes, Graphics,
|
||||
JvFullColorSpaces;
|
||||
|
||||
type
|
||||
TJvRotateColor = (rcCommon, rcRed, rcGreen, rcBlue);
|
||||
|
||||
TJvSaturationMethod = (smRange, smLoop);
|
||||
|
||||
TJvRotateValueType = -255..255;
|
||||
|
||||
TJvRotateValue = class(TPersistent)
|
||||
private
|
||||
FValue: TJvRotateValueType;
|
||||
FSaturationMethod: TJvSaturationMethod;
|
||||
public
|
||||
constructor Create; reintroduce;
|
||||
property Value: TJvRotateValueType read FValue write FValue default 0;
|
||||
property SaturationMethod: TJvSaturationMethod read FSaturationMethod write FSaturationMethod default smRange;
|
||||
procedure Assign(AValue: TJvRotateValue); reintroduce;
|
||||
end;
|
||||
|
||||
TJvAxisDelta = class(TPersistent)
|
||||
private
|
||||
FConstituents: array [TJvAxisIndex] of TJvRotateValue;
|
||||
function GetConstituents(Index: TJvAxisIndex): TJvRotateValue;
|
||||
procedure SetConstituents(Index: TJvAxisIndex; const Value: TJvRotateValue);
|
||||
public
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
procedure Assign(Value: TJvAxisDelta); reintroduce;
|
||||
property Constituents[Index: TJvAxisIndex]: TJvRotateValue read GetConstituents write SetConstituents; default;
|
||||
end;
|
||||
|
||||
TJvColorDelta = class(TPersistent)
|
||||
private
|
||||
FColorID: TJvFullColorSpaceID;
|
||||
FAxisRed: TJvAxisDelta;
|
||||
FAxisGreen: TJvAxisDelta;
|
||||
FAxisBlue: TJvAxisDelta;
|
||||
procedure SetAxisBlue(const Value: TJvAxisDelta);
|
||||
procedure SetAxisGreen(const Value: TJvAxisDelta);
|
||||
procedure SetAxisRed(const Value: TJvAxisDelta);
|
||||
public
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
procedure Assign(Value: TJvColorDelta); reintroduce;
|
||||
property ColorID: TJvFullColorSpaceID read FColorID write FColorID default csRGB;
|
||||
property AxisRed: TJvAxisDelta read FAxisRed write SetAxisRed;
|
||||
property AxisGreen: TJvAxisDelta read FAxisGreen write SetAxisGreen;
|
||||
property AxisBlue: TJvAxisDelta read FAxisBlue write SetAxisBlue;
|
||||
end;
|
||||
|
||||
function RotateColor(AColor: TJvFullColor; AColorDelta: TJvColorDelta): TJvFullColor;
|
||||
procedure RotateBitmap(SourceBitmap, DestBitmap: TBitmap; AColorDelta: TJvColorDelta);
|
||||
|
||||
|
||||
implementation
|
||||
|
||||
uses
|
||||
JvTypes;
|
||||
|
||||
function RotateColor(AColor: TJvFullColor; AColorDelta: TJvColorDelta): TJvFullColor;
|
||||
var
|
||||
I: TJvAxisIndex;
|
||||
MinAxis: array [TJvAxisIndex] of Byte;
|
||||
MaxAxis: array [TJvAxisIndex] of Byte;
|
||||
ValueAxis: array [TJvAxisIndex] of SmallInt;
|
||||
ColorRed, ColorGreen, ColorBlue: TColor;
|
||||
MaxColorAxis:Integer;
|
||||
SourceColorSpace, DeltaColorSpace: TJvColorSpace;
|
||||
LColor: TColor;
|
||||
|
||||
function DoRotate(AValue: TJvFullColor; AAxisDelta: TJvAxisDelta): TColor;
|
||||
var
|
||||
I: TJvAxisIndex;
|
||||
Range: Integer;
|
||||
begin
|
||||
for I := Low(TJvAxisIndex) to High(TJvAxisIndex) do
|
||||
begin
|
||||
ValueAxis[I] := Integer(GetAxisValue(AValue, I)) + AAxisDelta[I].Value;
|
||||
if AAxisDelta[I].SaturationMethod = smRange then
|
||||
begin
|
||||
if ValueAxis[I] > MaxAxis[I] then
|
||||
ValueAxis[I] := MaxAxis[I];
|
||||
if ValueAxis[I] < MinAxis[I] then
|
||||
ValueAxis[I] := MinAxis[I];
|
||||
end
|
||||
else
|
||||
begin
|
||||
Range := MaxAxis[I] - MinAxis[I] + 1;
|
||||
while ValueAxis[I] < MinAxis[I] do
|
||||
Inc(ValueAxis[I], Range);
|
||||
while ValueAxis[I] > MaxAxis[I] do
|
||||
Dec(ValueAxis[I], Range);
|
||||
end;
|
||||
end;
|
||||
Result :=
|
||||
(ValueAxis[axIndex0]) or (ValueAxis[axIndex1] shl 8) or (ValueAxis[axIndex2] shl 16);
|
||||
end;
|
||||
|
||||
begin
|
||||
with ColorSpaceManager do
|
||||
begin
|
||||
SourceColorSpace := ColorSpace[GetColorSpaceID(AColor)];
|
||||
LColor := SourceColorSpace.ConvertToColor(AColor);
|
||||
DeltaColorSpace := ColorSpace[AColorDelta.ColorID];
|
||||
|
||||
with DeltaColorSpace do
|
||||
begin
|
||||
for I := Low(TJvAxisIndex) to High(TJvAxisIndex) do
|
||||
begin
|
||||
MinAxis[I] := AxisMin[I];
|
||||
MaxAxis[I] := AxisMax[I];
|
||||
end;
|
||||
ColorRed := ConvertToColor(DoRotate(ConvertFromColor(LColor and $000000FF), AColorDelta.AxisRed));
|
||||
ColorGreen := ConvertToColor(DoRotate(ConvertFromColor(LColor and $0000FF00), AColorDelta.AxisGreen));
|
||||
ColorBlue := ConvertToColor(DoRotate(ConvertFromColor(LColor and $00FF0000), AColorDelta.AxisBlue));
|
||||
|
||||
MaxColorAxis := 255;
|
||||
for I := Low(TJvAxisIndex) to High(TJvAxisIndex) do
|
||||
begin
|
||||
ValueAxis[I] := (ColorRed and $FF) + (ColorGreen and $FF) + (ColorBlue and $FF);
|
||||
if ValueAxis[I] > MaxColorAxis then
|
||||
MaxColorAxis := ValueAxis[I];
|
||||
ColorRed := ColorRed shr 8;
|
||||
ColorGreen := ColorGreen shr 8;
|
||||
ColorBlue := ColorBlue shr 8;
|
||||
end;
|
||||
|
||||
for I := Low(TJvAxisIndex) to High(TJvAxisIndex) do
|
||||
begin
|
||||
ValueAxis[I] := ValueAxis[I] + 255 - MaxColorAxis;
|
||||
if ValueAxis[I] < 0 then
|
||||
ValueAxis[I] := 0;
|
||||
end;
|
||||
LColor := ValueAxis[axIndex0] or (ValueAxis[axIndex1] shl 8) or (ValueAxis[axIndex2] shl 16);
|
||||
end;
|
||||
Result := SourceColorSpace.ConvertFromColor(LColor);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure RotateBitmap(SourceBitmap, DestBitmap: TBitmap; AColorDelta: TJvColorDelta);
|
||||
type
|
||||
TFullColorValue = array [TJvAxisIndex] of SmallInt;
|
||||
PFullColorValue = ^TFullColorValue;
|
||||
var
|
||||
OriginalPixelFormat: TPixelFormat;
|
||||
Colors: array [TJvAxisIndex,Byte] of TFullColorValue;
|
||||
ColorR, ColorB, ColorG, ColorFusion: TFullColorValue;
|
||||
I: TJvAxisIndex;
|
||||
J: Byte;
|
||||
X, Y: Integer;
|
||||
MinAxis: array [TJvAxisIndex] of SmallInt;
|
||||
MaxAxis: array [TJvAxisIndex] of SmallInt;
|
||||
MaxColorAxis: SmallInt;
|
||||
DeltaColorSpace: TJvColorSpace;
|
||||
DestLine, SourceLine: PCardinal;
|
||||
|
||||
procedure DoRotate(Color: TColor; AAxisDelta: TJvAxisDelta; out DestColor: TFullColorValue);
|
||||
var
|
||||
I: TJvAxisIndex;
|
||||
Range: Integer;
|
||||
FullColor: TJvFullColor;
|
||||
ColorValue: TFullColorValue;
|
||||
begin
|
||||
FullColor := DeltaColorSpace.ConvertFromColor(Color);
|
||||
for I := Low(TJvAxisIndex) to High(TJvAxisIndex) do
|
||||
begin
|
||||
ColorValue[I] := Integer(GetAxisValue(FullColor, I)) + AAxisDelta[I].Value;
|
||||
if AAxisDelta[I].SaturationMethod = smRange then
|
||||
begin
|
||||
if ColorValue[I] > MaxAxis[I] then
|
||||
ColorValue[I] := MaxAxis[I];
|
||||
if ColorValue[I] < MinAxis[I] then
|
||||
ColorValue[I] := MinAxis[I];
|
||||
end
|
||||
else
|
||||
begin
|
||||
Range := MaxAxis[I] - MinAxis[I] + 1;
|
||||
while ColorValue[I] < MinAxis[I] do
|
||||
Inc(ColorValue[I], Range);
|
||||
while ColorValue[I] > MaxAxis[I] do
|
||||
Dec(ColorValue[I], Range);
|
||||
end;
|
||||
end;
|
||||
Color := DeltaColorSpace.ConvertToColor(ColorValue[axIndex0] or
|
||||
(ColorValue[axIndex1] shl 8) or (ColorValue[axIndex2] shl 16));
|
||||
DestColor[axIndex0] := Color and $FF;
|
||||
DestColor[axIndex1] := (Color shr 8) and $FF;
|
||||
DestColor[axIndex2] := (Color shr 16) and $FF;
|
||||
end;
|
||||
|
||||
begin
|
||||
DestBitmap.Width := SourceBitmap.Width;
|
||||
DestBitmap.Height := SourceBitmap.Height;
|
||||
OriginalPixelFormat := SourceBitmap.PixelFormat;
|
||||
SourceBitmap.PixelFormat := pf32bit;
|
||||
DestBitmap.PixelFormat := pf32bit;
|
||||
with ColorSpaceManager do
|
||||
begin
|
||||
DeltaColorSpace := ColorSpace[AColorDelta.ColorID];
|
||||
with DeltaColorSpace do
|
||||
begin
|
||||
for I := Low(TJvAxisIndex) to High(TJvAxisIndex) do
|
||||
begin
|
||||
MinAxis[I] := AxisMin[I];
|
||||
MaxAxis[I] := AxisMax[I];
|
||||
end;
|
||||
for J := Low(Byte) to High(Byte) do
|
||||
begin
|
||||
DoRotate(TColor(J),AColorDelta.AxisRed,Colors[axIndex0,J]);
|
||||
DoRotate(TColor(J shl 8),AColorDelta.AxisGreen,Colors[axIndex1,J]);
|
||||
DoRotate(TColor(J shl 16),AColorDelta.AxisBlue,Colors[axIndex2,J]);
|
||||
end;
|
||||
|
||||
for Y := 0 to DestBitmap.Height-1 do
|
||||
begin
|
||||
SourceLine := SourceBitmap.ScanLine[Y];
|
||||
DestLine := DestBitmap.ScanLine[Y];
|
||||
for X := 0 to DestBitmap.Width-1 do
|
||||
begin
|
||||
ColorR := Colors[axIndex0,(SourceLine^ shr 16) and $FF]; //
|
||||
ColorG := Colors[axIndex1,(SourceLine^ shr 8) and $FF]; // Bitmap Color Format is
|
||||
ColorB := Colors[axIndex2,(SourceLine^) and $FF]; // (MSB)0RGB(LSB)
|
||||
ColorFusion[axIndex0] := ColorR[axIndex0] + ColorG[axIndex0] + ColorB[axIndex0];
|
||||
ColorFusion[axIndex1] := ColorR[axIndex1] + ColorG[axIndex1] + ColorB[axIndex1];
|
||||
ColorFusion[axIndex2] := ColorR[axIndex2] + ColorG[axIndex2] + ColorB[axIndex2];
|
||||
MaxColorAxis := 255;
|
||||
if ColorFusion[axIndex0] > MaxColorAxis then
|
||||
MaxColorAxis := ColorFusion[axIndex0];
|
||||
if ColorFusion[axIndex1] > MaxColorAxis then
|
||||
MaxColorAxis := ColorFusion[axIndex1];
|
||||
if ColorFusion[axIndex2] > MaxColorAxis then
|
||||
MaxColorAxis := ColorFusion[axIndex2];
|
||||
ColorFusion[axIndex0] := ColorFusion[axIndex0] + 255 - MaxColorAxis;
|
||||
if ColorFusion[axIndex0] < 0 then
|
||||
ColorFusion[axIndex0] := 0;
|
||||
ColorFusion[axIndex1] := ColorFusion[axIndex1] + 255 - MaxColorAxis;
|
||||
if ColorFusion[axIndex1] < 0 then
|
||||
ColorFusion[axIndex1] := 0;
|
||||
ColorFusion[axIndex2] := ColorFusion[axIndex2] + 255 - MaxColorAxis;
|
||||
if ColorFusion[axIndex2] < 0 then
|
||||
ColorFusion[axIndex2] := 0;
|
||||
DestLine^ := // Bitmap Color Format is (MSB)0RGB(LSB)
|
||||
(ColorFusion[axIndex0] shl 16) or (ColorFusion[axIndex1] shl 8) or (ColorFusion[axIndex2]);
|
||||
Inc(SourceLine);
|
||||
Inc(DestLine);
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
SourceBitmap.PixelFormat := OriginalPixelFormat;
|
||||
DestBitmap.PixelFormat := OriginalPixelFormat;
|
||||
end;
|
||||
|
||||
//=== { TJvAxisDelta } =======================================================
|
||||
|
||||
constructor TJvAxisDelta.Create;
|
||||
var
|
||||
Index: TJvAxisIndex;
|
||||
begin
|
||||
inherited Create;
|
||||
for Index := Low(TJvAxisIndex) to High(TJvAxisIndex) do
|
||||
FConstituents[Index] := TJvRotateValue.Create;
|
||||
end;
|
||||
|
||||
destructor TJvAxisDelta.Destroy;
|
||||
var
|
||||
Index: TJvAxisIndex;
|
||||
begin
|
||||
for Index := Low(TJvAxisIndex) to High(TJvAxisIndex) do
|
||||
FConstituents[Index].Free;
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TJvAxisDelta.Assign(Value: TJvAxisDelta);
|
||||
var
|
||||
Index: TJvAxisIndex;
|
||||
begin
|
||||
for Index := Low(TJvAxisIndex) to High(TJvAxisIndex) do
|
||||
FConstituents[Index].Assign(Value[Index]);
|
||||
end;
|
||||
|
||||
function TJvAxisDelta.GetConstituents(Index: TJvAxisIndex): TJvRotateValue;
|
||||
begin
|
||||
Result := FConstituents[Index];
|
||||
end;
|
||||
|
||||
procedure TJvAxisDelta.SetConstituents(Index: TJvAxisIndex;
|
||||
const Value: TJvRotateValue);
|
||||
begin
|
||||
FConstituents[Index].Assign(Value);
|
||||
end;
|
||||
|
||||
//=== { TJvColorDelta } ======================================================
|
||||
|
||||
constructor TJvColorDelta.Create;
|
||||
begin
|
||||
inherited Create;
|
||||
FColorID := csRGB;
|
||||
FAxisRed := TJvAxisDelta.Create;
|
||||
FAxisGreen := TJvAxisDelta.Create;
|
||||
FAxisBlue := TJvAxisDelta.Create;
|
||||
end;
|
||||
|
||||
destructor TJvColorDelta.Destroy;
|
||||
begin
|
||||
FAxisRed.Free;
|
||||
FAxisGreen.Free;
|
||||
FAxisBlue.Free;
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
procedure TJvColorDelta.Assign(Value: TJvColorDelta);
|
||||
begin
|
||||
AxisRed.Assign(Value.AxisRed);
|
||||
AxisGreen.Assign(Value.AxisGreen);
|
||||
AxisBlue.Assign(Value.AxisBlue);
|
||||
ColorID := Value.ColorID;
|
||||
end;
|
||||
|
||||
procedure TJvColorDelta.SetAxisBlue(const Value: TJvAxisDelta);
|
||||
begin
|
||||
FAxisBlue.Assign(Value);
|
||||
end;
|
||||
|
||||
procedure TJvColorDelta.SetAxisGreen(const Value: TJvAxisDelta);
|
||||
begin
|
||||
FAxisGreen.Assign(Value);
|
||||
end;
|
||||
|
||||
procedure TJvColorDelta.SetAxisRed(const Value: TJvAxisDelta);
|
||||
begin
|
||||
FAxisRed.Assign(Value);
|
||||
end;
|
||||
|
||||
//=== { TJvRotateValue } =====================================================
|
||||
|
||||
constructor TJvRotateValue.Create;
|
||||
begin
|
||||
FValue := 0;
|
||||
FSaturationMethod := smLoop;
|
||||
end;
|
||||
|
||||
procedure TJvRotateValue.Assign(AValue: TJvRotateValue);
|
||||
begin
|
||||
FValue := AValue.Value;
|
||||
FSaturationMethod := AValue.SaturationMethod;
|
||||
end;
|
||||
|
||||
|
||||
end.
|