1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-12-23 15:58:51 -05:00

Some fixes + added Clear.

git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@300 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
Wizzup? 2009-12-20 17:27:46 +00:00
parent 782e0f5461
commit a33f1e3f18
4 changed files with 65 additions and 71 deletions

View File

@ -117,6 +117,7 @@ object ColourHistoryForm: TColourHistoryForm
Caption = 'File'
object CHClear: TMenuItem
Caption = 'Clear'
OnClick = CHClearClick
end
object CHLoad: TMenuItem
Caption = 'Load'

View File

@ -35,11 +35,11 @@ LazarusResources.Add('TColourHistoryForm','FORMDATA',[
+'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
+'Clear'#7'OnClick'#7#12'CHClearClick'#0#0#9'TMenuItem'#6'CHLoad'#7'Caption'#6
+#4'Load'#7'OnClick'#7#11'CHLoadClick'#0#0#9'TMenuItem'#6'CHSave'#7'Caption'#6
+#4'Save'#7'OnClick'#7#11'CHSaveClick'#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'C'
+'HAboutClick'#0#0#0#0#11'TSaveDialog'#12'CHSaveDialog'#10'DefaultExt'#6#4'.x'
+'ml'#4'left'#3#136#1#3'top'#3#160#0#0#0#11'TOpenDialog'#12'CHOpenDialog'#10
+'DefaultExt'#6#4'.xml'#4'left'#3#200#1#3'top'#3#160#0#0#0#0
]);

View File

@ -65,6 +65,7 @@ type
ColourTree: TTreeView;
procedure CHAboutClick(Sender: TObject);
procedure ChangeName(Sender: TObject);
procedure CHClearClick(Sender: TObject);
procedure CHLoadClick(Sender: TObject);
procedure ColourTreeChange(Sender: TObject; Node: TTreeNode);
procedure ColourTreeDragDrop(Sender, Source: TObject; X, Y: Integer);
@ -224,7 +225,6 @@ begin
begin
WriteXMLData(n, XMLNode, XMLDoc, XMLChild, C);
writeln('Walking: ' + n.text);
WalkTree(n, XMLChild, XMLDoc, C);
n := n.GetNextSibling;
end;
@ -337,6 +337,15 @@ begin
TColourPickerObject(ColourTree.Selected.Data).Name := SelectionName.Text;
end;
procedure TColourHistoryForm.CHClearClick(Sender: TObject);
begin
TreeChanged:=False;
ColourTree.BeginUpdate;
ColourTree.Items.Clear;
CHImages.Clear;
ColourTree.EndUpdate;
end;
//heavily modded from http://wiki.lazarus.freepascal.org/XML_Tutorial
procedure TColourHistoryForm.XML2Tree(XMLDoc: TXMLDocument);
var
@ -421,10 +430,8 @@ begin
IDYES :
begin
if CHSaveDialog.Execute then
begin
writeln('Saving to file: ' +CHSaveDialog.FileName);
ColourTree.SaveToFile(CHSaveDialog.FileName);
end else
ColourTree.SaveToFile(CHSaveDialog.FileName)
else
Exit;
end;
end;
@ -435,26 +442,16 @@ begin
begin
writeln('Loading from file: ' + CHOpenDialog.FileName);
ReadXMLFile(XMLDoc, CHOpenDialog.FileName);
// Clear Tree and Images
ColourTree.BeginUpdate;
ColourTree.Items.Clear;
CHImages.Clear;
XML2Tree(XMLDoc);
ColourTree.EndUpdate;
XMLDoc.Free;
end;
// Clear Tree and Images
ColourTree.BeginUpdate;
ColourTree.Items.Clear;
CHImages.Clear;
XML2Tree(XMLDoc);
ColourTree.EndUpdate;
XMLDoc.Free;
end;
procedure TColourHistoryForm.CHAboutClick(Sender: TObject);
@ -480,14 +477,10 @@ 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');
begin
SaveToXML(CHSaveDialog.FileName);
TreeChanged:=False;
end;
end;
procedure TColourHistoryForm.FormCreate(Sender: TObject);

View File

@ -1451,8 +1451,8 @@
<ComponentName Value="ColourHistoryForm"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="colourhistory"/>
<CursorPos X="79" Y="346"/>
<TopLine Value="332"/>
<CursorPos X="52" Y="242"/>
<TopLine Value="218"/>
<EditorIndex Value="6"/>
<UsageCount Value="134"/>
<Loaded Value="True"/>
@ -1883,123 +1883,123 @@
<JumpHistory Count="30" HistoryIndex="29">
<Position1>
<Filename Value="colourhistory.pas"/>
<Caret Line="182" Column="76" TopLine="143"/>
<Caret Line="216" Column="39" TopLine="186"/>
</Position1>
<Position2>
<Filename Value="colourhistory.pas"/>
<Caret Line="216" Column="39" TopLine="186"/>
<Caret Line="212" Column="23" TopLine="189"/>
</Position2>
<Position3>
<Filename Value="colourhistory.pas"/>
<Caret Line="212" Column="23" TopLine="189"/>
<Caret Line="217" Column="32" TopLine="193"/>
</Position3>
<Position4>
<Filename Value="colourhistory.pas"/>
<Caret Line="217" Column="32" TopLine="193"/>
<Caret Line="199" Column="21" TopLine="193"/>
</Position4>
<Position5>
<Filename Value="colourhistory.pas"/>
<Caret Line="199" Column="21" TopLine="193"/>
<Caret Line="192" Column="28" TopLine="157"/>
</Position5>
<Position6>
<Filename Value="colourhistory.pas"/>
<Caret Line="152" Column="6" TopLine="157"/>
<Caret Line="155" Column="4" TopLine="139"/>
</Position6>
<Position7>
<Filename Value="colourhistory.pas"/>
<Caret Line="192" Column="28" TopLine="157"/>
<Caret Line="150" Column="25" TopLine="148"/>
</Position7>
<Position8>
<Filename Value="colourhistory.pas"/>
<Caret Line="155" Column="4" TopLine="139"/>
<Caret Line="196" Column="34" TopLine="176"/>
</Position8>
<Position9>
<Filename Value="colourhistory.pas"/>
<Caret Line="150" Column="25" TopLine="148"/>
<Caret Line="334" Column="23" TopLine="297"/>
</Position9>
<Position10>
<Filename Value="colourhistory.pas"/>
<Caret Line="196" Column="34" TopLine="176"/>
<Caret Line="362" Column="15" TopLine="325"/>
</Position10>
<Position11>
<Filename Value="colourhistory.pas"/>
<Caret Line="334" Column="23" TopLine="297"/>
<Caret Line="381" Column="5" TopLine="356"/>
</Position11>
<Position12>
<Filename Value="colourhistory.pas"/>
<Caret Line="362" Column="15" TopLine="325"/>
<Caret Line="376" Column="64" TopLine="356"/>
</Position12>
<Position13>
<Filename Value="colourhistory.pas"/>
<Caret Line="381" Column="5" TopLine="356"/>
<Caret Line="410" Column="48" TopLine="387"/>
</Position13>
<Position14>
<Filename Value="colourhistory.pas"/>
<Caret Line="376" Column="64" TopLine="356"/>
<Caret Line="87" Column="26" TopLine="58"/>
</Position14>
<Position15>
<Filename Value="colourhistory.pas"/>
<Caret Line="410" Column="48" TopLine="387"/>
<Caret Line="366" Column="8" TopLine="350"/>
</Position15>
<Position16>
<Filename Value="colourhistory.pas"/>
<Caret Line="87" Column="26" TopLine="58"/>
<Caret Line="365" Column="79" TopLine="344"/>
</Position16>
<Position17>
<Filename Value="colourhistory.pas"/>
<Caret Line="366" Column="8" TopLine="350"/>
<Caret Line="371" Column="21" TopLine="355"/>
</Position17>
<Position18>
<Filename Value="colourhistory.pas"/>
<Caret Line="365" Column="79" TopLine="344"/>
<Caret Line="376" Column="64" TopLine="356"/>
</Position18>
<Position19>
<Filename Value="colourhistory.pas"/>
<Caret Line="371" Column="21" TopLine="355"/>
<Caret Line="393" Column="36" TopLine="356"/>
</Position19>
<Position20>
<Filename Value="colourhistory.pas"/>
<Caret Line="376" Column="64" TopLine="356"/>
<Caret Line="389" Column="29" TopLine="361"/>
</Position20>
<Position21>
<Filename Value="colourhistory.pas"/>
<Caret Line="393" Column="36" TopLine="356"/>
<Caret Line="399" Column="39" TopLine="371"/>
</Position21>
<Position22>
<Filename Value="colourhistory.pas"/>
<Caret Line="389" Column="29" TopLine="361"/>
<Caret Line="395" Column="31" TopLine="375"/>
</Position22>
<Position23>
<Filename Value="colourhistory.pas"/>
<Caret Line="399" Column="39" TopLine="371"/>
<Caret Line="342" Column="79" TopLine="330"/>
</Position23>
<Position24>
<Filename Value="colourhistory.pas"/>
<Caret Line="395" Column="31" TopLine="375"/>
<Caret Line="391" Column="29" TopLine="361"/>
</Position24>
<Position25>
<Filename Value="colourhistory.pas"/>
<Caret Line="342" Column="79" TopLine="330"/>
<Caret Line="91" Column="15" TopLine="56"/>
</Position25>
<Position26>
<Filename Value="colourhistory.pas"/>
<Caret Line="391" Column="29" TopLine="361"/>
<Caret Line="31" Column="65" TopLine="23"/>
</Position26>
<Position27>
<Filename Value="colourhistory.pas"/>
<Caret Line="91" Column="15" TopLine="56"/>
<Caret Line="393" Column="72" TopLine="383"/>
</Position27>
<Position28>
<Filename Value="colourhistory.pas"/>
<Caret Line="31" Column="65" TopLine="23"/>
<Caret Line="364" Column="17" TopLine="332"/>
</Position28>
<Position29>
<Filename Value="colourhistory.pas"/>
<Caret Line="393" Column="72" TopLine="383"/>
<Caret Line="227" Column="1" TopLine="200"/>
</Position29>
<Position30>
<Filename Value="colourhistory.pas"/>
<Caret Line="364" Column="17" TopLine="332"/>
<Caret Line="79" Column="26" TopLine="52"/>
</Position30>
</JumpHistory>
</ProjectOptions>