From bb06a7fe8e7f68af8e9cd3436d555690255abaa6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Cl=C3=A9ment=20Stenac?= Date: Thu, 6 Oct 2005 17:45:57 +0000 Subject: [PATCH] Misc WX improvements - patches by zcot * Option to have extended interface by default (Closes: #232) * Fix "floating" volume bar with wxMSW 2.6.X (Closes:#289) * Enforce minimum vertical size (Closes:#360) * Fix a font size problem on WX * Add him to THANKS, obviously :) --- THANKS | 1 + modules/gui/wxwidgets/interface.cpp | 46 ++++++++++++++++++++++++++++- modules/gui/wxwidgets/wxwidgets.cpp | 4 +++ 3 files changed, 50 insertions(+), 1 deletion(-) diff --git a/THANKS b/THANKS index ec77aecab0..1510e088b7 100644 --- a/THANKS +++ b/THANKS @@ -95,6 +95,7 @@ Remco Poortinga - IPv6 multicast patch Rene Gollent - BeOS interface fix Roine Gustafsson - spudec bug fixes Rudolf Cornelissen - BeOS fixes +Scott Claude - Visualisation, WX improvements Sebastien Chaumat - YOPY port tests Steve Lhomme - MSVC fixes and Matroska enhancements Steve Brown - fix for optional PES size bug diff --git a/modules/gui/wxwidgets/interface.cpp b/modules/gui/wxwidgets/interface.cpp index c75b158729..ce4f6ee994 100644 --- a/modules/gui/wxwidgets/interface.cpp +++ b/modules/gui/wxwidgets/interface.cpp @@ -330,6 +330,20 @@ Interface::Interface( intf_thread_t *_p_intf, long style ): if( ws->GetSettings( WindowSettings::ID_MAIN, b_shown, p, s ) ) Move( p ); + + /* Set minimum window size to prevent user from glitching it */ + s = GetSize(); + if( config_GetInt( p_intf, "wx-embed" ) ) + { + wxSize s2; + s2 = video_window->GetSize(); + s.SetHeight( s.GetHeight() - s2.GetHeight() ); + } + SetMinSize( s ); + + /* Show extended GUI if requested */ + if( ( b_extra = config_GetInt( p_intf, "wx-extended" ) ) ) + frame_sizer->Show( extra_frame ); } Interface::~Interface() @@ -359,7 +373,7 @@ Interface::~Interface() void Interface::Init() { /* Misc init */ - SetupHotkeys(); + //SetupHotkeys(); } void Interface::Update() @@ -473,6 +487,34 @@ void Interface::CreateOurMenuBar() #endif #endif } + +/* Patch by zcot for menu wrapping */ +#if defined(WIN32) + /* Find out size of msw menu bar */ + i_size = 0; + SIZE sizing; + HDC hdc = GetDC( NULL ); + for( unsigned int i = 0; i < menubar->GetMenuCount(); i++ ) + { + // [ MENU BUTTON WIDTH CALCULATION ] + // [ SM_CXDLGFRAME + pixels + textextent + pixels + SM_CXDLGFRAME ] + GetTextExtentPoint32( hdc, menubar->GetLabelTop(i), + strlen( menubar->GetLabelTop(i) ), + &sizing ); + i_size += sizing.cx; // + text size.. + // +1 more pixel on each size + i_size += 2; + // width of 2 DLGFRAME + i_size += GetSystemMetrics( SM_CXDLGFRAME ) * 2; + } + ReleaseDC( NULL, hdc ); + // Width of 2 edges of app window + i_size += GetSystemMetrics( SM_CXSIZEFRAME ) * 2; + // + 2 more pixels on each side.. + i_size += 4; +#endif +/* End patch by zcot */ + frame_sizer->SetMinSize( i_size, -1 ); /* Intercept all menu events in our custom event handler */ @@ -536,11 +578,13 @@ void Interface::CreateOurToolBar() wxU(_(HELP_PLO)) ); } +#if !( (wxMAJOR_VERSION <= 2) && (wxMINOR_VERSION <= 6) && (wxRELEASE_NUMBER < 2) ) wxControl *p_dummy_ctrl = new wxControl( toolbar, -1, wxDefaultPosition, wxSize(35, 16 ), wxBORDER_NONE ); toolbar->AddControl( p_dummy_ctrl ); +#endif volctrl = new VLCVolCtrl( p_intf, toolbar ); toolbar->AddControl( volctrl ); diff --git a/modules/gui/wxwidgets/wxwidgets.cpp b/modules/gui/wxwidgets/wxwidgets.cpp index a5450b568f..4a629f93b6 100644 --- a/modules/gui/wxwidgets/wxwidgets.cpp +++ b/modules/gui/wxwidgets/wxwidgets.cpp @@ -89,6 +89,8 @@ private: #define BOOKMARKS_TEXT N_("Show bookmarks dialog") #define BOOKMARKS_LONGTEXT N_("Show bookmarks dialog when the interface " \ "starts.") +#define EXTENDED_TEXT N_("Show extended GUI") +#define EXTENDED_LONGTEXT N_("Show extended GUI") #define TASKBAR_TEXT N_("Show taskbar entry") #define TASKBAR_LONGTEXT N_("Show taskbar entry") #define MINIMAL_TEXT N_("Minimal interface") @@ -125,6 +127,8 @@ vlc_module_begin(); add_bool( "wx-taskbar", 1, NULL, TASKBAR_TEXT, TASKBAR_LONGTEXT, VLC_FALSE ); add_deprecated( "wxwin-taskbar", VLC_FALSE); /*Deprecated since 0.8.4*/ + add_bool( "wx-extended", 0, NULL, + EXTENDED_TEXT, EXTENDED_LONGTEXT, VLC_FALSE ); add_bool( "wx-minimal", 0, NULL, MINIMAL_TEXT, MINIMAL_LONGTEXT, VLC_TRUE ); add_deprecated( "wxwin-minimal", VLC_FALSE); /*Deprecated since 0.8.4*/ -- 2.39.5