Skip to content

Commit

Permalink
remember form position and collapsed state
Browse files Browse the repository at this point in the history
  • Loading branch information
m-audio91 committed Apr 3, 2019
1 parent 2725ef5 commit f57d194
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion fasubrip.lpi
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<AutoIncrementBuild Value="True"/>
<MajorVersionNr Value="1"/>
<MinorVersionNr Value="2"/>
<BuildNr Value="250"/>
<BuildNr Value="258"/>
<StringTable Comments="http://mohammadrezab.blogsky.com" CompanyName="MohammadReza Bahrami" FileDescription="FaSubrip: autodetects and converts encoding of farsi (persian) subrip files. with additional functionalities." InternalName="FaSubrip" LegalCopyright="MohammadReza Bahrami" OriginalFilename="fasubrip" ProductName="FaSubrip" ProductVersion="1.2.0.0"/>
</VersionInfo>
<BuildModes Count="6">
Expand Down
Binary file modified fasubrip.res
Binary file not shown.
4 changes: 2 additions & 2 deletions umain.lfm
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ object FaSubripMain: TFaSubripMain
OnDropFiles = FormDropFiles
OnShow = FormShow
ParentFont = True
Position = poScreenCenter
SessionProperties = 'AppendEncodingToFileName.State;ArabicCharsToFarsi.State;CensorshipLevel.ItemIndex;OpenDlg.InitialDir;OutFileEncoding.ItemIndex;PhrasesCensorshipFile.Text;PhrasesCensorship.State;ReplaceSourceFile.State;StripHTMLFontTags.State;StripHTMLStyleTags.State;EndingPunctuations.ItemIndex'
SessionProperties = 'AppendEncodingToFileName.State;ArabicCharsToFarsi.State;CensorshipLevel.ItemIndex;EndingPunctuations.ItemIndex;OpenDlg.InitialDir;OutFileEncoding.ItemIndex;PhrasesCensorshipFile.Text;PhrasesCensorship.State;ReplaceSourceFile.State;StripHTMLFontTags.State;StripHTMLStyleTags.State;Left;Top'
object Header: TPanel
Left = 0
Height = 30
Expand Down Expand Up @@ -602,6 +601,7 @@ object FaSubripMain: TFaSubripMain
end
object IniProps: TIniPropStorage
StoredValues = <>
OnRestoringProperties = IniPropsRestoringProperties
Left = 80
Top = 72
end
Expand Down
13 changes: 13 additions & 0 deletions umain.pas
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ TFaSubripMain = class(TForm)
DragNotifierL: TLabel;
HeaderLinks: TPanel;
OptionalSettings: TDividerBevel;
procedure IniPropsRestoringProperties(Sender: TObject);
procedure PhrasesCensorshipFileKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure FormCreate(Sender: TObject);
Expand All @@ -100,6 +101,7 @@ TFaSubripMain = class(TForm)
FInputFile: String;
FMaxHeight: Integer;
FMinHeight: Integer;
FCollapsed: Boolean;
function OutputDirValid(const Dir: String): Boolean;
procedure DoRun;
procedure ProcessSubtitle;
Expand All @@ -117,6 +119,8 @@ TFaSubripMain = class(TForm)
LicenseUrlL: TUrlLabelEx;
FInputFiles: array of String;
FAutoRun: Boolean;
published
property Collapsed: Boolean read FCollapsed write FCollapsed;
end;

TIntegerDict = record
Expand Down Expand Up @@ -204,6 +208,7 @@ procedure TFaSubripMain.FormCreate(Sender: TObject);
Hint := rsLicenseHint;
HighlightColor := clHighlight;
end;
Collapsed := True;
end;

procedure TFaSubripMain.PhrasesCensorshipFileKeyDown(Sender: TObject; var Key: Word;
Expand All @@ -212,6 +217,11 @@ procedure TFaSubripMain.PhrasesCensorshipFileKeyDown(Sender: TObject; var Key: W
if Key = VK_RETURN then (Sender as TFileNameEdit).RunDialog;
end;

procedure TFaSubripMain.IniPropsRestoringProperties(Sender: TObject);
begin
SessionProperties := SessionProperties+';Collapsed';
end;

procedure TFaSubripMain.FormShow(Sender: TObject);
begin
{$ifdef darwin}
Expand All @@ -231,6 +241,8 @@ procedure TFaSubripMain.FormShow(Sender: TObject);
Visible := False;
end;
FMinHeight := Height;
if not Collapsed then
SettingsShowClick(SettingsShow);
{$ifndef darwin}
if FAutoRun then
begin
Expand Down Expand Up @@ -281,6 +293,7 @@ procedure TFaSubripMain.SettingsShowClick(Sender: TObject);
SettingsShow.ImageIndex:= 0;
end;
end;
Collapsed := not SettingContainersGrid.Visible;
{$ifdef linux}
Constraints.MinHeight := h;
Constraints.MaxHeight := h;
Expand Down

0 comments on commit f57d194

Please sign in to comment.