Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows GUI: Upgrade to C++Builder 12 Community Edition #918

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
255 changes: 230 additions & 25 deletions Project/BCB/GUI/MediaInfo_GUI.cbproj

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Source/Common/Utilsx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include <vfw.h> // ICINFO
#include "Utils.h"
#include "Preferences.h"
#include "tchar.h"
#include <ZenLib/Ztring.h>
#include <ZenLib/File.h>
using namespace ZenLib;
Expand Down
57 changes: 24 additions & 33 deletions Source/GUI/VCL/GUI_Main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,18 +413,8 @@ void __fastcall TMainF::GUI_Configure()
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<float>(DPI)/96;
float ScaledScreenWidth=Screen->Width/DPIScale;
float ScaledScreenHeight=Screen->Height/DPIScale;
float ScaledScreenWidth=Screen->Width/ScaleFactor;
float ScaledScreenHeight=Screen->Height/ScaleFactor;
Width=500;
Height=400;
if (ScaledScreenWidth>=1024)
Expand All @@ -435,8 +425,8 @@ void __fastcall TMainF::FormShow(TObject *Sender)
Height=500;
if (ScaledScreenHeight>=1024)
Height=600;
Width*=DPIScale;
Height*=DPIScale;
Width*=ScaleFactor;
Height*=ScaleFactor;
Left=(Screen->Width-Width)/2;
Top=(Screen->Height-Height)/2;

Expand Down Expand Up @@ -962,34 +952,35 @@ void __fastcall TMainF::Refresh(TTabSheet *Page)
else if (Page==Page_HTML)
{
I->Option_Static(__T("Inform"), __T("HTML"));

//Creating file
File F;
if (FileName_Temp==__T(""))
{
FileName_Temp=FileName::TempFileName_Create(__T("MI_"));
File::Delete(FileName_Temp);
FileName_Temp+=__T(".html");
}
F.Create(FileName_Temp, true);
if (FilesCount>0)
{
//Creating file
Ztring S1=I->Inform().c_str();
File F;
S1=InjectHTMLStyle(I->Inform().c_str());
if (FileName_Temp==__T(""))
{
FileName_Temp=FileName::TempFileName_Create(__T("MI_"));
File::Delete(FileName_Temp);
FileName_Temp+=__T(".html");
}
F.Create(FileName_Temp, true);
Ztring S1=InjectHTMLStyle(I->Inform().c_str());
F.Write(S1);
F.Close();
//Navigate
Page_HTML_HTML->Navigate((MediaInfoNameSpace::Char*)FileName_Temp.c_str());
}
else
{
Ztring TempA; TempA=Prefs->Translate(__T("At least one file"));
Ztring Temp;
Temp+=L"about:<html><head></head><body>";
Temp+=L"<!DOCTYPE html><html><head></head><body>";
Temp+=TempA.To_Unicode();
Temp+=L"</body></html>";
Temp=InjectHTMLStyle(Temp.c_str());
Page_HTML_HTML->Navigate((MediaInfoNameSpace::Char*)Temp.c_str());
F.Write(Temp);
}
F.Close();

//Navigate
Page_HTML_HTML->Navigate(const_cast<MediaInfoNameSpace::Char*>(FileName_Temp.c_str()));
}

//Custom
Expand Down Expand Up @@ -1865,8 +1856,8 @@ void __fastcall TMainF::Page_Sheet_Splitter1Moved(TObject *Sender)
}

//---------------------------------------------------------------------------
void __fastcall TMainF::Page_Sheet_SheetSelectCell(TObject *Sender, int ACol,
int ARow, bool &CanSelect)
void __fastcall TMainF::Page_Sheet_SheetSelectCell(TObject *Sender, System::LongInt ACol,
System::LongInt ARow, bool &CanSelect)
{
Page_Position=ARow-1;

Expand Down Expand Up @@ -2088,7 +2079,7 @@ void __fastcall TMainF::DestroyWnd()

//---------------------------------------------------------------------------
void __fastcall TMainF::ApplicationEvents1OnSettingChange(
TObject* Sender, int Flag, const UnicodeString Section, int &Result)
TObject* Sender, int Flag, const UnicodeString Section, System::LongInt &Result)
{
if (Section == "ImmersiveColorSet") {
ConfigTheme();
Expand Down
13 changes: 6 additions & 7 deletions Source/GUI/VCL/GUI_Main.dfm
Original file line number Diff line number Diff line change
Expand Up @@ -581,14 +581,14 @@ object MainF: TMainF
object Page_HTML: TTabSheet
Caption = 'HTML'
ImageIndex = 6
object Page_HTML_HTML: TCppWebBrowser
Left = 4
object Page_HTML_HTML: TWebBrowser
Left = 0
Top = 0
Width = 673
Height = 385
Width = 300
Height = 150
TabOrder = 0
ControlData = {
4C0000008E450000CA2700000000000000000000000000000000000000000000
4C000000021F0000810F00000000000000000000000000000000000000000000
000000004C000000000000000000000001000000E0D057007335CF11AE690800
2B2E126208000000000000004C0000000114020000000000C000000000000046
8000000000000000000000000000000000000000000000000000000000000000
Expand Down Expand Up @@ -621,7 +621,7 @@ object MainF: TMainF
ScrollBars = ssBoth
TabOrder = 0
end
object Page_Custom_HTML: TCppWebBrowser
object Page_Custom_HTML: TWebBrowser
Left = 336
Top = 0
Width = 300
Expand Down Expand Up @@ -729,7 +729,6 @@ object MainF: TMainF
ShowHint = True
TabOrder = 1
Transparent = True
ExplicitHeight = 599
object Tool_File: TToolButton
Left = 0
Top = 0
Expand Down
15 changes: 9 additions & 6 deletions Source/GUI/VCL/GUI_Main.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include <Menus.hpp>
#include <StdCtrls.hpp>
#include <Dialogs.hpp>
#include "SHDocVw_OCX.h"
#include <ExtCtrls.hpp>
#include <Buttons.hpp>
#include <System.ImageList.hpp>
Expand All @@ -34,6 +33,10 @@
#include <Vcl.VirtualImageList.hpp>
#include <Registry.hpp>
#include <Vcl.AppEvnts.hpp>
#include <Vcl.Edge.hpp>
#include <Winapi.ActiveX.hpp>
#include <Winapi.WebView2.hpp>
#include <SHDocVw.hpp>
//---------------------------------------------------------------------------

//---------------------------------------------------------------------------
Expand Down Expand Up @@ -91,10 +94,8 @@ class TMainF : public TForm
TTabSheet *Page_Text;
TMemo *Page_Text_Text;
TTabSheet *Page_HTML;
TCppWebBrowser *Page_HTML_HTML;
TTabSheet *Page_Custom;
TMemo *Page_Custom_Text;
TCppWebBrowser *Page_Custom_HTML;
TTabSheet *Page_System;
TGroupBox *Page_System_Buttons;
TRadioButton *Page_System_Buttons_Video;
Expand Down Expand Up @@ -226,6 +227,8 @@ class TMainF : public TForm
TMenuItem *M_Options_Theme_System;
TMenuItem *M_Options_Theme_Light;
TMenuItem *M_Options_Theme_Dark;
TWebBrowser *Page_HTML_HTML;
TWebBrowser *Page_Custom_HTML;
void __fastcall FormResize(TObject *Sender);
void __fastcall M_Help_AboutClick(TObject *Sender);
void __fastcall M_Options_PreferencesClick(TObject *Sender);
Expand Down Expand Up @@ -257,8 +260,8 @@ class TMainF : public TForm
void __fastcall M_LanguageClick(TObject *Sender);
void __fastcall M_Help_SupportedParametersClick(TObject *Sender);
void __fastcall M_File_ExportClick(TObject *Sender);
void __fastcall Page_Sheet_SheetSelectCell(TObject *Sender, int ACol, int ARow,
bool &CanSelect);
void __fastcall Page_Sheet_SheetSelectCell(TObject *Sender, System::LongInt ACol,
System::LongInt ARow, bool &CanSelect);
void __fastcall Page_Easy_FileChange(TObject *Sender);
void __fastcall Page_Easy_DifferentViewClick(TObject *Sender);
void __fastcall FormClose(TObject *Sender, TCloseAction &Action);
Expand Down Expand Up @@ -292,7 +295,7 @@ class TMainF : public TForm
void __fastcall M_View_Graph_SvgClick(TObject *Sender);
void __fastcall M_Options_FullParsingClick(TObject *Sender);
void __fastcall ApplicationEvents1OnSettingChange(TObject *Sender, int Flag, const UnicodeString Section,
int &Result);
System::LongInt &Result);
void __fastcall Page_Sheet_Splitter1Moved(TObject *Sender);
void __fastcall M_Options_Theme_SystemClick(TObject *Sender);
void __fastcall M_Options_Theme_LightClick(TObject *Sender);
Expand Down
5 changes: 2 additions & 3 deletions Source/GUI/VCL/GUI_Web.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ void __fastcall TWebF::Execute()
Browser->Navigate((UnicodeString(L"https://MediaArea.net/MediaInfo/ChangeLog?Name=MediaInfoGUI&Version=")+MediaInfo_Version_GUI+L"&Lib="+MediaInfo_Version_GUI).w_str());
}
//---------------------------------------------------------------------------
void __fastcall TWebF::BrowserNavigateComplete2(TObject *Sender,
LPDISPATCH pDisp, Variant *URL)
void __fastcall TWebF::BrowserNavigateComplete2(TObject *ASender, IDispatch * const pDisp,
const OleVariant &URL)
{
Hide();
}
Expand All @@ -55,4 +55,3 @@ void __fastcall TWebF::BrowserNavigateComplete2(TObject *Sender,
//***************************************************************************

#endif //MEDIAINFOGUI_UPDATE_NO

6 changes: 2 additions & 4 deletions Source/GUI/VCL/GUI_Web.dfm
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,10 @@ object WebF: TWebF
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
Position = poDesktopCenter
WindowState = wsMinimized
PixelsPerInch = 96
TextHeight = 13
object Browser: TCppWebBrowser
object Browser: TWebBrowser
Left = 8
Top = 8
Width = 210
Expand All @@ -27,7 +25,7 @@ object WebF: TWebF
ControlData = {
4C000000B41500003D0400000000000000000000000000000000000000000000
000000004C000000000000000000000001000000E0D057007335CF11AE690800
2B2E12620A000000000000004C0000000114020000000000C000000000000046
2B2E126208000000000000004C0000000114020000000000C000000000000046
8000000000000000000000000000000000000000000000000000000000000000
00000000000000000100000000000000000000000000000000000000}
end
Expand Down
8 changes: 4 additions & 4 deletions Source/GUI/VCL/GUI_Web.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include "SHDocVw_OCX.h"
#include <OleCtrls.hpp>
#include <SHDocVw.hpp>
//---------------------------------------------------------------------------
class TWebF : public TForm
{
__published: // IDE-managed Components
TCppWebBrowser *Browser;
void __fastcall BrowserNavigateComplete2(TObject *Sender, LPDISPATCH pDisp,
Variant *URL);
TWebBrowser *Browser;
void __fastcall BrowserNavigateComplete2(TObject *ASender, IDispatch * const pDisp,
const OleVariant &URL);
private: // User declarations
public: // User declarations
__fastcall TWebF(TComponent* Owner);
Expand Down
Loading