mirror of https://github.com/PCSX2/pcsx2.git
Partial implementation of Video configuration panel (totally just for show right now, does nothing).
Dev note: kinda reached a point where I'd like to make some revamps of the wxHelper classes based on better understanding of wx-in-practice. So I'm going to work on a significant refactoring of most pcsx2 panel constructors starting now. :) git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2171 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
1a99183639
commit
a33f3e1daf
|
@ -40,6 +40,100 @@ wxRect wxGetDisplayArea()
|
|||
return wxRect( wxPoint(), wxGetDisplaySize() );
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// pxTextWrapper / pxTextWrapperBase Implementations
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
||||
pxTextWrapperBase& pxTextWrapperBase::Wrap( const wxWindow& win, const wxString& text, int widthMax )
|
||||
{
|
||||
const wxChar *lastSpace = NULL;
|
||||
wxString line;
|
||||
line.Alloc( widthMax+12 );
|
||||
|
||||
const wxChar *lineStart = text.c_str();
|
||||
for ( const wxChar *p = lineStart; ; p++ )
|
||||
{
|
||||
if ( IsStartOfNewLine() )
|
||||
{
|
||||
OnNewLine();
|
||||
|
||||
lastSpace = NULL;
|
||||
line.clear();
|
||||
lineStart = p;
|
||||
}
|
||||
|
||||
if ( *p == L'\n' || *p == L'\0' )
|
||||
{
|
||||
DoOutputLine(line);
|
||||
|
||||
if ( *p == L'\0' )
|
||||
break;
|
||||
}
|
||||
else // not EOL
|
||||
{
|
||||
if ( *p == L' ' )
|
||||
lastSpace = p;
|
||||
|
||||
line += *p;
|
||||
|
||||
if ( widthMax >= 0 && lastSpace )
|
||||
{
|
||||
int width;
|
||||
win.GetTextExtent(line, &width, NULL);
|
||||
|
||||
if ( width > widthMax )
|
||||
{
|
||||
// remove the last word from this line
|
||||
line.erase(lastSpace - lineStart, p + 1 - lineStart);
|
||||
DoOutputLine(line);
|
||||
|
||||
// go back to the last word of this line which we didn't
|
||||
// output yet
|
||||
p = lastSpace;
|
||||
}
|
||||
}
|
||||
//else: no wrapping at all or impossible to wrap
|
||||
}
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
void pxTextWrapperBase::DoOutputLine(const wxString& line)
|
||||
{
|
||||
OnOutputLine(line);
|
||||
m_linecount++;
|
||||
m_eol = true;
|
||||
}
|
||||
|
||||
// this function is a destructive inspector: when it returns true it also
|
||||
// resets the flag to false so calling it again wouldn't return true any
|
||||
// more
|
||||
bool pxTextWrapperBase::IsStartOfNewLine()
|
||||
{
|
||||
if ( !m_eol )
|
||||
return false;
|
||||
|
||||
m_eol = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
pxTextWrapper& pxTextWrapper::Wrap( const wxWindow& win, const wxString& text, int widthMax )
|
||||
{
|
||||
_parent::Wrap( win, text, widthMax );
|
||||
return *this;
|
||||
}
|
||||
|
||||
void pxTextWrapper::OnOutputLine(const wxString& line)
|
||||
{
|
||||
m_text += line;
|
||||
}
|
||||
|
||||
void pxTextWrapper::OnNewLine()
|
||||
{
|
||||
m_text += L'\n';
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// ScopedBusyCursor Implementations
|
||||
// --------------------------------------------------------------------------------------
|
||||
|
@ -107,3 +201,30 @@ const wxCursor& MoreStockCursors::GetArrowWait()
|
|||
}
|
||||
|
||||
MoreStockCursors StockCursors;
|
||||
|
||||
// --------------------------------------------------------------------------------------
|
||||
// pxSetToolTip
|
||||
// --------------------------------------------------------------------------------------
|
||||
// This is the preferred way to assign tooltips to wxWindow-based objects, as it performs the
|
||||
// necessary text wrapping on platforms that need it. On windows tooltips are wrapped at 600
|
||||
// pixels, or 66% of the screen width, whichever is smaller. GTK and MAC perform internal
|
||||
// wrapping, so this function does a regular assignment there.
|
||||
void pxSetToolTip( wxWindow* wind, const wxString& src )
|
||||
{
|
||||
if( !pxAssert( wind != NULL ) ) return;
|
||||
|
||||
// Windows needs manual tooltip word wrapping (sigh).
|
||||
// GTK and Mac are a wee bit more clever (except in GTK tooltips don't show at all
|
||||
// half the time because of some other bug .. sigh)
|
||||
#ifdef __WXMSW__
|
||||
int whee = wxGetDisplaySize().GetWidth() * 0.75;
|
||||
wind->SetToolTip( pxTextWrapper().Wrap( *wind, src, std::min( whee, 600 ) ).GetResult() );
|
||||
#else
|
||||
wind->SetToolTip( src );
|
||||
#endif
|
||||
}
|
||||
|
||||
void pxSetToolTip( wxWindow& wind, const wxString& src )
|
||||
{
|
||||
pxSetToolTip( &wind, src );
|
||||
}
|
||||
|
|
|
@ -67,7 +67,8 @@ void GSFrame::OnKeyDown( wxKeyEvent& evt )
|
|||
{
|
||||
// HACK: Legacy PAD plugins expect PCSX2 to ignore keyboard messages on the GS Window while
|
||||
// the PAD plugin is open, so ignore here (PCSX2 will direct messages routed from PAD directly
|
||||
// to the APP level message handler).
|
||||
// to the APP level message handler, which in turn routes them right back here -- yes it's
|
||||
// silly, but oh well).
|
||||
|
||||
if( (PADopen != NULL) && CoreThread.IsOpen() ) return;
|
||||
|
||||
|
|
|
@ -280,12 +280,40 @@ namespace Panels
|
|||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
class FramelimiterPanel : public BaseApplicableConfigPanel
|
||||
{
|
||||
protected:
|
||||
wxCheckBox* m_check_LimiterDisable;
|
||||
wxSpinCtrl* m_spin_NominalPct;
|
||||
wxSpinCtrl* m_spin_SlomoPct;
|
||||
wxSpinCtrl* m_spin_TurboPct;
|
||||
|
||||
wxTextCtrl* m_text_BaseNtsc;
|
||||
wxTextCtrl* m_text_BasePal;
|
||||
|
||||
wxCheckBox* m_SkipperEnable;
|
||||
wxCheckBox* m_TurboSkipEnable;
|
||||
wxSpinCtrl* m_spin_SkipThreshold;
|
||||
|
||||
wxSpinCtrl* m_spin_FramesToSkip;
|
||||
wxSpinCtrl* m_spin_FramesToDraw;
|
||||
|
||||
public:
|
||||
FramelimiterPanel( wxWindow& parent, int idealWidth );
|
||||
virtual ~FramelimiterPanel() throw() {}
|
||||
void Apply();
|
||||
};
|
||||
|
||||
class VideoPanel : public BaseApplicableConfigPanel
|
||||
{
|
||||
protected:
|
||||
wxCheckBox* m_check_CloseGS;
|
||||
//wxCheckBox* m_check_CloseGS;
|
||||
//wxCheckBox* m_;
|
||||
|
||||
public:
|
||||
VideoPanel( wxWindow& parent, int idealWidth );
|
||||
virtual ~VideoPanel() throw() {}
|
||||
void Apply();
|
||||
};
|
||||
|
||||
|
|
|
@ -16,9 +16,125 @@
|
|||
#include "PrecompiledHeader.h"
|
||||
#include "ConfigurationPanels.h"
|
||||
|
||||
#include <wx/spinctrl.h>
|
||||
|
||||
using namespace wxHelpers;
|
||||
|
||||
Panels::FramelimiterPanel::FramelimiterPanel( wxWindow& parent, int idealWidth ) :
|
||||
BaseApplicableConfigPanel( &parent, idealWidth )
|
||||
{
|
||||
wxBoxSizer& mainSizer = *new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
AddStaticText( mainSizer, pxE( ".Framelimiter:Heading",
|
||||
L"The internal framelimiter regulates the speed of the virtual machine. Adjustment values below are in "
|
||||
L"percentages of the default region-based framerate, which can also be configured below."
|
||||
) );
|
||||
|
||||
m_check_LimiterDisable = &AddCheckBox( mainSizer, _("Disable Framelimiting"),
|
||||
_("Useful for running benchmarks. Toggle this option in-game by pressing F4."),
|
||||
pxE( ".Tooltip:Framelimiter:Disable",
|
||||
L"Note that when Framelimiting is disabled, Turbo and SlowMotion modes will not "
|
||||
L"be available either."
|
||||
)
|
||||
);
|
||||
|
||||
m_spin_NominalPct = new wxSpinCtrl( this );
|
||||
m_spin_SlomoPct = new wxSpinCtrl( this );
|
||||
m_spin_TurboPct = new wxSpinCtrl( this );
|
||||
|
||||
(m_text_BaseNtsc = new wxTextCtrl( this, wxID_ANY ))->SetWindowStyleFlag( wxTE_RIGHT );
|
||||
(m_text_BasePal = new wxTextCtrl( this, wxID_ANY ))->SetWindowStyleFlag( wxTE_RIGHT );
|
||||
|
||||
m_spin_NominalPct->SetValue( 100 );
|
||||
m_spin_SlomoPct->SetValue( 50 );
|
||||
m_spin_TurboPct->SetValue( 100 );
|
||||
|
||||
m_text_BaseNtsc->SetValue( L"59.94" );
|
||||
m_text_BasePal->SetValue( L"50.00" );
|
||||
|
||||
wxFlexGridSizer& s_spins = *new wxFlexGridSizer( 5 );
|
||||
|
||||
//s_spins.AddGrowableCol( 0, 1 );
|
||||
//s_spins.AddGrowableCol( 1, 1 );
|
||||
|
||||
AddStaticText( s_spins, _("Base Framerate Adjust:"), wxALIGN_LEFT );
|
||||
s_spins.AddSpacer( 5 );
|
||||
s_spins.Add( m_spin_NominalPct, wxSizerFlags().Border(wxTOP, 3) );
|
||||
s_spins.Add( new wxStaticText( this, wxID_ANY, L"%" ), SizerFlags::StdSpace() );
|
||||
s_spins.AddSpacer( 5 );
|
||||
|
||||
AddStaticText( s_spins, _("Slow Motion Adjust:"), wxALIGN_LEFT );
|
||||
s_spins.AddSpacer( 5 );
|
||||
s_spins.Add( m_spin_SlomoPct, wxSizerFlags().Border(wxTOP, 3) );
|
||||
s_spins.Add( new wxStaticText( this, wxID_ANY, L"%" ), SizerFlags::StdSpace() );
|
||||
s_spins.AddSpacer( 5 );
|
||||
|
||||
AddStaticText( s_spins, _("Turbo Adjust:"), wxALIGN_LEFT );
|
||||
s_spins.AddSpacer( 5 );
|
||||
s_spins.Add( m_spin_TurboPct, wxSizerFlags().Border(wxTOP, 3) );
|
||||
s_spins.Add( new wxStaticText( this, wxID_ANY, L"%" ), SizerFlags::StdSpace() );
|
||||
s_spins.AddSpacer( 5 );
|
||||
|
||||
s_spins.AddSpacer( 15 );
|
||||
s_spins.AddSpacer( 15 );
|
||||
s_spins.AddSpacer( 15 );
|
||||
s_spins.AddSpacer( 15 );
|
||||
s_spins.AddSpacer( 15 );
|
||||
|
||||
AddStaticText( s_spins, _("NTSC Framerate:"), wxALIGN_LEFT );
|
||||
s_spins.AddSpacer( 5 );
|
||||
s_spins.Add( m_text_BaseNtsc, wxSizerFlags().Border(wxTOP, 3) );
|
||||
s_spins.Add( new wxStaticText( this, wxID_ANY, _("FPS") ), SizerFlags::StdSpace() );
|
||||
s_spins.AddSpacer( 5 );
|
||||
|
||||
AddStaticText( s_spins, _("PAL Framerate:"), wxALIGN_LEFT );
|
||||
s_spins.AddSpacer( 5 );
|
||||
s_spins.Add( m_text_BasePal, wxSizerFlags().Border(wxTOP, 3) );
|
||||
s_spins.Add( new wxStaticText( this, wxID_ANY, _("FPS") ), SizerFlags::StdSpace() );
|
||||
s_spins.AddSpacer( 5 );
|
||||
|
||||
mainSizer.Add( &s_spins );
|
||||
|
||||
SetSizer( &mainSizer );
|
||||
|
||||
}
|
||||
|
||||
void Panels::FramelimiterPanel::Apply()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Panels::VideoPanel::VideoPanel( wxWindow& parent, int idealWidth ) :
|
||||
BaseApplicableConfigPanel( &parent, idealWidth )
|
||||
{
|
||||
wxBoxSizer& mainSizer = *new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_check_CloseGS = &AddCheckBox( mainSizer, _("Hide GS window on Suspend"),
|
||||
wxEmptyString, // subtext
|
||||
pxE( ".Tooltip:Video:HideGS",
|
||||
L"Completely closes the often large and bulky GS window when pressing "
|
||||
L"ESC or suspending the emulator. That way it won't get *in* the way!"
|
||||
)
|
||||
);
|
||||
|
||||
/*&AddCheckBox( mainSizer, _(""),
|
||||
wxEmptyString, // subtext
|
||||
pxE( ".Tooltip:Video:HideGS",
|
||||
L"Completely closes the often large and bulky GS window when pressing "
|
||||
L"ESC or suspending the emulator. That way it won't get *in* the way!"
|
||||
)
|
||||
);*/
|
||||
|
||||
m_check_CloseGS->SetValue( g_Conf->CloseGSonEsc );
|
||||
|
||||
wxStaticBoxSizer& limitSizer = *new wxStaticBoxSizer( wxVERTICAL, this, _("Framelimiter") );
|
||||
|
||||
limitSizer.Add( new FramelimiterPanel( *this, idealWidth - 32 ) );
|
||||
|
||||
mainSizer.Add( &limitSizer );
|
||||
|
||||
SetSizer( &mainSizer );
|
||||
|
||||
// TODO:
|
||||
// Framelimiting / Frameskipping / Vsync
|
||||
// GS Window Options ( incl. Fullscreen )
|
||||
|
|
|
@ -196,122 +196,6 @@ void wxHelpers::Explore(const char *path)
|
|||
Explore( fromUTF8(path) );
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
pxTextWrapperBase& pxTextWrapperBase::Wrap( const wxWindow& win, const wxString& text, int widthMax )
|
||||
{
|
||||
const wxChar *lastSpace = NULL;
|
||||
wxString line;
|
||||
line.Alloc( widthMax+12 );
|
||||
|
||||
const wxChar *lineStart = text.c_str();
|
||||
for ( const wxChar *p = lineStart; ; p++ )
|
||||
{
|
||||
if ( IsStartOfNewLine() )
|
||||
{
|
||||
OnNewLine();
|
||||
|
||||
lastSpace = NULL;
|
||||
line.clear();
|
||||
lineStart = p;
|
||||
}
|
||||
|
||||
if ( *p == L'\n' || *p == L'\0' )
|
||||
{
|
||||
DoOutputLine(line);
|
||||
|
||||
if ( *p == L'\0' )
|
||||
break;
|
||||
}
|
||||
else // not EOL
|
||||
{
|
||||
if ( *p == L' ' )
|
||||
lastSpace = p;
|
||||
|
||||
line += *p;
|
||||
|
||||
if ( widthMax >= 0 && lastSpace )
|
||||
{
|
||||
int width;
|
||||
win.GetTextExtent(line, &width, NULL);
|
||||
|
||||
if ( width > widthMax )
|
||||
{
|
||||
// remove the last word from this line
|
||||
line.erase(lastSpace - lineStart, p + 1 - lineStart);
|
||||
DoOutputLine(line);
|
||||
|
||||
// go back to the last word of this line which we didn't
|
||||
// output yet
|
||||
p = lastSpace;
|
||||
}
|
||||
}
|
||||
//else: no wrapping at all or impossible to wrap
|
||||
}
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
void pxTextWrapperBase::DoOutputLine(const wxString& line)
|
||||
{
|
||||
OnOutputLine(line);
|
||||
m_linecount++;
|
||||
m_eol = true;
|
||||
}
|
||||
|
||||
// this function is a destructive inspector: when it returns true it also
|
||||
// resets the flag to false so calling it again wouldn't return true any
|
||||
// more
|
||||
bool pxTextWrapperBase::IsStartOfNewLine()
|
||||
{
|
||||
if ( !m_eol )
|
||||
return false;
|
||||
|
||||
m_eol = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
pxTextWrapper& pxTextWrapper::Wrap( const wxWindow& win, const wxString& text, int widthMax )
|
||||
{
|
||||
_parent::Wrap( win, text, widthMax );
|
||||
return *this;
|
||||
}
|
||||
|
||||
void pxTextWrapper::OnOutputLine(const wxString& line)
|
||||
{
|
||||
m_text += line;
|
||||
}
|
||||
|
||||
void pxTextWrapper::OnNewLine()
|
||||
{
|
||||
m_text += L'\n';
|
||||
}
|
||||
|
||||
// This is the preferred way to assign tooltips to wxWindow-based objects, as it performs the
|
||||
// necessary text wrapping on platforms that need it. On windows tooltips are wrapped at 600
|
||||
// pixels, or 66% of the screen width, whichever is smaller. GTK and MAC perform internal
|
||||
// wrapping, so this function does a regular assignment there.
|
||||
void pxSetToolTip( wxWindow* wind, const wxString& src )
|
||||
{
|
||||
if( !pxAssert( wind != NULL ) ) return;
|
||||
|
||||
// Windows needs manual tooltip word wrapping (sigh).
|
||||
// GTK and Mac are a wee bit more clever (except in GTK tooltips don't show at all
|
||||
// half the time because of some other bug .. sigh)
|
||||
#ifdef __WXMSW__
|
||||
int whee = wxGetDisplaySize().GetWidth() * 0.75;
|
||||
wind->SetToolTip( pxTextWrapper().Wrap( *wind, src, std::min( whee, 600 ) ).GetResult() );
|
||||
#else
|
||||
wind->SetToolTip( src );
|
||||
#endif
|
||||
}
|
||||
|
||||
void pxSetToolTip( wxWindow& wind, const wxString& src )
|
||||
{
|
||||
pxSetToolTip( &wind, src );
|
||||
}
|
||||
|
||||
|
||||
// =====================================================================================================
|
||||
// wxDialogWithHelpers Class Implementations
|
||||
// =====================================================================================================
|
||||
|
|
|
@ -78,6 +78,8 @@ public:
|
|||
wxPanelWithHelpers( wxWindow* parent, int idealWidth=wxDefaultCoord );
|
||||
wxPanelWithHelpers( wxWindow* parent, const wxPoint& pos, const wxSize& size=wxDefaultSize );
|
||||
|
||||
//wxRadioButton& NewSpinCtrl( const wxString& label, const wxString& subtext=wxEmptyString, const wxString& tooltip=wxEmptyString );
|
||||
|
||||
wxCheckBox& AddCheckBox( wxSizer& sizer, const wxString& label, const wxString& subtext=wxEmptyString, const wxString& tooltip=wxEmptyString );
|
||||
wxRadioButton& AddRadioButton( wxSizer& sizer, const wxString& label, const wxString& subtext=wxEmptyString, const wxString& tooltip=wxEmptyString );
|
||||
wxStaticText& AddStaticText(wxSizer& sizer, const wxString& label, int alignFlags=wxALIGN_CENTRE, int size=wxDefaultCoord );
|
||||
|
|
Loading…
Reference in New Issue