1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-21 08:45:06 -05:00

Resolve bug #222.

This commit is contained in:
Merlijn Wajer 2011-09-28 23:00:21 +02:00
parent c7a6f55b66
commit b11cf8bd53
2 changed files with 163 additions and 95 deletions

View File

@ -0,0 +1,55 @@
ssCheckUpdate = 'Settings/Updater/CheckForUpdates';
ssCheckUpdateMinutes = 'Settings/Updater/CheckEveryXMinutes';
ssUpdaterLink = 'Settings/Updater/RemoteLink';
ssUpdaterVersionLink = 'Settings/Updater/RemoteVersionLink';
ssLoadFontsOnStart = 'Settings/Fonts/LoadOnStartUp';
ssFontsVersion = 'Settings/Fonts/Version';
ssFontsLink = 'Settings/Fonts/UpdateLink';
ssFontsVersionLink = 'Settings/Fonts/VersionLink';
ssFontsPath = 'Settings/Fonts/Path';
ssIncludesPath = 'Settings/Includes/Path';
ssInterpreterType = 'Settings/Interpreter/Type';
ssTabsOpenNextOnClose = 'Settings/Tabs/OpenNextOnClose';
ssTabsOpenScriptInNewTab = 'Settings/Tabs/OpenScriptInNewTab';
ssTabsCheckBeforeOpen = 'Settings/Tabs/CheckTabsBeforeOpen';
ssColourPickerShowHistoryOnPick = 'Settings/ColourPicker/ShowHistoryOnPick';
ssColourPickerAddToHistoryOnPick = 'Settings/ColourPicker/AddToHistoryOnPick';
ssScriptsPath = 'Settings/Scripts/Path';
ssCodeHintsShowAutomatically = 'Settings/CodeHints/ShowAutomatically';
ssCodeCompletionShowAutomatically = 'Settings/CodeCompletion/ShowAutomatically';
ssExtensionsFileExtension = 'Settings/Extensions/FileExtension';
ssSourceEditorLazColors = 'Settings/SourceEditor/LazColors';
ssSourceEditorDefScriptPath = 'Settings/SourceEditor/DefScriptPath';
ssNewsLink = 'Settings/News/URL';
ssPluginsPath = 'Settings/Plugins/Path';
ssExtensionsExtensionN = 'Extensions/Extension';
ssExtensionsPath = 'Settings/Extensions/Path';
ssExtensionsCount = 'Extensions/ExtensionCount';
ssTrayAlwaysVisible = 'Settings/Tray/AlwaysVisible';
ssConsoleVisible = 'LastConfig/Console/Visible';
ssMainFormPosition = 'LastConfig/MainForm/Position';
ssMainFormState = 'LastConfig/MainForm/State';
ssMainFormNormalSize = 'Settings/MainForm/NormalSize';
ssFunctionListShown = 'LastConfig/MainForm/FunctionListShown';
ssFunctionListShowOnStart = 'Settings/FunctionList/ShowOnStart';
ssMaxRecentFiles = 'Settings/General/MaxRecentFiles';
ssRecentFiles = 'LastConfig/MainForm/RecentFiles';
ssRecentFilesCount = 'LastConfig/MainForm/RecentFiles/Count';
ssRecentFileN = 'LastConfig/MainForm/RecentFiles/File';

View File

@ -82,6 +82,8 @@ const
shortcut_PickColourKey = VK_P;
{$ENDIF}
{$I settings_const.inc}
type
{ TMufasaTab }
@ -768,7 +770,7 @@ end;
function TSimbaForm.GetInterpreter: Integer;
begin
result := StrToIntDef(LoadSettingDef('Settings/Interpreter/Type','0'),0);
result := StrToIntDef(LoadSettingDef(ssInterpreterType, '0'),0);
if (result < 0) or (result > 2) then
begin
SetInterpreter(0);
@ -778,12 +780,12 @@ end;
function TSimbaForm.GetDefScriptPath: string;
begin
result :=LoadSettingDef('Settings/SourceEditor/DefScriptPath', ExpandFileName(MainDir+DS+'default.simba'));
result :=LoadSettingDef(ssSourceEditorDefScriptPath, ExpandFileName(MainDir+DS+'default.simba'));
end;
function TSimbaForm.GetScriptPath: string;
begin
result :=IncludeTrailingPathDelimiter(LoadSettingDef('Settings/Scripts/Path', ExpandFileName(MainDir+DS+'Scripts' + DS)));
result :=IncludeTrailingPathDelimiter(LoadSettingDef(ssScriptsPath, ExpandFileName(MainDir+DS+'Scripts' + DS)));
end;
procedure TSimbaForm.HandleOpenFileData;
@ -992,7 +994,7 @@ var
begin
UpdateTimer.Interval:= MaxInt;
FontUpdate;
chk := LowerCase(LoadSettingDef('Settings/Updater/CheckForUpdates','True'));
chk := LowerCase(LoadSettingDef(ssCheckUpdate, 'True'));
if chk <> 'true' then
Exit;
@ -1008,7 +1010,7 @@ begin
mDebugLn(format('Current Simba version: %d',[SimbaVersion]));
mDebugLn('Latest Simba Version: ' + IntToStr(LatestVersion));
end;
time := StrToIntDef(LoadSettingDef('Settings/Updater/CheckEveryXMinutes','30'),30);
time := StrToIntDef(LoadSettingDef(ssCheckUpdateMinutes, '30'),30);
UpdateTimer.Interval:= time {mins} * 60 {secs} * 1000 {ms};//Every half hour
end;
@ -1154,7 +1156,7 @@ begin
OldIndex := PageControl1.TabIndex;
if TabIndex = OldIndex then
begin;
if lowercase(LoadSettingDef('Settings/Tabs/OpenNextOnClose','False')) = 'false' then
if lowercase(LoadSettingDef(ssTabsOpenNextOnClose, 'False')) = 'false' then
OldIndex := LastTab //We are closing the 'current' tab, lets go back in history
else
OldIndex := Min(Tabs.Count - 1,OldIndex + 1);
@ -1364,43 +1366,52 @@ procedure TSimbaForm.CreateDefaultEnvironment;
var
PluginsPath,extensionsPath : string;
begin
CreateSetting('Settings/Updater/CheckForUpdates','True');
CreateSetting('Settings/Updater/CheckEveryXMinutes','30');
CreateSetting('Settings/Interpreter/Type', '0');
CreateSetting('Settings/Fonts/LoadOnStartUp', 'True');
CreateSetting('Settings/Fonts/Version','-1');
CreateSetting('Settings/Tabs/OpenNextOnClose','False');
CreateSetting('Settings/Tabs/OpenScriptInNewTab','True');
CreateSetting('Settings/Tabs/CheckTabsBeforeOpen','True');
CreateSetting('Settings/ColourPicker/ShowHistoryOnPick', 'True');
CreateSetting('Settings/General/MaxRecentFiles','10');
CreateSetting('Settings/MainForm/NormalSize','739:555');
CreateSetting('Settings/FunctionList/ShowOnStart','True');
CreateSetting('Settings/CodeHints/ShowAutomatically','True');
CreateSetting('Settings/CodeCompletion/ShowAutomatically','True');
CreateSetting('Settings/SourceEditor/LazColors','True');
{$IFDEF USE_EXTENSIONS}CreateSetting('Settings/Extensions/FileExtension','sex');{$ENDIF}
CreateSetting(ssCheckUpdate, 'True');
CreateSetting(ssCheckUpdateMinutes, '30');
CreateSetting(ssInterpreterType, '0');
CreateSetting(ssLoadFontsOnStart, 'True');
CreateSetting(ssFontsVersion, '-1');
CreateSetting(ssTabsOpenNextOnClose, 'False');
CreateSetting(ssTabsOpenScriptInNewTab, 'True');
CreateSetting(ssTabsCheckBeforeOpen, 'True');
CreateSetting(ssColourPickerShowHistoryOnPick, 'True');
CreateSetting(ssMaxRecentFiles, '10');
CreateSetting(ssMainFormNormalSize, '739:555');
CreateSetting(ssFunctionListShowOnStart, 'True');
CreateSetting(ssCodeHintsShowAutomatically, 'True');
CreateSetting(ssCodeCompletionShowAutomatically, 'True');
CreateSetting(ssSourceEditorLazColors, 'True');
CreateSetting('Settings/Updater/RemoteLink',SimbaURL + 'Simba'{$IFDEF WINDOWS} +'.exe'{$ENDIF});
CreateSetting('Settings/Updater/RemoteVersionLink',SimbaURL + 'Version');
CreateSetting('Settings/Fonts/VersionLink', FontURL + 'Version');
CreateSetting('Settings/Fonts/UpdateLink', FontURL + 'Fonts.tar.bz2');
{$IFDEF USE_EXTENSIONS}
CreateSetting(ssExtensionsFileExtension, 'sex');
{$ENDIF}
CreateSetting('Settings/News/URL', 'http://simba.villavu.com/bin/news');
CreateSetting(ssUpdaterLink, SimbaURL + 'Simba'{$IFDEF WINDOWS} +'.exe'{$ENDIF});
CreateSetting(ssUpdaterVersionLink, SimbaURL + 'Version');
CreateSetting(ssFontsVersionLink, FontURL + 'Version');
CreateSetting(ssFontsLink, FontURL + 'Fonts.tar.bz2');
CreateSetting(ssNewsLink, 'http://simba.villavu.com/bin/news');
{Creates the paths and returns the path}
PluginsPath := CreateSetting('Settings/Plugins/Path', ExpandFileName(MainDir+ DS+ 'Plugins' + DS));
PluginsPath := CreateSetting(ssPluginsPath, ExpandFileName(MainDir + DS + 'Plugins' + DS));
{$IFDEF USE_EXTENSIONS}
extensionsPath := CreateSetting('Settings/Extensions/Path',ExpandFileName(MainDir +DS + 'Extensions' + DS));
CreateSetting('Extensions/ExtensionCount','0');
extensionsPath := CreateSetting(ssExtensionsPath,
ExpandFileName(MainDir +DS + 'Extensions' + DS));
CreateSetting(ssExtensionsCount, '0');
{$ENDIF}
CreateSetting('LastConfig/MainForm/Position','');
CreateSetting('LastConfig/MainForm/State','Normal');
CreateSetting(ssMainFormPosition, '');
CreateSetting(ssMainFormState, 'Normal');
{$ifdef MSWindows}
CreateSetting('LastConfig/Console/Visible','False');
CreateSetting(ssConsoleVisible, 'False');
ShowConsole(False);
{$endif}
CreateSetting('Settings/Tray/AlwaysVisible', 'True');
CreateSetting(ssTrayAlwaysVisible, 'True');
if not DirectoryExists(IncludePath) then
CreateDir(IncludePath);
if not DirectoryExists(FontPath) then
@ -1429,7 +1440,7 @@ var
i,ii : integer;
begin
self.BeginFormUpdate;
str := LoadSettingDef('LastConfig/MainForm/Position','');
str := LoadSettingDef(ssMainFormPosition, '');
if str <> '' then
begin;
Data := Explode(':',str);
@ -1440,36 +1451,38 @@ begin
Self.Width:= StrToIntDef(Data[2],self.width);
Self.Height:= StrToIntDef(Data[3],self.height);
end;
str := lowercase(LoadSettingDef('LastConfig/MainForm/State','Normal'));
str := lowercase(LoadSettingDef(ssMainFormState, 'Normal'));
if str = 'maximized' then
self.windowstate := wsMaximized
else
// if str = 'normal' then
Self.WindowState := wsNormal;
if SettingExists('LastConfig/MainForm/RecentFiles/Count') then
if SettingExists(ssRecentFilesCount) then
begin;
ii := StrToIntDef(LoadSettingDef('LastConfig/MainForm/RecentFiles/Count','-1'),-1);
ii := StrToIntDef(LoadSettingDef(ssRecentFilesCount, '-1'), -1);
for i := 0 to ii do
begin
str := LoadSettingDef('LastConfig/MainForm/RecentFiles/File' + inttostr(I),'');
str := LoadSettingDef(ssRecentFileN + inttostr(I),'');
if str <> '' then
AddRecentFile(str);
end;
end;
str := LowerCase(LoadSettingDef('Settings/FunctionList/ShowOnStart','True'));
str2 := lowercase(LoadSettingDef('LastConfig/MainForm/FunctionListShown',''));
str := LowerCase(LoadSettingDef(ssFunctionListShowOnStart, 'True'));
str2 := lowercase(LoadSettingDef(ssFunctionListShown, ''));
if (str = 'true') or (str2 = 'true') then
FunctionListShown(True)
else
FunctionListShown(false);
{$ifdef MSWindows}
str := LowerCase(LoadSettingDef('LastConfig/Console/Visible','True'));
str := LowerCase(LoadSettingDef(ssConsoleVisible, 'True'));
if str = 'true' then
ShowConsole(True)
else
ShowConsole(false);
{$endif}
if Lowercase(LoadSettingDef('Settings/Tray/AlwaysVisible', 'True')) <> 'true' then
if Lowercase(LoadSettingDef(ssTrayAlwaysVisible, 'True')) <> 'true' then
begin
MTrayIcon.Hide;
writeln('Hiding tray.');
@ -1488,36 +1501,36 @@ begin
with SettingsForm.Settings do
begin
if Self.WindowState = wsMaximized then
SetSetting('LastConfig/MainForm/State','maximized')
SetSetting(ssMainFormState, 'maximized')
else
begin; //Only save the form position if its not maximized.
SetSetting('LastConfig/MainForm/State','normal');
SetSetting(ssMainFormState, 'normal');
Data := ConvArr([inttostr(Self.left),inttostr(self.top),inttostr(self.width),inttostr(self.height)]);
SetSetting('LastConfig/MainForm/Position', Implode(':',Data ));
SetSetting(ssMainFormPosition, Implode(':',Data ));
end;
DeleteKey('LastConfig/MainForm/RecentFiles');
DeleteKey(ssRecentFiles);
if RecentFiles.Count > 0 then
begin
SetSetting('LastConfig/MainForm/RecentFiles/Count',inttostr(RecentFiles.Count));
SetSetting(ssRecentFiles + '/Count', inttostr(RecentFiles.Count));
SetLength(data,RecentFiles.Count);
for i := 0 to RecentFiles.Count - 1 do
SetSetting('LastConfig/MainForm/RecentFiles/File'+inttostr(i),RecentFiles[i]);
SetSetting(ssRecentFileN + inttostr(i),RecentFiles[i]);
end;
if MenuItemFunctionList.Checked then
SetSetting('LastConfig/MainForm/FunctionListShown','True')
SetSetting(ssFunctionListShown, 'True')
else
SetSetting('LastConfig/MainForm/FunctionListShown','False');
SetSetting(ssFunctionListShown, 'False');
{$ifdef MSWindows}
if ConsoleVisible then
SetSetting('LastConfig/Console/Visible','True')
SetSetting(ssConsoleVisible, 'True')
else
SetSetting('LastConfig/Console/Visible','False');
SetSetting(ssConsoleVisible, 'False');
{$endif}
{$IFDEF USE_EXTENSIONS}
SetSetting('Extensions/ExtensionCount',inttostr(ExtManager.Extensions.Count));
SetSetting(ssExtensionsCount, inttostr(ExtManager.Extensions.Count));
for i := 0 to ExtManager.Extensions.Count-1 do
begin;
path :='Extensions/Extension' + inttostr(I);
path := ssExtensionsExtensionN + inttostr(I);
SetSetting(Path + '/Path',TVirtualSimbaExtension(ExtManager.Extensions[i]).Filename);
SetSetting(Path + '/Enabled',BoolToStr(TVirtualSimbaExtension(ExtManager.Extensions[i]).Enabled,True));
end;
@ -1539,7 +1552,7 @@ var
result := false;
if (number < 0) or (number >= extCount) then
exit;
path := 'Extensions/Extension' + inttostr(number);
path := ssExtensionsExtensionN + inttostr(number);
if SettingExists(Path) = false then
exit;
ExtPath := LoadSettingDef(Path + '/Path','');
@ -1555,11 +1568,11 @@ var
i : integer;
path : string;
begin;
path := 'Extensions/Extension';
path := ssExtensionsExtensionN;
SettingsForm.Settings.DeleteKey(path + inttostr(number));
for i := number + 1 to extCount - 1 do
SettingsForm.Settings.RenameKey(path + inttostr(i),'Extension' + inttostr(i-1));
SetSetting('Extensions/ExtensionCount',inttostr(extCount - 1),true);
SetSetting(ssExtensionsCount, inttostr(extCount - 1),true);
dec(extCount);
end;
@ -1567,13 +1580,13 @@ var
str,str2 : string;
i : integer;
begin
extCount := StrToIntDef(LoadSettingDef('Extensions/ExtensionCount/','0'),0);
extCount := StrToIntDef(LoadSettingDef(ssExtensionsCount, '0'),0);
for i := 0 to extCount - 1 do
while (i < extCount) and not LoadExtension(i) do
DeleteExtension(i);
SetSetting('Extensions/ExtensionCount',inttostr(extCount));
str := LoadSettingDef('Settings/Extensions/Path',ExpandFileName(MainDir +DS + 'Extensions' + DS));
str2 := LoadSettingDef('Settings/Extensions/FileExtension','sex');
SetSetting(ssExtensionsCount, inttostr(extCount));
str := LoadSettingDef(ssExtensionsPath, ExpandFileName(MainDir +DS + 'Extensions' + DS));
str2 := LoadSettingDef(ssExtensionsFileExtension, 'sex');
ExtManager.LoadPSExtensionsDir(str,str2);
{$ELSE}
begin
@ -1585,7 +1598,7 @@ var
MaxRecentFiles : integer;
Len,i : integer;
begin
MaxRecentFiles:= StrToIntDef(LoadSettingDef('Settings/General/MaxRecentFiles','10'),10);
MaxRecentFiles:= StrToIntDef(LoadSettingDef(ssMaxRecentFiles, '10'), 10);
i := RecentFiles.IndexOf(filename);
if i <> -1 then
RecentFiles.Delete(i);
@ -1674,7 +1687,7 @@ begin
if selector.haspicked then
Thread.Client.IOManager.SetTarget(Selector.LastPick);
loadFontsOnScriptStart := (lowercase(LoadSettingDef('Settings/Fonts/LoadOnStartUp', 'True')) = 'true');
loadFontsOnScriptStart := (lowercase(LoadSettingDef(ssLoadFontsOnStart, 'True')) = 'true');
if (loadFontsOnScriptStart) then
begin
@ -1930,12 +1943,12 @@ var
SizeStr : string;
Data : TStringArray;
begin
SizeStr := LoadSettingDef('Settings/MainForm/NormalSize','739:555');
SizeStr := LoadSettingDef(ssMainFormNormalSize, '739:555');
Data := Explode(':',SizeStr);
if length(Data) = 2 then
begin
Self.Width:= StrToIntDef(Data[0],739);
Self.Height:= StrToIntDef(Data[1],555);
Self.Width:= StrToIntDef(Data[0], 739);
Self.Height:= StrToIntDef(Data[1], 555);
end else
begin;
self.width := 739;
@ -2812,7 +2825,7 @@ end;
procedure TSimbaForm.MTrayIconClick(Sender: TObject);
begin
self.Show;
if Lowercase(LoadSettingDef('Settings/Tray/AlwaysVisible', 'True')) <> 'true' then
if Lowercase(LoadSettingDef(ssTrayAlwaysVisible, 'True')) <> 'true' then
MTrayIcon.Hide;
if Self.CanFocus then
self.SetFocus;
@ -2822,7 +2835,7 @@ function TSimbaForm.GetSimbaNews: String;
var
t: TDownloadThread;
begin
t := TDownloadThread.Create(LoadSettingDef('Settings/News/URL', 'http://Simba.villavu.com/bin/news'),
t := TDownloadThread.Create(LoadSettingDef(ssNewsLink, 'http://Simba.villavu.com/bin/news'),
@Result);
t.Resume;
while not t.done do
@ -2834,13 +2847,13 @@ end;
procedure TSimbaForm.SetDefScriptPath(const AValue: string);
begin
SetSetting('Settings/SourceEditor/DefScriptPath',AValue,True);
SetSetting(ssSourceEditorDefScriptPath, AValue,True);
end;
{$IFDEF USE_EXTENSIONS}
procedure TSimbaForm.SetExtPath(const AValue: string);
begin
SetSetting('Settings/Extensions/Path',AValue,true);
SetSetting(ssExtensionsPath, AValue,true);
end;
{$ENDIF}
@ -2881,10 +2894,10 @@ begin
cobj := TColourPickerObject.Create(c, Classes.Point(x,y), '');
{ TODO: This should be no problem if the form is hidden? }
if lowercase(LoadSettingDef('Settings/ColourPicker/AddToHistoryOnPick', 'True')) = 'true' then
if lowercase(LoadSettingDef(ssColourPickerAddToHistoryOnPick, 'True')) = 'true' then
ColourHistoryForm.AddColObj(cobj, true);
if lowercase(LoadSettingDef('Settings/ColourPicker/ShowHistoryOnPick', 'True')) = 'true' then
if lowercase(LoadSettingDef(ssColourPickerShowHistoryOnPick, 'True')) = 'true' then
ColourHistoryForm.Show;
FormWritelnEx('Picked colour: ' + inttostr(c) + ' at (' + inttostr(x) + ', ' + inttostr(y) + ')');
@ -3004,34 +3017,34 @@ end;
function TSimbaForm.GetShowParamHintAuto: boolean;
begin
Result := LowerCase(LoadSettingDef('Settings/CodeHints/ShowAutomatically','True')) = 'true';
Result := LowerCase(LoadSettingDef(ssCodeHintsShowAutomatically, 'True')) = 'true';
end;
function TSimbaForm.GetShowCodeCompletionAuto: boolean;
begin
Result := LowerCase(LoadSettingDef('Settings/CodeCompletion/ShowAutomatically','True')) = 'true';
Result := LowerCase(LoadSettingDef(ssCodeCompletionShowAutomatically, 'True')) = 'true';
end;
procedure TSimbaForm.SetFontPath(const AValue: String);
begin
SetSetting('Settings/Fonts/Path',AValue,true);
SetSetting(ssFontsPath, AValue,true);
end;
function TSimbaForm.GetFontPath: String;
begin
Result := IncludeTrailingPathDelimiter(LoadSettingDef('Settings/Fonts/Path', ExpandFileName(MainDir+DS+'Fonts' + DS)));
Result := IncludeTrailingPathDelimiter(LoadSettingDef(ssFontsPath, ExpandFileName(MainDir+DS+'Fonts' + DS)));
end;
{$IFDEF USE_EXTENSIONS}
function TSimbaForm.GetExtPath: string;
begin
Result := IncludeTrailingPathDelimiter(LoadSettingDef('Settings/Extensions/Path', ExpandFileName(MainDir+DS+'Extensions' + DS)));
Result := IncludeTrailingPathDelimiter(LoadSettingDef(ssExtensionsPath, ExpandFileName(MainDir+DS+'Extensions' + DS)));
end;
{$ENDIF}
function TSimbaForm.GetHighlighter: TSynCustomHighlighter;
begin
if lowercase(LoadSettingDef('Settings/SourceEditor/LazColors','True')) = 'true' then
if lowercase(LoadSettingDef(ssSourceEditorLazColors, 'True')) = 'true' then
result := LazHighlighter
else
result := SCARHighlighter;
@ -3039,17 +3052,17 @@ end;
function TSimbaForm.GetIncludePath: String;
begin
Result := IncludeTrailingPathDelimiter(LoadSettingDef('Settings/Includes/Path', ExpandFileName(MainDir+DS+'Includes' + DS)));
Result := IncludeTrailingPathDelimiter(LoadSettingDef(ssIncludesPath, ExpandFileName(MainDir+DS+'Includes' + DS)));
end;
function TSimbaForm.GetPluginPath: string;
begin
Result := IncludeTrailingPathDelimiter(LoadSettingDef('Settings/Plugins/Path', ExpandFileName(MainDir+DS+'Plugins' + DS)));
Result := IncludeTrailingPathDelimiter(LoadSettingDef(ssPluginsPath, ExpandFileName(MainDir+DS+'Plugins' + DS)));
end;
procedure TSimbaForm.SetIncludePath(const AValue: String);
begin
SetSetting('Settings/Includes/Path',AValue,true);
SetSetting(ssIncludesPath, AValue,true);
end;
procedure TSimbaForm.SetInterpreter(const AValue: Integer);
@ -3061,7 +3074,7 @@ begin
with CurrScript.Synedit do
if (Lines.text = DefaultScript) and not(CanUndo or CanRedo) then
UpdateCurrScript := true;
SetSetting('Settings/Interpreter/Type',Inttostr(AValue),true);
SetSetting(ssInterpreterType, Inttostr(AValue),true);
UpdateInterpreter;
if UpdateCurrScript then
CurrScript.SynEdit.Lines.text := DefaultScript;
@ -3069,12 +3082,12 @@ end;
procedure TSimbaForm.SetPluginPath(const AValue: string);
begin
SetSetting('Settings/Plugins/Path',AValue,true);
SetSetting(ssPluginsPath, AValue,true);
end;
procedure TSimbaForm.SetScriptPath(const AValue: string);
begin
SetSetting('Settings/Scripts/Path',AValue,True);
SetSetting(ssScriptsPath, AValue,True);
end;
procedure TSimbaForm.SetScriptState(const State: TScriptState);
@ -3147,12 +3160,12 @@ begin
if UpdatingFonts then
exit;
UpdatingFonts := True;
CurrVersion := StrToIntDef(LoadSettingDef('Settings/Fonts/Version','-1'),-1);
CurrVersion := StrToIntDef(LoadSettingDef(ssFontsVersion, '-1'), -1);
LatestVersion := SimbaUpdateForm.GetLatestFontVersion;
if LatestVersion > CurrVersion then
begin;
formWriteln(format('New fonts available. Current version: %d. Latest version: %d',[CurrVersion,LatestVersion]));
FontDownload := TDownloadThread.Create(LoadSettingDef('Settings/Fonts/UpdateLink',FontURL + 'Fonts.tar.bz2'),
FontDownload := TDownloadThread.Create(LoadSettingDef(ssFontsLink, FontURL + 'Fonts.tar.bz2'),
@Fonts);
FontDownload.resume;
while FontDownload.Done = false do
@ -3173,7 +3186,7 @@ begin
if UnTarrer.Result then
begin;
FormWriteln('Successfully installed the new fonts!');
SetSetting('Settings/Fonts/Version',IntToStr(LatestVersion),true);
SetSetting(ssFontsVersion, IntToStr(LatestVersion),true);
if Assigned(self.OCR_Fonts) then
self.OCR_Fonts.Free;
FormWriteln('Freeing the current fonts. Creating new ones now');
@ -3202,12 +3215,12 @@ end;
procedure TSimbaForm.SetShowParamHintAuto(const AValue: boolean);
begin
SetSetting('Settings/CodeHints/ShowAutomatically', Booltostr(AValue,true));
SetSetting(ssCodeHintsShowAutomatically, Booltostr(AValue,true));
end;
procedure TSimbaForm.SetShowCodeCompletionAuto(const AValue: boolean);
begin
SetSetting('Settings/CodeCompletion/ShowAutomatically', Booltostr(AValue,true));
SetSetting(ssCodeCompletionShowAutomatically, Booltostr(AValue,true));
end;
{$ifdef mswindows}
@ -3335,7 +3348,7 @@ var
OpenInNewTab : boolean;
begin
Result := False;
OpenInNewTab:= (LowerCase(LoadSettingDef('Settings/Tabs/OpenScriptInNewTab','True')) = 'true');
OpenInNewTab:= (LowerCase(LoadSettingDef(ssTabsOpenScriptInNewTab, 'True')) = 'true');
if not OpenInNewTab then
if CanExitOrOpen = false then
Exit;
@ -3347,7 +3360,7 @@ begin
InitialDir := ScriptDir;
Options := [ofAllowMultiSelect, ofExtensionDifferent, ofPathMustExist, ofFileMustExist, ofEnableSizing, ofViewDetail];
Filter:= 'Simba Files|*.simba;*.simb;*.cogat;*.mufa;*.txt' +
{$IFDEF USE_EXTENSIONS}';*.' + LoadSettingDef('Settings/Extensions/FileExtension', 'sex') + {$ENDIF}
{$IFDEF USE_EXTENSIONS}';*.' + LoadSettingDef(ssExtensionsFileExtension, 'sex') + {$ENDIF}
'|Any files|*.*';
if Execute then
begin
@ -3376,11 +3389,11 @@ begin
if AlwaysOpenInNewTab then
OpenInNewTab := true
else
OpenInNewTab:= (LowerCase(LoadSettingDef('Settings/Tabs/OpenScriptInNewTab','True')) = 'true');
OpenInNewTab:= (LowerCase(LoadSettingDef(ssTabsOpenScriptInNewTab,'True')) = 'true');
if CheckOtherTabs then
CheckTabsFirst := True
else
CheckTabsFirst := (Lowercase(LoadSettingDef('Settings/Tabs/CheckTabsBeforeOpen','True')) = 'true');
CheckTabsFirst := (Lowercase(LoadSettingDef(ssTabsCheckBeforeOpen, 'True')) = 'true');
if FileExistsUTF8(FileName) then
begin;
if CheckTabsFirst then
@ -3455,7 +3468,7 @@ begin
else
InitialDir := ScriptDir;
filter := 'Simba Files|*.simba;*.simb;*.cogat;*.mufa;*.txt' +
{$IFDEF USE_EXTENSIONS}';*.' + LoadSettingDef('Settings/Extensions/FileExtension','sex') + {$ENDIF}
{$IFDEF USE_EXTENSIONS}';*.' + LoadSettingDef(ssExtensionsFileExtension, 'sex') + {$ENDIF}
'|Any files|*.*';
if Execute then
begin;