diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index 239902a905..8065741813 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -113,6 +113,7 @@ set( PCBNEW_DIALOGS dialogs/dialog_layer_selection_base.cpp dialogs/dialog_layers_setup.cpp dialogs/dialog_layers_setup_base.cpp + dialogs/dialog_modedit_display_options.cpp dialogs/dialog_modedit_options.cpp dialogs/dialog_modedit_options_base.cpp dialogs/dialog_netlist.cpp diff --git a/pcbnew/dialogs/dialog_modedit_display_options.cpp b/pcbnew/dialogs/dialog_modedit_display_options.cpp new file mode 100644 index 0000000000..808eab7056 --- /dev/null +++ b/pcbnew/dialogs/dialog_modedit_display_options.cpp @@ -0,0 +1,89 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2017 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 + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include + +#include +#include + +#include + +#include + + +bool DIALOG_MODEDIT_DISPLAY_OPTIONS::Invoke( FOOTPRINT_EDIT_FRAME& aCaller ) +{ + DIALOG_MODEDIT_DISPLAY_OPTIONS dlg( aCaller ); + + int ret = dlg.ShowModal(); + + return ret == wxID_OK; +} + + +DIALOG_MODEDIT_DISPLAY_OPTIONS::DIALOG_MODEDIT_DISPLAY_OPTIONS( FOOTPRINT_EDIT_FRAME& aParent ) : + DIALOG_SHIM( &aParent, wxID_ANY, _( "Display Options" ) ), + m_parent( aParent ) +{ + auto mainSizer = new wxBoxSizer( wxVERTICAL ); + SetSizer( mainSizer ); + + // install GAL options pane + KIGFX::GAL_DISPLAY_OPTIONS& galOptions = m_parent.GetGalDisplayOptions(); + + m_galOptsPanel = new GAL_OPTIONS_PANEL( this, galOptions ); + mainSizer->Add( m_galOptsPanel, 1, wxEXPAND, 0 ); + + auto btnSizer = new wxStdDialogButtonSizer(); + mainSizer->Add( btnSizer, 0, wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT, 5 ); + + btnSizer->AddButton( new wxButton( this, wxID_OK ) ); + btnSizer->AddButton( new wxButton( this, wxID_CANCEL ) ); + + btnSizer->Realize(); + + GetSizer()->SetSizeHints( this ); + Centre(); +} + + +bool DIALOG_MODEDIT_DISPLAY_OPTIONS::TransferDataToWindow() +{ + // update GAL options + return m_galOptsPanel->TransferDataToWindow(); +} + + +bool DIALOG_MODEDIT_DISPLAY_OPTIONS::TransferDataFromWindow() +{ + // update GAL options + m_galOptsPanel->TransferDataFromWindow(); + + // refresh view + KIGFX::VIEW* view = m_parent.GetGalCanvas()->GetView(); + view->RecacheAllItems(); + view->MarkTargetDirty( KIGFX::TARGET_NONCACHED ); + m_parent.GetCanvas()->Refresh(); + + return true; +} diff --git a/pcbnew/dialogs/dialog_modedit_display_options.h b/pcbnew/dialogs/dialog_modedit_display_options.h new file mode 100644 index 0000000000..4bab8abac4 --- /dev/null +++ b/pcbnew/dialogs/dialog_modedit_display_options.h @@ -0,0 +1,45 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2017 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 + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include + +class GAL_OPTIONS_PANEL; +class FOOTPRINT_EDIT_FRAME; + +class DIALOG_MODEDIT_DISPLAY_OPTIONS : public DIALOG_SHIM +{ +public: + DIALOG_MODEDIT_DISPLAY_OPTIONS( FOOTPRINT_EDIT_FRAME& aParent ); + + static bool Invoke( FOOTPRINT_EDIT_FRAME& aCaller ); + +private: + + bool TransferDataToWindow() override; + bool TransferDataFromWindow() override; + + FOOTPRINT_EDIT_FRAME& m_parent; + + // subpanel + GAL_OPTIONS_PANEL* m_galOptsPanel; +}; diff --git a/pcbnew/menubar_modedit.cpp b/pcbnew/menubar_modedit.cpp index 4eade3e9bd..e04003eb5c 100644 --- a/pcbnew/menubar_modedit.cpp +++ b/pcbnew/menubar_modedit.cpp @@ -327,6 +327,11 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar() _( "&Settings" ), _( "Change the footprint editor settings." ), KiBitmap( preference_xpm ) ); + AddMenuItem( prefs_menu, ID_PCB_DISPLAY_OPTIONS_SETUP, + _( "&Display" ), + _( "Change footprint editor display settings" ), + KiBitmap( display_options_xpm ) ); + // Language submenu Pgm().AddMenuLanguageList( prefs_menu ); diff --git a/pcbnew/module_editor_frame.h b/pcbnew/module_editor_frame.h index d89a701b6c..310e001223 100644 --- a/pcbnew/module_editor_frame.h +++ b/pcbnew/module_editor_frame.h @@ -32,9 +32,11 @@ #include #include #include +#include class PCB_LAYER_WIDGET; class FP_LIB_TABLE; +class EDGE_MODULE; namespace PCB { struct IFACE; } // A KIFACE_I coded in pcbnew.c diff --git a/pcbnew/moduleframe.cpp b/pcbnew/moduleframe.cpp index 2255d1f59a..f9deadbd84 100644 --- a/pcbnew/moduleframe.cpp +++ b/pcbnew/moduleframe.cpp @@ -51,6 +51,7 @@ #include #include #include +#include #include #include #include @@ -139,6 +140,8 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME ) FOOTPRINT_EDIT_FRAME::ProcessPreferences ) EVT_MENU( wxID_PREFERENCES, FOOTPRINT_EDIT_FRAME::ProcessPreferences ) + EVT_MENU( ID_PCB_DISPLAY_OPTIONS_SETUP, + FOOTPRINT_EDIT_FRAME::ProcessPreferences ) EVT_MENU( ID_PREFERENCES_CONFIGURE_PATHS, FOOTPRINT_EDIT_FRAME::OnConfigurePaths ) // popup commands @@ -929,6 +932,10 @@ void FOOTPRINT_EDIT_FRAME::ProcessPreferences( wxCommandEvent& event ) InvokeFPEditorPrefsDlg( this ); break; + case ID_PCB_DISPLAY_OPTIONS_SETUP: + DIALOG_MODEDIT_DISPLAY_OPTIONS::Invoke( *this ); + break; + default: DisplayError( this, "FOOTPRINT_EDIT_FRAME::ProcessPreferences error" ); }