1
0
mirror of https://github.com/moparisthebest/Simba synced 2025-01-11 05:38:00 -05:00

Fixed a bug when selecting. Added Load/Save support with XML.

git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@299 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
Wizzup? 2009-12-20 17:16:52 +00:00
parent b13691bcb3
commit 782e0f5461
4 changed files with 1184 additions and 898 deletions

View File

@ -5,17 +5,19 @@ object ColourHistoryForm: TColourHistoryForm
Width = 490
ActiveControl = SelectionName
Caption = 'Colour Picker History'
ClientHeight = 250
ClientHeight = 225
ClientWidth = 490
Constraints.MinHeight = 200
Constraints.MinWidth = 490
Menu = CHMainMenu
OnCreate = FormCreate
OnHide = UnSetCHShowMenu
OnShow = SetCHShowMenu
LCLVersion = '0.9.29'
object DeleteButton: TButton
Left = 16
Height = 25
Top = 208
Top = 183
Width = 128
Anchors = [akLeft, akBottom]
Caption = 'Delete'
@ -36,7 +38,7 @@ object ColourHistoryForm: TColourHistoryForm
object PickNewColourButton: TButton
Left = 217
Height = 25
Top = 208
Top = 183
Width = 128
Anchors = [akRight, akBottom]
Caption = 'Pick New Colour'
@ -65,14 +67,14 @@ object ColourHistoryForm: TColourHistoryForm
object ColourImage: TImage
Left = 152
Height = 24
Top = 209
Top = 184
Width = 57
Anchors = [akLeft, akRight, akBottom]
end
object OkButton: TButton
Left = 393
Height = 24
Top = 209
Top = 184
Width = 80
Anchors = [akRight, akBottom]
Caption = 'Ok'
@ -91,7 +93,7 @@ object ColourHistoryForm: TColourHistoryForm
end
object ColourTree: TTreeView
Left = 8
Height = 169
Height = 144
Top = 16
Width = 337
Anchors = [akTop, akLeft, akRight, akBottom]
@ -101,11 +103,46 @@ object ColourHistoryForm: TColourHistoryForm
ScrollBars = ssAutoBoth
TabOrder = 5
OnChange = ColourTreeChange
OnDragDrop = ColourTreeDragDrop
OnDragOver = ColourTreeDragOver
OnEndDrag = ColourTreeEndDrag
end
object CHImages: TImageList
left = 424
top = 160
end
object CHMainMenu: TMainMenu
left = 360
top = 200
top = 160
object CHFile: TMenuItem
Caption = 'File'
object CHClear: TMenuItem
Caption = 'Clear'
end
object CHLoad: TMenuItem
Caption = 'Load'
OnClick = CHLoadClick
end
object CHSave: TMenuItem
Caption = 'Save'
OnClick = CHSaveClick
end
end
object CHHelp: TMenuItem
Caption = 'Help'
object CHAbout: TMenuItem
Caption = 'About'
OnClick = CHAboutClick
end
end
end
object CHSaveDialog: TSaveDialog
DefaultExt = '.xml'
left = 392
top = 160
end
object CHOpenDialog: TOpenDialog
DefaultExt = '.xml'
left = 456
top = 160
end
end

View File

@ -3,34 +3,43 @@
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'
+'Caption'#6#21'Colour Picker History'#12'ClientHeight'#3#225#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#8'DragMode'#7#11'dmAuto'
+'matic'#6'Images'#7#8'CHImages'#10'ScrollBars'#7#10'ssAutoBoth'#8'TabOrder'#2
+#5#8'OnChange'#7#16'ColourTreeChange'#10'OnDragOver'#7#18'ColourTreeDragOver'
+#9'OnEndDrag'#7#17'ColourTreeEndDrag'#0#0#10'TImageList'#8'CHImages'#4'left'
+#3'h'#1#3'top'#3#200#0#0#0#0
+#1#4'Menu'#7#10'CHMainMenu'#8'OnCreate'#7#10'FormCreate'#6'OnHide'#7#15'UnSe'
+'tCHShowMenu'#6'OnShow'#7#13'SetCHShowMenu'#10'LCLVersion'#6#6'0.9.29'#0#7'T'
+'Button'#12'DeleteButton'#4'Left'#2#16#6'Height'#2#25#3'Top'#3#183#0#5'Width'
+#3#128#0#7'Anchors'#11#6'akLeft'#8'akBottom'#0#7'Caption'#6#6'Delete'#7'OnCl'
+'ick'#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'OnKeyPress'#7#21'SelectionName'
+'KeyPress'#8'TabOrder'#2#1#4'Text'#6#4'Name'#0#0#7'TButton'#19'PickNewColour'
+'Button'#4'Left'#3#217#0#6'Height'#2#25#3'Top'#3#183#0#5'Width'#3#128#0#7'An'
+'chors'#11#7'akRight'#8'akBottom'#0#7'Caption'#6#15'Pick New Colour'#8'TabOr'
+'der'#2#2#0#0#5'TEdit'#11'ColourValue'#4'Left'#3'i'#1#6'Height'#2#27#3'Top'#2
+'8'#5'Width'#2'p'#7'Anchors'#11#5'akTop'#7'akRight'#0#8'ReadOnly'#9#8'TabOrd'
+'er'#2#3#4'Text'#6#11'ColourValue'#0#0#6'TLabel'#10'CoordValue'#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.MinWidth'#2'p'#11'ParentColor'
+#8#0#0#6'TImage'#11'ColourImage'#4'Left'#3#152#0#6'Height'#2#24#3'Top'#3#184
+#0#5'Width'#2'9'#7'Anchors'#11#6'akLeft'#7'akRight'#8'akBottom'#0#0#0#7'TBut'
+'ton'#8'OkButton'#4'Left'#3#137#1#6'Height'#2#24#3'Top'#3#184#0#5'Width'#2'P'
+#7'Anchors'#11#7'akRight'#8'akBottom'#0#7'Caption'#6#2'Ok'#7'OnClick'#7#13'O'
+'kButtonClick'#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'Anchors'#11#5'akTop'#7'akRigh'
+'t'#0#7'Caption'#6#9'RGBValues'#20'Constraints.MinWidth'#2'p'#11'ParentColor'
+#8#0#0#9'TTreeView'#10'ColourTree'#4'Left'#2#8#6'Height'#3#144#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#8'DragMode'#7#11'dmAutomatic'#6'Images'#7#8'CHImage'
+'s'#10'ScrollBars'#7#10'ssAutoBoth'#8'TabOrder'#2#5#8'OnChange'#7#16'ColourT'
+'reeChange'#10'OnDragDrop'#7#18'ColourTreeDragDrop'#10'OnDragOver'#7#18'Colo'
+'urTreeDragOver'#0#0#10'TImageList'#8'CHImages'#4'left'#3#168#1#3'top'#3#160
+#0#0#0#9'TMainMenu'#10'CHMainMenu'#4'left'#3'h'#1#3'top'#3#160#0#0#9'TMenuIt'
+'em'#6'CHFile'#7'Caption'#6#4'File'#0#9'TMenuItem'#7'CHClear'#7'Caption'#6#5
+'Clear'#0#0#9'TMenuItem'#6'CHLoad'#7'Caption'#6#4'Load'#7'OnClick'#7#11'CHLo'
+'adClick'#0#0#9'TMenuItem'#6'CHSave'#7'Caption'#6#4'Save'#7'OnClick'#7#11'CH'
+'SaveClick'#0#0#0#9'TMenuItem'#6'CHHelp'#7'Caption'#6#4'Help'#0#9'TMenuItem'
+#7'CHAbout'#7'Caption'#6#5'About'#7'OnClick'#7#12'CHAboutClick'#0#0#0#0#11'T'
+'SaveDialog'#12'CHSaveDialog'#10'DefaultExt'#6#4'.xml'#4'left'#3#136#1#3'top'
+#3#160#0#0#0#11'TOpenDialog'#12'CHOpenDialog'#10'DefaultExt'#6#4'.xml'#4'lef'
+'t'#3#200#1#3'top'#3#160#0#0#0#0
]);

View File

@ -1,4 +1,26 @@
unit colourhistory;
{
This file is part of the Mufasa Macro Library (MML)
Copyright (c) 2009 by Raymond van Venetië and Merlijn Wajer
MML is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
MML is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with MML. If not, see <http://www.gnu.org/licenses/>.
See the file COPYING, included in this distribution,
for details about the copyright.
Coliur History window for Mufasa Macro Library
}
unit colourhistory;
{$mode objfpc}{$H+}
@ -6,7 +28,7 @@ interface
uses
Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
ComCtrls, StdCtrls, ExtCtrls;
ComCtrls, StdCtrls, ExtCtrls, Menus, DOM, XMLWrite, XMLRead;
type
TColourPickerObject = class(TObject)
@ -24,32 +46,49 @@ type
TColourHistoryForm = class(TForm)
CH_RGB_Label: TLabel;
CHImages: TImageList;
CHMainMenu: TMainMenu;
CHFile: TMenuItem;
CHHelp: TMenuItem;
CHClear: TMenuItem;
CHLoad: TMenuItem;
CHSave: TMenuItem;
CHAbout: TMenuItem;
OkButton: TButton;
ColourValue: TEdit;
CoordValue: TLabel;
ColourImage: TImage;
CHOpenDialog: TOpenDialog;
PickNewColourButton: TButton;
DeleteButton: TButton;
CHSaveDialog: TSaveDialog;
SelectionName: TEdit;
ColourTree: TTreeView;
procedure CHAboutClick(Sender: TObject);
procedure ChangeName(Sender: TObject);
procedure CHLoadClick(Sender: TObject);
procedure ColourTreeChange(Sender: TObject; Node: TTreeNode);
procedure ColourTreeDragDrop(Sender, Source: TObject; X, Y: Integer);
procedure ColourTreeDragOver(Sender, Source: TObject; X, Y: Integer;
State: TDragState; var Accept: Boolean);
procedure ColourTreeEndDrag(Sender, Target: TObject; X, Y: Integer);
procedure DeleteSelected(Sender: TObject);
procedure AddColObj(c: TColourPickerObject; autoName: Boolean);
constructor Create(TheOwner: TComponent); override;
destructor Destroy; override;
procedure CHSaveClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure OkButtonClick(Sender: TObject);
procedure SelectionNameKeyPress(Sender: TObject; var Key: char);
procedure SetCHShowMenu(Sender: TObject);
procedure UnSetCHShowMenu(Sender: TObject);
private
TreeChanged: Boolean;
{ private declarations }
protected
procedure AddColObj(c: TColourPickerObject);
procedure SetNodeBitmap(N: TTreeNode);
procedure SaveToXML(s: String);
procedure XML2Tree(XMLDoc: TXMLDocument);
public
IndexSelected: Integer;
{ public declarations }
@ -62,7 +101,7 @@ var
implementation
uses
colour_conv, TestUnit;
colour_conv, TestUnit, lclintf, lcltype;
constructor TColourPickerObject.Create(C: Integer; P: TPoint; N: String);
begin
@ -90,25 +129,32 @@ begin
Self.AddColObj(c);
end;
procedure TColourHistoryForm.SetNodeBitmap(N: TTreeNode);
var
bmp: TBitmap;
begin
bmp:=TBitmap.Create;
bmp.SetSize(16,16);
bmp.Canvas.Brush.Color:=TColourPickerObject(n.Data).Colour;
bmp.Canvas.Rectangle(0,0,16,16);
n.ImageIndex:=CHImages.Add(bmp, nil);
n.SelectedIndex:=n.ImageIndex;
bmp.Free;
end;
procedure TColourHistoryForm.AddColObj(c: TColourPickerObject);
var
it: TTreeNode;
bmp: TBitmap;
begin
TreeChanged:=True;
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);
it.SelectedIndex:=it.ImageIndex;
bmp.Free;
SetNodeBitmap(it);
end;
procedure TColourHistoryForm.DeleteSelected(Sender: TObject);
@ -130,6 +176,88 @@ begin
end;
end;
procedure WriteXMLData(n: TTreeNode;
XMLNode: TDOMNode; XMLDoc: TXMLDocument;
var XMLChild: TDOMNode; var C: Integer);
var
DDataNode, DataNode, Data: TDOMNode;
begin
XMLChild := XMLDoc.CreateElement('Item' + IntToStr(C));
Inc(C);
XMLNode.AppendChild(XMLChild);
DDataNode := XMLDoc.CreateElement('Data');
XMLChild.AppendChild(DDataNode);
DataNode := XMLDoc.CreateElement('Name');
DDataNode.AppendChild(DataNode);
Data := XMLDoc.CreateTextNode(TColourPickerObject(n.Data).Name);
DataNode.AppendChild(Data);
DataNode := XMLDoc.CreateElement('Colour');
DDataNode.AppendChild(DataNode);
Data := XMLDoc.CreateTextNode(IntToStr(TColourPickerObject(n.Data).Colour));
DataNode.AppendChild(Data);
DataNode := XMLDoc.CreateElement('CoordX');
DDataNode.AppendChild(DataNode);
Data := XMLDoc.CreateTextNode(IntToStr(TColourPickerObject(n.Data).Pos.X));
DataNode.AppendChild(Data);
DataNode := XMLDoc.CreateElement('CoordY');
DDataNode.AppendChild(DataNode);
Data := XMLDoc.CreateTextNode(IntToStr(TColourPickerObject(n.Data).Pos.Y));
DataNode.AppendChild(Data);
end;
procedure WalkTree(Node: TTreeNode; XMLNode: TDOMNode; XMLDoc: TXMLDocument;
var C: Integer);
var
N: TTreeNode;
XMLChild, DDataNode, DataNode, Data: TDOMNode;
begin
N := Node.GetFirstChild;
while assigned(n) do
begin
WriteXMLData(n, XMLNode, XMLDoc, XMLChild, C);
writeln('Walking: ' + n.text);
WalkTree(n, XMLChild, XMLDoc, C);
n := n.GetNextSibling;
end;
end;
procedure TColourHistoryForm.SaveToXML(s: String);
var
XMLDoc: TXMLDocument;
RootNode, XMLChild: TDOMNode;
C, i: Integer;
begin
XMLDoc := TXMLDocument.Create;
RootNode := XMLDoc.CreateElement('Tree');
XMLDoc.AppendChild(RootNode);
RootNode := XMLDoc.DocumentElement;
C := 0;
writeln(Colourtree.Items.TopLvlCount);
for i := 0 to Colourtree.Items.TopLvlCount -1 do
begin
WriteXMLData(ColourTree.Items.TopLvlItems[i], RootNode, XMLDoc, XMLChild, C);
WalkTree(ColourTree.Items.TopLvlItems[i], XMLChild, XMLDoc, C);
end;
WriteXMLFile(XMLDoc, s);
XMLDoc.Free;
end;
procedure TColourHistoryForm.ColourTreeChange(Sender: TObject; Node: TTreeNode);
var
r,g,b:integer;
@ -166,37 +294,38 @@ begin
end;
end;
procedure TColourHistoryForm.ColourTreeDragOver(Sender, Source: TObject; X,
Y: Integer; State: TDragState; var Accept: Boolean);
begin
Accept:=True;
end;
procedure TColourHistoryForm.ColourTreeEndDrag(Sender, Target: TObject; X,
procedure TColourHistoryForm.ColourTreeDragDrop(Sender, Source: TObject; X,
Y: Integer);
Var
Node: TTreeNode;
begin
if Sender <> ColourTree then
Exit;
Node := ColourTree.GetNodeAt(X, Y);
if not assigned(ColourTree.Selected) then
begin
writeln('No valid node is currently selected');
exit;
end;
if not assigned(Node) then
begin
ColourTree.Selected.MoveTo(nil, naAdd);
exit;
end;
ColourTree.Selected.MoveTo(Node, naAddChild);
writeln('Dragging from: ' + ColourTree.Selected.Text);
writeln('Dragging to: ' + Node.Text);
end;
procedure TColourHistoryForm.ColourTreeDragOver(Sender, Source: TObject; X,
Y: Integer; State: TDragState; var Accept: Boolean);
begin
Accept:=True;
end;
procedure TColourHistoryForm.ChangeName(Sender: TObject);
begin
if not Assigned(ColourTree.Selected) then
@ -208,6 +337,131 @@ begin
TColourPickerObject(ColourTree.Selected.Data).Name := SelectionName.Text;
end;
//heavily modded from http://wiki.lazarus.freepascal.org/XML_Tutorial
procedure TColourHistoryForm.XML2Tree(XMLDoc: TXMLDocument);
var
iNode: TDOMNode;
procedure ProcessNode(Node: TDOMNode; TreeNode: TTreeNode);
var
cNode, dNode: TDOMNode;
OP: TColourPickerObject;
pos: TPoint;
Colour: Integer;
Name: String;
begin
if Node = nil then Exit;
If Node.NodeName = 'Data' Then
exit;
TreeNode := ColourTree.Items.AddChild(TreeNode, 'ERROR');
writeln(Node.NodeName);
cNode := Node.FindNode('Data');
if Assigned(cNode) then
begin
dNode := cNode.FindNode('Name');
if assigned(dNode) then
Name := dNode.TextContent
else
Name := 'Error';
dNode := cNode.FindNode('Colour');
if assigned(dNode) then
Colour := StrToIntDef(dNode.TextContent, -1);
dNode := cNode.FindNode('CoordX');
if assigned(dNode) then
Pos.X := StrToIntDef(dNode.TextContent, -1);
dNode := cNode.FindNode('CoordY');
if assigned(dNode) then
Pos.Y := StrToIntDef(dNode.TextContent, -1);
OP := TColourPickerObject.Create(Colour, Pos, Name);
TreeNode.Text := Name;
TreeNode.Data := Pointer(OP);
SetNodeBitmap(TreeNode);
end;
// Goes to the child node
cNode := Node.FirstChild;
// Processes all child nodes
while cNode <> nil do
begin
ProcessNode(cNode, TreeNode);
cNode := cNode.NextSibling;
end;
end;
begin
iNode := XMLDoc.DocumentElement.FirstChild;
while iNode <> nil do
begin
ProcessNode(iNode, nil); // Recursive
iNode := iNode.NextSibling;
end;
end;
procedure TColourHistoryForm.CHLoadClick(Sender: TObject);
var
XMLDoc: TXMLDocument;
begin
if TreeChanged then
begin
case MessageBox(0,pchar('Do you want to save the colors?'), Pchar('Colours have been modified.'),
MB_YESNOCANCEL or MB_ICONQUESTION) of
IDCANCEL :
Exit;
IDYES :
begin
if CHSaveDialog.Execute then
begin
writeln('Saving to file: ' +CHSaveDialog.FileName);
ColourTree.SaveToFile(CHSaveDialog.FileName);
end else
Exit;
end;
end;
end;
if CHOpenDialog.Execute then
if FileExists(CHOpenDialog.FileName) then
begin
writeln('Loading from file: ' + CHOpenDialog.FileName);
ReadXMLFile(XMLDoc, CHOpenDialog.FileName);
end;
// Clear Tree and Images
ColourTree.BeginUpdate;
ColourTree.Items.Clear;
CHImages.Clear;
XML2Tree(XMLDoc);
ColourTree.EndUpdate;
XMLDoc.Free;
end;
procedure TColourHistoryForm.CHAboutClick(Sender: TObject);
begin
end;
constructor TColourHistoryForm.Create(TheOwner: TComponent);
begin
inherited Create(TheOwner);
@ -222,6 +476,25 @@ begin
inherited Destroy;
end;
procedure TColourHistoryForm.CHSaveClick(Sender: TObject);
begin
if CHSaveDialog.Execute then
if FileExists(CHSaveDialog.FileName) then
begin
writeln('Saving to file: ' +CHSaveDialog.FileName);
SaveToXML(CHSaveDialog.FileName);
//ColourTree.SaveToFile(CHSaveDialog.FileName);
TreeChanged:=False;
end else
writeln('no saving to file');
end;
procedure TColourHistoryForm.FormCreate(Sender: TObject);
begin
TreeChanged:=False;
end;
procedure TColourHistoryForm.OkButtonClick(Sender: TObject);
begin
Self.Close;

File diff suppressed because it is too large Load Diff