From f5103ad464a33d141109d0ac6bbde39988a2a4b6 Mon Sep 17 00:00:00 2001 From: regs01 Date: Tue, 2 Jul 2024 07:40:44 +0300 Subject: [PATCH 1/9] Add ability to save window position and dimensions. Improve Preferences form. --- Source/Common/Preferences.cpp | 2 + Source/GUI/VCL/GUI_Main.cpp | 130 +++-- Source/GUI/VCL/GUI_Main.dfm | 1 - Source/GUI/VCL/GUI_Main.h | 1 - Source/GUI/VCL/GUI_Preferences.cpp | 31 +- Source/GUI/VCL/GUI_Preferences.dfm | 882 ++++++++++++++++------------- Source/GUI/VCL/GUI_Preferences.h | 6 + 7 files changed, 599 insertions(+), 454 deletions(-) diff --git a/Source/Common/Preferences.cpp b/Source/Common/Preferences.cpp index 3dfd27d54..8c59d3aac 100644 --- a/Source/Common/Preferences.cpp +++ b/Source/Common/Preferences.cpp @@ -251,6 +251,8 @@ int Preferences::Config_Save() if (Config(__T("ShellExtension")).empty()) Config(__T("ShellExtension"))=__T("1"); if (Config(__T("ShellExtension_Folder")).empty()) Config(__T("ShellExtension_Folder"))=__T("0"); if (Config(__T("ShellInfoTip")).empty()) Config(__T("ShellInfoTip"))=__T("0"); + if (Config(__T("RememberWindowPosition")).empty()) Config(__T("RememberWindowPosition"))=__T("0"); + if (Config(__T("RememberWindowDimensions")).empty()) Config(__T("RememberWindowDimensions"))=__T("1"); if (Config(__T("ShowToolBar")).empty()) Config(__T("ShowToolBar"))=__T("1"); if (Config(__T("ShowMenu")).empty()) Config(__T("ShowMenu"))=__T("1"); if (Config(__T("CloseAllAuto")).empty()) Config(__T("CloseAllAuto"))=__T("1"); diff --git a/Source/GUI/VCL/GUI_Main.cpp b/Source/GUI/VCL/GUI_Main.cpp index 1b0f9ba43..c537fa57b 100644 --- a/Source/GUI/VCL/GUI_Main.cpp +++ b/Source/GUI/VCL/GUI_Main.cpp @@ -6,6 +6,7 @@ //--------------------------------------------------------------------------- #include +#include #pragma hdrstop #include "GUI/VCL/GUI_Main.h" #ifndef MEDIAINFOGUI_PREFS_NO @@ -416,42 +417,88 @@ void __fastcall TMainF::GUI_Configure() //Configure theme ConfigTheme(); -} -//--------------------------------------------------------------------------- -void __fastcall TMainF::FormShow(TObject *Sender) -{ - //Set window size and position - OSVERSIONINFO osvi; - ZeroMemory(&osvi, sizeof(OSVERSIONINFO)); - osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - GetVersionEx(&osvi); - int DPI; - if (osvi.dwMajorVersion >= 10 && (osvi.dwMajorVersion > 10 || osvi.dwMinorVersion > 0 || osvi.dwBuildNumber >= 14939)) - DPI=GetDpiForWindow(WindowHandle); - else - DPI=GetDeviceCaps(GetDC(NULL), LOGPIXELSX); - float DPIScale=static_cast(DPI)/96; - float ScaledScreenWidth=Screen->Width/DPIScale; - float ScaledScreenHeight=Screen->Height/DPIScale; - Width=500; - Height=400; - if (ScaledScreenWidth>=1024) - Width=700; - if (ScaledScreenWidth>=1280) - Width=830; - if (ScaledScreenHeight>=768) - Height=500; - if (ScaledScreenHeight>=1024) - Height=600; - Width*=DPIScale; - Height*=DPIScale; - Left=(Screen->Width-Width)/2; - Top=(Screen->Height-Height)/2; + //Set window size and position + // todo: move all property assignments into FormCreate + // note: VCL version? It's been having built-in DPI support since long ago. And it should be Monitor instead of Screen. + // OSVERSIONINFO osvi; + // ZeroMemory(&osvi, sizeof(OSVERSIONINFO)); + // osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + // GetVersionEx(&osvi); + // int DPI; + // if (osvi.dwMajorVersion >= 10 && (osvi.dwMajorVersion > 10 || osvi.dwMinorVersion > 0 || osvi.dwBuildNumber >= 14939)) + // DPI=GetDpiForWindow(WindowHandle); + // else + // DPI=GetDeviceCaps(GetDC(NULL), LOGPIXELSX); + // float DPIScale=static_cast(DPI)/96; + // + // float fpUnscaledMonitorWidth=Monitor->Width/DPIScale; + // float fpUnscaledMonitorHeight=Monitor->Height/DPIScale; + + if (Prefs->Config(__T("RememberWindowDimensions")) == __T("1")) { + + int nPrefWidth = Width; + int nPrefHeight = Height; + + if (Prefs->Config(__T("FormWidth")).IsNumber()) + nPrefWidth = Prefs->Config(__T("FormWidth")).To_int32s(); + if (Prefs->Config(__T("FormHeight")).IsNumber()) + nPrefHeight = Prefs->Config(__T("FormHeight")).To_int32s(); + + nPrefWidth = Min(Monitor->WorkareaRect.Width(), nPrefWidth); + nPrefHeight = Min(Monitor->WorkareaRect.Height(), nPrefHeight); + + SetBounds(Left, Top, nPrefWidth, nPrefHeight); + + } + else { + + // using VCL + float fpUnscaledMonitorWidth = Monitor->Width / ScaleFactor; + float fpUnscaledMonitorHeight = Monitor->Height / ScaleFactor; + + Width=500; + Height=400; + if (fpUnscaledMonitorWidth>=1024) + Width=700; + if (fpUnscaledMonitorWidth>=1280) + Width=830; + if (fpUnscaledMonitorHeight>=768) + Height=500; + if (fpUnscaledMonitorHeight>=1024) + Height=600; + if (fpUnscaledMonitorHeight>=1440) + Height=900; + Width *= ScaleFactor; + Height *= ScaleFactor; + // note: just use poScreenCenter + // Left=(Screen->Width-Width)/2; + // Top=(Screen->Height-Height)/2; + + } + if (Prefs->Config(__T("RememberWindowPosition")) == __T("1")) { + + int nPrefTop = 0; + int nPrefLeft = 0; + + if (Prefs->Config(__T("FormTop")).IsNumber()) + nPrefTop = Prefs->Config(__T("FormTop")).To_int32s(); + if (Prefs->Config(__T("FormLeft")).IsNumber()) + nPrefLeft = Prefs->Config(__T("FormLeft")).To_int32s(); + + nPrefTop = Max(nPrefTop, 0); + nPrefTop = Min(nPrefTop, Monitor->WorkareaRect.Height() - Height); + nPrefLeft = Max(nPrefLeft, 0); + nPrefLeft = Min(nPrefLeft, Monitor->WorkareaRect.Width() - Width); + SetBounds(nPrefLeft, nPrefTop, Width, Height); + + Position = poDesigned; + + } + else { + Position = poScreenCenter; + } - //Refresh global - FormResize(NULL); - Refresh(); } //--------------------------------------------------------------------------- @@ -461,6 +508,21 @@ void __fastcall TMainF::FormClose(TObject *Sender, TCloseAction &Action) if (FileName_Temp!=__T("")) File::Delete(FileName_Temp); + bool bCallPrefsSave = false; + if (Prefs->Config(__T("RememberWindowPosition")) == __T("1")) { + Prefs->Config(__T("FormTop")).From_Number((int)this->Top); + Prefs->Config(__T("FormLeft")).From_Number((int)this->Left); + bCallPrefsSave = true; + } + if (Prefs->Config(__T("RememberWindowDimensions")) == __T("1")) { + Prefs->Config(__T("FormWidth")).From_Number((int)this->Width); + Prefs->Config(__T("FormHeight")).From_Number((int)this->Height); + bCallPrefsSave = true; + } + + if (bCallPrefsSave) + Prefs->Config.Save(); + //The form is closed and all allocated memory for the form is freed. Action = caFree; } diff --git a/Source/GUI/VCL/GUI_Main.dfm b/Source/GUI/VCL/GUI_Main.dfm index 6eedea223..82e160ada 100644 --- a/Source/GUI/VCL/GUI_Main.dfm +++ b/Source/GUI/VCL/GUI_Main.dfm @@ -14,7 +14,6 @@ object MainF: TMainF OnClose = FormClose OnDestroy = FormDestroy OnResize = FormResize - OnShow = FormShow TextHeight = 13 object SpeedButton1: TSpeedButton Left = 8 diff --git a/Source/GUI/VCL/GUI_Main.h b/Source/GUI/VCL/GUI_Main.h index 529516130..5def730ad 100644 --- a/Source/GUI/VCL/GUI_Main.h +++ b/Source/GUI/VCL/GUI_Main.h @@ -243,7 +243,6 @@ class TMainF : public TForm void __fastcall M_Debug_HeaderClick(TObject *Sender); void __fastcall M_File_ExitClick(TObject *Sender); void __fastcall M_File_Open_FileClick(TObject *Sender); - void __fastcall FormShow(TObject *Sender); void __fastcall M_Debug_AdvancedClick(TObject *Sender); void __fastcall M_Options_ShowToolBarClick(TObject *Sender); void __fastcall M_View_EasyClick(TObject *Sender); diff --git a/Source/GUI/VCL/GUI_Preferences.cpp b/Source/GUI/VCL/GUI_Preferences.cpp index b58c37f2e..4456e3e88 100644 --- a/Source/GUI/VCL/GUI_Preferences.cpp +++ b/Source/GUI/VCL/GUI_Preferences.cpp @@ -388,6 +388,18 @@ void __fastcall TPreferencesF::CB_InfoTipClick(TObject *Sender) Prefs->Config(__T("ShellInfoTip"), 1)=__T("0"); } +//--------------------------------------------------------------------------- +void __fastcall TPreferencesF::CB_RememberWindowPositionClick(TObject *Sender) +{ + Prefs->Config(__T("RememberWindowPosition"), 1) = CB_RememberWindowPosition->Checked ? __T("1") : __T("0"); +} + +//--------------------------------------------------------------------------- +void __fastcall TPreferencesF::CB_RememberWindowDimensionsClick(TObject *Sender) +{ + Prefs->Config(__T("RememberWindowDimensions"), 1) = CB_RememberWindowDimensions->Checked ? __T("1") : __T("0"); +} + //--------------------------------------------------------------------------- void __fastcall TPreferencesF::CB_ShowToolBarClick(TObject *Sender) { @@ -581,7 +593,7 @@ void __fastcall TPreferencesF::TreeChange(TObject *Sender, //--------------------------------------------------------------------------- void __fastcall TPreferencesF::General_Language_MoreClick(TObject *Sender) { - Tree->Select(Tree->Items->Item[7]); + Page->ActivePage = Customize_Language; } //--------------------------------------------------------------------------- @@ -602,17 +614,16 @@ void __fastcall TPreferencesF::General_Output_MoreClick(TObject *Sender) //--------------------------------------------------------------------------- void __fastcall TPreferencesF::FormShow(TObject *Sender) { + // review: GUI_Configure should be in FormCreate GUI_Configure(); General_Output_SelChange(NULL); - //Not done with BCB because I want to easy select tabs in it - //Page->Top=-6; - //Page->TabHeight=1; - Page->Top=-(Page->TabHeight*1.15); //Replaced above with this to hide tabs better on high-DPI - Page->Height=Page->Height+(Page->TabHeight*1.15); //Required with above line - Cancel->Top=Page->Top+Page->Height+(Cancel->Height*0.15); - OK->Top=Cancel->Top; - ClientHeight=OK->Top+(OK->Height*1.15); + // review: move to GUI_Configure + for (int cTabIndex = 0; cTabIndex <= Page->PageCount-1; cTabIndex++) { + Page->Pages[cTabIndex]->TabVisible = False; + } + + // ClientHeight=OK->Top+(OK->Height*1.15); } //--------------------------------------------------------------------------- @@ -628,6 +639,8 @@ void __fastcall TPreferencesF::Setup_GeneralShow(TObject *Sender) //--------------------------------------------------------------------------- void __fastcall TPreferencesF::Setup_AdvancedShow(TObject *Sender) { + CB_RememberWindowPosition->Checked=Prefs->Config(__T("RememberWindowPosition")).To_int32s(); + CB_RememberWindowDimensions->Checked=Prefs->Config(__T("RememberWindowDimensions")).To_int32s(); CB_ShowToolBar->Checked=Prefs->Config(__T("ShowToolBar")).To_int32s(); CB_ShowMenu->Checked=Prefs->Config(__T("ShowMenu")).To_int32s(); Advanced_CloseAllAuto->Checked=Prefs->Config(__T("CloseAllAuto")).To_int32s(); diff --git a/Source/GUI/VCL/GUI_Preferences.dfm b/Source/GUI/VCL/GUI_Preferences.dfm index fcf71765d..3ec3267d2 100644 --- a/Source/GUI/VCL/GUI_Preferences.dfm +++ b/Source/GUI/VCL/GUI_Preferences.dfm @@ -1,12 +1,12 @@ object PreferencesF: TPreferencesF Left = 286 Top = 180 - BorderIcons = [] - BorderStyle = bsDialog + BorderIcons = [biSystemMenu, biMinimize] Caption = 'Preferences' - ClientHeight = 194 - ClientWidth = 667 - Color = clBtnFace + ClientHeight = 279 + ClientWidth = 833 + Color = clWindow + Constraints.MinHeight = 275 Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 @@ -14,430 +14,494 @@ object PreferencesF: TPreferencesF Font.Style = [] Position = poDesigned OnShow = FormShow + DesignSize = ( + 833 + 279) TextHeight = 14 object OK: TButton - Left = 540 - Top = 163 + Left = 703 + Top = 243 Width = 122 Height = 27 + Anchors = [akRight, akBottom] Caption = 'OK' Default = True ModalResult = 1 TabOrder = 0 OnClick = OKClick - end - object Tree: TTreeView - Left = 0 - Top = 0 - Width = 176 - Height = 158 - Indent = 19 - ParentShowHint = False - ReadOnly = True - ShowHint = False - TabOrder = 1 - OnChange = TreeChange - Items.NodeData = { - 0302000000280000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF000000 - 00010000000105530065007400750070002E0000000000000000000000FFFFFF - FFFFFFFFFFFFFFFFFF0000000000000000010841006400760061006E00630065 - 006400300000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF0000000005 - 000000010943007500730074006F006D0069007A006500280000000000000000 - 000000FFFFFFFFFFFFFFFFFFFFFFFF0000000000000000010553006800650065 - 007400340000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF0000000000 - 000000010B540072006500650020002600200054006500780074003400000000 - 00000000000000FFFFFFFFFFFFFFFFFFFFFFFF0000000000000000010B430075 - 00730074006F006D0020007400650078007400280000000000000000000000FF - FFFFFFFFFFFFFFFFFFFFFF00000000000000000105470072006100700068002E - 0000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF000000000000000001 - 084C0061006E0067007500610067006500} + ExplicitLeft = 699 + ExplicitTop = 242 end object Cancel: TButton - Left = 415 - Top = 163 + Left = 569 + Top = 243 Width = 121 Height = 27 + Anchors = [akRight, akBottom] Cancel = True Caption = 'Cancel' ModalResult = 2 - TabOrder = 2 + TabOrder = 1 + ExplicitLeft = 565 + ExplicitTop = 242 end - object Page: TPageControl - Left = 176 + object Panel1: TPanel + Left = 0 Top = 0 - Width = 490 - Height = 158 - ActivePage = Setup - MultiLine = True - TabHeight = 22 - TabOrder = 3 - object Setup: TTabSheet - Caption = 'General' - OnShow = Setup_GeneralShow - object Langue_C: TLabel - Left = 0 - Top = 3 - Width = 54 - Height = 14 - Caption = 'Language :' - end - object Output_C: TLabel - Left = 0 - Top = 29 - Width = 38 - Height = 14 - Caption = 'Output :' - end - object General_Language_Sel: TComboBox - Left = 124 - Top = 0 - Width = 113 - Height = 22 - Style = csDropDownList - TabOrder = 0 - OnChange = General_Language_SelChange - end - object General_Output_Sel: TComboBox - Left = 124 - Top = 26 - Width = 113 - Height = 22 - Style = csDropDownList - DropDownCount = 10 - TabOrder = 1 - OnChange = General_Output_SelChange - Items.Strings = ( - 'Simple' - 'Sheet' - 'Tree' - 'Text' - 'HTML' - 'Custom') - end - object CB_CheckUpdate: TCheckBox - Left = 0 - Top = 52 - Width = 506 - Height = 18 - Caption = 'Check for newest versions (require Internet connection)' - Checked = True - State = cbChecked - TabOrder = 2 - OnClick = CB_CheckUpdateClick - end - object General_Language_More: TButton - Left = 239 - Top = 0 - Width = 57 - Height = 23 - Caption = 'More...' - TabOrder = 6 - OnClick = General_Language_MoreClick - end - object General_Output_More: TButton - Left = 239 - Top = 26 - Width = 57 - Height = 22 - Caption = 'More...' - TabOrder = 7 - OnClick = General_Output_MoreClick - end - object CB_InfoTip: TCheckBox - Left = 0 - Top = 100 - Width = 506 - Height = 18 - Caption = - 'Shell InfoTip (in explorer, move the mouse on file, info will be' + - ' displayed)' - TabOrder = 5 - OnClick = CB_InfoTipClick - end - object CB_InscrireShell: TCheckBox - Left = 0 - Top = 68 - Width = 506 - Height = 18 - Caption = - 'Shell extension (in explorer, righ click, there will be a "Media' + - ' Info" option...)' - Checked = True - State = cbChecked - TabOrder = 3 - OnClick = CB_InscrireShellClick - end - object CB_InscrireShell_Folder: TCheckBox - Left = 16 - Top = 84 - Width = 369 - Height = 17 - Caption = 'For folders too' - TabOrder = 4 - OnClick = CB_InscrireShell_FolderClick - end - end - object Setup_Advanced: TTabSheet - Caption = 'Advanced' - ImageIndex = 1 - OnShow = Setup_AdvancedShow - object Advanced_DisplayCaptions_Caption: TLabel - Left = 0 - Top = 105 - Width = 141 - Height = 14 - Caption = 'Handling of 608/708 streams:' - end - object CB_ShowToolBar: TCheckBox - Left = 0 - Top = 0 - Width = 268 - Height = 18 - Caption = 'Show toolbar' - TabOrder = 0 - OnClick = CB_ShowToolBarClick - end - object Advanced_CloseAllAuto: TCheckBox - Left = 0 - Top = 33 - Width = 268 - Height = 18 - Caption = 'Close all before open' - TabOrder = 5 - OnClick = Advanced_CloseAllAutoClick - end - object CB_ShowMenu: TCheckBox - Left = 0 - Top = 16 - Width = 268 - Height = 18 - Caption = 'Show menu' - TabOrder = 2 - OnClick = CB_ShowMenuClick - end - object Advanced_InformVersion: TCheckBox - Left = 0 - Top = 50 - Width = 268 - Height = 18 - Caption = 'Add version to text output' - TabOrder = 3 - OnClick = Advanced_InformVersionClick - end - object Advanced_InformTimestamp: TCheckBox - Left = 0 - Top = 67 - Width = 268 - Height = 18 - Caption = 'Add creation date to text output' - TabOrder = 6 - OnClick = Advanced_InformTimestampClick - end - object Advanced_EnableFfmpeg: TCheckBox - Left = 0 - Top = 84 - Width = 268 - Height = 18 - Caption = 'Enable FFmpeg plugin' - TabOrder = 4 - OnClick = Advanced_EnableFfmpegClick - end - object Advanced_DisplayCaptions_Sel: TComboBox - Left = 193 - Top = 102 - Width = 285 - Height = 22 - Style = csDropDownList - DropDownCount = 10 - TabOrder = 1 - OnChange = Advanced_DisplayCaptions_SelChange - Items.Strings = ( - 'When content is detected' - 'When content or a command is detected' - 'Even when no content or command is detected') - end - end - object Customize_Language: TTabSheet - Caption = 'Language' - ImageIndex = 3 - OnShow = Customize_LanguageShow - object Language_Caption: TLabel - Left = 0 - Top = 0 - Width = 154 - Height = 14 - Caption = 'Choose your desired language :' - end - object Language_New: TButton - Left = 162 - Top = 43 - Width = 80 - Height = 23 - Caption = 'New...' - TabOrder = 3 - OnClick = Language_NewClick - end - object Language_Delete: TButton - Left = 0 - Top = 43 - Width = 81 - Height = 23 - Caption = 'Delete' - TabOrder = 1 - OnClick = Language_DeleteClick - end - object Language_Edit: TButton - Left = 81 - Top = 43 - Width = 81 - Height = 23 - Caption = 'Edit...' - TabOrder = 2 - OnClick = Language_EditClick - end - object Language_Sel: TComboBox - Left = 0 - Top = 17 - Width = 242 - Height = 22 - Style = csDropDownList - TabOrder = 0 - OnChange = Language_SelChange - end - end - object Customize_Sheet: TTabSheet - Caption = 'Sheet' - ImageIndex = 4 - OnShow = Customize_SheetShow - object Sheet_Caption: TLabel - Left = 0 - Top = 0 - Width = 175 - Height = 14 - Caption = 'Choose your desired custom sheet :' - end - object Sheet_Sel: TComboBox - Left = 0 - Top = 17 - Width = 242 - Height = 22 - Style = csDropDownList - TabOrder = 0 - OnChange = Sheet_SelChange - end - object Sheet_Delete: TButton - Left = 0 - Top = 43 - Width = 81 - Height = 23 - Caption = 'Delete' - TabOrder = 1 - OnClick = Sheet_DeleteClick - end - object Sheet_Edit: TButton - Left = 81 - Top = 43 - Width = 81 - Height = 23 - Caption = 'Edit...' - TabOrder = 2 - OnClick = Sheet_EditClick - end - object Sheet_New: TButton - Left = 162 - Top = 43 - Width = 80 - Height = 23 - Caption = 'New...' - TabOrder = 3 - OnClick = Sheet_NewClick - end - end - object Customize_TreeText: TTabSheet - Caption = 'Tree && Text' - ImageIndex = 6 - object Tree_NotYet: TLabel - Left = 362 - Top = 78 - Width = 43 - Height = 14 - Caption = 'Not yet...' - end - end - object Customize_Graph: TTabSheet - Caption = 'Graph' - ImageIndex = 8 - OnShow = Customize_GraphShow - object Graph_Adm_ShowTrackUIDs: TCheckBox - Left = 0 - Top = 0 - Width = 268 - Height = 18 - Caption = 'ADM: Show TrackUIDs' - TabOrder = 0 - OnClick = Graph_Adm_ShowTrackUIDsClick - end - object Graph_Adm_ShowChannelFormats: TCheckBox - Left = 0 - Top = 16 - Width = 268 - Height = 18 - Caption = 'ADM: Show ChannelFormats' - TabOrder = 1 - OnClick = Graph_Adm_ShowChannelFormatsClick - end - end - object Customize_Custom: TTabSheet - Caption = 'Custom Text' - ImageIndex = 6 - OnShow = Customize_CustomShow - object Custom_Caption: TLabel - Left = 0 - Top = 0 - Width = 166 - Height = 14 - Caption = 'Choose your desired custom text :' - end - object Custom_New: TButton - Left = 162 - Top = 43 - Width = 80 - Height = 23 - Caption = 'New...' - TabOrder = 0 - OnClick = Custom_NewClick - end - object Custom_Edit: TButton - Left = 81 - Top = 43 - Width = 81 - Height = 23 - Caption = 'Edit...' - TabOrder = 1 - OnClick = Custom_EditClick - end - object Custom_Delete: TButton - Left = 0 - Top = 43 - Width = 81 - Height = 23 - Caption = 'Delete' - TabOrder = 2 - OnClick = Custom_DeleteClick - end - object Custom_Sel: TComboBox - Left = 0 - Top = 17 - Width = 242 - Height = 22 - Style = csDropDownList - TabOrder = 3 - OnChange = Custom_SelChange + Width = 833 + Height = 233 + Align = alTop + Anchors = [akLeft, akTop, akRight, akBottom] + BevelOuter = bvNone + Color = clWindow + ParentBackground = False + TabOrder = 2 + ExplicitWidth = 829 + ExplicitHeight = 232 + object Page: TPageControl + AlignWithMargins = True + Left = 201 + Top = 0 + Width = 629 + Height = 233 + Margins.Top = 0 + Margins.Bottom = 0 + ActivePage = Setup_Advanced + Align = alClient + MultiLine = True + Style = tsFlatButtons + TabOrder = 0 + StyleElements = [seFont, seClient] + ExplicitWidth = 625 + ExplicitHeight = 232 + object Setup: TTabSheet + Caption = 'General' + OnShow = Setup_GeneralShow + object Langue_C: TLabel + Left = 3 + Top = 3 + Width = 54 + Height = 14 + Caption = 'Language :' + end + object Output_C: TLabel + Left = 3 + Top = 29 + Width = 38 + Height = 14 + Caption = 'Output :' + end + object General_Language_Sel: TComboBox + Left = 124 + Top = 0 + Width = 113 + Height = 22 + Style = csDropDownList + TabOrder = 0 + OnChange = General_Language_SelChange + end + object General_Output_Sel: TComboBox + Left = 124 + Top = 26 + Width = 113 + Height = 22 + Style = csDropDownList + DropDownCount = 10 + TabOrder = 1 + OnChange = General_Output_SelChange + Items.Strings = ( + 'Simple' + 'Sheet' + 'Tree' + 'Text' + 'HTML' + 'Custom') + end + object CB_CheckUpdate: TCheckBox + Left = 3 + Top = 54 + Width = 506 + Height = 18 + Caption = 'Check for newest versions (require Internet connection)' + Checked = True + State = cbChecked + TabOrder = 2 + OnClick = CB_CheckUpdateClick + end + object General_Language_More: TButton + Left = 240 + Top = 0 + Width = 57 + Height = 23 + Caption = 'More...' + TabOrder = 6 + OnClick = General_Language_MoreClick + end + object General_Output_More: TButton + Left = 240 + Top = 26 + Width = 57 + Height = 22 + Caption = 'More...' + TabOrder = 7 + OnClick = General_Output_MoreClick + end + object CB_InfoTip: TCheckBox + Left = 3 + Top = 111 + Width = 506 + Height = 18 + Caption = + 'Shell InfoTip (in explorer, move the mouse on file, info will be' + + ' displayed)' + TabOrder = 5 + OnClick = CB_InfoTipClick + end + object CB_InscrireShell: TCheckBox + Left = 3 + Top = 73 + Width = 506 + Height = 18 + Caption = + 'Shell extension (in explorer, righ click, there will be a "Media' + + ' Info" option...)' + Checked = True + State = cbChecked + TabOrder = 3 + OnClick = CB_InscrireShellClick + end + object CB_InscrireShell_Folder: TCheckBox + Left = 22 + Top = 92 + Width = 369 + Height = 17 + Caption = 'For folders too' + TabOrder = 4 + OnClick = CB_InscrireShell_FolderClick + end + end + object Setup_Advanced: TTabSheet + Caption = 'Advanced' + ImageIndex = 1 + OnShow = Setup_AdvancedShow + DesignSize = ( + 621 + 201) + object Advanced_DisplayCaptions_Caption: TLabel + Left = 3 + Top = 157 + Width = 141 + Height = 14 + Caption = 'Handling of 608/708 streams:' + end + object CB_ShowToolBar: TCheckBox + Left = 3 + Top = 38 + Width = 268 + Height = 18 + Caption = 'Show toolbar' + TabOrder = 0 + OnClick = CB_ShowToolBarClick + end + object Advanced_CloseAllAuto: TCheckBox + Left = 3 + Top = 76 + Width = 268 + Height = 18 + Caption = 'Close all before open' + TabOrder = 5 + OnClick = Advanced_CloseAllAutoClick + end + object CB_ShowMenu: TCheckBox + Left = 3 + Top = 57 + Width = 268 + Height = 18 + Caption = 'Show menu' + TabOrder = 2 + OnClick = CB_ShowMenuClick + end + object Advanced_InformVersion: TCheckBox + Left = 3 + Top = 95 + Width = 268 + Height = 18 + Caption = 'Add version to text output' + TabOrder = 3 + OnClick = Advanced_InformVersionClick + end + object Advanced_InformTimestamp: TCheckBox + Left = 3 + Top = 114 + Width = 268 + Height = 18 + Caption = 'Add creation date to text output' + TabOrder = 6 + OnClick = Advanced_InformTimestampClick + end + object Advanced_EnableFfmpeg: TCheckBox + Left = 3 + Top = 133 + Width = 268 + Height = 18 + Caption = 'Enable FFmpeg plugin' + TabOrder = 4 + OnClick = Advanced_EnableFfmpegClick + end + object Advanced_DisplayCaptions_Sel: TComboBox + Left = 163 + Top = 154 + Width = 318 + Height = 22 + Style = csDropDownList + Anchors = [akLeft, akTop, akRight] + DropDownCount = 10 + TabOrder = 1 + OnChange = Advanced_DisplayCaptions_SelChange + Items.Strings = ( + 'When content is detected' + 'When content or a command is detected' + 'Even when no content or command is detected') + end + object CB_RememberWindowPosition: TCheckBox + Left = 3 + Top = 0 + Width = 268 + Height = 17 + Caption = 'Remember window position' + TabOrder = 7 + OnClick = CB_RememberWindowPositionClick + end + object CB_RememberWindowDimensions: TCheckBox + Left = 3 + Top = 19 + Width = 268 + Height = 17 + Caption = 'Remember window dimensions' + TabOrder = 8 + OnClick = CB_RememberWindowDimensionsClick + end + end + object Customize_Language: TTabSheet + Caption = 'Language' + ImageIndex = 3 + OnShow = Customize_LanguageShow + object Language_Caption: TLabel + Left = 3 + Top = 0 + Width = 154 + Height = 14 + Caption = 'Choose your desired language :' + end + object Language_New: TButton + Left = 165 + Top = 43 + Width = 80 + Height = 23 + Caption = 'New...' + TabOrder = 3 + OnClick = Language_NewClick + end + object Language_Delete: TButton + Left = 3 + Top = 43 + Width = 81 + Height = 23 + Caption = 'Delete' + TabOrder = 1 + OnClick = Language_DeleteClick + end + object Language_Edit: TButton + Left = 84 + Top = 43 + Width = 81 + Height = 23 + Caption = 'Edit...' + TabOrder = 2 + OnClick = Language_EditClick + end + object Language_Sel: TComboBox + Left = 3 + Top = 17 + Width = 242 + Height = 22 + Style = csDropDownList + TabOrder = 0 + OnChange = Language_SelChange + end + end + object Customize_Sheet: TTabSheet + Caption = 'Sheet' + ImageIndex = 4 + OnShow = Customize_SheetShow + object Sheet_Caption: TLabel + Left = 3 + Top = 0 + Width = 175 + Height = 14 + Caption = 'Choose your desired custom sheet :' + end + object Sheet_Sel: TComboBox + Left = 3 + Top = 17 + Width = 242 + Height = 22 + Style = csDropDownList + TabOrder = 0 + OnChange = Sheet_SelChange + end + object Sheet_Delete: TButton + Left = 3 + Top = 43 + Width = 81 + Height = 23 + Caption = 'Delete' + TabOrder = 1 + OnClick = Sheet_DeleteClick + end + object Sheet_Edit: TButton + Left = 84 + Top = 43 + Width = 81 + Height = 23 + Caption = 'Edit...' + TabOrder = 2 + OnClick = Sheet_EditClick + end + object Sheet_New: TButton + Left = 165 + Top = 43 + Width = 80 + Height = 23 + Caption = 'New...' + TabOrder = 3 + OnClick = Sheet_NewClick + end + end + object Customize_TreeText: TTabSheet + Caption = 'Tree && Text' + ImageIndex = 6 + object Tree_NotYet: TLabel + Left = 0 + Top = 0 + Width = 621 + Height = 201 + Align = alClient + Alignment = taCenter + Caption = 'Not yet...' + Layout = tlCenter + ExplicitWidth = 43 + ExplicitHeight = 14 + end + end + object Customize_Graph: TTabSheet + Caption = 'Graph' + ImageIndex = 8 + OnShow = Customize_GraphShow + object Graph_Adm_ShowTrackUIDs: TCheckBox + Left = 3 + Top = 0 + Width = 268 + Height = 18 + Caption = 'ADM: Show TrackUIDs' + TabOrder = 0 + OnClick = Graph_Adm_ShowTrackUIDsClick + end + object Graph_Adm_ShowChannelFormats: TCheckBox + Left = 3 + Top = 19 + Width = 268 + Height = 18 + Caption = 'ADM: Show ChannelFormats' + TabOrder = 1 + OnClick = Graph_Adm_ShowChannelFormatsClick + end + end + object Customize_Custom: TTabSheet + Caption = 'Custom Text' + ImageIndex = 6 + OnShow = Customize_CustomShow + object Custom_Caption: TLabel + Left = 3 + Top = 0 + Width = 166 + Height = 14 + Caption = 'Choose your desired custom text :' + end + object Custom_New: TButton + Left = 165 + Top = 43 + Width = 80 + Height = 23 + Caption = 'New...' + TabOrder = 0 + OnClick = Custom_NewClick + end + object Custom_Edit: TButton + Left = 84 + Top = 43 + Width = 81 + Height = 23 + Caption = 'Edit...' + TabOrder = 1 + OnClick = Custom_EditClick + end + object Custom_Delete: TButton + Left = 3 + Top = 43 + Width = 81 + Height = 23 + Caption = 'Delete' + TabOrder = 2 + OnClick = Custom_DeleteClick + end + object Custom_Sel: TComboBox + Left = 3 + Top = 17 + Width = 242 + Height = 22 + Style = csDropDownList + TabOrder = 3 + OnChange = Custom_SelChange + end + end + object Customize: TTabSheet + Caption = 'Customize' + ImageIndex = 7 end end - object Customize: TTabSheet - Caption = 'Customize' - ImageIndex = 7 + object Tree: TTreeView + AlignWithMargins = True + Left = 4 + Top = 3 + Width = 190 + Height = 228 + Margins.Left = 4 + Margins.Right = 4 + Margins.Bottom = 2 + Align = alLeft + BorderStyle = bsNone + Indent = 19 + ParentShowHint = False + ReadOnly = True + ShowHint = False + TabOrder = 1 + OnChange = TreeChange + Items.NodeData = { + 0302000000280000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF000000 + 00010000000105530065007400750070002E0000000000000000000000FFFFFF + FFFFFFFFFFFFFFFFFF0000000000000000010841006400760061006E00630065 + 006400300000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF0000000005 + 000000010943007500730074006F006D0069007A006500280000000000000000 + 000000FFFFFFFFFFFFFFFFFFFFFFFF0000000000000000010553006800650065 + 007400340000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF0000000000 + 000000010B540072006500650020002600200054006500780074003400000000 + 00000000000000FFFFFFFFFFFFFFFFFFFFFFFF0000000000000000010B430075 + 00730074006F006D0020007400650078007400280000000000000000000000FF + FFFFFFFFFFFFFFFFFFFFFF00000000000000000105470072006100700068002E + 0000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF000000000000000001 + 084C0061006E0067007500610067006500} + ExplicitHeight = 227 end end end diff --git a/Source/GUI/VCL/GUI_Preferences.h b/Source/GUI/VCL/GUI_Preferences.h index 64fd49dd2..154438b12 100644 --- a/Source/GUI/VCL/GUI_Preferences.h +++ b/Source/GUI/VCL/GUI_Preferences.h @@ -18,6 +18,7 @@ #include #include #include +#include #include "GUI_Main.h" #include "Common/Preferences.h" //--------------------------------------------------------------------------- @@ -74,6 +75,9 @@ class TPreferencesF : public TForm TCheckBox *CB_InfoTip; TCheckBox *CB_InscrireShell; TCheckBox *CB_InscrireShell_Folder; + TPanel *Panel1; + TCheckBox *CB_RememberWindowPosition; + TCheckBox *CB_RememberWindowDimensions; void __fastcall General_Language_SelChange(TObject *Sender); void __fastcall General_Output_SelChange(TObject *Sender); void __fastcall Custom_EditClick(TObject *Sender); @@ -112,6 +116,8 @@ class TPreferencesF : public TForm void __fastcall CB_ShowMenuClick(TObject *Sender); void __fastcall CB_InfoTipClick(TObject *Sender); void __fastcall CB_InscrireShell_FolderClick(TObject *Sender); + void __fastcall CB_RememberWindowPositionClick(TObject *Sender); + void __fastcall CB_RememberWindowDimensionsClick(TObject *Sender); private: // User declarations public: // User declarations __fastcall TPreferencesF(TComponent* Owner); From 845714eb2993a63683208757413bd4238933a978 Mon Sep 17 00:00:00 2001 From: regs01 Date: Wed, 3 Jul 2024 01:34:54 +0300 Subject: [PATCH 2/9] Move switching tab visibility in front of setting active tab --- Source/GUI/VCL/GUI_Preferences.cpp | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Source/GUI/VCL/GUI_Preferences.cpp b/Source/GUI/VCL/GUI_Preferences.cpp index 4456e3e88..92542435f 100644 --- a/Source/GUI/VCL/GUI_Preferences.cpp +++ b/Source/GUI/VCL/GUI_Preferences.cpp @@ -618,11 +618,6 @@ void __fastcall TPreferencesF::FormShow(TObject *Sender) GUI_Configure(); General_Output_SelChange(NULL); - // review: move to GUI_Configure - for (int cTabIndex = 0; cTabIndex <= Page->PageCount-1; cTabIndex++) { - Page->Pages[cTabIndex]->TabVisible = False; - } - // ClientHeight=OK->Top+(OK->Height*1.15); } @@ -683,6 +678,10 @@ void __fastcall TPreferencesF::Customize_GraphShow(TObject *Sender) void __fastcall TPreferencesF::GUI_Configure() { //Preparation of GUI + + for (int cTabIndex = 0; cTabIndex <= Page->PageCount-1; cTabIndex++) + Page->Pages[cTabIndex]->TabVisible = False; + Tree->FullExpand(); Page->ActivePage=Setup; From befd8052dfbdfd5ac139691530ce79f777b5a58d Mon Sep 17 00:00:00 2001 From: regs01 Date: Wed, 3 Jul 2024 01:39:53 +0300 Subject: [PATCH 3/9] Readd FormResize and Refresh for Main form --- Source/GUI/VCL/GUI_Main.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Source/GUI/VCL/GUI_Main.cpp b/Source/GUI/VCL/GUI_Main.cpp index c537fa57b..d0431104b 100644 --- a/Source/GUI/VCL/GUI_Main.cpp +++ b/Source/GUI/VCL/GUI_Main.cpp @@ -499,6 +499,10 @@ void __fastcall TMainF::GUI_Configure() Position = poScreenCenter; } + //Refresh global + FormResize(NULL); + Refresh(); + } //--------------------------------------------------------------------------- From 8a2368ba47b7ca96de9ebd33cd760e13497b5459 Mon Sep 17 00:00:00 2001 From: regs01 Date: Wed, 3 Jul 2024 05:14:07 +0300 Subject: [PATCH 4/9] More constraints --- Source/GUI/VCL/GUI_Preferences.dfm | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/Source/GUI/VCL/GUI_Preferences.dfm b/Source/GUI/VCL/GUI_Preferences.dfm index 3ec3267d2..4086b472d 100644 --- a/Source/GUI/VCL/GUI_Preferences.dfm +++ b/Source/GUI/VCL/GUI_Preferences.dfm @@ -4,9 +4,10 @@ object PreferencesF: TPreferencesF BorderIcons = [biSystemMenu, biMinimize] Caption = 'Preferences' ClientHeight = 279 - ClientWidth = 833 + ClientWidth = 777 Color = clWindow Constraints.MinHeight = 275 + Constraints.MinWidth = 750 Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 @@ -15,11 +16,11 @@ object PreferencesF: TPreferencesF Position = poDesigned OnShow = FormShow DesignSize = ( - 833 + 777 279) TextHeight = 14 object OK: TButton - Left = 703 + Left = 643 Top = 243 Width = 122 Height = 27 @@ -29,11 +30,11 @@ object PreferencesF: TPreferencesF ModalResult = 1 TabOrder = 0 OnClick = OKClick - ExplicitLeft = 699 + ExplicitLeft = 695 ExplicitTop = 242 end object Cancel: TButton - Left = 569 + Left = 509 Top = 243 Width = 121 Height = 27 @@ -42,13 +43,13 @@ object PreferencesF: TPreferencesF Caption = 'Cancel' ModalResult = 2 TabOrder = 1 - ExplicitLeft = 565 + ExplicitLeft = 561 ExplicitTop = 242 end object Panel1: TPanel Left = 0 Top = 0 - Width = 833 + Width = 777 Height = 233 Align = alTop Anchors = [akLeft, akTop, akRight, akBottom] @@ -62,7 +63,7 @@ object PreferencesF: TPreferencesF AlignWithMargins = True Left = 201 Top = 0 - Width = 629 + Width = 573 Height = 233 Margins.Top = 0 Margins.Bottom = 0 @@ -185,7 +186,7 @@ object PreferencesF: TPreferencesF ImageIndex = 1 OnShow = Setup_AdvancedShow DesignSize = ( - 621 + 565 201) object Advanced_DisplayCaptions_Caption: TLabel Left = 3 @@ -251,10 +252,11 @@ object PreferencesF: TPreferencesF object Advanced_DisplayCaptions_Sel: TComboBox Left = 163 Top = 154 - Width = 318 + Width = 258 Height = 22 Style = csDropDownList Anchors = [akLeft, akTop, akRight] + Constraints.MinWidth = 250 DropDownCount = 10 TabOrder = 1 OnChange = Advanced_DisplayCaptions_SelChange @@ -262,6 +264,7 @@ object PreferencesF: TPreferencesF 'When content is detected' 'When content or a command is detected' 'Even when no content or command is detected') + ExplicitWidth = 310 end object CB_RememberWindowPosition: TCheckBox Left = 3 @@ -384,7 +387,7 @@ object PreferencesF: TPreferencesF object Tree_NotYet: TLabel Left = 0 Top = 0 - Width = 621 + Width = 565 Height = 201 Align = alClient Alignment = taCenter @@ -504,4 +507,4 @@ object PreferencesF: TPreferencesF ExplicitHeight = 227 end end -end +end \ No newline at end of file From 99aeef0e2eaa393d6ac2ae27e52f52147018fa10 Mon Sep 17 00:00:00 2001 From: regs01 Date: Wed, 3 Jul 2024 06:03:46 +0300 Subject: [PATCH 5/9] Remember maximized state --- Source/GUI/VCL/GUI_Main.cpp | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/Source/GUI/VCL/GUI_Main.cpp b/Source/GUI/VCL/GUI_Main.cpp index 883ccb07c..4efad7b18 100644 --- a/Source/GUI/VCL/GUI_Main.cpp +++ b/Source/GUI/VCL/GUI_Main.cpp @@ -490,6 +490,16 @@ void __fastcall TMainF::GUI_Configure() Position = poScreenCenter; } + // debug: Dimensions won't restore properly from Maximized state + if ( ((Prefs->Config(__T("RememberWindowPosition")) == __T("1")) || + (Prefs->Config(__T("RememberWindowDimensions")) == __T("1"))) ) { + int nPrefWindowState = 0; + if (Prefs->Config(__T("WindowState")).IsNumber()) + nPrefWindowState = Prefs->Config(__T("WindowState")).To_int32s(); + if (nPrefWindowState == (int)TWindowState::wsMaximized) + WindowState = wsMaximized; + } + //Refresh global FormResize(NULL); Refresh(); @@ -503,20 +513,21 @@ void __fastcall TMainF::FormClose(TObject *Sender, TCloseAction &Action) if (FileName_Temp!=__T("")) File::Delete(FileName_Temp); - bool bCallPrefsSave = false; - if (Prefs->Config(__T("RememberWindowPosition")) == __T("1")) { - Prefs->Config(__T("FormTop")).From_Number((int)this->Top); - Prefs->Config(__T("FormLeft")).From_Number((int)this->Left); - bCallPrefsSave = true; - } - if (Prefs->Config(__T("RememberWindowDimensions")) == __T("1")) { - Prefs->Config(__T("FormWidth")).From_Number((int)this->Width); - Prefs->Config(__T("FormHeight")).From_Number((int)this->Height); - bCallPrefsSave = true; - } - - if (bCallPrefsSave) + if ( ((Prefs->Config(__T("RememberWindowPosition")) == __T("1")) || + (Prefs->Config(__T("RememberWindowDimensions")) == __T("1"))) ) { + Prefs->Config(__T("WindowState")).From_Number((int)WindowState); + if (WindowState != wsMaximized) { + if (Prefs->Config(__T("RememberWindowPosition")) == __T("1")) { + Prefs->Config(__T("FormTop")).From_Number((int)this->Top); + Prefs->Config(__T("FormLeft")).From_Number((int)this->Left); + } + if (Prefs->Config(__T("RememberWindowDimensions")) == __T("1")) { + Prefs->Config(__T("FormWidth")).From_Number((int)this->Width); + Prefs->Config(__T("FormHeight")).From_Number((int)this->Height); + } + } Prefs->Config.Save(); + } //The form is closed and all allocated memory for the form is freed. Action = caFree; From 262a6f0d0e79656b3de4e5ea7b64c645f4f55c54 Mon Sep 17 00:00:00 2001 From: regs01 Date: Wed, 3 Jul 2024 06:04:15 +0300 Subject: [PATCH 6/9] Remove ancient DPI code --- Source/GUI/VCL/GUI_Main.cpp | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/Source/GUI/VCL/GUI_Main.cpp b/Source/GUI/VCL/GUI_Main.cpp index 4efad7b18..d94245825 100644 --- a/Source/GUI/VCL/GUI_Main.cpp +++ b/Source/GUI/VCL/GUI_Main.cpp @@ -410,22 +410,6 @@ void __fastcall TMainF::GUI_Configure() } //Set window size and position - // todo: move all property assignments into FormCreate - // note: VCL version? It's been having built-in DPI support since long ago. And it should be Monitor instead of Screen. - // OSVERSIONINFO osvi; - // ZeroMemory(&osvi, sizeof(OSVERSIONINFO)); - // osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - // GetVersionEx(&osvi); - // int DPI; - // if (osvi.dwMajorVersion >= 10 && (osvi.dwMajorVersion > 10 || osvi.dwMinorVersion > 0 || osvi.dwBuildNumber >= 14939)) - // DPI=GetDpiForWindow(WindowHandle); - // else - // DPI=GetDeviceCaps(GetDC(NULL), LOGPIXELSX); - // float DPIScale=static_cast(DPI)/96; - // - // float fpUnscaledMonitorWidth=Monitor->Width/DPIScale; - // float fpUnscaledMonitorHeight=Monitor->Height/DPIScale; - if (Prefs->Config(__T("RememberWindowDimensions")) == __T("1")) { int nPrefWidth = Width; From b8411a2ac50dc40a4d1555ab8403c1bf252387ac Mon Sep 17 00:00:00 2001 From: regs01 Date: Thu, 4 Jul 2024 07:54:04 +0300 Subject: [PATCH 7/9] Move Refresh after reading args --- Source/GUI/VCL/GUI_Main.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Source/GUI/VCL/GUI_Main.cpp b/Source/GUI/VCL/GUI_Main.cpp index d94245825..f3630f903 100644 --- a/Source/GUI/VCL/GUI_Main.cpp +++ b/Source/GUI/VCL/GUI_Main.cpp @@ -277,6 +277,11 @@ __fastcall TMainF::TMainF(TComponent* Owner) for (int I1 = 1; I1 < ParamCount(); I1++) I->Open(Ztring().From_Local(ParamStr(I1).c_str())); #endif + + //Refresh global + FormResize(NULL); + Refresh(); + } //*************************************************************************** @@ -484,10 +489,6 @@ void __fastcall TMainF::GUI_Configure() WindowState = wsMaximized; } - //Refresh global - FormResize(NULL); - Refresh(); - } //--------------------------------------------------------------------------- From abccdf092cf7d61800f82e773532ee57b1cfef2f Mon Sep 17 00:00:00 2001 From: regs01 Date: Wed, 3 Jul 2024 22:46:55 +0300 Subject: [PATCH 8/9] Revert back button alignment to comboboxes --- Source/GUI/VCL/GUI_Preferences.cpp | 11 +++++++++++ Source/GUI/VCL/GUI_Preferences.dfm | 1 + Source/GUI/VCL/GUI_Preferences.h | 1 + 3 files changed, 13 insertions(+) diff --git a/Source/GUI/VCL/GUI_Preferences.cpp b/Source/GUI/VCL/GUI_Preferences.cpp index 5f97af041..8a1284da9 100644 --- a/Source/GUI/VCL/GUI_Preferences.cpp +++ b/Source/GUI/VCL/GUI_Preferences.cpp @@ -611,6 +611,13 @@ void __fastcall TPreferencesF::General_Output_MoreClick(TObject *Sender) Tree->Select(Tree->Items->Item[5]); } +//--------------------------------------------------------------------------- +void __fastcall TPreferencesF::FormAfterMonitorDpiChanged(TObject *Sender, int OldDPI, int NewDPI) +{ + General_Language_More->Height=General_Language_Sel->Height; + General_Output_More->Height=General_Output_Sel->Height; +} + //--------------------------------------------------------------------------- void __fastcall TPreferencesF::FormShow(TObject *Sender) { @@ -792,6 +799,10 @@ void __fastcall TPreferencesF::GUI_Configure() Custom_Edit->Caption=(Prefs->Translate(__T("Edit"))+__T("...")).c_str(); Custom_Delete->Caption=Prefs->Translate(__T("Delete")).c_str(); Custom_New->Caption=(Prefs->Translate(__T("New"))+__T("...")).c_str(); + + General_Language_More->Height=General_Language_Sel->Height; + General_Output_More->Height=General_Output_Sel->Height; + } //*************************************************************************** diff --git a/Source/GUI/VCL/GUI_Preferences.dfm b/Source/GUI/VCL/GUI_Preferences.dfm index 4086b472d..25b7af5ea 100644 --- a/Source/GUI/VCL/GUI_Preferences.dfm +++ b/Source/GUI/VCL/GUI_Preferences.dfm @@ -14,6 +14,7 @@ object PreferencesF: TPreferencesF Font.Name = 'Arial' Font.Style = [] Position = poDesigned + OnAfterMonitorDpiChanged = FormAfterMonitorDpiChanged OnShow = FormShow DesignSize = ( 777 diff --git a/Source/GUI/VCL/GUI_Preferences.h b/Source/GUI/VCL/GUI_Preferences.h index 154438b12..a84f8e477 100644 --- a/Source/GUI/VCL/GUI_Preferences.h +++ b/Source/GUI/VCL/GUI_Preferences.h @@ -118,6 +118,7 @@ class TPreferencesF : public TForm void __fastcall CB_InscrireShell_FolderClick(TObject *Sender); void __fastcall CB_RememberWindowPositionClick(TObject *Sender); void __fastcall CB_RememberWindowDimensionsClick(TObject *Sender); + void __fastcall FormAfterMonitorDpiChanged(TObject *Sender, int OldDPI, int NewDPI); private: // User declarations public: // User declarations __fastcall TPreferencesF(TComponent* Owner); From b67c0715d2f21f1c7bb752b45a0bb755eb7f9b75 Mon Sep 17 00:00:00 2001 From: regs01 Date: Sun, 7 Jul 2024 07:04:35 +0300 Subject: [PATCH 9/9] Move GUI_Configure into OnCreate --- Source/GUI/VCL/GUI_Preferences.cpp | 10 +++++++++- Source/GUI/VCL/GUI_Preferences.dfm | 1 + Source/GUI/VCL/GUI_Preferences.h | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/Source/GUI/VCL/GUI_Preferences.cpp b/Source/GUI/VCL/GUI_Preferences.cpp index 8a1284da9..3daf32414 100644 --- a/Source/GUI/VCL/GUI_Preferences.cpp +++ b/Source/GUI/VCL/GUI_Preferences.cpp @@ -45,6 +45,14 @@ __fastcall TPreferencesF::TPreferencesF(TComponent* Owner) { } +//--------------------------------------------------------------------------- +void __fastcall TPreferencesF::FormCreate(TObject *Sender) +{ + + GUI_Configure(); + +} + //--------------------------------------------------------------------------- void __fastcall TPreferencesF::ComboBox_Update(TComboBox *CB, Prefs_t List) { @@ -622,7 +630,7 @@ void __fastcall TPreferencesF::FormAfterMonitorDpiChanged(TObject *Sender, int O void __fastcall TPreferencesF::FormShow(TObject *Sender) { // review: GUI_Configure should be in FormCreate - GUI_Configure(); + // GUI_Configure(); General_Output_SelChange(NULL); } diff --git a/Source/GUI/VCL/GUI_Preferences.dfm b/Source/GUI/VCL/GUI_Preferences.dfm index 25b7af5ea..04b7274d0 100644 --- a/Source/GUI/VCL/GUI_Preferences.dfm +++ b/Source/GUI/VCL/GUI_Preferences.dfm @@ -15,6 +15,7 @@ object PreferencesF: TPreferencesF Font.Style = [] Position = poDesigned OnAfterMonitorDpiChanged = FormAfterMonitorDpiChanged + OnCreate = FormCreate OnShow = FormShow DesignSize = ( 777 diff --git a/Source/GUI/VCL/GUI_Preferences.h b/Source/GUI/VCL/GUI_Preferences.h index a84f8e477..cc2edfdee 100644 --- a/Source/GUI/VCL/GUI_Preferences.h +++ b/Source/GUI/VCL/GUI_Preferences.h @@ -105,6 +105,7 @@ class TPreferencesF : public TForm void __fastcall Setup_GeneralShow(TObject *Sender); void __fastcall Setup_AdvancedShow(TObject *Sender); void __fastcall Customize_LanguageShow(TObject *Sender); + void __fastcall FormCreate(TObject *Sender); void __fastcall FormShow(TObject *Sender); void __fastcall Customize_CustomShow(TObject *Sender); void __fastcall Sheet_SelChange(TObject *Sender);