3D viewer: Minor enhancement: in show on/off layers menu option, user layers options are disabled in realistic mode to avoid mistakes, because they are never shown in this mode.

This commit is contained in:
jean-pierre charras 2015-08-18 12:59:43 +02:00
parent 56084b3ee2
commit eb71c15b46
6 changed files with 216 additions and 17 deletions

View File

@ -562,6 +562,8 @@ void EDA_3D_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_MENU3D_REALISTIC_MODE:
GetPrm3DVisu().SetFlag( FL_USE_REALISTIC_MODE, isChecked );
GetMenuBar()->FindItem( ID_MENU3D_COMMENTS_ONOFF )->Enable( !isChecked );
GetMenuBar()->FindItem( ID_MENU3D_ECO_ONOFF )->Enable( !isChecked );
NewDisplay();
return;

View File

@ -1,9 +1,9 @@
/*
* 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) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2013 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
* modify it under the terms of the GNU General Public License
@ -280,6 +280,8 @@ void EDA_3D_FRAME::CreateMenuBar()
AddMenuItem( layersMenu, ID_MENU3D_SOLDER_PASTE_ONOFF,
_( "Show Solder &Paste Layers" ), KiBitmap( pads_mask_layers_xpm ), wxITEM_CHECK );
// Other layers are not "board" layers, and are not shown in realistic mode
// These menus will be disabled in in realistic mode
AddMenuItem( layersMenu, ID_MENU3D_COMMENTS_ONOFF,
_( "Show &Comments and Drawings Layer" ), KiBitmap( edit_sheet_xpm ), wxITEM_CHECK );
@ -301,6 +303,10 @@ void EDA_3D_FRAME::SetMenuBarOptionsState()
// Set the state of toggle menus according to the current display options
item = menuBar->FindItem( ID_MENU3D_REALISTIC_MODE );
item->Check( GetPrm3DVisu().IsRealisticMode() );
item = menuBar->FindItem( ID_MENU3D_COMMENTS_ONOFF );
item->Enable( !GetPrm3DVisu().IsRealisticMode() );
item = menuBar->FindItem( ID_MENU3D_ECO_ONOFF );
item->Enable( !GetPrm3DVisu().IsRealisticMode() );
item = menuBar->FindItem( ID_MENU3D_FL_RENDER_SHADOWS );
item->Check( GetPrm3DVisu().GetFlag( FL_RENDER_SHADOWS ) );

View File

@ -41,6 +41,7 @@ private:
void OnShowAllClick( wxCommandEvent& event );
void OnShowNoneClick( wxCommandEvent& event );
void OnOKClick( wxCommandEvent& event );
void OnCheckRealisticMode( wxCommandEvent& event );
};
@ -72,6 +73,7 @@ DIALOG_3D_VIEW_OPTIONS::DIALOG_3D_VIEW_OPTIONS( EDA_3D_FRAME* parent )
void DIALOG_3D_VIEW_OPTIONS::initDialog()
{
m_bitmapRealisticMode->SetBitmap( KiBitmap( use_3D_copper_thickness_xpm ) );
m_bitmapCuThickness->SetBitmap( KiBitmap( use_3D_copper_thickness_xpm ) );
m_bitmap3Dshapes->SetBitmap( KiBitmap( shape_3d_xpm ) );
m_bitmapAreas->SetBitmap( KiBitmap( add_zone_xpm ) );
@ -83,6 +85,7 @@ void DIALOG_3D_VIEW_OPTIONS::initDialog()
m_bitmapECO->SetBitmap( KiBitmap( edit_sheet_xpm ) );
// Check/uncheck checkboxes
m_checkBoxRealisticMode->SetValue( m_3Dprms.GetFlag( FL_USE_REALISTIC_MODE ) );
m_checkBoxCuThickness->SetValue( m_3Dprms.GetFlag( FL_USE_COPPER_THICKNESS ) );
m_checkBox3Dshapes->SetValue( m_3Dprms.GetFlag( FL_MODULE ) );
m_checkBoxAreas->SetValue( m_3Dprms.GetFlag( FL_ZONE ) );
@ -90,10 +93,20 @@ void DIALOG_3D_VIEW_OPTIONS::initDialog()
m_checkBoxSolderMask->SetValue( m_3Dprms.GetFlag( FL_SOLDERMASK ) );
m_checkBoxSolderpaste->SetValue( m_3Dprms.GetFlag( FL_SOLDERPASTE ) );
m_checkBoxAdhesive->SetValue( m_3Dprms.GetFlag( FL_ADHESIVE ) );
m_checkBoxComments->SetValue( m_3Dprms.GetFlag( FL_COMMENTS ) );
m_checkBoxECO->SetValue( m_3Dprms.GetFlag( FL_ECO ) );
bool enable = !m_3Dprms.GetFlag( FL_USE_REALISTIC_MODE );
m_checkBoxComments->Enable( enable );
m_checkBoxECO->Enable( enable );
}
void DIALOG_3D_VIEW_OPTIONS::OnCheckRealisticMode( wxCommandEvent& event )
{
bool enable = !m_checkBoxRealisticMode->GetValue();
m_checkBoxComments->Enable( enable );
m_checkBoxECO->Enable( enable );
}
void DIALOG_3D_VIEW_OPTIONS::OnShowAllClick( wxCommandEvent& event )
{
@ -127,6 +140,7 @@ void DIALOG_3D_VIEW_OPTIONS::OnShowNoneClick( wxCommandEvent& event )
void DIALOG_3D_VIEW_OPTIONS::OnOKClick( wxCommandEvent& event )
{
m_3Dprms.SetFlag( FL_USE_REALISTIC_MODE, m_checkBoxRealisticMode->GetValue() );
m_3Dprms.SetFlag( FL_USE_COPPER_THICKNESS, m_checkBoxCuThickness->GetValue() );
m_3Dprms.SetFlag( FL_MODULE, m_checkBox3Dshapes->GetValue() );
m_3Dprms.SetFlag( FL_ZONE, m_checkBoxAreas->GetValue() );

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// C++ code generated with wxFormBuilder (version Jun 17 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -20,10 +20,16 @@ DIALOG_3D_VIEW_OPTIONS_BASE::DIALOG_3D_VIEW_OPTIONS_BASE( wxWindow* parent, wxWi
bSizerLeft = new wxBoxSizer( wxHORIZONTAL );
wxFlexGridSizer* fgSizeShowOpts;
fgSizeShowOpts = new wxFlexGridSizer( 9, 2, 0, 0 );
fgSizeShowOpts = new wxFlexGridSizer( 0, 2, 0, 0 );
fgSizeShowOpts->SetFlexibleDirection( wxBOTH );
fgSizeShowOpts->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_bitmapRealisticMode = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
fgSizeShowOpts->Add( m_bitmapRealisticMode, 0, wxALL, 5 );
m_checkBoxRealisticMode = new wxCheckBox( this, wxID_ANY, _("Realistic mode"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizeShowOpts->Add( m_checkBoxRealisticMode, 0, wxALL, 5 );
m_bitmapCuThickness = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0 );
fgSizeShowOpts->Add( m_bitmapCuThickness, 0, wxALL, 5 );
@ -116,18 +122,18 @@ DIALOG_3D_VIEW_OPTIONS_BASE::DIALOG_3D_VIEW_OPTIONS_BASE( wxWindow* parent, wxWi
this->Centre( wxBOTH );
// Connect Events
m_checkBoxRealisticMode->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_3D_VIEW_OPTIONS_BASE::OnCheckRealisticMode ), NULL, this );
m_buttonShowAll->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_3D_VIEW_OPTIONS_BASE::OnShowAllClick ), NULL, this );
m_buttonShowNone->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_3D_VIEW_OPTIONS_BASE::OnShowNoneClick ), NULL, this );
m_sdbSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_3D_VIEW_OPTIONS_BASE::OnCancelClick ), NULL, this );
m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_3D_VIEW_OPTIONS_BASE::OnOKClick ), NULL, this );
}
DIALOG_3D_VIEW_OPTIONS_BASE::~DIALOG_3D_VIEW_OPTIONS_BASE()
{
// Disconnect Events
m_checkBoxRealisticMode->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_3D_VIEW_OPTIONS_BASE::OnCheckRealisticMode ), NULL, this );
m_buttonShowAll->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_3D_VIEW_OPTIONS_BASE::OnShowAllClick ), NULL, this );
m_buttonShowNone->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_3D_VIEW_OPTIONS_BASE::OnShowNoneClick ), NULL, this );
m_sdbSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_3D_VIEW_OPTIONS_BASE::OnCancelClick ), NULL, this );
m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_3D_VIEW_OPTIONS_BASE::OnOKClick ), NULL, this );
}

View File

@ -116,8 +116,177 @@
<property name="name">fgSizeShowOpts</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">none</property>
<property name="rows">9</property>
<property name="rows">0</property>
<property name="vgap">0</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticBitmap" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="bitmap"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_bitmapRealisticMode</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Realistic mode</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_checkBoxRealisticMode</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</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_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox">OnCheckRealisticMode</event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
@ -1928,7 +2097,7 @@
<property name="name">m_sdbSizer</property>
<property name="permission">protected</property>
<event name="OnApplyButtonClick"></event>
<event name="OnCancelButtonClick">OnCancelClick</event>
<event name="OnCancelButtonClick"></event>
<event name="OnContextHelpButtonClick"></event>
<event name="OnHelpButtonClick"></event>
<event name="OnNoButtonClick"></event>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// C++ code generated with wxFormBuilder (version Jun 17 2015)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -40,6 +40,8 @@ class DIALOG_3D_VIEW_OPTIONS_BASE : public DIALOG_SHIM
private:
protected:
wxStaticBitmap* m_bitmapRealisticMode;
wxCheckBox* m_checkBoxRealisticMode;
wxStaticBitmap* m_bitmapCuThickness;
wxCheckBox* m_checkBoxCuThickness;
wxStaticBitmap* m_bitmap3Dshapes;
@ -66,9 +68,9 @@ class DIALOG_3D_VIEW_OPTIONS_BASE : public DIALOG_SHIM
wxButton* m_sdbSizerCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnCheckRealisticMode( wxCommandEvent& event ) { event.Skip(); }
virtual void OnShowAllClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnShowNoneClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOKClick( wxCommandEvent& event ) { event.Skip(); }