1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-25 10:42:20 -05:00

Patch from ss23 + some other small changes.

git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@578 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
Raymond 2010-03-06 12:06:19 +00:00
parent 8f449fd456
commit 641ec96b28
6 changed files with 821 additions and 820 deletions

View File

@ -1,7 +1,7 @@
object Form1: TForm1 object Form1: TForm1
Left = 433 Left = 331
Height = 555 Height = 555
Top = 224 Top = 150
Width = 739 Width = 739
ActiveControl = ScriptPanel ActiveControl = ScriptPanel
AllowDropFiles = True AllowDropFiles = True
@ -1245,13 +1245,9 @@ object Form1: TForm1
Caption = 'View &Function List' Caption = 'View &Function List'
OnClick = MenuItemFunctionListClick OnClick = MenuItemFunctionListClick
end end
object MenuViewSettings: TMenuItem
Caption = 'View Settings'
OnClick = MenuViewSettingsClick
end end
end object MenuTools: TMenuItem
object MenuExtra: TMenuItem Caption = '&Tools'
Caption = 'E&xtra'
object MenuitemFillFunctionList: TMenuItem object MenuitemFillFunctionList: TMenuItem
Caption = '&Fill Function List' Caption = '&Fill Function List'
Bitmap.Data = { Bitmap.Data = {
@ -1336,6 +1332,13 @@ object Form1: TForm1
object MenuItemDivider9: TMenuItem object MenuItemDivider9: TMenuItem
Caption = '-' Caption = '-'
end end
object MenuItemSettingsButton: TMenuItem
Caption = 'Settings'
OnClick = MenuItemSettingsButtonClick
end
object MenuItemDivider10: TMenuItem
Caption = '-'
end
object MenuItemExportHTML: TMenuItem object MenuItemExportHTML: TMenuItem
Caption = '&Export script as HTML' Caption = '&Export script as HTML'
Bitmap.Data = { Bitmap.Data = {

File diff suppressed because it is too large Load Diff

View File

@ -35,7 +35,7 @@ uses
//Client, //Client,
MufasaTypes, MufasaTypes,
mmlpsthread,synedittypes, mmlpsthread,synedittypes,
{$IFDEF MSWINDOWS} os_windows, {$ENDIF} //For ColorPicker etc. {$IFDEF MSWINDOWS} os_windows, windows,{$ENDIF} //For ColorPicker etc.
{$IFDEF LINUX} os_linux, {$ENDIF} //For ColorPicker etc. {$IFDEF LINUX} os_linux, {$ENDIF} //For ColorPicker etc.
colourpicker, framescript, windowselector, lcltype, ActnList, colourpicker, framescript, windowselector, lcltype, ActnList,
SynExportHTML, SynEditKeyCmds, SynEditHighlighter, SynExportHTML, SynEditKeyCmds, SynEditHighlighter,
@ -44,7 +44,7 @@ uses
about, framefunctionlist, ocr, updateform, simbasettings; about, framefunctionlist, ocr, updateform, simbasettings;
const const
SimbaVersion = 576; SimbaVersion = 578;
type type
@ -100,13 +100,14 @@ type
MenuFile: TMenuItem; MenuFile: TMenuItem;
MenuEdit: TMenuItem; MenuEdit: TMenuItem;
MenuHelp: TMenuItem; MenuHelp: TMenuItem;
MenuExtra: TMenuItem; MenuItemSettingsButton: TMenuItem;
MenuItemDivider10: TMenuItem;
MenuTools: TMenuItem;
MenuItemOpenRecent: TMenuItem; MenuItemOpenRecent: TMenuItem;
MenuItemCompile: TMenuItem; MenuItemCompile: TMenuItem;
MenuItemHandbook: TMenuItem; MenuItemHandbook: TMenuItem;
MenuItemAbout: TMenuItem; MenuItemAbout: TMenuItem;
MenuItemReportBug: TMenuItem; MenuItemReportBug: TMenuItem;
MenuViewSettings: TMenuItem;
MenuItemExportHTML: TMenuItem; MenuItemExportHTML: TMenuItem;
MenuItemDivider9: TMenuItem; MenuItemDivider9: TMenuItem;
MouseTimer: TTimer; MouseTimer: TTimer;
@ -269,11 +270,11 @@ type
procedure MenuitemFillFunctionListClick(Sender: TObject); procedure MenuitemFillFunctionListClick(Sender: TObject);
procedure MenuItemHideClick(Sender: TObject); procedure MenuItemHideClick(Sender: TObject);
procedure MenuItemReportBugClick(Sender: TObject); procedure MenuItemReportBugClick(Sender: TObject);
procedure MenuItemSettingsButtonClick(Sender: TObject);
procedure MenuItemShowClick(Sender: TObject); procedure MenuItemShowClick(Sender: TObject);
procedure MenuItemTabCloseClick(Sender: TObject); procedure MenuItemTabCloseClick(Sender: TObject);
procedure MenuItemTabCloseOthersClick(Sender: TObject); procedure MenuItemTabCloseOthersClick(Sender: TObject);
procedure MenuItemFunctionListClick(Sender: TObject); procedure MenuItemFunctionListClick(Sender: TObject);
procedure MenuViewSettingsClick(Sender: TObject);
procedure NewsTimerTimer(Sender: TObject); procedure NewsTimerTimer(Sender: TObject);
procedure OnLinePSScript(Sender: TObject); procedure OnLinePSScript(Sender: TObject);
procedure ButtonPickClick(Sender: TObject); procedure ButtonPickClick(Sender: TObject);
@ -453,11 +454,11 @@ begin
Accept := frmFunctionList.DragKind = dkDock; Accept := frmFunctionList.DragKind = dkDock;
if(Accept)then if(Accept)then
begin begin
P := ScriptPanel.ClientToScreen(Point(0, 0)); P := ScriptPanel.ClientToScreen(Classes.Point(0, 0));
if(X <= (ScriptPanel.Width div 2))then if(X <= (ScriptPanel.Width div 2))then
Source.DockRect := Rect(P.x, P.y, min(P.x + frmFunctionList.Width, P.x + (ScriptPanel.Width div 2)), P.y + ScriptPanel.Height) Source.DockRect := Classes.Rect(P.x, P.y, min(P.x + frmFunctionList.Width, P.x + (ScriptPanel.Width div 2)), P.y + ScriptPanel.Height)
else else
Source.DockRect := Rect(max(P.x + ScriptPanel.Width - frmFunctionList.Width, P.x + (ScriptPanel.Width div 2)), P.y, P.x + ScriptPanel.Width, P.y + ScriptPanel.Height); Source.DockRect := Classes.Rect(max(P.x + ScriptPanel.Width - frmFunctionList.Width, P.x + (ScriptPanel.Width div 2)), P.y, P.x + ScriptPanel.Width, P.y + ScriptPanel.Height);
end; end;
end; end;
@ -770,7 +771,7 @@ begin
Res := CurrScript.SynEdit.SearchReplaceEx(SearchString,'',SearchOptions,CurrPos); Res := CurrScript.SynEdit.SearchReplaceEx(SearchString,'',SearchOptions,CurrPos);
if res = 0 then if res = 0 then
begin begin
res := CurrScript.SynEdit.SearchReplaceEx(SearchString,'',SearchOptions,Point(0,0)); res := CurrScript.SynEdit.SearchReplaceEx(SearchString,'',SearchOptions,Classes.Point(0,0));
if res > 0 then if res > 0 then
begin; begin;
Writeln('End of document reached'); Writeln('End of document reached');
@ -866,6 +867,7 @@ begin
CreateSetting('Settings/ColourPicker/ShowHistoryOnPick', 'True'); CreateSetting('Settings/ColourPicker/ShowHistoryOnPick', 'True');
CreateSetting('Settings/General/MaxRecentFiles','10'); CreateSetting('Settings/General/MaxRecentFiles','10');
CreateSetting('Settings/MainForm/NormalSize','739:555'); CreateSetting('Settings/MainForm/NormalSize','739:555');
CreateSetting('Settings/FunctionList/ShowOnStart','True');
CreateSetting('Settings/Updater/RemoteVersion', CreateSetting('Settings/Updater/RemoteVersion',
{$IFDEF WINDOWS} {$IFDEF WINDOWS}
@ -915,7 +917,7 @@ end;
procedure TForm1.LoadFormSettings; procedure TForm1.LoadFormSettings;
var var
str : string; str,str2 : string;
Data : TStringArray; Data : TStringArray;
i : integer; i : integer;
begin begin
@ -944,6 +946,12 @@ begin
for i := high(data) downto 0 do//First = entry should be added as last for i := high(data) downto 0 do//First = entry should be added as last
AddRecentFile(data[i]); AddRecentFile(data[i]);
end; end;
str := LowerCase(LoadSettingDef('Settings/FunctionList/ShowOnStart','True'));
str2 := lowercase(LoadSettingDef('LastConfig/MainForm/FunctionListShown',''));
if (str = 'true') or (str2 = 'true') then
FunctionListShown(True)
else
FunctionListShown(false);
end; end;
procedure TForm1.SaveFormSettings; procedure TForm1.SaveFormSettings;
@ -968,6 +976,10 @@ begin
data[high(data) - i] := RecentFiles[i]; data[high(data) - i] := RecentFiles[i];
SetKeyValue('LastConfig/MainForm/RecentFiles',implode(';',data)); SetKeyValue('LastConfig/MainForm/RecentFiles',implode(';',data));
end; end;
if MenuItemFunctionList.Checked then
SetKeyValue('LastConfig/MainForm/FunctionListShown','True')
else
SetKeyValue('LastConfig/MainForm/FunctionListShown','False');
SaveToXML(SimbaSettingsFile); SaveToXML(SimbaSettingsFile);
end; end;
end; end;
@ -1355,7 +1367,7 @@ begin
begin; begin;
Writeln('This is currently not supported'); Writeln('This is currently not supported');
SynEdit.Lines[CompletionCaret.y - 1] := CompletionStart; SynEdit.Lines[CompletionCaret.y - 1] := CompletionStart;
SynEdit.LogicalCaretXY:= point(CompletionCaret.x,CompletionCaret.y); SynEdit.LogicalCaretXY:= Classes.point(CompletionCaret.x,CompletionCaret.y);
SynEdit.SelEnd:= SynEdit.SelStart; SynEdit.SelEnd:= SynEdit.SelStart;
end; end;
InCodeCompletion:= false; InCodeCompletion:= false;
@ -1403,7 +1415,7 @@ begin
key := #0; key := #0;
StopCodeCompletion; StopCodeCompletion;
CurrScript.SynEdit.Lines[frmFunctionList.CompletionCaret.y - 1] := frmFunctionList.CompletionStart; CurrScript.SynEdit.Lines[frmFunctionList.CompletionCaret.y - 1] := frmFunctionList.CompletionStart;
CurrScript.SynEdit.LogicalCaretXY:= point(frmFunctionList.CompletionCaret.x,frmFunctionList.CompletionCaret.y); CurrScript.SynEdit.LogicalCaretXY:= Classes.point(frmFunctionList.CompletionCaret.x,frmFunctionList.CompletionCaret.y);
CurrScript.SynEdit.SelEnd:= CurrScript.SynEdit.SelStart; CurrScript.SynEdit.SelEnd:= CurrScript.SynEdit.SelStart;
CurrScript.SynEdit.SetFocus; CurrScript.SynEdit.SetFocus;
end else end else
@ -1514,7 +1526,7 @@ begin
begin begin
Btns:= [mbYes, mbNo]; Btns:= [mbYes, mbNo];
if(frReplaceAll in dlgReplace.Options)then Btns+= [mbYesToAll]; if(frReplaceAll in dlgReplace.Options)then Btns+= [mbYesToAll];
if(frEntireScope in dlgReplace.Options)then P:= Point(0, 0) else P:= CaretXY; if(frEntireScope in dlgReplace.Options)then P:= Classes.Point(0, 0) else P:= CaretXY;
while SearchReplaceEx(dlgReplace.FindText, '', SOptions, P) > 0 do while SearchReplaceEx(dlgReplace.FindText, '', SOptions, P) > 0 do
begin begin
if(Y)then if(Y)then
@ -1573,7 +1585,6 @@ begin
PageControl1.OnCloseTabClicked:=ActionCloseTab.OnExecute; PageControl1.OnCloseTabClicked:=ActionCloseTab.OnExecute;
Tabs := TList.Create; Tabs := TList.Create;
AddTab;//Give it alteast 1 tab ;-). AddTab;//Give it alteast 1 tab ;-).
FunctionListShown(True); //Show this function list bitch!
Manager := TIOManager.Create; //No need to load plugins for the Global manager Manager := TIOManager.Create; //No need to load plugins for the Global manager
Picker := TMColorPicker.Create(Manager); Picker := TMColorPicker.Create(Manager);
Selector := TMWindowSelector.Create(Manager); Selector := TMWindowSelector.Create(Manager);
@ -1588,7 +1599,7 @@ begin
if FileExists(Application.ExeName+'_old_') then if FileExists(Application.ExeName+'_old_') then
begin begin
Writeln('We still have an out-dated exe file in the dir, lets remove!'); Writeln('We still have an out-dated exe file in the dir, lets remove!');
Writeln(format('Sucesfully deleted the file? %s',[BoolToStr(DeleteFile(Application.ExeName + '_old_'),true)])); Writeln(format('Sucesfully deleted the file? %s',[BoolToStr(DeleteFile(PChar(Application.ExeName + '_old_')),true)]));
end; end;
{$endif} {$endif}
frmFunctionList.OnEndDock:= @frmFunctionList.FrameEndDock; frmFunctionList.OnEndDock:= @frmFunctionList.FrameEndDock;
@ -1789,6 +1800,7 @@ begin
end; end;
Sections.free; Sections.free;
end; end;
if CurrScript <> nil then
frmFunctionList.LoadScriptTree(CurrScript.SynEdit.Text); frmFunctionList.LoadScriptTree(CurrScript.SynEdit.Text);
end; end;
@ -1805,6 +1817,11 @@ begin
OpenURL('http://mufasa.villavu.com/mantis/bug_report_page.php'); OpenURL('http://mufasa.villavu.com/mantis/bug_report_page.php');
end; end;
procedure TForm1.MenuItemSettingsButtonClick(Sender: TObject);
begin
SettingsForm.ShowModal;
end;
procedure TForm1.MenuItemShowClick(Sender: TObject); procedure TForm1.MenuItemShowClick(Sender: TObject);
begin begin
Self.Show; Self.Show;
@ -1826,11 +1843,6 @@ begin
FunctionListShown(not MenuItemFunctionList.Checked); FunctionListShown(not MenuItemFunctionList.Checked);
end; end;
procedure TForm1.MenuViewSettingsClick(Sender: TObject);
begin
SettingsForm.ShowModal;
end;
function GetSimbaNews: String; function GetSimbaNews: String;
var var
t: TSimbaVersionThread; t: TSimbaVersionThread;
@ -1875,7 +1887,7 @@ var
cobj: TColourPickerObject; cobj: TColourPickerObject;
begin begin
Picker.Pick(c, x, y); Picker.Pick(c, x, y);
cobj := TColourPickerObject.Create(c, Point(x,y), ''); cobj := TColourPickerObject.Create(c, Classes.Point(x,y), '');
if lowercase(LoadSettingDef('Settings/ColourPicker/ShowHistoryOnPick', 'True')) = 'true' then if lowercase(LoadSettingDef('Settings/ColourPicker/ShowHistoryOnPick', 'True')) = 'true' then
begin begin
@ -1935,7 +1947,7 @@ var
begin begin
if sender <> PageControl1 then if sender <> PageControl1 then
exit; exit;
NewPos := PageControl1.TabIndexAtClientPos(Point(x,y)); NewPos := PageControl1.TabIndexAtClientPos(Classes.Point(x,y));
OldPos := PageControl1.TabIndex; OldPos := PageControl1.TabIndex;
if (NewPos <> OldPos) and (NewPos <> -1) then if (NewPos <> OldPos) and (NewPos <> -1) then
begin; begin;
@ -1949,7 +1961,7 @@ procedure TForm1.PageControl1DragOver(Sender, Source: TObject; X, Y: Integer;
var var
Pos: Integer; Pos: Integer;
begin begin
Pos := PageControl1.TabIndexAtClientPos(Point(x,y)); Pos := PageControl1.TabIndexAtClientPos(Classes.Point(x,y));
Accept := (Pos <> PageControl1.TabIndex) and (Pos <> -1); Accept := (Pos <> PageControl1.TabIndex) and (Pos <> -1);
end; end;
@ -1969,8 +1981,8 @@ procedure TForm1.PageControl1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer); Shift: TShiftState; X, Y: Integer);
begin begin
if(Button = mbMiddle) and (not(PageControl1.Dragging))then if(Button = mbMiddle) and (not(PageControl1.Dragging))then
if(PageControl1.TabIndexAtClientPos(Point(x,y)) <> -1)then if(PageControl1.TabIndexAtClientPos(Classes.Point(x,y)) <> -1)then
DeleteTab(PageControl1.TabIndexAtClientPos(Point(x,y)), False); DeleteTab(PageControl1.TabIndexAtClientPos(Classes.Point(x,y)), False);
end; end;
procedure TForm1.PopupItemFindClick(Sender: TObject); procedure TForm1.PopupItemFindClick(Sender: TObject);
@ -2041,6 +2053,7 @@ begin
if editSearchList.CanFocus then if editSearchList.CanFocus then
editSearchList.SetFocus; editSearchList.SetFocus;
//Lets load up this Script tree! //Lets load up this Script tree!
if CurrScript <> nil then
frmFunctionList.LoadScriptTree(CurrScript.SynEdit.text); frmFunctionList.LoadScriptTree(CurrScript.SynEdit.text);
end else begin end else begin
if(frmFunctionList.Parent is TPanel)then if(frmFunctionList.Parent is TPanel)then

View File

@ -1,68 +1,59 @@
object SimbaUpdateForm: TSimbaUpdateForm object SimbaUpdateForm: TSimbaUpdateForm
Left = 507 Left = 262
Height = 391 Height = 331
Top = 321 Top = 219
Width = 467 Width = 473
ActiveControl = UpdateButton ActiveControl = UpdateButton
BorderIcons = [biSystemMenu, biMinimize] BorderIcons = [biSystemMenu, biMinimize]
Caption = 'Update Simba' Caption = 'Update Simba'
ClientHeight = 391 ClientHeight = 331
ClientWidth = 467 ClientWidth = 473
OnCreate = FormCreate OnCreate = FormCreate
OnShow = CleanUpdateForm OnShow = CleanUpdateForm
LCLVersion = '0.9.29' LCLVersion = '0.9.29'
object DownloadProgress: TProgressBar object DownloadProgress: TProgressBar
Left = 24 Left = 8
Height = 28 Height = 29
Top = 64 Top = 268
Width = 413 Width = 454
Anchors = [akTop, akLeft, akRight] Anchors = [akLeft, akRight, akBottom]
Smooth = True Smooth = True
TabOrder = 0 TabOrder = 0
end end
object UpdateButton: TButton object UpdateButton: TButton
Left = 24 Left = 387
Height = 40 Height = 25
Top = 8 Top = 300
Width = 413 Width = 75
Anchors = [akTop, akLeft, akRight] Anchors = [akRight, akBottom]
Caption = 'Update!' Caption = 'Update!'
OnClick = UpdateButtonClick OnClick = UpdateButtonClick
TabOrder = 1 TabOrder = 1
end end
object OkButton: TButton object CloseButton: TButton
Left = 362 Left = 8
Height = 25 Height = 25
Top = 352 Top = 300
Width = 75
Anchors = [akRight, akBottom]
Caption = 'Ok'
OnClick = OkButtonClick
TabOrder = 2
end
object CancelButton: TButton
Left = 24
Height = 25
Top = 352
Width = 75 Width = 75
Anchors = [akLeft, akBottom] Anchors = [akLeft, akBottom]
Caption = 'Cancel' Caption = 'Close'
OnClick = CancelButtonClick OnClick = CloseButtonClick
TabOrder = 3 TabOrder = 2
end end
object UpdateLog: TMemo object UpdateLog: TMemo
Left = 24 Left = 8
Height = 207 Height = 253
Top = 128 Top = 8
Width = 413 Width = 454
Anchors = [akTop, akLeft, akRight, akBottom] Anchors = [akTop, akLeft, akRight, akBottom]
TabOrder = 4 TabOrder = 3
end end
object DownloadSpeed: TLabel object DownloadSpeed: TLabel
Left = 24 Left = 96
Height = 14 Height = 14
Top = 104 Top = 306
Width = 78 Width = 78
Anchors = [akLeft, akBottom]
Caption = 'DownloadSpeed' Caption = 'DownloadSpeed'
ParentColor = False ParentColor = False
Visible = False Visible = False

View File

@ -1,24 +1,22 @@
{ This is an automatically generated lazarus resource file } { This is an automatically generated lazarus resource file }
LazarusResources.Add('TSimbaUpdateForm','FORMDATA',[ LazarusResources.Add('TSimbaUpdateForm','FORMDATA',[
'TPF0'#16'TSimbaUpdateForm'#15'SimbaUpdateForm'#4'Left'#3#251#1#6'Height'#3 'TPF0'#16'TSimbaUpdateForm'#15'SimbaUpdateForm'#4'Left'#3#6#1#6'Height'#3'K'#1
+#135#1#3'Top'#3'A'#1#5'Width'#3#211#1#13'ActiveControl'#7#12'UpdateButton'#11 +#3'Top'#3#219#0#5'Width'#3#217#1#13'ActiveControl'#7#12'UpdateButton'#11'Bor'
+'BorderIcons'#11#12'biSystemMenu'#10'biMinimize'#0#7'Caption'#6#12'Update Si' +'derIcons'#11#12'biSystemMenu'#10'biMinimize'#0#7'Caption'#6#12'Update Simba'
+'mba'#12'ClientHeight'#3#135#1#11'ClientWidth'#3#211#1#8'OnCreate'#7#10'Form' +#12'ClientHeight'#3'K'#1#11'ClientWidth'#3#217#1#8'OnCreate'#7#10'FormCreate'
+'Create'#6'OnShow'#7#15'CleanUpdateForm'#10'LCLVersion'#6#6'0.9.29'#0#12'TPr' +#6'OnShow'#7#15'CleanUpdateForm'#10'LCLVersion'#6#6'0.9.29'#0#12'TProgressBa'
+'ogressBar'#16'DownloadProgress'#4'Left'#2#24#6'Height'#2#28#3'Top'#2'@'#5'W' +'r'#16'DownloadProgress'#4'Left'#2#8#6'Height'#2#29#3'Top'#3#12#1#5'Width'#3
+'idth'#3#157#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#6'Smooth'#9#8'T' +#198#1#7'Anchors'#11#6'akLeft'#7'akRight'#8'akBottom'#0#6'Smooth'#9#8'TabOrd'
+'abOrder'#2#0#0#0#7'TButton'#12'UpdateButton'#4'Left'#2#24#6'Height'#2'('#3 +'er'#2#0#0#0#7'TButton'#12'UpdateButton'#4'Left'#3#131#1#6'Height'#2#25#3'To'
+'Top'#2#8#5'Width'#3#157#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#0#7'C' +'p'#3','#1#5'Width'#2'K'#7'Anchors'#11#7'akRight'#8'akBottom'#0#7'Caption'#6
+'aption'#6#7'Update!'#7'OnClick'#7#17'UpdateButtonClick'#8'TabOrder'#2#1#0#0 +#7'Update!'#7'OnClick'#7#17'UpdateButtonClick'#8'TabOrder'#2#1#0#0#7'TButton'
+#7'TButton'#8'OkButton'#4'Left'#3'j'#1#6'Height'#2#25#3'Top'#3'`'#1#5'Width' +#11'CloseButton'#4'Left'#2#8#6'Height'#2#25#3'Top'#3','#1#5'Width'#2'K'#7'An'
+#2'K'#7'Anchors'#11#7'akRight'#8'akBottom'#0#7'Caption'#6#2'Ok'#7'OnClick'#7 +'chors'#11#6'akLeft'#8'akBottom'#0#7'Caption'#6#5'Close'#7'OnClick'#7#16'Clo'
+#13'OkButtonClick'#8'TabOrder'#2#2#0#0#7'TButton'#12'CancelButton'#4'Left'#2 +'seButtonClick'#8'TabOrder'#2#2#0#0#5'TMemo'#9'UpdateLog'#4'Left'#2#8#6'Heig'
+#24#6'Height'#2#25#3'Top'#3'`'#1#5'Width'#2'K'#7'Anchors'#11#6'akLeft'#8'akB' +'ht'#3#253#0#3'Top'#2#8#5'Width'#3#198#1#7'Anchors'#11#5'akTop'#6'akLeft'#7
+'ottom'#0#7'Caption'#6#6'Cancel'#7'OnClick'#7#17'CancelButtonClick'#8'TabOrd' +'akRight'#8'akBottom'#0#8'TabOrder'#2#3#0#0#6'TLabel'#13'DownloadSpeed'#4'Le'
+'er'#2#3#0#0#5'TMemo'#9'UpdateLog'#4'Left'#2#24#6'Height'#3#207#0#3'Top'#3 +'ft'#2'`'#6'Height'#2#14#3'Top'#3'2'#1#5'Width'#2'N'#7'Anchors'#11#6'akLeft'
+#128#0#5'Width'#3#157#1#7'Anchors'#11#5'akTop'#6'akLeft'#7'akRight'#8'akBott' +#8'akBottom'#0#7'Caption'#6#13'DownloadSpeed'#11'ParentColor'#8#7'Visible'#8
+'om'#0#8'TabOrder'#2#4#0#0#6'TLabel'#13'DownloadSpeed'#4'Left'#2#24#6'Height' +#0#0#0
+#2#14#3'Top'#2'h'#5'Width'#2'N'#7'Caption'#6#13'DownloadSpeed'#11'ParentColo'
+'r'#8#7'Visible'#8#0#0#0
]); ]);

View File

@ -25,13 +25,11 @@ type
DownloadSpeed: TLabel; DownloadSpeed: TLabel;
UpdateLog: TMemo; UpdateLog: TMemo;
UpdateButton: TButton; UpdateButton: TButton;
OkButton: TButton; CloseButton: TButton;
CancelButton: TButton;
DownloadProgress: TProgressBar; DownloadProgress: TProgressBar;
procedure CancelButtonClick(Sender: TObject); procedure CloseButtonClick(Sender: TObject);
procedure CleanUpdateForm(Sender: TObject); procedure CleanUpdateForm(Sender: TObject);
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
procedure OkButtonClick(Sender: TObject);
procedure UpdateButtonClick(Sender: TObject); procedure UpdateButtonClick(Sender: TObject);
function CanUpdate: Boolean; function CanUpdate: Boolean;
@ -94,7 +92,6 @@ begin
end; end;
function TSimbaUpdateForm.GetLatestSimbaVersion: Integer; function TSimbaUpdateForm.GetLatestSimbaVersion: Integer;
begin begin
if SimbaVersionThread = nil then//Create thread (only if no-other one is already running) if SimbaVersionThread = nil then//Create thread (only if no-other one is already running)
begin begin
@ -125,42 +122,38 @@ end;
procedure TSimbaUpdateForm.UpdateButtonClick(Sender: TObject); procedure TSimbaUpdateForm.UpdateButtonClick(Sender: TObject);
begin begin
if FUpdating then if FUpdating then
UpdateLog.Lines.Add('Already performing an update!') FCancelling := True
else else
Self.PerformUpdate; Self.PerformUpdate;
end; end;
procedure TSimbaUpdateForm.CancelButtonClick(Sender: TObject); procedure TSimbaUpdateForm.CloseButtonClick(Sender: TObject);
begin begin
if FCancelled or FDone then if FCancelled or FDone then
begin Self.ModalResult := mrCancel
Self.ModalResult:=mrCancel; else
Self.Hide; Self.UpdateLog.Lines.Add('Update in progress!');
end else
begin
FCancelling := True;
end;
end; end;
procedure TSimbaUpdateForm.CleanUpdateForm(Sender: TObject); procedure TSimbaUpdateForm.CleanUpdateForm(Sender: TObject);
begin begin
Self.DownloadProgress.Position:=0; Self.DownloadProgress.Position := 0;
Self.UpdateLog.Clear; Self.UpdateLog.Clear;
Self.UpdateLog.Lines.Add('---------- Update Session ----------'); Self.UpdateLog.Lines.Add('---------- Update Session ----------');
Self.DownloadSpeed.Visible:= false; Self.DownloadSpeed.Visible := false;
if not CanUpdate then
begin
ShowMessage('No Updates Available!');
Self.UpdateLog.Lines.Add('No Updates Available!');
Self.UpdateButton.Enabled := False;
end else
Self.UpdateButton.Enabled := true;
end; end;
procedure TSimbaUpdateForm.FormCreate(Sender: TObject); procedure TSimbaUpdateForm.FormCreate(Sender: TObject);
begin begin
FDone := True; FDone := True;
FUpdating:= false; FUpdating := false;
end;
procedure TSimbaUpdateForm.OkButtonClick(Sender: TObject);
begin
Self.ModalResult:=mrOK;
Self.Hide;
end; end;
{ Return true if we have to cancel } { Return true if we have to cancel }
@ -187,7 +180,6 @@ begin
end; end;
procedure TSimbaUpdateForm.PerformUpdate; procedure TSimbaUpdateForm.PerformUpdate;
begin begin
FUpdating:= True; FUpdating:= True;
Updater := TMMLFileDownloader.Create; Updater := TMMLFileDownloader.Create;
@ -211,7 +203,8 @@ begin
Self.UpdateLog.Lines.Add('Starting download of ' + Updater.FileURL + ' ...'); Self.UpdateLog.Lines.Add('Starting download of ' + Updater.FileURL + ' ...');
try try
Self.OkButton.Enabled := False; // grey out button Self.UpdateButton.Caption := 'Cancel'; // Update to Cancel
Self.CloseButton.Enabled := false;
DownloadSpeed.Visible:= true; DownloadSpeed.Visible:= true;
DownloadSpeed.Caption:= Format(DownloadSpeedTextRunning,[0]); DownloadSpeed.Caption:= Format(DownloadSpeedTextRunning,[0]);
FStartTime:= GetTickCount - 1;//Be sure that we don't get div 0 FStartTime:= GetTickCount - 1;//Be sure that we don't get div 0
@ -228,13 +221,14 @@ begin
except except
FCancelling := False; FCancelling := False;
FCancelled := True; FCancelled := True;
DownloadSpeed.Visible:= false; DownloadSpeed.Visible := false;
Self.UpdateLog.Lines.Add('Download stopped at '+inttostr(DownloadProgress.Position)+'%... Simba did not succesfully update.'); Self.UpdateLog.Lines.Add('Download stopped at '+inttostr(DownloadProgress.Position)+'%... Simba did not succesfully update.');
// more detailed info // more detailed info
writeln('EXCEPTION IN UPDATEFORM: We either hit Cancel, or something went wrong with files'); writeln('EXCEPTION IN UPDATEFORM: We either hit Cancel, or something went wrong with files');
end; end;
FDone := True; FDone := True;
Self.OkButton.Enabled := True; // un-grey out button Self.UpdateButton.Caption := 'Update!';
Self.CloseButton.Enabled := true;
FUpdating:= false; FUpdating:= false;
end; end;