2017-03-13 15:18:30 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2018-01-08 04:05:03 +00:00
|
|
|
* Copyright (C) 2017-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
2017-03-13 15:18:30 +00:00
|
|
|
*
|
2018-01-08 04:05:03 +00:00
|
|
|
* 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 3 of the License, or (at your
|
|
|
|
* option) any later version.
|
2017-03-13 15:18:30 +00:00
|
|
|
*
|
2018-01-08 04:05:03 +00:00
|
|
|
* 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.
|
2017-03-13 15:18:30 +00:00
|
|
|
*
|
2018-01-08 04:05:03 +00:00
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
2017-03-13 15:18:30 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <dialog_modedit_display_options.h>
|
|
|
|
|
|
|
|
#include <class_drawpanel.h>
|
2018-01-29 20:58:58 +00:00
|
|
|
#include <footprint_edit_frame.h>
|
2017-03-13 15:18:30 +00:00
|
|
|
|
|
|
|
#include <view/view.h>
|
|
|
|
|
|
|
|
#include <widgets/gal_options_panel.h>
|
2018-01-08 04:05:03 +00:00
|
|
|
#include <widgets/stepped_slider.h>
|
|
|
|
#include <wx/checkbox.h>
|
|
|
|
#include <wx/sizer.h>
|
2017-03-13 15:18:30 +00:00
|
|
|
|
|
|
|
|
|
|
|
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" ) ),
|
2018-02-19 19:26:02 +00:00
|
|
|
m_parent( aParent )
|
2017-03-13 15:18:30 +00:00
|
|
|
{
|
|
|
|
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
|
2018-01-08 04:05:03 +00:00
|
|
|
m_galOptsPanel->TransferDataToWindow();
|
|
|
|
return true;
|
2017-03-13 15:18:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|