Commit ec4d74c9 authored by Wayne Stambaugh's avatar Wayne Stambaugh

Minor 3D viewer improvements (fixes lp:1406680).

* Make OK button the default action in the 3D viewer option dialog per UI
  policy.
* Fix standard button sizer padding in 3D viewer options dialog.
* Let sizers do their job by using default size for 3D viewer options
  dialog.
* Set 3D viewer hot key to Alt+3 in all parent windows where 3D viewer is
  accessible.
* Minor code cleaning and coding policy fixes.
parent 45808deb
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.TXT for contributors. * Copyright (C) 2014-2015 KiCad Developers, see CHANGELOG.TXT for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -43,9 +43,11 @@ private: ...@@ -43,9 +43,11 @@ private:
void OnOKClick( wxCommandEvent& event ); void OnOKClick( wxCommandEvent& event );
}; };
void EDA_3D_FRAME::Install_3D_ViewOptionDialog( wxCommandEvent& event ) void EDA_3D_FRAME::Install_3D_ViewOptionDialog( wxCommandEvent& event )
{ {
DIALOG_3D_VIEW_OPTIONS dlg( this ); DIALOG_3D_VIEW_OPTIONS dlg( this );
if( dlg.ShowModal() == wxID_OK ) if( dlg.ShowModal() == wxID_OK )
{ {
SetMenuBarOptionsState(); SetMenuBarOptionsState();
...@@ -61,8 +63,9 @@ DIALOG_3D_VIEW_OPTIONS::DIALOG_3D_VIEW_OPTIONS( EDA_3D_FRAME* parent ) ...@@ -61,8 +63,9 @@ DIALOG_3D_VIEW_OPTIONS::DIALOG_3D_VIEW_OPTIONS( EDA_3D_FRAME* parent )
initDialog(); initDialog();
SetDefaultItem( (wxWindow*) m_sdbSizerOK );
Layout(); Layout();
GetSizer()->SetSizeHints(this); GetSizer()->SetSizeHints( this );
Centre(); Centre();
} }
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 8 2012) // C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -69,13 +69,13 @@ DIALOG_3D_VIEW_OPTIONS_BASE::DIALOG_3D_VIEW_OPTIONS_BASE( wxWindow* parent, wxWi ...@@ -69,13 +69,13 @@ DIALOG_3D_VIEW_OPTIONS_BASE::DIALOG_3D_VIEW_OPTIONS_BASE( wxWindow* parent, wxWi
m_bitmapComments = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); m_bitmapComments = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
fgSizeShowOpts->Add( m_bitmapComments, 0, wxALL, 5 ); fgSizeShowOpts->Add( m_bitmapComments, 0, wxALL, 5 );
m_checkBoxComments = new wxCheckBox( this, wxID_ANY, _("Show comments and drawings Layers"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkBoxComments = new wxCheckBox( this, wxID_ANY, _("Show comments and drawings layers"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizeShowOpts->Add( m_checkBoxComments, 0, wxALL, 5 ); fgSizeShowOpts->Add( m_checkBoxComments, 0, wxALL, 5 );
m_bitmapECO = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 ); m_bitmapECO = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
fgSizeShowOpts->Add( m_bitmapECO, 0, wxALL, 5 ); fgSizeShowOpts->Add( m_bitmapECO, 0, wxALL, 5 );
m_checkBoxECO = new wxCheckBox( this, wxID_ANY, _("Show ECOs layers"), wxDefaultPosition, wxDefaultSize, 0 ); m_checkBoxECO = new wxCheckBox( this, wxID_ANY, _("Show ECO layers"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizeShowOpts->Add( m_checkBoxECO, 0, wxALL, 5 ); fgSizeShowOpts->Add( m_checkBoxECO, 0, wxALL, 5 );
...@@ -106,11 +106,12 @@ DIALOG_3D_VIEW_OPTIONS_BASE::DIALOG_3D_VIEW_OPTIONS_BASE( wxWindow* parent, wxWi ...@@ -106,11 +106,12 @@ DIALOG_3D_VIEW_OPTIONS_BASE::DIALOG_3D_VIEW_OPTIONS_BASE( wxWindow* parent, wxWi
m_sdbSizer->AddButton( m_sdbSizerCancel ); m_sdbSizer->AddButton( m_sdbSizerCancel );
m_sdbSizer->Realize(); m_sdbSizer->Realize();
bSizerMain->Add( m_sdbSizer, 0, wxALIGN_RIGHT, 5 ); bSizerMain->Add( m_sdbSizer, 0, wxALL|wxEXPAND, 5 );
this->SetSizer( bSizerMain ); this->SetSizer( bSizerMain );
this->Layout(); this->Layout();
bSizerMain->Fit( this );
this->Centre( wxBOTH ); this->Centre( wxBOTH );
......
This source diff could not be displayed because it is too large. You can view the blob instead.
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 8 2012) // C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -74,7 +74,7 @@ class DIALOG_3D_VIEW_OPTIONS_BASE : public DIALOG_SHIM ...@@ -74,7 +74,7 @@ class DIALOG_3D_VIEW_OPTIONS_BASE : public DIALOG_SHIM
public: public:
DIALOG_3D_VIEW_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("3D Display Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 340,344 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); DIALOG_3D_VIEW_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("3D Display Options"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_3D_VIEW_OPTIONS_BASE(); ~DIALOG_3D_VIEW_OPTIONS_BASE();
}; };
......
...@@ -236,7 +236,7 @@ void DISPLAY_FOOTPRINTS_FRAME::ReCreateHToolbar() ...@@ -236,7 +236,7 @@ void DISPLAY_FOOTPRINTS_FRAME::ReCreateHToolbar()
m_mainToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_CVPCB_SHOW3D_FRAME, wxEmptyString, KiBitmap( three_d_xpm ), m_mainToolBar->AddTool( ID_CVPCB_SHOW3D_FRAME, wxEmptyString, KiBitmap( three_d_xpm ),
_( "3D Display" ) ); _( "3D Display (Alt+3)" ) );
// after adding the buttons to the toolbar, must call Realize() to reflect // after adding the buttons to the toolbar, must call Realize() to reflect
// the changes // the changes
...@@ -363,6 +363,11 @@ bool DISPLAY_FOOTPRINTS_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPositi ...@@ -363,6 +363,11 @@ bool DISPLAY_FOOTPRINTS_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPositi
GetScreen()->m_O_Curseur = GetCrossHairPosition(); GetScreen()->m_O_Curseur = GetCrossHairPosition();
break; break;
case GR_KB_ALT + '3':
cmd.SetId( ID_CVPCB_SHOW3D_FRAME );
GetEventHandler()->ProcessEvent( cmd );
break;
default: default:
eventHandled = false; eventHandled = false;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2007-2014 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2007-2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -172,6 +172,8 @@ static EDA_HOTKEY HkZoomOut( _HKI( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2 ); ...@@ -172,6 +172,8 @@ static EDA_HOTKEY HkZoomOut( _HKI( "Zoom Out" ), HK_ZOOM_OUT, WXK_F2 );
static EDA_HOTKEY HkZoomOut( _HKI( "Zoom Out" ), HK_ZOOM_OUT, GR_KB_CTRL + '-' ); static EDA_HOTKEY HkZoomOut( _HKI( "Zoom Out" ), HK_ZOOM_OUT, GR_KB_CTRL + '-' );
#endif #endif
static EDA_HOTKEY Hk3DViewer( _HKI( "3D Viewer" ), HK_3D_VIEWER, GR_KB_ALT + '3' );
static EDA_HOTKEY HkHelp( _HKI( "Help (this window)" ), HK_HELP, '?' ); static EDA_HOTKEY HkHelp( _HKI( "Help (this window)" ), HK_HELP, '?' );
...@@ -257,7 +259,7 @@ static EDA_HOTKEY HkCallMacros9( _HKI( "Call Macro 9" ), HK_CALL_MACROS_9, '9' ) ...@@ -257,7 +259,7 @@ static EDA_HOTKEY HkCallMacros9( _HKI( "Call Macro 9" ), HK_CALL_MACROS_9, '9' )
EDA_HOTKEY* common_Hotkey_List[] = EDA_HOTKEY* common_Hotkey_List[] =
{ {
&HkHelp, &HkZoomIn, &HkZoomOut, &HkHelp, &HkZoomIn, &HkZoomOut,
&HkZoomRedraw, &HkZoomCenter, &HkZoomAuto, &HkZoomRedraw, &HkZoomCenter, &HkZoomAuto, &Hk3DViewer,
&HkSwitchUnits, &HkResetLocalCoord, &HkSetGridOrigin, &HkResetGridOrigin, &HkSwitchUnits, &HkResetLocalCoord, &HkSetGridOrigin, &HkResetGridOrigin,
&HkUndo, &HkRedo, &HkUndo, &HkRedo,
&HkMouseLeftClick, &HkMouseLeftClick,
...@@ -269,7 +271,7 @@ EDA_HOTKEY* common_Hotkey_List[] = ...@@ -269,7 +271,7 @@ EDA_HOTKEY* common_Hotkey_List[] =
EDA_HOTKEY* common_basic_Hotkey_List[] = EDA_HOTKEY* common_basic_Hotkey_List[] =
{ {
&HkHelp, &HkZoomIn, &HkZoomOut, &HkHelp, &HkZoomIn, &HkZoomOut,
&HkZoomRedraw, &HkZoomCenter, &HkZoomAuto, &HkZoomRedraw, &HkZoomCenter, &HkZoomAuto, &Hk3DViewer,
&HkSwitchUnits, &HkResetLocalCoord, &HkSwitchUnits, &HkResetLocalCoord,
&HkMouseLeftClick, &HkMouseLeftClick,
&HkMouseLeftDClick, &HkMouseLeftDClick,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2007-2014 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2007-2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -59,6 +59,7 @@ enum hotkey_id_commnand { ...@@ -59,6 +59,7 @@ enum hotkey_id_commnand {
HK_SAVE_MODULE, HK_SAVE_MODULE,
HK_SWITCH_UNITS, HK_SWITCH_UNITS,
HK_SWITCH_TRACK_DISPLAY_MODE, HK_SWITCH_TRACK_DISPLAY_MODE,
HK_3D_VIEWER,
HK_FIND_ITEM, HK_FIND_ITEM,
HK_EDIT_ITEM, HK_EDIT_ITEM,
HK_EDIT_MODULE_WITH_MODEDIT, HK_EDIT_MODULE_WITH_MODEDIT,
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2009 Jean-Pierre Charras, jp.charras@wanadoo.fr * Copyright (C) 2009 Jean-Pierre Charras, jp.charras@wanadoo.fr
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
......
...@@ -233,9 +233,8 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() ...@@ -233,9 +233,8 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
viewMenu->AppendSeparator(); viewMenu->AppendSeparator();
// 3D view // 3D view
AddMenuItem( viewMenu, ID_MENU_PCB_SHOW_3D_FRAME, text = AddHotkeyName( _( "3&D Viewer" ), g_Module_Editor_Hokeys_Descr, HK_3D_VIEWER );
_( "3&D View" ), AddMenuItem( viewMenu, ID_MENU_PCB_SHOW_3D_FRAME, text, _( "Show footprint in 3D viewer" ),
_( "Show board in 3D viewer" ),
KiBitmap( three_d_xpm ) ); KiBitmap( three_d_xpm ) );
//-------- Place menu -------------------- //-------- Place menu --------------------
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
* *
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr * Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2012-2015 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -345,8 +345,9 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() ...@@ -345,8 +345,9 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
viewMenu->AppendSeparator(); viewMenu->AppendSeparator();
AddMenuItem( viewMenu, ID_MENU_PCB_SHOW_3D_FRAME, text = AddHotkeyName( _( "&3D Viewer" ), g_Pcbnew_Editor_Hokeys_Descr, HK_3D_VIEWER );
_( "&3D Display" ),_( "Show board in 3D viewer" ),
AddMenuItem( viewMenu, ID_MENU_PCB_SHOW_3D_FRAME, text, _( "Show board in 3D viewer" ),
KiBitmap( three_d_xpm ) ); KiBitmap( three_d_xpm ) );
AddMenuItem( viewMenu, ID_MENU_LIST_NETS, AddMenuItem( viewMenu, ID_MENU_LIST_NETS,
...@@ -434,7 +435,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar() ...@@ -434,7 +435,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
KiBitmap( grid_select_axis_xpm ) ); KiBitmap( grid_select_axis_xpm ) );
wxMenu* routeMenu = new wxMenu; wxMenu* routeMenu = new wxMenu;
AddMenuItem( routeMenu, ID_TRACK_BUTT, AddMenuItem( routeMenu, ID_TRACK_BUTT,
_( "Single Track" ), _( "Single Track" ),
_( "Interactively route a single track" ), _( "Interactively route a single track" ),
......
...@@ -599,41 +599,6 @@ bool FOOTPRINT_VIEWER_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition ...@@ -599,41 +599,6 @@ bool FOOTPRINT_VIEWER_FRAME::GeneralControl( wxDC* aDC, const wxPoint& aPosition
eventHandled = OnHotKey( aDC, aHotKey, aPosition ); eventHandled = OnHotKey( aDC, aHotKey, aPosition );
} }
/* switch( aHotKey )
{
case WXK_F1:
cmd.SetId( ID_POPUP_ZOOM_IN );
GetEventHandler()->ProcessEvent( cmd );
break;
case WXK_F2:
cmd.SetId( ID_POPUP_ZOOM_OUT );
GetEventHandler()->ProcessEvent( cmd );
break;
case WXK_F3:
cmd.SetId( ID_ZOOM_REDRAW );
GetEventHandler()->ProcessEvent( cmd );
break;
case WXK_F4:
cmd.SetId( ID_POPUP_ZOOM_CENTER );
GetEventHandler()->ProcessEvent( cmd );
break;
case WXK_HOME:
cmd.SetId( ID_ZOOM_PAGE );
GetEventHandler()->ProcessEvent( cmd );
break;
case ' ':
GetScreen()->m_O_Curseur = GetCrossHairPosition();
break;
default:
eventHandled = false;
}
*/
SetCrossHairPosition( pos ); SetCrossHairPosition( pos );
RefreshCrossHair( oldpos, aPosition, aDC ); RefreshCrossHair( oldpos, aPosition, aDC );
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
* *
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2012-2015 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -142,8 +142,7 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateMenuBar( void ) ...@@ -142,8 +142,7 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateMenuBar( void )
// Active library selection // Active library selection
AddMenuItem( fileMenu, ID_MODVIEW_SELECT_LIB, _("Set Current Library"), AddMenuItem( fileMenu, ID_MODVIEW_SELECT_LIB, _("Set Current Library"),
_( "Select library to be displayed" ), _( "Select library to be displayed" ), KiBitmap( open_library_xpm ) );
KiBitmap( open_library_xpm ) );
fileMenu->AppendSeparator(); fileMenu->AppendSeparator();
// Close viewer // Close viewer
...@@ -175,9 +174,8 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateMenuBar( void ) ...@@ -175,9 +174,8 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateMenuBar( void )
viewMenu->AppendSeparator(); viewMenu->AppendSeparator();
// 3D view // 3D view
AddMenuItem( viewMenu, ID_MODVIEW_SHOW_3D_VIEW, text = AddHotkeyName( _( "3&D Viewer" ), g_Module_Viewer_Hokeys_Descr, HK_3D_VIEWER );
_( "3&D View" ), AddMenuItem( viewMenu, ID_MODVIEW_SHOW_3D_VIEW, text, _( "Show footprint in 3D viewer" ),
_( "Show footprint in 3D viewer" ),
KiBitmap( three_d_xpm ) ); KiBitmap( three_d_xpm ) );
// Menu Help: // Menu Help:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment