1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-22 09:12:19 -05:00

Redesigned the way RecentFiles are saved/loaded.

This commit is contained in:
Raymond 2010-04-15 16:47:21 +02:00
parent 1e0ccf34ef
commit 9d8f4f39fb

View File

@ -1171,13 +1171,15 @@ begin
else else
// if str = 'normal' then // if str = 'normal' then
Self.WindowState := wsNormal; Self.WindowState := wsNormal;
if SettingExtists('LastConfig/MainForm/RecentFiles/Count') then
str := LoadSettingDef('LastConfig/MainForm/RecentFiles',''); begin;
if str <> '' then ii := StrToIntDef(LoadSettingDef('LastConfig/MainForm/RecentFiles/Count','-1'),-1);
for i := 0 to ii do
begin begin
Data := Explode(';',str); str := LoadSettingDef('LastConfig/MainForm/RecentFiles/File' + inttostr(I),'');
for i := high(data) downto 0 do//First = entry should be added as last if str <> '' then
AddRecentFile(data[i]); AddRecentFile(str);
end;
end; end;
str := LowerCase(LoadSettingDef('Settings/FunctionList/ShowOnStart','True')); str := LowerCase(LoadSettingDef('Settings/FunctionList/ShowOnStart','True'));
str2 := lowercase(LoadSettingDef('LastConfig/MainForm/FunctionListShown','')); str2 := lowercase(LoadSettingDef('LastConfig/MainForm/FunctionListShown',''));
@ -1211,14 +1213,14 @@ begin
Data := ConvArr([inttostr(Self.left),inttostr(self.top),inttostr(self.width),inttostr(self.height)]); Data := ConvArr([inttostr(Self.left),inttostr(self.top),inttostr(self.width),inttostr(self.height)]);
SetSetting('LastConfig/MainForm/Position', Implode(':',Data )); SetSetting('LastConfig/MainForm/Position', Implode(':',Data ));
end; end;
DeleteKey('LastConfig/MainForm/RecentFiles');
if RecentFiles.Count > 0 then if RecentFiles.Count > 0 then
begin begin
SetSetting('LastConfig/MainForm/RecentFiles/Count',inttostr(RecentFiles.Count));
SetLength(data,RecentFiles.Count); SetLength(data,RecentFiles.Count);
for i := 0 to high(data) do //First entry should be the last-opened for i := 0 to RecentFiles.Count - 1 do
data[high(data) - i] := RecentFiles[i]; SetSetting('LastConfig/MainForm/RecentFiles/File'+inttostr(i),RecentFiles[i]);
SetSetting('LastConfig/MainForm/RecentFiles',implode(';',data)); end;
end else
SetSetting('LastConfig/MainForm/RecentFiles','');
if MenuItemFunctionList.Checked then if MenuItemFunctionList.Checked then
SetSetting('LastConfig/MainForm/FunctionListShown','True') SetSetting('LastConfig/MainForm/FunctionListShown','True')
else else