Add a display settings dialog to Modedit
For a start, this contains the GAL display settings (AA settings and grid styling). In future, other modedit-specific settings could go here too. Fixes: lp:1672150 * https://bugs.launchpad.net/kicad/+bug/1672150
This commit is contained in:
parent
f2aa4d2911
commit
bdc9ae75f5
|
@ -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
|
||||
|
|
|
@ -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 <dialog_modedit_display_options.h>
|
||||
|
||||
#include <class_drawpanel.h>
|
||||
#include <module_editor_frame.h>
|
||||
|
||||
#include <view/view.h>
|
||||
|
||||
#include <widgets/gal_options_panel.h>
|
||||
|
||||
|
||||
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;
|
||||
}
|
|
@ -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 <dialog_shim.h>
|
||||
|
||||
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;
|
||||
};
|
|
@ -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 );
|
||||
|
||||
|
|
|
@ -32,9 +32,11 @@
|
|||
#include <wxBasePcbFrame.h>
|
||||
#include <pcb_base_edit_frame.h>
|
||||
#include <io_mgr.h>
|
||||
#include <config_params.h>
|
||||
|
||||
class PCB_LAYER_WIDGET;
|
||||
class FP_LIB_TABLE;
|
||||
class EDGE_MODULE;
|
||||
|
||||
namespace PCB { struct IFACE; } // A KIFACE_I coded in pcbnew.c
|
||||
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#include <pcbnew.h>
|
||||
#include <pcbnew_id.h>
|
||||
#include <hotkeys.h>
|
||||
#include <dialogs/dialog_modedit_display_options.h>
|
||||
#include <dialog_hotkeys_editor.h>
|
||||
#include <module_editor_frame.h>
|
||||
#include <modview_frame.h>
|
||||
|
@ -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" );
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue