Minor enhancements and changes for wxWidgets 3 compat

This commit is contained in:
charras 2009-04-26 17:00:59 +00:00
parent d6af27a308
commit fab8dece8f
10 changed files with 36 additions and 90 deletions

View File

@ -54,7 +54,6 @@ enum onrclick_id {
*/ */
BEGIN_EVENT_TABLE( Pcb3D_GLCanvas, wxGLCanvas ) BEGIN_EVENT_TABLE( Pcb3D_GLCanvas, wxGLCanvas )
EVT_SIZE( Pcb3D_GLCanvas::OnSize )
EVT_PAINT( Pcb3D_GLCanvas::OnPaint ) EVT_PAINT( Pcb3D_GLCanvas::OnPaint )
EVT_CHAR( Pcb3D_GLCanvas::OnChar ) EVT_CHAR( Pcb3D_GLCanvas::OnChar )
EVT_MOUSE_EVENTS( Pcb3D_GLCanvas::OnMouseEvent ) EVT_MOUSE_EVENTS( Pcb3D_GLCanvas::OnMouseEvent )
@ -67,7 +66,7 @@ END_EVENT_TABLE()
Pcb3D_GLCanvas::Pcb3D_GLCanvas( WinEDA3D_DrawFrame* parent, const wxWindowID id, Pcb3D_GLCanvas::Pcb3D_GLCanvas( WinEDA3D_DrawFrame* parent, const wxWindowID id,
int* gl_attrib ) : int* gl_attrib ) :
wxGLCanvas( parent, id, wxGLCanvas( parent, id,
wxPoint( -1, -1 ), wxSize( -1, -1 ), 0, wxT( "Pcb3D_glcanvas" ), gl_attrib ) wxPoint( -1, -1 ), wxSize( -1, -1 ), wxFULL_REPAINT_ON_RESIZE )
/*************************************************************************/ /*************************************************************************/
{ {
m_init = FALSE; m_init = FALSE;
@ -479,36 +478,20 @@ void Pcb3D_GLCanvas::OnPaint( wxPaintEvent& event )
/*************************************************/ /*************************************************/
{ {
wxPaintDC dc( this ); wxPaintDC dc( this );
// Set the OpenGL viewport according to the client size of this canvas.
// This is done here rather than in a wxSizeEvent handler because our
// OpenGL rendering context (and thus viewport setting) is used with
// multiple canvases: If we updated the viewport in the wxSizeEvent
// handler, changing the size of one canvas causes a viewport setting that
// is wrong when next another canvas is repainted.
const wxSize ClientSize = GetClientSize();
#ifndef __WXMOTIF__ glViewport(0, 0, ClientSize.x, ClientSize.y);
if( !GetContext() )
return;
#endif
Redraw(); Redraw();
event.Skip(); event.Skip();
} }
/*****************************************************/
void Pcb3D_GLCanvas::OnSize( wxSizeEvent& event )
/*****************************************************/
{
int w, h;
// set GL viewport (not called by wxGLCanvas::OnSize on all platforms...)
// this is also necessary to update the context on some platforms
wxGLCanvas::OnSize( event );
GetClientSize( &w, &h );
#ifndef __WXMOTIF__
if( GetContext() )
#endif
{
glViewport( 0, 0, (GLint) w, (GLint) h );
}
event.Skip();
}
/***********************************************************/ /***********************************************************/
void Pcb3D_GLCanvas::OnEraseBackground( wxEraseEvent& event ) void Pcb3D_GLCanvas::OnEraseBackground( wxEraseEvent& event )

View File

@ -87,7 +87,6 @@ public:
void ClearLists(); void ClearLists();
void OnPaint(wxPaintEvent& event); void OnPaint(wxPaintEvent& event);
void OnSize(wxSizeEvent& event);
void OnEraseBackground(wxEraseEvent& event); void OnEraseBackground(wxEraseEvent& event);
void OnChar(wxKeyEvent& event); void OnChar(wxKeyEvent& event);
void OnMouseEvent(wxMouseEvent& event); void OnMouseEvent(wxMouseEvent& event);

View File

@ -540,7 +540,7 @@ FOOTPRINT* GetModuleDescrByName( const wxString& FootprintName,
{ {
footprint = *i; footprint = *i;
if( *footprint->m_Module == FootprintName ) if( footprint->m_Module == FootprintName )
return footprint; return footprint;
} }

View File

@ -47,8 +47,6 @@ void DialogLabelEditor::init()
{ {
wxString msg; wxString msg;
SetFont( *g_DialogFont );
m_TextLabel->SetValue( m_CurrentText->m_Text ); m_TextLabel->SetValue( m_CurrentText->m_Text );
m_TextLabel->SetFocus(); m_TextLabel->SetFocus();
@ -133,3 +131,13 @@ void DialogLabelEditor::OnButtonCANCEL_Click( wxCommandEvent& event )
m_Parent->DrawPanel->MouseToCursorSchema(); m_Parent->DrawPanel->MouseToCursorSchema();
EndModal( -1 ); EndModal( -1 );
} }
/*!
* wxTE_PROCESS_ENTER event handler for m_TextLabel
*/
void DialogLabelEditor::onEnterKey( wxCommandEvent& event )
{
TextPropertiesAccept( event );
}

View File

@ -16,8 +16,6 @@ private:
WinEDA_SchematicFrame * m_Parent; WinEDA_SchematicFrame * m_Parent;
SCH_TEXT * m_CurrentText; SCH_TEXT * m_CurrentText;
void init();
protected: protected:
// these are protected so that the static ShowModally() gets used. // these are protected so that the static ShowModally() gets used.
DialogLabelEditor( WinEDA_SchematicFrame* parent, SCH_TEXT * CurrentText); DialogLabelEditor( WinEDA_SchematicFrame* parent, SCH_TEXT * CurrentText);
@ -36,7 +34,8 @@ public:
static int ShowModally( WinEDA_SchematicFrame* parent, SCH_TEXT * CurrentText ); static int ShowModally( WinEDA_SchematicFrame* parent, SCH_TEXT * CurrentText );
private: private:
void OnInitDialog( wxInitDialogEvent& event ); void init( );
void onEnterKey( wxCommandEvent& event );
void OnButtonOKClick( wxCommandEvent& event ); void OnButtonOKClick( wxCommandEvent& event );
void OnButtonCANCEL_Click( wxCommandEvent& event ); void OnButtonCANCEL_Click( wxCommandEvent& event );
void TextPropertiesAccept( wxCommandEvent& event ); void TextPropertiesAccept( wxCommandEvent& event );

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Aug 7 2008) // C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
@ -23,7 +23,7 @@ DialogLabelEditor_Base::DialogLabelEditor_Base( wxWindow* parent, wxWindowID id,
m_staticText1->Wrap( -1 ); m_staticText1->Wrap( -1 );
bSizer2->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); bSizer2->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_TextLabel = new wxTextCtrl( this, wxID_VALUE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); m_TextLabel = new wxTextCtrl( this, wxID_VALUE, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
m_TextLabel->SetToolTip( _("Enter the text to be used within the schematic") ); m_TextLabel->SetToolTip( _("Enter the text to be used within the schematic") );
bSizer2->Add( m_TextLabel, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); bSizer2->Add( m_TextLabel, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
@ -82,6 +82,7 @@ DialogLabelEditor_Base::DialogLabelEditor_Base( wxWindow* parent, wxWindowID id,
this->Layout(); this->Layout();
// Connect Events // Connect Events
m_TextLabel->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DialogLabelEditor_Base::onEnterKey ), NULL, this );
m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnButtonOKClick ), NULL, this ); m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnButtonOKClick ), NULL, this );
m_buttonCANCEL->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnButtonCANCEL_Click ), NULL, this ); m_buttonCANCEL->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnButtonCANCEL_Click ), NULL, this );
} }
@ -89,6 +90,7 @@ DialogLabelEditor_Base::DialogLabelEditor_Base( wxWindow* parent, wxWindowID id,
DialogLabelEditor_Base::~DialogLabelEditor_Base() DialogLabelEditor_Base::~DialogLabelEditor_Base()
{ {
// Disconnect Events // Disconnect Events
m_TextLabel->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DialogLabelEditor_Base::onEnterKey ), NULL, this );
m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnButtonOKClick ), NULL, this ); m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnButtonOKClick ), NULL, this );
m_buttonCANCEL->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnButtonCANCEL_Click ), NULL, this ); m_buttonCANCEL->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnButtonCANCEL_Click ), NULL, this );
} }

View File

@ -37,10 +37,6 @@
<property name="subclass"></property> <property name="subclass"></property>
<property name="title">Text Editor</property> <property name="title">Text Editor</property>
<property name="tooltip"></property> <property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
@ -110,10 +106,6 @@
<property name="style"></property> <property name="style"></property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="tooltip"></property> <property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
@ -162,13 +154,9 @@
<property name="permission">protected</property> <property name="permission">protected</property>
<property name="pos"></property> <property name="pos"></property>
<property name="size"></property> <property name="size"></property>
<property name="style"></property> <property name="style">wxTE_PROCESS_ENTER</property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="tooltip">Enter the text to be used within the schematic</property> <property name="tooltip">Enter the text to be used within the schematic</property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value"></property> <property name="value"></property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
@ -196,7 +184,7 @@
<event name="OnSetFocus"></event> <event name="OnSetFocus"></event>
<event name="OnSize"></event> <event name="OnSize"></event>
<event name="OnText"></event> <event name="OnText"></event>
<event name="OnTextEnter"></event> <event name="OnTextEnter">onEnterKey</event>
<event name="OnTextMaxLen"></event> <event name="OnTextMaxLen"></event>
<event name="OnTextURL"></event> <event name="OnTextURL"></event>
<event name="OnUpdateUI"></event> <event name="OnUpdateUI"></event>
@ -236,10 +224,6 @@
<property name="style">wxRA_SPECIFY_COLS</property> <property name="style">wxRA_SPECIFY_COLS</property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="tooltip"></property> <property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
@ -294,10 +278,6 @@
<property name="style">wxRA_SPECIFY_COLS</property> <property name="style">wxRA_SPECIFY_COLS</property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="tooltip"></property> <property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
@ -352,10 +332,6 @@
<property name="style">wxRA_SPECIFY_COLS</property> <property name="style">wxRA_SPECIFY_COLS</property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="tooltip"></property> <property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
@ -420,10 +396,6 @@
<property name="style"></property> <property name="style"></property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="tooltip"></property> <property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
@ -475,10 +447,6 @@
<property name="style"></property> <property name="style"></property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="tooltip"></property> <property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="value"></property> <property name="value"></property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
@ -545,10 +513,6 @@
<property name="style"></property> <property name="style"></property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="tooltip"></property> <property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
@ -601,10 +565,6 @@
<property name="style"></property> <property name="style"></property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="tooltip"></property> <property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Aug 7 2008) // C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
@ -50,12 +50,12 @@ class DialogLabelEditor_Base : public wxDialog
wxButton* m_buttonCANCEL; wxButton* m_buttonCANCEL;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void onEnterKey( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonOKClick( wxCommandEvent& event ){ event.Skip(); } virtual void OnButtonOKClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonCANCEL_Click( wxCommandEvent& event ){ event.Skip(); } virtual void OnButtonCANCEL_Click( wxCommandEvent& event ){ event.Skip(); }
public: public:
DialogLabelEditor_Base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Text Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 600,300 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); DialogLabelEditor_Base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Text Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 600,300 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DialogLabelEditor_Base(); ~DialogLabelEditor_Base();

View File

@ -257,34 +257,29 @@ void WinEDA_MainFrame::RecreateBaseHToolbar()
SetToolBar( m_HToolBar ); SetToolBar( m_HToolBar );
// Set up toolbar // Set up toolbar
m_HToolBar->AddTool( ID_NEW_PROJECT, wxBitmap( new_project_xpm ), m_HToolBar->AddTool( ID_NEW_PROJECT, wxEmptyString, wxBitmap( new_project_xpm ),
wxNullBitmap, FALSE, -1, -1, (wxObject*) NULL,
_( "Start a new project" ) ); _( "Start a new project" ) );
// Load project // Load project
m_HToolBar->AddTool( ID_LOAD_PROJECT, wxBitmap( open_project_xpm ), m_HToolBar->AddTool( ID_LOAD_PROJECT, wxEmptyString, wxBitmap( open_project_xpm ),
wxNullBitmap, FALSE, -1, -1, (wxObject*) NULL,
_( "Load existing project" ) ); _( "Load existing project" ) );
// Save project // Save project
m_HToolBar->AddTool( ID_SAVE_PROJECT, wxBitmap( save_project_xpm ), m_HToolBar->AddTool( ID_SAVE_PROJECT, wxEmptyString, wxBitmap( save_project_xpm ),
wxNullBitmap, FALSE, -1, -1, (wxObject*) NULL,
_( "Save current project" ) ); _( "Save current project" ) );
// Separator // Separator
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
// Save and archive files // Save and archive files
m_HToolBar->AddTool( ID_SAVE_AND_ZIP_FILES, wxBitmap( zip_xpm ), m_HToolBar->AddTool( ID_SAVE_AND_ZIP_FILES, wxEmptyString, wxBitmap( zip_xpm ),
wxNullBitmap, FALSE, -1, -1, (wxObject*) NULL,
_( "Archive all project files" ) ); // Tooltip _( "Archive all project files" ) ); // Tooltip
// Separator // Separator
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
// Refresh project tree // Refresh project tree
m_HToolBar->AddTool( ID_PROJECT_TREE_REFRESH, wxBitmap( reload_xpm ), m_HToolBar->AddTool( ID_PROJECT_TREE_REFRESH, wxEmptyString, wxBitmap( reload_xpm ),
wxNullBitmap, FALSE, -1, -1, (wxObject*) NULL,
_( "Refresh project tree" ) ); _( "Refresh project tree" ) );
m_HToolBar->Realize(); // Create m_HToolBar m_HToolBar->Realize(); // Create m_HToolBar

View File

@ -985,7 +985,7 @@ void WinEDA_PrjFrame::OnRight( wxTreeEvent& Event )
{ {
// Grrrr! wxMenu does not have any copy constructor !! (do it by hand) // Grrrr! wxMenu does not have any copy constructor !! (do it by hand)
wxMenuItem* src = list[i]; wxMenuItem* src = list[i];
wxString label = src->GetText(); wxString label = src->GetLabel();
// for obscure reasons, the & is translated into _ ... so replace it // for obscure reasons, the & is translated into _ ... so replace it
label.Replace( wxT( "_" ), wxT( "&" ), true ); label.Replace( wxT( "_" ), wxT( "&" ), true );