1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-12-23 07:48:50 -05:00

Bug fixes/Little GUI-updates

git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@404 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
Raymond 2010-01-12 18:07:47 +00:00
parent 2abf01efb2
commit d4a672a4f6
7 changed files with 3047 additions and 2973 deletions

View File

@ -62,14 +62,16 @@ procedure TFunctionListFrame.FrameEndDock(Sender, Target: TObject; X, Y: Integer
);
begin
if Target is TPanel then
FunctionListLabel.Visible := True
begin
Form1.SplitterFunctionList.Visible := true;
CloseButton.Visible:= true;
end
else if Target is TCustomDockForm then
begin
TCustomDockForm(Target).Caption := 'Function List';
TCustomDockForm(Target).Caption := 'Functionlist';
TCustomDockForm(Target).OnClose := @DockFormOnClose;
Form1.SplitterFunctionList.Visible:= false;
FunctionListLabel.Visible := false;
// TCustomDockForm(frmFunctionList.Parent).BorderStyle:= bsNone;
CloseButton.Visible:= false;
end;
end;
@ -164,6 +166,7 @@ begin
tmpNode.Data:= strnew(PChar(Analyzer.Methods[i].CreateMethodStr));
end;
ScriptNode.Expand(true);
Analyzer.free;
end;
function TFunctionListFrame.Find(Next : boolean; backwards : boolean = false) : boolean;

View File

@ -596,6 +596,7 @@ object ScriptFrame: TScriptFrame
OnProcessCommand = SynEditProcessCommand
OnProcessUserCommand = SynEditProcessUserCommand
OnSpecialLineColors = SynEditSpecialLineColors
OnStatusChange = SynEditStatusChange
inline TSynGutterPartList
object TSynGutterMarks
Width = 23

View File

@ -1,3 +1,5 @@
{ This is an automatically generated lazarus resource file }
LazarusResources.Add('TScriptFrame','FORMDATA',[
'TPF0'#12'TScriptFrame'#11'ScriptFrame'#4'Left'#2#0#6'Height'#3'H'#1#3'Top'#2
+#0#5'Width'#3#141#1#12'ClientHeight'#3'H'#1#11'ClientWidth'#3#141#1#8'TabOrd'
@ -117,36 +119,37 @@ LazarusResources.Add('TScriptFrame','FORMDATA',[
+'nd.'#0#21'BracketHighlightStyle'#7#8'sbhsBoth'#8'OnChange'#7#13'SynEditChan'
+'ge'#16'OnProcessCommand'#7#21'SynEditProcessCommand'#20'OnProcessUserComman'
+'d'#7#25'SynEditProcessUserCommand'#19'OnSpecialLineColors'#7#24'SynEditSpec'
+'ialLineColors'#0#244#18'TSynGutterPartList'#0#0#15'TSynGutterMarks'#0#5'Wid'
+'th'#2#23#0#0#20'TSynGutterLineNumber'#0#5'Width'#2#17#12'MouseActions'#14#0
+#21'MarkupInfo.Background'#7#9'clBtnFace'#21'MarkupInfo.Foreground'#7#6'clNo'
+'ne'#10'DigitCount'#2#2#30'ShowOnlyLineNumbersMultiplesOf'#2#1#9'ZeroStart'#8
+#12'LeadingZeros'#8#0#0#17'TSynGutterChanges'#0#5'Width'#2#4#13'ModifiedColo'
+'r'#4#252#233#0#0#10'SavedColor'#7#7'clGreen'#0#0#19'TSynGutterSeparator'#0#5
+'Width'#2#2#0#0#21'TSynGutterCodeFolding'#0#12'MouseActions'#14#1#5'Shift'#11
+#0#9'ShiftMask'#11#0#6'Button'#7#7'mbRight'#10'ClickCount'#7#8'ccSingle'#8'C'
+'lickDir'#7#4'cdUp'#7'Command'#2#16#9'MoveCaret'#8#6'Option'#2#0#8'Priority'
+#2#0#0#1#5'Shift'#11#0#9'ShiftMask'#11#7'ssShift'#0#6'Button'#7#8'mbMiddle'
,#10'ClickCount'#7#5'ccAny'#8'ClickDir'#7#6'cdDown'#7'Command'#2#14#9'MoveCar'
+'et'#8#6'Option'#2#0#8'Priority'#2#0#0#1#5'Shift'#11#7'ssShift'#0#9'ShiftMas'
+'k'#11#7'ssShift'#0#6'Button'#7#8'mbMiddle'#10'ClickCount'#7#5'ccAny'#8'Clic'
+'kDir'#7#6'cdDown'#7'Command'#2#14#9'MoveCaret'#8#6'Option'#2#1#8'Priority'#2
+#0#0#1#5'Shift'#11#0#9'ShiftMask'#11#0#6'Button'#7#6'mbLeft'#10'ClickCount'#7
+#5'ccAny'#8'ClickDir'#7#6'cdDown'#7'Command'#2#0#9'MoveCaret'#8#6'Option'#2#0
+#8'Priority'#2#0#0#0#21'MarkupInfo.Background'#7#6'clNone'#21'MarkupInfo.For'
+'eground'#7#6'clGray'#20'MouseActionsExpanded'#14#1#5'Shift'#11#0#9'ShiftMas'
+'k'#11#0#6'Button'#7#6'mbLeft'#10'ClickCount'#7#5'ccAny'#8'ClickDir'#7#6'cdD'
+'own'#7'Command'#2#14#9'MoveCaret'#8#6'Option'#2#0#8'Priority'#2#0#0#0#21'Mo'
+'useActionsCollapsed'#14#1#5'Shift'#11#6'ssCtrl'#0#9'ShiftMask'#11#6'ssCtrl'
+'ialLineColors'#14'OnStatusChange'#7#19'SynEditStatusChange'#0#244#18'TSynGu'
+'tterPartList'#0#0#15'TSynGutterMarks'#0#5'Width'#2#23#0#0#20'TSynGutterLine'
+'Number'#0#5'Width'#2#17#12'MouseActions'#14#0#21'MarkupInfo.Background'#7#9
+'clBtnFace'#21'MarkupInfo.Foreground'#7#6'clNone'#10'DigitCount'#2#2#30'Show'
+'OnlyLineNumbersMultiplesOf'#2#1#9'ZeroStart'#8#12'LeadingZeros'#8#0#0#17'TS'
+'ynGutterChanges'#0#5'Width'#2#4#13'ModifiedColor'#4#252#233#0#0#10'SavedCol'
+'or'#7#7'clGreen'#0#0#19'TSynGutterSeparator'#0#5'Width'#2#2#0#0#21'TSynGutt'
+'erCodeFolding'#0#12'MouseActions'#14#1#5'Shift'#11#0#9'ShiftMask'#11#0#6'Bu'
+'tton'#7#7'mbRight'#10'ClickCount'#7#8'ccSingle'#8'ClickDir'#7#4'cdUp'#7'Com'
+'mand'#2#16#9'MoveCaret'#8#6'Option'#2#0#8'Priority'#2#0#0#1#5'Shift'#11#0#9
,'ShiftMask'#11#7'ssShift'#0#6'Button'#7#8'mbMiddle'#10'ClickCount'#7#5'ccAny'
+#8'ClickDir'#7#6'cdDown'#7'Command'#2#14#9'MoveCaret'#8#6'Option'#2#0#8'Prio'
+'rity'#2#0#0#1#5'Shift'#11#7'ssShift'#0#9'ShiftMask'#11#7'ssShift'#0#6'Butto'
+'n'#7#8'mbMiddle'#10'ClickCount'#7#5'ccAny'#8'ClickDir'#7#6'cdDown'#7'Comman'
+'d'#2#14#9'MoveCaret'#8#6'Option'#2#1#8'Priority'#2#0#0#1#5'Shift'#11#0#9'Sh'
+'iftMask'#11#0#6'Button'#7#6'mbLeft'#10'ClickCount'#7#5'ccAny'#8'ClickDir'#7
+#6'cdDown'#7'Command'#2#0#9'MoveCaret'#8#6'Option'#2#0#8'Priority'#2#0#0#0#21
+'MarkupInfo.Background'#7#6'clNone'#21'MarkupInfo.Foreground'#7#6'clGray'#20
+'MouseActionsExpanded'#14#1#5'Shift'#11#0#9'ShiftMask'#11#0#6'Button'#7#6'mb'
+'Left'#10'ClickCount'#7#5'ccAny'#8'ClickDir'#7#6'cdDown'#7'Command'#2#14#9'M'
+'oveCaret'#8#6'Option'#2#0#8'Priority'#2#0#0#0#21'MouseActionsCollapsed'#14#1
+#5'Shift'#11#6'ssCtrl'#0#9'ShiftMask'#11#6'ssCtrl'#0#6'Button'#7#6'mbLeft'#10
+'ClickCount'#7#5'ccAny'#8'ClickDir'#7#6'cdDown'#7'Command'#2#15#9'MoveCaret'
+#8#6'Option'#2#0#8'Priority'#2#0#0#1#5'Shift'#11#0#9'ShiftMask'#11#6'ssCtrl'
+#0#6'Button'#7#6'mbLeft'#10'ClickCount'#7#5'ccAny'#8'ClickDir'#7#6'cdDown'#7
+'Command'#2#15#9'MoveCaret'#8#6'Option'#2#0#8'Priority'#2#0#0#1#5'Shift'#11#0
+#9'ShiftMask'#11#6'ssCtrl'#0#6'Button'#7#6'mbLeft'#10'ClickCount'#7#5'ccAny'
+#8'ClickDir'#7#6'cdDown'#7'Command'#2#15#9'MoveCaret'#8#6'Option'#2#1#8'Prio'
+'rity'#2#0#0#0#0#0#0#0#17'TSynFreePascalSyn'#17'SynFreePascalSyn1'#7'Enabled'
+#8#23'CommentAttri.Foreground'#7#6'clBlue'#18'CommentAttri.Style'#11#6'fsBol'
+'d'#0#26'IdentifierAttri.Foreground'#7#9'clDefault'#22'NumberAttri.Foregroun'
+'d'#7#6'clNavy'#22'StringAttri.Foreground'#7#6'clBlue'#22'SymbolAttri.Foregr'
+'ound'#7#5'clRed'#25'DirectiveAttri.Foreground'#7#5'clRed'#20'DirectiveAttri'
+'.Style'#11#6'fsBold'#0#12'CompilerMode'#7#9'pcmObjFPC'#14'NestedComments'#9
+#4'left'#3'@'#1#3'top'#2#16#0#0#0
+'Command'#2#15#9'MoveCaret'#8#6'Option'#2#1#8'Priority'#2#0#0#0#0#0#0#0#17'T'
+'SynFreePascalSyn'#17'SynFreePascalSyn1'#7'Enabled'#8#23'CommentAttri.Foregr'
+'ound'#7#6'clBlue'#18'CommentAttri.Style'#11#6'fsBold'#0#26'IdentifierAttri.'
+'Foreground'#7#9'clDefault'#22'NumberAttri.Foreground'#7#6'clNavy'#22'String'
+'Attri.Foreground'#7#6'clBlue'#22'SymbolAttri.Foreground'#7#5'clRed'#25'Dire'
+'ctiveAttri.Foreground'#7#5'clRed'#20'DirectiveAttri.Style'#11#6'fsBold'#0#12
+'CompilerMode'#7#9'pcmObjFPC'#14'NestedComments'#9#4'left'#3'@'#1#3'top'#2#16
+#0#0#0
]);

View File

@ -56,6 +56,7 @@ type
var Command: TSynEditorCommand; var AChar: TUTF8Char; Data: pointer);
procedure SynEditSpecialLineColors(Sender: TObject; Line: integer;
var Special: boolean; var FG, BG: TColor);
procedure SynEditStatusChange(Sender: TObject; Changes: TSynStatusChanges);
private
OwnerPage : TPageControl;
OwnerSheet : TTabSheet;//The owner TTabsheet -> For title setting
@ -198,6 +199,17 @@ begin
end;
end;
procedure TScriptFrame.SynEditStatusChange(Sender: TObject;
Changes: TSynStatusChanges);
begin
if scSelection in changes then
begin;
Form1.TT_Cut.Enabled := SynEdit.SelAvail;
form1.TT_Copy.Enabled:= Form1.TT_Cut.Enabled;
form1.TT_Paste.Enabled:= SynEdit.CanPaste;
end;
end;
procedure TScriptFrame.undo;
begin

View File

@ -5,7 +5,7 @@ object Form1: TForm1
Width = 734
ActiveControl = ScriptPanel
Caption = 'THA FUKING MUFASA'
ClientHeight = 532
ClientHeight = 537
ClientWidth = 734
KeyPreview = True
Menu = MainMenu1
@ -27,14 +27,14 @@ object Form1: TForm1
ShowHint = True
TabOrder = 0
object TB_Run: TToolButton
Left = 96
Left = 168
Hint = 'Run'
Top = 2
Action = ActionRunScript
ImageIndex = 6
end
object TB_Pause: TToolButton
Left = 119
Left = 191
Hint = 'Pause'
Top = 2
Action = ActionPauseScript
@ -42,7 +42,7 @@ object Form1: TForm1
ImageIndex = 5
end
object TB_Stop: TToolButton
Left = 142
Left = 214
Hint = 'Stop'
Top = 2
Action = ActionStopScript
@ -50,39 +50,39 @@ object Form1: TForm1
ImageIndex = 7
end
object ToolButton1: TToolButton
Left = 165
Left = 237
Top = 2
Width = 3
Caption = 'ToolButton1'
Style = tbsDivider
end
object TB_NewTab: TToolButton
Left = 168
Left = 240
Hint = 'Add tab'
Top = 2
Action = ActionNewTab
end
object TB_CloseTab: TToolButton
Left = 191
Left = 263
Hint = 'Close tab'
Top = 2
Action = ActionCloseTab
end
object ToolButton4: TToolButton
Left = 214
Left = 286
Top = 2
Width = 3
Caption = 'ToolButton4'
Style = tbsDivider
end
object TB_ClearDebug: TToolButton
Left = 217
Left = 289
Hint = 'Clear debug box'
Top = 2
Action = ActionClearDebug
end
object TB_PickColour: TToolButton
Left = 240
Left = 312
Hint = 'Pick a color'
Top = 2
Caption = 'TB_PickColour'
@ -90,7 +90,7 @@ object Form1: TForm1
OnClick = ButtonPickClick
end
object TB_SelectClient: TToolButton
Left = 263
Left = 335
Hint = 'Select a client'
Top = 2
Caption = 'TB_SelectClient'
@ -98,14 +98,14 @@ object Form1: TForm1
OnMouseDown = ButtonSelectorDown
end
object ToolButton8: TToolButton
Left = 286
Left = 358
Top = 2
Width = 3
Caption = 'ToolButton8'
Style = tbsDivider
end
object TB_ReloadPlugins: TToolButton
Left = 289
Left = 361
Hint = 'Reload plugins'
Top = 2
Caption = 'TB_ReloadPlugins'
@ -113,7 +113,7 @@ object Form1: TForm1
ImageIndex = 13
end
object TB_Tray: TToolButton
Left = 312
Left = 384
Hint = 'Minimize to tray'
Top = 2
Caption = 'TB_Tray'
@ -157,26 +157,52 @@ object Form1: TForm1
Enabled = False
end
object ToolButton3: TToolButton
Left = 335
Left = 407
Top = 2
Width = 3
Caption = 'ToolButton3'
Style = tbsDivider
end
object UpdateButton: TToolButton
Left = 344
object TT_Update: TToolButton
Left = 410
Hint = 'A new update is available'
Top = 2
Caption = 'UpdateButton'
Caption = 'TT_Update'
ImageIndex = 1
Visible = False
OnClick = UpdateButtonClick
OnClick = TT_UpdateClick
end
object TT_Cut: TToolButton
Left = 96
Top = 2
Caption = 'Cu&t'
ImageIndex = 3
OnClick = ActionCutExecute
end
object TT_Copy: TToolButton
Left = 119
Top = 2
Caption = '&Copy'
ImageIndex = 22
OnClick = ActionCopyExecute
end
object TT_Paste: TToolButton
Left = 142
Top = 2
Action = ActionPaste
end
object ToolButton9: TToolButton
Left = 165
Top = 2
Width = 3
Caption = 'ToolButton9'
Style = tbsDivider
end
end
object StatusBar: TStatusBar
Left = 0
Height = 21
Top = 511
Height = 23
Top = 514
Width = 734
Panels = <
item
@ -194,7 +220,7 @@ object Form1: TForm1
object PanelMemo: TPanel
Left = 0
Height = 154
Top = 357
Top = 360
Width = 734
Align = alBottom
ClientHeight = 154
@ -214,19 +240,19 @@ object Form1: TForm1
Cursor = crVSplit
Left = 0
Height = 5
Top = 352
Top = 355
Width = 734
Align = alBottom
ResizeAnchor = akBottom
end
object ScriptPanel: TPanel
Left = 0
Height = 328
Height = 331
Top = 24
Width = 734
Align = alClient
BevelOuter = bvNone
ClientHeight = 328
ClientHeight = 331
ClientWidth = 734
DockSite = True
TabOrder = 4
@ -234,7 +260,7 @@ object Form1: TForm1
OnDockOver = ScriptPanelDockOver
object PageControl1: TPageControl
Left = 155
Height = 293
Height = 296
Top = 0
Width = 579
Align = alClient
@ -253,7 +279,7 @@ object Form1: TForm1
object SearchPanel: TPanel
Left = 0
Height = 35
Top = 293
Top = 296
Width = 734
Align = alBottom
BevelOuter = bvSpace
@ -349,7 +375,7 @@ object Form1: TForm1
end
object LabeledEditSearch: TLabeledEdit
Left = 104
Height = 27
Height = 21
Top = 6
Width = 174
EditLabel.AnchorSideLeft.Control = LabeledEditSearch
@ -357,10 +383,10 @@ object Form1: TForm1
EditLabel.AnchorSideTop.Side = asrCenter
EditLabel.AnchorSideRight.Control = LabeledEditSearch
EditLabel.AnchorSideBottom.Control = LabeledEditSearch
EditLabel.Left = 67
EditLabel.Height = 18
EditLabel.Top = 10
EditLabel.Width = 34
EditLabel.Left = 73
EditLabel.Height = 14
EditLabel.Top = 9
EditLabel.Width = 28
EditLabel.Caption = 'Find: '
EditLabel.ParentColor = False
LabelPosition = lpLeft
@ -373,9 +399,9 @@ object Form1: TForm1
end
object CheckBoxMatchCase: TCheckBox
Left = 320
Height = 22
Height = 17
Top = 7
Width = 97
Width = 72
Caption = 'Match case'
OnClick = CheckBoxMatchCaseClick
TabOrder = 1
@ -383,39 +409,35 @@ object Form1: TForm1
end
object SplitterFunctionList: TSplitter
Left = 150
Height = 293
Height = 296
Top = 0
Width = 5
OnCanResize = SplitterFunctionListCanResize
Visible = False
end
inline frmFunctionList: TFunctionListFrame
Height = 293
Height = 296
Width = 150
ClientHeight = 293
ClientHeight = 296
ClientWidth = 150
OnEndDock = nil
TabOrder = 3
inherited FunctionList: TTreeView
Height = 244
Top = 22
Height = 257
Width = 150
DefaultItemHeight = 19
OnChange = FunctionListChange
OnDeletion = nil
OnEnter = FunctionListEnter
OnExit = FunctionListExit
end
inherited editSearchList: TEdit
Height = 27
Top = 266
Top = 275
Width = 150
OnExit = editSearchListExit
OnKeyDown = editSearchListKeyDown
OnKeyPress = editSearchListKeyPress
end
inherited FunctionListLabel: TLabel
Height = 18
Width = 146
end
end
@ -1220,6 +1242,7 @@ object Form1: TForm1
Caption = 'Extra'
object MenuitemFillFunctionList: TMenuItem
Caption = '&Fill Function List'
ShortCut = 16465
OnClick = MenuitemFillFunctionListClick
end
object UpdateMenuButton: TMenuItem
@ -2284,6 +2307,7 @@ object Form1: TForm1
end
object TrayPopup: TPopupMenu
Images = Mufasa_Image_List
OnPopup = TrayPopupPopup
left = 528
top = 144
object TrayStop: TMenuItem

File diff suppressed because it is too large Load Diff

View File

@ -42,7 +42,7 @@ uses
ocr, updateform, simbasettings;
const
SimbaVersion = 399;
SimbaVersion = 404;
type
@ -99,9 +99,13 @@ type
MenuViewSettings: TMenuItem;
MenuItemExportHTML: TMenuItem;
MenuItemDivider9: TMenuItem;
TT_Cut: TToolButton;
TT_Copy: TToolButton;
TT_Paste: TToolButton;
ToolButton9: TToolButton;
UpdateTimer: TTimer;
ToolButton3: TToolButton;
UpdateButton: TToolButton;
TT_Update: TToolButton;
UpdateMenuButton: TMenuItem;
MenuitemFillFunctionList: TMenuItem;
MenuItemFunctionList: TMenuItem;
@ -280,7 +284,8 @@ type
procedure SpeedButtonSearchClick(Sender: TObject);
procedure SplitterFunctionListCanResize(Sender: TObject; var NewSize: Integer;
var Accept: Boolean);
procedure UpdateButtonClick(Sender: TObject);
procedure TrayPopupPopup(Sender: TObject);
procedure TT_UpdateClick(Sender: TObject);
procedure UpdateMenuButtonClick(Sender: TObject);
procedure UpdateTimerCheck(Sender: TObject);
private
@ -290,6 +295,7 @@ type
LastTab : integer;
function GetScriptState: TScriptState;
procedure SetScriptState(const State: TScriptState);
function LoadSettingDef(Key : string; Def : string) : string;
public
DebugStream: String;
SearchString : string;
@ -312,10 +318,9 @@ type
procedure PauseScript;
procedure StopScript;
procedure AddTab;
function DeleteTab( TabIndex : integer; CloseLast : boolean) : boolean;
function DeleteTab( TabIndex : integer; CloseLast : boolean; Silent : boolean = false) : boolean;
procedure ClearTab( TabIndex : integer);
procedure CloseTabs( Exclude : integer);overload;//-1 for none
procedure CloseTabs;overload;
procedure CloseTabs(Exclude: integer = -1; Silent : boolean = false); //-1 for no exclusion
procedure SetEditActions;
procedure DoSearch(Next : boolean; HighlightAll : boolean);
procedure RefreshTab;//Refreshes all the form items that depend on the Script (Panels, title etc.)
@ -429,10 +434,21 @@ begin
NewSize := ScriptPanel.Width div 2;
end;
procedure TForm1.UpdateButtonClick(Sender: TObject);
procedure TForm1.TrayPopupPopup(Sender: TObject);
begin
MenuItemHide.enabled:= Form1.Visible;
{$ifdef MSWindows}
MenuItemShow.Enabled:= not Form1.Visible;
if Form1.Visible then
if Form1.CanFocus then
form1.SetFocus;
{$endif}
end;
procedure TForm1.TT_UpdateClick(Sender: TObject);
begin
SimbaUpdateForm.ShowModal;
UpdateButton.Visible:=False;
TT_Update.Visible:=False;
end;
procedure TForm1.UpdateTimerCheck(Sender: TObject);
@ -441,22 +457,18 @@ var
time:integer;
begin
chk := SettingsForm.Settings.GetSetLoadSaveDefaultKeyValueIfNotExists(
'Settings/Updater/CheckForUpdates',
'True', SimbaSettingsFile);
chk := LoadSettingDef('Settings/Updater/CheckForUpdates','True');
if chk <> 'True' then
Exit;
if SimbaUpdateForm.CanUpdate then
begin;
UpdateButton.Visible:=True;
TT_Update.Visible:=True;
formWriteln('A new update of Simba is available!');
end;
time := StrToIntDef(SettingsForm.Settings.GetSetLoadSaveDefaultKeyValueIfNotExists(
'Settings/Updater/CheckEveryXMinutes','30', SimbaSettingsFile)
,30);
time := StrToIntDef(LoadSettingDef('Settings/Updater/CheckEveryXMinutes','30'),30);
UpdateTimer.Interval:= time {mins} * 60 {secs} * 1000 {ms};//Every half hour
end;
@ -528,20 +540,15 @@ begin
if ScriptFile <> '' then
ScriptPath := ExtractFileDir(ScriptFile);
AppPath:= MainDir + DS;
includePath:= SettingsForm.Settings.GetSetLoadSaveDefaultKeyValueIfNotExists(
'Settings/Includes/Path',
IncludeTrailingPathDelimiter(ExpandFileName(MainDir+
DS + '..' + DS + '..' + ds)) + 'Includes' + DS,
SimbaSettingsFile);
fontPath := SettingsForm.Settings.GetSetLoadSaveDefaultKeyValueIfNotExists(
'Settings/Fonts/Path',
IncludeTrailingPathDelimiter(ExpandFileName(MainDir+
DS + '..' + DS + '..' + ds)) + 'Fonts' + DS,
SimbaSettingsFile);
PluginsPath := SettingsForm.Settings.GetSetLoadSaveDefaultKeyValueIfNotExists(
'Settings/Plugins/Path',
ExpandFileName(MainDir + DS + '..' + DS + '..'+ DS + 'Plugins'+ DS),
SimbaSettingsFile);
includePath:= LoadSettingDef('Settings/Includes/Path',
IncludeTrailingPathDelimiter(ExpandFileName(MainDir+
DS + '..' + DS + '..' + ds)) + 'Includes' + DS);
fontPath := LoadSettingDef('Settings/Fonts/Path',
IncludeTrailingPathDelimiter(ExpandFileName(MainDir+
DS + '..' + DS + '..' + ds)) + 'Fonts' + DS);
PluginsPath := LoadSettingDef('Settings/Plugins/Path',
ExpandFileName(MainDir + DS + '..' + DS + '..'+ DS + 'Plugins'+ DS));
if not DirectoryExists(PluginsPath) and not assigned(PluginsGlob) then
begin
if FirstRun then
@ -564,8 +571,7 @@ begin
ScriptThread.Client.MWindow.SetWindow(Self.Window);
loadFontsOnScriptStart := SettingsForm.Settings.GetSetLoadSaveDefaultKeyValueIfNotExists(
'Settings/Fonts/LoadOnStartUp', 'True', SimbaSettingsFile);
loadFontsOnScriptStart := LoadSettingDef('Settings/Fonts/LoadOnStartUp', 'True');
// Copy our current fonts
if not assigned(Self.OCR_Fonts) and (lowercase(loadFontsOnScriptStart) = 'true') and DirectoryExists(fontPath) then
begin
@ -657,15 +663,23 @@ begin;
end;
end;
function TForm1.DeleteTab(TabIndex: integer; CloseLast : boolean) : boolean;
function TForm1.DeleteTab(TabIndex: integer; CloseLast : boolean; Silent : boolean = false) : boolean;
var
Tab : TMufasaTab;
OldIndex : integer;//So that we can switch back, if needed.
begin
OldIndex := PageControl1.TabIndex;
if TabIndex = OldIndex then //We are closing the 'current' tab, lets go back in history
OldIndex := LastTab;
PageControl1.TabIndex:= TabIndex;
if not Silent then
begin;
OldIndex := PageControl1.TabIndex;
if TabIndex = OldIndex then
begin;
if lowercase(LoadSettingDef('Settings/Tabs/OpenNextOnClose','False')) = 'false' then
OldIndex := LastTab //We are closing the 'current' tab, lets go back in history
else
OldIndex := Min(Tabs.Count - 1,OldIndex + 1);
end;
PageControl1.TabIndex:= TabIndex;
end;
//ScriptFrame now is now correct ;-D
result := CanExitOrOpen;
if not result then
@ -677,17 +691,21 @@ begin
begin;
Tab.Free;
Tabs.Delete(TabIndex);
if OldIndex > TabIndex then
PageControl1.TabIndex := OldIndex - 1
else if OldIndex < TabIndex then
PageControl1.TabIndex := OldIndex;
if not Silent then
begin;
if OldIndex > TabIndex then
PageControl1.TabIndex := OldIndex - 1
else if OldIndex < TabIndex then
PageControl1.TabIndex := OldIndex;
end;
end;
if tabs.count <= 1 then
begin;
TB_SaveAll.Enabled:= false;
MenuItemSaveAll.Enabled:= false;
end;
RefreshTab;
if not silent then
RefreshTab;
end;
procedure TForm1.ClearTab(TabIndex: integer);
@ -695,21 +713,16 @@ begin
TMufasaTab(Tabs[TabIndex]).Clear;
end;
procedure TForm1.CloseTabs(Exclude: integer);
procedure TForm1.CloseTabs(Exclude: integer = -1; Silent : boolean = false);
var
I : integer;
begin
for i := tabs.count - 1 downto 0 do
if i <> exclude then
if not DeleteTab(i,false) then
if not DeleteTab(i,false,silent) then
exit;
end;
procedure TForm1.CloseTabs;
begin
CloseTabs(-1);
end;
procedure TForm1.SetEditActions;
procedure EditActions(Undo,Redo,Cut,Copy,Paste,Delete : boolean);
begin;
@ -719,6 +732,9 @@ begin;
ActionCopy.Enabled:= Copy;
ActionPaste.Enabled:= Paste;
ActionDelete.Enabled:= Delete;
TT_Cut.Enabled:= Cut;
TT_Paste.Enabled:=Paste;
TT_Copy.enabled := Copy;
end;
var
@ -730,15 +746,17 @@ begin
with CurrScript.SynEdit do
begin
EditActions(CanUndo,CanRedo,SelText <> '',SelText <> '',CanPaste,SelText <> '');
B:= SelText <> '';
// B:= SelText <> '';
B := SelAvail;
PopupItemFind.Enabled:= B;
PopupItemReplace.Enabled:= B;
if(B)then
begin
if(Length(SelText) > 13)then
S:= Format('"%s"', [Copy(SelText, 1, 10) + '...'])
s := SelText;
if(Length(S) > 13)then
S:= Format('"%s"', [Copy(S, 1, 10) + '...'])
else
S:= Format('"%s"', [SelText]);
S:= Format('"%s"', [S]);
PopupItemFind.Caption:= 'Find next: ' + S;
PopupItemReplace.Caption:= 'Replace: ' + S;
end;
@ -1420,28 +1438,32 @@ var
Temp2Node : TTreeNode;
Tree : TTreeView;
begin
Methods := TMMLPSThread.GetExportedMethods;
Tree := frmFunctionList.FunctionList;
Tree.Items.Clear;
Sections := TStringList.Create;
LastSection := '';
frmFunctionList.ScriptNode := Tree.Items.Add(nil,'Script');
for i := 0 to high(Methods) do
if frmFunctionList.FunctionList.Items.Count = 0 then
begin;
if Methods[i].Section <> LastSection then
Methods := TMMLPSThread.GetExportedMethods;
Tree := frmFunctionList.FunctionList;
Tree.Items.Clear;
Sections := TStringList.Create;
LastSection := '';
frmFunctionList.ScriptNode := Tree.Items.Add(nil,'Script');
for i := 0 to high(Methods) do
begin;
LastSection := Methods[i].Section;
Index := Sections.IndexOf(LastSection);
if Index <> -1 then
TempNode := Tree.Items.Item[index]
else
begin
TempNode := Tree.Items.Add(nil,LastSection);
Sections.Add(LastSection);
if Methods[i].Section <> LastSection then
begin;
LastSection := Methods[i].Section;
Index := Sections.IndexOf(LastSection);
if Index <> -1 then
TempNode := Tree.Items.Item[index]
else
begin
TempNode := Tree.Items.Add(nil,LastSection);
Sections.Add(LastSection);
end;
end;
Temp2Node := Tree.Items.AddChild(Tempnode,GetMethodName(Methods[i].FuncDecl,false));
Temp2Node.Data:= strnew(PChar(Methods[i].FuncDecl));
end;
Temp2Node := Tree.Items.AddChild(Tempnode,GetMethodName(Methods[i].FuncDecl,false));
Temp2Node.Data:= strnew(PChar(Methods[i].FuncDecl));
Sections.free;
end;
frmFunctionList.LoadScriptTree(CurrScript.SynEdit.Text);
end;
@ -1498,9 +1520,7 @@ begin
Picker.Pick(c, x, y);
cobj := TColourPickerObject.Create(c, Point(x,y), '');
if lowercase(SettingsForm.Settings.GetSetLoadSaveDefaultKeyValueIfNotExists(
'Settings/ColourPicker/ShowHistoryOnPick', 'True', SimbaSettingsFile
)) = 'true' then
if lowercase(LoadSettingDef('Settings/ColourPicker/ShowHistoryOnPick', 'True')) = 'true' then
begin
ColourHistoryForm.AddColObj(cobj, true);
ColourHistoryForm.Show;
@ -1635,6 +1655,11 @@ begin
end;
end;
function TForm1.LoadSettingDef(Key: string; Def: string): string;
begin
result := SettingsForm.Settings.GetSetLoadSaveDefaultKeyValueIfNotExists(Key,def,SimbaSettingsFile);
end;
procedure TForm1.FunctionListShown(ShowIt: boolean);
var
Node : TTreeNode;