1
0
mirror of https://github.com/moparisthebest/Simba synced 2025-02-07 02:30:19 -05:00
git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@296 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
Wizzup? 2009-12-19 23:34:38 +00:00
parent 3e2a64cc7e
commit a74bd810c0
5 changed files with 484 additions and 503 deletions

View File

@ -1,116 +1,108 @@
object ColourHistoryForm: TColourHistoryForm
Left = 420
Height = 250
Top = 318
Width = 490
ActiveControl = SelectionName
Caption = 'Colour Picker History'
ClientHeight = 250
ClientWidth = 490
Constraints.MinHeight = 200
Constraints.MinWidth = 490
OnCreate = FormCreate
OnHide = UnSetCHShowMenu
OnShow = SetCHShowMenu
LCLVersion = '0.9.29'
object ColourList: TListView
Left = 16
Height = 176
Top = 16
Width = 329
Anchors = [akTop, akLeft, akRight, akBottom]
Columns = <
item
Caption = 'Colour'
MaxWidth = 50
MinWidth = 50
Width = 10
end
item
Caption = 'Woot'
Width = 10
end>
ItemIndex = -1
TabOrder = 0
ViewStyle = vsReport
OnAdvancedCustomDrawSubItem = ColourListAdvancedCustomDrawSubItem
OnSelectItem = ChangeViewData
end
object DeleteButton: TButton
Left = 16
Height = 25
Top = 208
Width = 128
Anchors = [akLeft, akBottom]
Caption = 'Delete'
OnClick = DeleteSelected
TabOrder = 1
end
object SelectionName: TEdit
Left = 361
Height = 21
Top = 16
Width = 112
Anchors = [akTop, akRight]
OnChange = ChangeName
OnKeyPress = SelectionNameKeyPress
TabOrder = 2
Text = 'Name'
end
object PickNewColourButton: TButton
Left = 217
Height = 25
Top = 208
Width = 128
Anchors = [akRight, akBottom]
Caption = 'Pick New Colour'
TabOrder = 3
end
object ColourValue: TEdit
Left = 361
Height = 21
Top = 56
Width = 112
Anchors = [akTop, akRight]
ReadOnly = True
TabOrder = 4
Text = 'ColourValue'
end
object CoordValue: TLabel
Left = 361
Height = 14
Top = 96
Width = 112
Anchors = [akTop, akRight]
Caption = 'CoordValue'
Constraints.MinWidth = 112
ParentColor = False
end
object ColourImage: TImage
Left = 152
Height = 24
Top = 209
Width = 57
Anchors = [akLeft, akRight, akBottom]
end
object OkButton: TButton
Left = 393
Height = 24
Top = 209
Width = 80
Anchors = [akRight, akBottom]
Caption = 'Ok'
OnClick = OkButtonClick
TabOrder = 5
end
object CH_RGB_Label: TLabel
Left = 361
Height = 14
Top = 128
Width = 112
Anchors = [akTop, akRight]
Caption = 'RGBValues'
Constraints.MinWidth = 112
ParentColor = False
end
end
object ColourHistoryForm: TColourHistoryForm
Left = 373
Height = 250
Top = 308
Width = 490
ActiveControl = SelectionName
Caption = 'Colour Picker History'
ClientHeight = 250
ClientWidth = 490
Constraints.MinHeight = 200
Constraints.MinWidth = 490
OnHide = UnSetCHShowMenu
OnShow = SetCHShowMenu
LCLVersion = '0.9.29'
object DeleteButton: TButton
Left = 16
Height = 25
Top = 208
Width = 128
Anchors = [akLeft, akBottom]
Caption = 'Delete'
OnClick = DeleteSelected
TabOrder = 0
end
object SelectionName: TEdit
Left = 361
Height = 27
Top = 16
Width = 112
Anchors = [akTop, akRight]
OnChange = ChangeName
OnKeyPress = SelectionNameKeyPress
TabOrder = 1
Text = 'Name'
end
object PickNewColourButton: TButton
Left = 217
Height = 25
Top = 208
Width = 128
Anchors = [akRight, akBottom]
Caption = 'Pick New Colour'
TabOrder = 2
end
object ColourValue: TEdit
Left = 361
Height = 27
Top = 56
Width = 112
Anchors = [akTop, akRight]
ReadOnly = True
TabOrder = 3
Text = 'ColourValue'
end
object CoordValue: TLabel
Left = 361
Height = 18
Top = 96
Width = 112
Anchors = [akTop, akRight]
Caption = 'CoordValue'
Constraints.MinWidth = 112
ParentColor = False
end
object ColourImage: TImage
Left = 152
Height = 24
Top = 209
Width = 57
Anchors = [akLeft, akRight, akBottom]
end
object OkButton: TButton
Left = 393
Height = 24
Top = 209
Width = 80
Anchors = [akRight, akBottom]
Caption = 'Ok'
OnClick = OkButtonClick
TabOrder = 4
end
object CH_RGB_Label: TLabel
Left = 361
Height = 18
Top = 128
Width = 112
Anchors = [akTop, akRight]
Caption = 'RGBValues'
Constraints.MinWidth = 112
ParentColor = False
end
object ColourTree: TTreeView
Left = 8
Height = 169
Top = 16
Width = 337
Anchors = [akTop, akLeft, akRight, akBottom]
DefaultItemHeight = 19
Images = CHImages
ScrollBars = ssAutoBoth
TabOrder = 5
OnChange = ColourTreeChange
end
object CHImages: TImageList
left = 360
top = 200
end
end

View File

@ -1,36 +1,34 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TColourHistoryForm','FORMDATA',[
'TPF0'#18'TColourHistoryForm'#17'ColourHistoryForm'#4'Left'#3#164#1#6'Height'
+#3#250#0#3'Top'#3'>'#1#5'Width'#3#234#1#13'ActiveControl'#7#13'SelectionName'
+#7'Caption'#6#21'Colour Picker History'#12'ClientHeight'#3#250#0#11'ClientWi'
+'dth'#3#234#1#21'Constraints.MinHeight'#3#200#0#20'Constraints.MinWidth'#3
+#234#1#8'OnCreate'#7#10'FormCreate'#6'OnHide'#7#15'UnSetCHShowMenu'#6'OnShow'
+#7#13'SetCHShowMenu'#10'LCLVersion'#6#6'0.9.29'#0#9'TListView'#10'ColourList'
+#4'Left'#2#16#6'Height'#3#176#0#3'Top'#2#16#5'Width'#3'I'#1#7'Anchors'#11#5
+'akTop'#6'akLeft'#7'akRight'#8'akBottom'#0#7'Columns'#14#1#7'Caption'#6#6'Co'
+'lour'#8'MaxWidth'#2'2'#8'MinWidth'#2'2'#5'Width'#2#10#0#1#7'Caption'#6#4'Wo'
+'ot'#5'Width'#2#10#0#0#9'ItemIndex'#2#255#8'TabOrder'#2#0#9'ViewStyle'#7#8'v'
+'sReport'#27'OnAdvancedCustomDrawSubItem'#7'#ColourListAdvancedCustomDrawSub'
+'Item'#12'OnSelectItem'#7#14'ChangeViewData'#0#0#7'TButton'#12'DeleteButton'
+#4'Left'#2#16#6'Height'#2#25#3'Top'#3#208#0#5'Width'#3#128#0#7'Anchors'#11#6
+'akLeft'#8'akBottom'#0#7'Caption'#6#6'Delete'#7'OnClick'#7#14'DeleteSelected'
+#8'TabOrder'#2#1#0#0#5'TEdit'#13'SelectionName'#4'Left'#3'i'#1#6'Height'#2#21
+#3'Top'#2#16#5'Width'#2'p'#7'Anchors'#11#5'akTop'#7'akRight'#0#8'OnChange'#7
+#10'ChangeName'#10'OnKeyPress'#7#21'SelectionNameKeyPress'#8'TabOrder'#2#2#4
+'Text'#6#4'Name'#0#0#7'TButton'#19'PickNewColourButton'#4'Left'#3#217#0#6'He'
+'ight'#2#25#3'Top'#3#208#0#5'Width'#3#128#0#7'Anchors'#11#7'akRight'#8'akBot'
+'tom'#0#7'Caption'#6#15'Pick New Colour'#8'TabOrder'#2#3#0#0#5'TEdit'#11'Col'
+'ourValue'#4'Left'#3'i'#1#6'Height'#2#21#3'Top'#2'8'#5'Width'#2'p'#7'Anchors'
+#11#5'akTop'#7'akRight'#0#8'ReadOnly'#9#8'TabOrder'#2#4#4'Text'#6#11'ColourV'
+'alue'#0#0#6'TLabel'#10'CoordValue'#4'Left'#3'i'#1#6'Height'#2#14#3'Top'#2'`'
+#5'Width'#2'p'#7'Anchors'#11#5'akTop'#7'akRight'#0#7'Caption'#6#10'CoordValu'
+'e'#20'Constraints.MinWidth'#2'p'#11'ParentColor'#8#0#0#6'TImage'#11'ColourI'
+'mage'#4'Left'#3#152#0#6'Height'#2#24#3'Top'#3#209#0#5'Width'#2'9'#7'Anchors'
+#11#6'akLeft'#7'akRight'#8'akBottom'#0#0#0#7'TButton'#8'OkButton'#4'Left'#3
+#137#1#6'Height'#2#24#3'Top'#3#209#0#5'Width'#2'P'#7'Anchors'#11#7'akRight'#8
+'akBottom'#0#7'Caption'#6#2'Ok'#7'OnClick'#7#13'OkButtonClick'#8'TabOrder'#2
+#5#0#0#6'TLabel'#12'CH_RGB_Label'#4'Left'#3'i'#1#6'Height'#2#14#3'Top'#3#128
+#0#5'Width'#2'p'#7'Anchors'#11#5'akTop'#7'akRight'#0#7'Caption'#6#9'RGBValue'
+'s'#20'Constraints.MinWidth'#2'p'#11'ParentColor'#8#0#0#0
]);
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TColourHistoryForm','FORMDATA',[
'TPF0'#18'TColourHistoryForm'#17'ColourHistoryForm'#4'Left'#3'u'#1#6'Height'#3
+#250#0#3'Top'#3'4'#1#5'Width'#3#234#1#13'ActiveControl'#7#13'SelectionName'#7
+'Caption'#6#21'Colour Picker History'#12'ClientHeight'#3#250#0#11'ClientWidt'
+'h'#3#234#1#21'Constraints.MinHeight'#3#200#0#20'Constraints.MinWidth'#3#234
+#1#6'OnHide'#7#15'UnSetCHShowMenu'#6'OnShow'#7#13'SetCHShowMenu'#10'LCLVersi'
+'on'#6#6'0.9.29'#0#7'TButton'#12'DeleteButton'#4'Left'#2#16#6'Height'#2#25#3
+'Top'#3#208#0#5'Width'#3#128#0#7'Anchors'#11#6'akLeft'#8'akBottom'#0#7'Capti'
+'on'#6#6'Delete'#7'OnClick'#7#14'DeleteSelected'#8'TabOrder'#2#0#0#0#5'TEdit'
+#13'SelectionName'#4'Left'#3'i'#1#6'Height'#2#27#3'Top'#2#16#5'Width'#2'p'#7
+'Anchors'#11#5'akTop'#7'akRight'#0#8'OnChange'#7#10'ChangeName'#10'OnKeyPres'
+'s'#7#21'SelectionNameKeyPress'#8'TabOrder'#2#1#4'Text'#6#4'Name'#0#0#7'TBut'
+'ton'#19'PickNewColourButton'#4'Left'#3#217#0#6'Height'#2#25#3'Top'#3#208#0#5
+'Width'#3#128#0#7'Anchors'#11#7'akRight'#8'akBottom'#0#7'Caption'#6#15'Pick '
+'New Colour'#8'TabOrder'#2#2#0#0#5'TEdit'#11'ColourValue'#4'Left'#3'i'#1#6'H'
+'eight'#2#27#3'Top'#2'8'#5'Width'#2'p'#7'Anchors'#11#5'akTop'#7'akRight'#0#8
+'ReadOnly'#9#8'TabOrder'#2#3#4'Text'#6#11'ColourValue'#0#0#6'TLabel'#10'Coor'
+'dValue'#4'Left'#3'i'#1#6'Height'#2#18#3'Top'#2'`'#5'Width'#2'p'#7'Anchors'
+#11#5'akTop'#7'akRight'#0#7'Caption'#6#10'CoordValue'#20'Constraints.MinWidt'
+'h'#2'p'#11'ParentColor'#8#0#0#6'TImage'#11'ColourImage'#4'Left'#3#152#0#6'H'
+'eight'#2#24#3'Top'#3#209#0#5'Width'#2'9'#7'Anchors'#11#6'akLeft'#7'akRight'
+#8'akBottom'#0#0#0#7'TButton'#8'OkButton'#4'Left'#3#137#1#6'Height'#2#24#3'T'
+'op'#3#209#0#5'Width'#2'P'#7'Anchors'#11#7'akRight'#8'akBottom'#0#7'Caption'
+#6#2'Ok'#7'OnClick'#7#13'OkButtonClick'#8'TabOrder'#2#4#0#0#6'TLabel'#12'CH_'
+'RGB_Label'#4'Left'#3'i'#1#6'Height'#2#18#3'Top'#3#128#0#5'Width'#2'p'#7'Anc'
+'hors'#11#5'akTop'#7'akRight'#0#7'Caption'#6#9'RGBValues'#20'Constraints.Min'
+'Width'#2'p'#11'ParentColor'#8#0#0#9'TTreeView'#10'ColourTree'#4'Left'#2#8#6
+'Height'#3#169#0#3'Top'#2#16#5'Width'#3'Q'#1#7'Anchors'#11#5'akTop'#6'akLeft'
+#7'akRight'#8'akBottom'#0#17'DefaultItemHeight'#2#19#6'Images'#7#8'CHImages'
+#10'ScrollBars'#7#10'ssAutoBoth'#8'TabOrder'#2#5#8'OnChange'#7#16'ColourTree'
+'Change'#0#0#10'TImageList'#8'CHImages'#4'left'#3'h'#1#3'top'#3#200#0#0#0#0
]);

View File

@ -1,226 +1,217 @@
unit colourhistory;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
ComCtrls, StdCtrls, ExtCtrls;
type
TColourPickerObject = class(TObject)
constructor Create(C: Integer; P: TPoint; N: String);
destructor Destroy; override;
public
Colour: Integer;
Pos: TPoint;
Name: String;
end;
{ TColourHistoryForm }
TColourHistoryForm = class(TForm)
CH_RGB_Label: TLabel;
OkButton: TButton;
ColourValue: TEdit;
CoordValue: TLabel;
ColourImage: TImage;
PickNewColourButton: TButton;
DeleteButton: TButton;
ColourList: TListView;
SelectionName: TEdit;
procedure ChangeName(Sender: TObject);
procedure ChangeViewData(Sender: TObject; Item: TListItem; Selected: Boolean
);
procedure ColourListAdvancedCustomDrawSubItem(Sender: TCustomListView;
Item: TListItem; SubItem: Integer; State: TCustomDrawState;
Stage: TCustomDrawStage; var DefaultDraw: Boolean);
procedure DeleteSelected(Sender: TObject);
procedure AddColObj(c: TColourPickerObject; autoName: Boolean);
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
procedure FormCreate(Sender: TObject);
procedure OkButtonClick(Sender: TObject);
procedure SelectionNameKeyPress(Sender: TObject; var Key: char);
procedure SetCHShowMenu(Sender: TObject);
procedure UnSetCHShowMenu(Sender: TObject);
private
Colour_Count: Integer;
{ private declarations }
protected
procedure AddColObj(c: TColourPickerObject);
public
IndexSelected: Integer;
{ public declarations }
end;
var
ColourHistoryForm: TColourHistoryForm;
implementation
uses
colour_conv, TestUnit;
constructor TColourPickerObject.Create(C: Integer; P: TPoint; N: String);
begin
inherited Create;
Self.Colour := C;
Self.Pos := P;
Self.Name:= N;
end;
destructor TColourPickerObject.Destroy;
begin
inherited Destroy;
end;
{ TColourHistoryForm }
procedure TColourHistoryForm.AddColObj(c: TColourPickerObject; autoName: Boolean);
begin
if autoName then
begin
Inc(Colour_Count);
// TODO: Proper name
c.Name := IntToStr(c.Colour) + ' (' + IntToStr(Colour_Count) + ')';
end;
Self.AddColObj(c);
end;
procedure TColourHistoryForm.AddColObj(c: TColourPickerObject);
var
it: TListItem;
begin
it := ColourList.Items.Add;
it.Data := c;
it.Caption:= c.Name;
ColourList.Selected := it;
end;
procedure TColourHistoryForm.DeleteSelected(Sender: TObject);
begin
if (Assigned(ColourList.Selected)) then
begin
TColourPickerObject(ColourList.Selected.Data).Free;
ColourList.Selected.Delete;
end;
end;
procedure TColourHistoryForm.ChangeViewData(Sender: TObject; Item: TListItem;
Selected: Boolean);
var
r,g,b:integer;
begin
if not Assigned(Item) then
exit;
if not Item.Selected then
exit;
{ This only occurs when we have manually added an item with the Form Editor }
if not Assigned(Item.Data) then
exit;
colour_conv.ColorToRGB(TColourPickerObject(Item.Data).Colour, r, g, b);
{ Change Form Text / Values }
ColourValue.Caption := IntToStr(TColourPickerObject(Item.Data).Colour);
CoordValue.Caption := 'Coords: ' + IntToStr(TColourPickerObject(Item.Data).Pos.X) +
', ' + IntToStr(TColourPickerObject(Item.Data).Pos.Y);
SelectionName.Text := TColourPickerObject(Item.Data).Name;
CH_RGB_Label.Caption:=Format('RGB:%d,%d,%d', [r,g,b]);
{ Draw the Image }
ColourImage.Canvas.Brush.Color := TColourPickerObject(Item.Data).Colour;
ColourImage.Canvas.Rectangle(0,0,ColourImage.Width, ColourImage.Height);
if Self.Visible then
begin
try
SelectionName.SetFocus;
finally
end;
end;
end;
procedure TColourHistoryForm.ColourListAdvancedCustomDrawSubItem(
Sender: TCustomListView; Item: TListItem; SubItem: Integer;
State: TCustomDrawState; Stage: TCustomDrawStage; var DefaultDraw: Boolean);
begin
if SubItem = 0 then
ColourList.Canvas.Brush.Color := clWhite
else
ColourList.Canvas.Brush.Color := TColourPickerObject(Item.Data).Colour;
end;
procedure TColourHistoryForm.ChangeName(Sender: TObject);
begin
if not Assigned(ColourList.Selected) then
begin
WriteLn('We double clicked but have nothing Selected?');
exit;
end;
ColourList.Selected.Caption := SelectionName.Text;
TColourPickerObject(ColourList.Selected.Data).Name := SelectionName.Text;
end;
constructor TColourHistoryForm.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
Colour_Count := 0;
PickNewColourButton.OnClick:= @Form1.ButtonPickClick;
end;
destructor TColourHistoryForm.Destroy;
begin
PickNewColourButton.OnClick := nil;
Colour_Count := 0;
inherited Destroy;
end;
procedure TColourHistoryForm.FormCreate(Sender: TObject);
begin
ColourList.Column[0].Width:= 100;
ColourList.Column[1].Width:= 500;
end;
procedure TColourHistoryForm.OkButtonClick(Sender: TObject);
begin
Self.close;
end;
procedure TColourHistoryForm.SelectionNameKeyPress(Sender: TObject;
var Key: char);
begin
if key = #13 then
begin
key := #0;
Self.close;
end;
end;
procedure TColourHistoryForm.SetCHShowMenu(Sender: TObject);
begin
Form1.MenuItemColourHistory.Checked := True;
end;
procedure TColourHistoryForm.UnSetCHShowMenu(Sender: TObject);
begin
Form1.MenuItemColourHistory.Checked := False;
end;
initialization
{$I colourhistory.lrs}
end.
unit colourhistory;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
ComCtrls, StdCtrls, ExtCtrls;
type
TColourPickerObject = class(TObject)
constructor Create(C: Integer; P: TPoint; N: String);
destructor Destroy; override;
public
Colour: Integer;
Pos: TPoint;
Name: String;
end;
{ TColourHistoryForm }
TColourHistoryForm = class(TForm)
CH_RGB_Label: TLabel;
CHImages: TImageList;
OkButton: TButton;
ColourValue: TEdit;
CoordValue: TLabel;
ColourImage: TImage;
PickNewColourButton: TButton;
DeleteButton: TButton;
SelectionName: TEdit;
ColourTree: TTreeView;
procedure ChangeName(Sender: TObject);
procedure ColourTreeChange(Sender: TObject; Node: TTreeNode);
procedure DeleteSelected(Sender: TObject);
procedure AddColObj(c: TColourPickerObject; autoName: Boolean);
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
procedure OkButtonClick(Sender: TObject);
procedure SelectionNameKeyPress(Sender: TObject; var Key: char);
procedure SetCHShowMenu(Sender: TObject);
procedure UnSetCHShowMenu(Sender: TObject);
private
{ private declarations }
protected
procedure AddColObj(c: TColourPickerObject);
public
IndexSelected: Integer;
{ public declarations }
end;
var
ColourHistoryForm: TColourHistoryForm;
implementation
uses
colour_conv, TestUnit;
constructor TColourPickerObject.Create(C: Integer; P: TPoint; N: String);
begin
inherited Create;
Self.Colour := C;
Self.Pos := P;
Self.Name:= N;
end;
destructor TColourPickerObject.Destroy;
begin
inherited Destroy;
end;
{ TColourHistoryForm }
procedure TColourHistoryForm.AddColObj(c: TColourPickerObject; autoName: Boolean);
begin
if autoName then
begin
// TODO: Proper name
c.Name := IntToStr(c.Colour);
end;
Self.AddColObj(c);
end;
procedure TColourHistoryForm.AddColObj(c: TColourPickerObject);
var
it: TTreeNode;
bmp: TBitmap;
begin
it := ColourTree.Items.Add(nil, c.Name);
it.Data := c;
ColourTree.Selected := it;
bmp:=TBitmap.Create;
bmp.SetSize(16,16);
bmp.Canvas.Brush.Color:=c.Colour;
bmp.Canvas.Rectangle(0,0,16,16);
it.ImageIndex:= CHImages.Add(bmp,nil);
bmp.Free;
end;
procedure TColourHistoryForm.DeleteSelected(Sender: TObject);
var
i:integer;
begin
if (Assigned(ColourTree.Selected)) then
begin
if Assigned(ColourTree.Selected.Data) then
TColourPickerObject(ColourTree.Selected.Data).Free;
i:=ColourTree.Selected.ImageIndex;
ColourTree.Selected.ImageIndex:=0;
CHImages.Delete(i);
ColourTree.Selected.Delete;
end;
end;
procedure TColourHistoryForm.ColourTreeChange(Sender: TObject; Node: TTreeNode);
var
r,g,b:integer;
begin
if not Assigned(Node) then
exit;
if not Node.Selected then
exit;
{ This only occurs when we have manually added an item with the Form Editor }
if not Assigned(Node.Data) then
exit;
colour_conv.ColorToRGB(TColourPickerObject(Node.Data).Colour, r, g, b);
{ Change Form Text / Values }
ColourValue.Caption := IntToStr(TColourPickerObject(Node.Data).Colour);
CoordValue.Caption := 'Coords: ' + IntToStr(TColourPickerObject(Node.Data).Pos.X) +
', ' + IntToStr(TColourPickerObject(Node.Data).Pos.Y);
SelectionName.Text := TColourPickerObject(Node.Data).Name;
CH_RGB_Label.Caption:=Format('RGB:%d,%d,%d', [r,g,b]);
{ Draw the Image }
ColourImage.Canvas.Brush.Color := TColourPickerObject(Node.Data).Colour;
ColourImage.Canvas.Rectangle(0,0,ColourImage.Width, ColourImage.Height);
if Self.Visible then
begin
try
SelectionName.SetFocus;
finally
end;
end;
end;
procedure TColourHistoryForm.ChangeName(Sender: TObject);
begin
if not Assigned(ColourTree.Selected) then
begin
WriteLn('We double clicked but have nothing Selected?');
exit;
end;
ColourTree.Selected.Text := SelectionName.Text;
TColourPickerObject(ColourTree.Selected.Data).Name := SelectionName.Text;
end;
constructor TColourHistoryForm.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
PickNewColourButton.OnClick:= @Form1.ButtonPickClick;
end;
destructor TColourHistoryForm.Destroy;
begin
PickNewColourButton.OnClick := nil;
inherited Destroy;
end;
procedure TColourHistoryForm.OkButtonClick(Sender: TObject);
begin
Self.Close;
end;
procedure TColourHistoryForm.SelectionNameKeyPress(Sender: TObject;
var Key: char);
begin
if key = #13 then
begin
key := #0;
Self.close;
end;
end;
procedure TColourHistoryForm.SetCHShowMenu(Sender: TObject);
begin
Form1.MenuItemColourHistory.Checked := True;
end;
procedure TColourHistoryForm.UnSetCHShowMenu(Sender: TObject);
begin
Form1.MenuItemColourHistory.Checked := False;
end;
initialization
{$I colourhistory.lrs}
end.

View File

@ -10,7 +10,7 @@
<TargetFileExt Value=""/>
<Title Value="Mufasa Stand Alone"/>
<UseXPManifest Value="True"/>
<ActiveEditorIndexAtStart Value="10"/>
<ActiveEditorIndexAtStart Value="6"/>
</General>
<VersionInfo>
<ProjectVersion Value=""/>
@ -167,8 +167,8 @@
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="TestUnit"/>
<CursorPos X="1" Y="403"/>
<TopLine Value="380"/>
<CursorPos X="57" Y="15"/>
<TopLine Value="1"/>
<EditorIndex Value="5"/>
<UsageCount Value="202"/>
<Loaded Value="True"/>
@ -224,8 +224,8 @@
<Filename Value="../../Units/MMLCore/client.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="Client"/>
<CursorPos X="107" Y="49"/>
<TopLine Value="34"/>
<CursorPos X="45" Y="14"/>
<TopLine Value="1"/>
<EditorIndex Value="1"/>
<UsageCount Value="201"/>
<Loaded Value="True"/>
@ -278,7 +278,7 @@
<CursorPos X="23" Y="8"/>
<TopLine Value="1"/>
<EditorIndex Value="18"/>
<UsageCount Value="69"/>
<UsageCount Value="71"/>
<Loaded Value="True"/>
</Unit31>
<Unit32>
@ -292,8 +292,8 @@
<Filename Value="../../Units/MMLCore/finder.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="finder"/>
<CursorPos X="25" Y="820"/>
<TopLine Value="807"/>
<CursorPos X="58" Y="23"/>
<TopLine Value="1"/>
<EditorIndex Value="8"/>
<UsageCount Value="201"/>
<Loaded Value="True"/>
@ -810,7 +810,7 @@
<CursorPos X="33" Y="34"/>
<TopLine Value="30"/>
<EditorIndex Value="17"/>
<UsageCount Value="28"/>
<UsageCount Value="30"/>
<Loaded Value="True"/>
</Unit107>
<Unit108>
@ -875,7 +875,7 @@
<IsPartOfProject Value="True"/>
<UnitName Value="ocr"/>
<CursorPos X="105" Y="105"/>
<TopLine Value="74"/>
<TopLine Value="252"/>
<EditorIndex Value="9"/>
<UsageCount Value="200"/>
<Loaded Value="True"/>
@ -1006,7 +1006,7 @@
<UnitName Value="web"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="185"/>
<UsageCount Value="188"/>
</Unit136>
<Unit137>
<Filename Value="../../../lazarus/lcl/lazhelphtml.pas"/>
@ -1205,7 +1205,7 @@
<UnitName Value="framescript"/>
<CursorPos X="106" Y="190"/>
<TopLine Value="180"/>
<UsageCount Value="178"/>
<UsageCount Value="181"/>
</Unit161>
<Unit162>
<Filename Value="framesynedit.lrs"/>
@ -1517,10 +1517,10 @@
<ComponentName Value="ColourHistoryForm"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="colourhistory"/>
<CursorPos X="72" Y="21"/>
<TopLine Value="13"/>
<CursorPos X="73" Y="197"/>
<TopLine Value="176"/>
<EditorIndex Value="6"/>
<UsageCount Value="115"/>
<UsageCount Value="118"/>
<Loaded Value="True"/>
</Unit208>
<Unit209>
@ -1771,7 +1771,7 @@
<UnitName Value="about"/>
<CursorPos X="44" Y="21"/>
<TopLine Value="4"/>
<UsageCount Value="78"/>
<UsageCount Value="81"/>
</Unit245>
<Unit246>
<Filename Value="../../Units/MMLAddon/PSInc/Wrappers/file.inc"/>
@ -1785,7 +1785,7 @@
<UnitName Value="internets"/>
<CursorPos X="87" Y="3"/>
<TopLine Value="1"/>
<UsageCount Value="72"/>
<UsageCount Value="75"/>
</Unit247>
<Unit248>
<Filename Value="debugimageform.pas"/>
@ -1794,7 +1794,7 @@
<UnitName Value="debugimageform"/>
<CursorPos X="20" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="59"/>
<UsageCount Value="62"/>
</Unit248>
<Unit249>
<Filename Value="debugimage.pas"/>
@ -1805,7 +1805,7 @@
<CursorPos X="87" Y="39"/>
<TopLine Value="20"/>
<EditorIndex Value="7"/>
<UsageCount Value="58"/>
<UsageCount Value="61"/>
<Loaded Value="True"/>
</Unit249>
<Unit250>
@ -1877,10 +1877,10 @@
<Unit260>
<Filename Value="../../Units/MMLCore/ocrutil.pas"/>
<UnitName Value="ocrutil"/>
<CursorPos X="60" Y="594"/>
<TopLine Value="573"/>
<CursorPos X="66" Y="17"/>
<TopLine Value="13"/>
<EditorIndex Value="10"/>
<UsageCount Value="16"/>
<UsageCount Value="18"/>
<Loaded Value="True"/>
</Unit260>
<Unit261>
@ -1909,130 +1909,130 @@
<CursorPos X="37" Y="3116"/>
<TopLine Value="3105"/>
<EditorIndex Value="3"/>
<UsageCount Value="11"/>
<UsageCount Value="13"/>
<Loaded Value="True"/>
</Unit264>
</Units>
<JumpHistory Count="30" HistoryIndex="29">
<Position1>
<Filename Value="../../Units/MMLCore/ocr.pas"/>
<Caret Line="99" Column="17" TopLine="90"/>
<Filename Value="../../Units/MMLCore/bitmaps.pas"/>
<Caret Line="65" Column="33" TopLine="45"/>
</Position1>
<Position2>
<Filename Value="../../Units/MMLCore/ocr.pas"/>
<Caret Line="110" Column="9" TopLine="90"/>
<Filename Value="../../Units/MMLCore/bitmaps.pas"/>
<Caret Line="27" Column="37" TopLine="1"/>
</Position2>
<Position3>
<Filename Value="../../Units/MMLCore/ocr.pas"/>
<Caret Line="97" Column="9" TopLine="91"/>
<Filename Value="../../Units/MMLCore/bitmaps.pas"/>
<Caret Line="65" Column="33" TopLine="45"/>
</Position3>
<Position4>
<Filename Value="../../Units/MMLCore/ocr.pas"/>
<Caret Line="111" Column="24" TopLine="91"/>
<Filename Value="../../Units/MMLCore/bitmaps.pas"/>
<Caret Line="66" Column="33" TopLine="45"/>
</Position4>
<Position5>
<Filename Value="../../Units/MMLCore/ocr.pas"/>
<Caret Line="130" Column="60" TopLine="103"/>
<Caret Line="137" Column="47" TopLine="110"/>
</Position5>
<Position6>
<Filename Value="../../Units/MMLCore/ocrutil.pas"/>
<Caret Line="61" Column="23" TopLine="49"/>
</Position6>
<Position7>
<Filename Value="../../Units/MMLCore/ocr.pas"/>
<Caret Line="177" Column="3" TopLine="158"/>
</Position7>
<Position8>
<Filename Value="../../Units/MMLCore/ocr.pas"/>
<Caret Line="241" Column="38" TopLine="218"/>
</Position8>
<Position9>
<Filename Value="../../Units/MMLCore/ocr.pas"/>
<Caret Line="229" Column="60" TopLine="146"/>
</Position9>
<Position10>
<Filename Value="../../Units/MMLCore/ocr.pas"/>
<Caret Line="241" Column="41" TopLine="161"/>
</Position10>
<Position11>
<Filename Value="../../Units/MMLCore/ocr.pas"/>
<Caret Line="200" Column="34" TopLine="178"/>
</Position11>
<Position12>
<Filename Value="../../Units/MMLCore/ocr.pas"/>
<Caret Line="263" Column="49" TopLine="242"/>
</Position12>
<Position13>
<Filename Value="../../Units/MMLCore/ocrutil.pas"/>
<Caret Line="598" Column="1" TopLine="573"/>
</Position13>
<Position14>
<Filename Value="../../Units/MMLCore/ocr.pas"/>
<Caret Line="301" Column="126" TopLine="278"/>
</Position14>
<Position15>
<Filename Value="../../Units/MMLCore/ocr.pas"/>
<Caret Line="270" Column="56" TopLine="242"/>
</Position15>
<Position16>
<Filename Value="../../Units/MMLAddon/windowselector.pas"/>
<Caret Line="97" Column="22" TopLine="73"/>
</Position16>
<Position17>
<Filename Value="../../Units/MMLAddon/windowselector.pas"/>
<Caret Line="99" Column="30" TopLine="73"/>
</Position17>
<Position18>
<Filename Value="../../Units/MMLAddon/windowselector.pas"/>
<Caret Line="117" Column="31" TopLine="97"/>
</Position18>
<Position19>
<Filename Value="../../Units/MMLAddon/windowselector.pas"/>
<Caret Line="102" Column="104" TopLine="85"/>
</Position19>
<Position20>
<Filename Value="../../Units/MMLAddon/windowselector.pas"/>
<Caret Line="101" Column="40" TopLine="87"/>
</Position20>
<Position21>
<Filename Value="../../Units/MMLCore/ocr.pas"/>
<Caret Line="339" Column="73" TopLine="314"/>
</Position21>
<Position22>
<Filename Value="../../Units/MMLCore/ocr.pas"/>
<Caret Line="83" Column="20" TopLine="74"/>
</Position22>
<Position23>
<Filename Value="../../Units/MMLCore/bitmaps.pas"/>
<Caret Line="65" Column="33" TopLine="45"/>
</Position23>
<Position24>
<Filename Value="../../Units/MMLCore/bitmaps.pas"/>
<Caret Line="27" Column="37" TopLine="1"/>
</Position24>
<Position25>
<Filename Value="../../Units/MMLCore/bitmaps.pas"/>
<Caret Line="65" Column="33" TopLine="45"/>
</Position25>
<Position26>
<Filename Value="../../Units/MMLCore/bitmaps.pas"/>
<Caret Line="66" Column="33" TopLine="45"/>
</Position26>
<Position27>
<Filename Value="../../Units/MMLCore/ocr.pas"/>
<Caret Line="137" Column="47" TopLine="110"/>
</Position27>
<Position28>
<Filename Value="../../Units/MMLCore/ocr.pas"/>
<Caret Line="81" Column="71" TopLine="62"/>
</Position28>
<Position29>
</Position6>
<Position7>
<Filename Value="../../Units/MMLCore/bitmaps.pas"/>
<Caret Line="65" Column="33" TopLine="41"/>
</Position29>
<Position30>
</Position7>
<Position8>
<Filename Value="../../Units/MMLCore/bitmaps.pas"/>
<Caret Line="66" Column="33" TopLine="41"/>
</Position8>
<Position9>
<Filename Value="../../Units/MMLCore/finder.pas"/>
<Caret Line="101" Column="5" TopLine="97"/>
</Position9>
<Position10>
<Filename Value="../../Units/MMLCore/finder.pas"/>
<Caret Line="30" Column="28" TopLine="25"/>
</Position10>
<Position11>
<Filename Value="testunit.pas"/>
<Caret Line="401" Column="43" TopLine="380"/>
</Position11>
<Position12>
<Filename Value="colourhistory.pas"/>
<Caret Line="1" Column="1" TopLine="1"/>
</Position12>
<Position13>
<Filename Value="colourhistory.pas"/>
<Caret Line="106" Column="29" TopLine="73"/>
</Position13>
<Position14>
<Filename Value="colourhistory.pas"/>
<Caret Line="105" Column="5" TopLine="85"/>
</Position14>
<Position15>
<Filename Value="colourhistory.pas"/>
<Caret Line="117" Column="13" TopLine="93"/>
</Position15>
<Position16>
<Filename Value="colourhistory.pas"/>
<Caret Line="39" Column="66" TopLine="169"/>
</Position16>
<Position17>
<Filename Value="colourhistory.pas"/>
<Caret Line="170" Column="19" TopLine="149"/>
</Position17>
<Position18>
<Filename Value="colourhistory.pas"/>
<Caret Line="176" Column="33" TopLine="150"/>
</Position18>
<Position19>
<Filename Value="colourhistory.pas"/>
<Caret Line="175" Column="27" TopLine="155"/>
</Position19>
<Position20>
<Filename Value="colourhistory.pas"/>
<Caret Line="194" Column="1" TopLine="177"/>
</Position20>
<Position21>
<Filename Value="colourhistory.pas"/>
<Caret Line="120" Column="77" TopLine="100"/>
</Position21>
<Position22>
<Filename Value="colourhistory.pas"/>
<Caret Line="35" Column="29" TopLine="23"/>
</Position22>
<Position23>
<Filename Value="colourhistory.pas"/>
<Caret Line="192" Column="8" TopLine="152"/>
</Position23>
<Position24>
<Filename Value="colourhistory.pas"/>
<Caret Line="117" Column="3" TopLine="101"/>
</Position24>
<Position25>
<Filename Value="colourhistory.pas"/>
<Caret Line="35" Column="50" TopLine="27"/>
</Position25>
<Position26>
<Filename Value="colourhistory.pas"/>
<Caret Line="47" Column="36" TopLine="27"/>
</Position26>
<Position27>
<Filename Value="colourhistory.pas"/>
<Caret Line="26" Column="13" TopLine="12"/>
</Position27>
<Position28>
<Filename Value="colourhistory.pas"/>
<Caret Line="107" Column="19" TopLine="83"/>
</Position28>
<Position29>
<Filename Value="colourhistory.pas"/>
<Caret Line="46" Column="10" TopLine="13"/>
</Position29>
<Position30>
<Filename Value="colourhistory.pas"/>
<Caret Line="177" Column="1" TopLine="158"/>
</Position30>
</JumpHistory>
</ProjectOptions>

View File

@ -98,8 +98,8 @@ type
implementation
uses
colour_conv,// For RGBToColor, etc.
Client, // For the Client Casts.
colour_conv, // For RGBToColor, etc.
math, //min/max
dtmutil
;