Skip to content

Commit

Permalink
restore last tab in side-panel
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexey-T committed Sep 15, 2016
1 parent 36d6c39 commit 181a073
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 4 deletions.
26 changes: 24 additions & 2 deletions app/formmain.pas
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,7 @@ TfmMain = class(TForm)
procedure FrameLexerChange(Sender: TObject);
procedure FrameOnEditorClickEndSelect(Sender: TObject; APrevPnt, ANewPnt: TPoint);
procedure FrameOnEditorClickMoveCaret(Sender: TObject; APrevPnt, ANewPnt: TPoint);
function GetTabNameLeft: string;
procedure InitToolbar;
function IsAllowedToOpenFileNow: boolean;
function IsThemeNameExist(const AName: string; AThemeUI: boolean): boolean;
Expand All @@ -598,8 +599,9 @@ TfmMain = class(TForm)
procedure MsgStatusAlt(const S: string; const NSeconds: integer);
procedure SetFullScreen_Universal(AValue: boolean);
procedure SetFullScreen_Win32(AValue: boolean);
procedure SetThemeSyntax(AValue: string);
procedure SetThemeUi(AValue: string);
procedure SetTabNameLeft(const AValue: string);
procedure SetThemeSyntax(const AValue: string);
procedure SetThemeUi(const AValue: string);
function SFindOptionsToTextHint: string;
procedure StatusResize(Sender: TObject);
procedure TreeGetSyntaxRange(ANode: TTreeNode; out P1, P2: TPoint);
Expand All @@ -613,6 +615,7 @@ TfmMain = class(TForm)
procedure DoOps_SaveHistory_GroupView(c: TJsonConfig);
procedure DoOps_LoadHistory;
procedure DoOps_LoadHistory_GroupView(c: TJsonConfig);
procedure DoOps_LoadHistory_AfterOnStart;
procedure DoOps_SaveSession(fn_session: string);
procedure DoOps_LoadSession(fn_session: string);
procedure DoOps_LoadOptionsAndApplyAll;
Expand Down Expand Up @@ -772,6 +775,7 @@ TfmMain = class(TForm)
property ShowBottom: boolean read GetShowBottom write SetShowBottom;
property ThemeUi: string read FThemeUi write SetThemeUi;
property ThemeSyntax: string read FThemeSyntax write SetThemeSyntax;
property TabNameLeft: string read GetTabNameLeft write SetTabNameLeft;
function DoPyEvent(AEd: TATSynEdit; AEvent: TAppPyEvent; const AParams: array of string): string;
procedure DoPyCommand(const AModule, AMethod: string; const AParam: string='');
end;
Expand Down Expand Up @@ -1391,6 +1395,7 @@ procedure TfmMain.FormShow(Sender: TObject);

DoPyEvent(CurrentEditor, cEventOnFocus, []);
DoPyEvent(CurrentEditor, cEventOnStart, []);
DoOps_LoadHistory_AfterOnStart;

ActiveControl:= CurrentEditor;
UpdateStatus;
Expand Down Expand Up @@ -2719,6 +2724,23 @@ procedure TfmMain.SetFullScreen_Win32(AValue: boolean);
end;
end;

procedure TfmMain.SetTabNameLeft(const AValue: string);
var
D: TATTabData;
i: integer;
begin
for i:= 0 to TabsLeft.TabCount-1 do
begin
D:= TabsLeft.GetTabData(i);
if Assigned(D) then
if D.TabCaption=AValue then
begin
TabsLeft.TabIndex:= i;
Break
end;
end;
end;


procedure TfmMain.DoEditorsLock(ALock: boolean);
var
Expand Down
10 changes: 10 additions & 0 deletions app/formmain_frame_proc.inc
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,16 @@ begin
end;
end;

function TfmMain.GetTabNameLeft: string;
var
D: TATTabData;
begin
Result:= '';
D:= TabsLeft.GetTabData(TabsLeft.TabIndex);
if Assigned(D) then
Result:= D.TabCaption;
end;

procedure TfmMain.FrameOnEditorClickEndSelect(Sender: TObject; APrevPnt,
ANewPnt: TPoint);
var
Expand Down
15 changes: 15 additions & 0 deletions app/formmain_loadsave.inc
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ begin
c.SetValue('show_bottom', ShowBottom);
c.SetValue('size_side', PanelLeft.Width);
c.SetValue('size_bottom', PanelBottom.Height);
c.SetValue('tab_left', TabNameLeft);
end;

////recents
Expand Down Expand Up @@ -269,6 +270,20 @@ begin
c.SetValue('/gr/p1_y', Groups.Panel1.Height);
end;


procedure TfmMain.DoOps_LoadHistory_AfterOnStart;
var
c: TJSONConfig;
begin
c:= TJSONConfig.Create(nil);
try
c.Filename:= GetAppPath(cFileOptHistory);
TabNameLeft:= c.GetValue('tab_left', '');
finally
FreeAndNil(c);
end;
end;

procedure TfmMain.DoOps_LoadHistory;
const
cReservePixels=70;
Expand Down
4 changes: 2 additions & 2 deletions app/formmain_themes.inc
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ begin
end;
end;

procedure TfmMain.SetThemeUi(AValue: string);
procedure TfmMain.SetThemeUi(const AValue: string);
begin
if FThemeUi=AValue then Exit;
FThemeUi:= AValue;
Expand All @@ -257,7 +257,7 @@ begin
DoApplyTheme;
end;

procedure TfmMain.SetThemeSyntax(AValue: string);
procedure TfmMain.SetThemeSyntax(const AValue: string);
begin
if FThemeSyntax=AValue then Exit;
FThemeSyntax:= AValue;
Expand Down
1 change: 1 addition & 0 deletions app/readme/history.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
1.4.7
+ Windows: Python 3.5
* del built-in commands to comment/uncomment; now plugin Comments (by kvichans) preinstalled for this, with more options and config dlg
+ restore last tab in side-panel
+ lexers JS, Python: keywords async/await

1.4.6
Expand Down

0 comments on commit 181a073

Please sign in to comment.