1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-25 02:32:19 -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
Left = 433
Left = 331
Height = 555
Top = 224
Top = 150
Width = 739
ActiveControl = ScriptPanel
AllowDropFiles = True
@ -1245,13 +1245,9 @@ object Form1: TForm1
Caption = 'View &Function List'
OnClick = MenuItemFunctionListClick
end
object MenuViewSettings: TMenuItem
Caption = 'View Settings'
OnClick = MenuViewSettingsClick
end
end
object MenuExtra: TMenuItem
Caption = 'E&xtra'
object MenuTools: TMenuItem
Caption = '&Tools'
object MenuitemFillFunctionList: TMenuItem
Caption = '&Fill Function List'
Bitmap.Data = {
@ -1336,6 +1332,13 @@ object Form1: TForm1
object MenuItemDivider9: TMenuItem
Caption = '-'
end
object MenuItemSettingsButton: TMenuItem
Caption = 'Settings'
OnClick = MenuItemSettingsButtonClick
end
object MenuItemDivider10: TMenuItem
Caption = '-'
end
object MenuItemExportHTML: TMenuItem
Caption = '&Export script as HTML'
Bitmap.Data = {

File diff suppressed because it is too large Load Diff

View File

@ -35,7 +35,7 @@ uses
//Client,
MufasaTypes,
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.
colourpicker, framescript, windowselector, lcltype, ActnList,
SynExportHTML, SynEditKeyCmds, SynEditHighlighter,
@ -44,7 +44,7 @@ uses
about, framefunctionlist, ocr, updateform, simbasettings;
const
SimbaVersion = 576;
SimbaVersion = 578;
type
@ -100,13 +100,14 @@ type
MenuFile: TMenuItem;
MenuEdit: TMenuItem;
MenuHelp: TMenuItem;
MenuExtra: TMenuItem;
MenuItemSettingsButton: TMenuItem;
MenuItemDivider10: TMenuItem;
MenuTools: TMenuItem;
MenuItemOpenRecent: TMenuItem;
MenuItemCompile: TMenuItem;
MenuItemHandbook: TMenuItem;
MenuItemAbout: TMenuItem;
MenuItemReportBug: TMenuItem;
MenuViewSettings: TMenuItem;
MenuItemExportHTML: TMenuItem;
MenuItemDivider9: TMenuItem;
MouseTimer: TTimer;
@ -269,11 +270,11 @@ type
procedure MenuitemFillFunctionListClick(Sender: TObject);
procedure MenuItemHideClick(Sender: TObject);
procedure MenuItemReportBugClick(Sender: TObject);
procedure MenuItemSettingsButtonClick(Sender: TObject);
procedure MenuItemShowClick(Sender: TObject);
procedure MenuItemTabCloseClick(Sender: TObject);
procedure MenuItemTabCloseOthersClick(Sender: TObject);
procedure MenuItemFunctionListClick(Sender: TObject);
procedure MenuViewSettingsClick(Sender: TObject);
procedure NewsTimerTimer(Sender: TObject);
procedure OnLinePSScript(Sender: TObject);
procedure ButtonPickClick(Sender: TObject);
@ -453,11 +454,11 @@ begin
Accept := frmFunctionList.DragKind = dkDock;
if(Accept)then
begin
P := ScriptPanel.ClientToScreen(Point(0, 0));
P := ScriptPanel.ClientToScreen(Classes.Point(0, 0));
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
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;
@ -770,7 +771,7 @@ begin
Res := CurrScript.SynEdit.SearchReplaceEx(SearchString,'',SearchOptions,CurrPos);
if res = 0 then
begin
res := CurrScript.SynEdit.SearchReplaceEx(SearchString,'',SearchOptions,Point(0,0));
res := CurrScript.SynEdit.SearchReplaceEx(SearchString,'',SearchOptions,Classes.Point(0,0));
if res > 0 then
begin;
Writeln('End of document reached');
@ -866,6 +867,7 @@ begin
CreateSetting('Settings/ColourPicker/ShowHistoryOnPick', 'True');
CreateSetting('Settings/General/MaxRecentFiles','10');
CreateSetting('Settings/MainForm/NormalSize','739:555');
CreateSetting('Settings/FunctionList/ShowOnStart','True');
CreateSetting('Settings/Updater/RemoteVersion',
{$IFDEF WINDOWS}
@ -915,7 +917,7 @@ end;
procedure TForm1.LoadFormSettings;
var
str : string;
str,str2 : string;
Data : TStringArray;
i : integer;
begin
@ -944,6 +946,12 @@ begin
for i := high(data) downto 0 do//First = entry should be added as last
AddRecentFile(data[i]);
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;
procedure TForm1.SaveFormSettings;
@ -968,6 +976,10 @@ begin
data[high(data) - i] := RecentFiles[i];
SetKeyValue('LastConfig/MainForm/RecentFiles',implode(';',data));
end;
if MenuItemFunctionList.Checked then
SetKeyValue('LastConfig/MainForm/FunctionListShown','True')
else
SetKeyValue('LastConfig/MainForm/FunctionListShown','False');
SaveToXML(SimbaSettingsFile);
end;
end;
@ -1355,7 +1367,7 @@ begin
begin;
Writeln('This is currently not supported');
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;
end;
InCodeCompletion:= false;
@ -1403,7 +1415,7 @@ begin
key := #0;
StopCodeCompletion;
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.SetFocus;
end else
@ -1514,7 +1526,7 @@ begin
begin
Btns:= [mbYes, mbNo];
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
begin
if(Y)then
@ -1573,7 +1585,6 @@ begin
PageControl1.OnCloseTabClicked:=ActionCloseTab.OnExecute;
Tabs := TList.Create;
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
Picker := TMColorPicker.Create(Manager);
Selector := TMWindowSelector.Create(Manager);
@ -1588,7 +1599,7 @@ begin
if FileExists(Application.ExeName+'_old_') then
begin
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;
{$endif}
frmFunctionList.OnEndDock:= @frmFunctionList.FrameEndDock;
@ -1789,7 +1800,8 @@ begin
end;
Sections.free;
end;
frmFunctionList.LoadScriptTree(CurrScript.SynEdit.Text);
if CurrScript <> nil then
frmFunctionList.LoadScriptTree(CurrScript.SynEdit.Text);
end;
procedure TForm1.MenuItemHideClick(Sender: TObject);
@ -1805,6 +1817,11 @@ begin
OpenURL('http://mufasa.villavu.com/mantis/bug_report_page.php');
end;
procedure TForm1.MenuItemSettingsButtonClick(Sender: TObject);
begin
SettingsForm.ShowModal;
end;
procedure TForm1.MenuItemShowClick(Sender: TObject);
begin
Self.Show;
@ -1826,11 +1843,6 @@ begin
FunctionListShown(not MenuItemFunctionList.Checked);
end;
procedure TForm1.MenuViewSettingsClick(Sender: TObject);
begin
SettingsForm.ShowModal;
end;
function GetSimbaNews: String;
var
t: TSimbaVersionThread;
@ -1875,7 +1887,7 @@ var
cobj: TColourPickerObject;
begin
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
begin
@ -1935,7 +1947,7 @@ var
begin
if sender <> PageControl1 then
exit;
NewPos := PageControl1.TabIndexAtClientPos(Point(x,y));
NewPos := PageControl1.TabIndexAtClientPos(Classes.Point(x,y));
OldPos := PageControl1.TabIndex;
if (NewPos <> OldPos) and (NewPos <> -1) then
begin;
@ -1949,7 +1961,7 @@ procedure TForm1.PageControl1DragOver(Sender, Source: TObject; X, Y: Integer;
var
Pos: Integer;
begin
Pos := PageControl1.TabIndexAtClientPos(Point(x,y));
Pos := PageControl1.TabIndexAtClientPos(Classes.Point(x,y));
Accept := (Pos <> PageControl1.TabIndex) and (Pos <> -1);
end;
@ -1969,8 +1981,8 @@ procedure TForm1.PageControl1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if(Button = mbMiddle) and (not(PageControl1.Dragging))then
if(PageControl1.TabIndexAtClientPos(Point(x,y)) <> -1)then
DeleteTab(PageControl1.TabIndexAtClientPos(Point(x,y)), False);
if(PageControl1.TabIndexAtClientPos(Classes.Point(x,y)) <> -1)then
DeleteTab(PageControl1.TabIndexAtClientPos(Classes.Point(x,y)), False);
end;
procedure TForm1.PopupItemFindClick(Sender: TObject);
@ -2041,7 +2053,8 @@ begin
if editSearchList.CanFocus then
editSearchList.SetFocus;
//Lets load up this Script tree!
frmFunctionList.LoadScriptTree(CurrScript.SynEdit.text);
if CurrScript <> nil then
frmFunctionList.LoadScriptTree(CurrScript.SynEdit.text);
end else begin
if(frmFunctionList.Parent is TPanel)then
frmFunctionList.Hide

View File

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

View File

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

View File

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