Implement primitive icon scaling for high DPI

This is meant as a stopgap for 5.0, with plans to add proper scaled
icons in the 6.0 cycle. A function KiScaledBitmap() is added, which
works like KiBitmap() except it scales the bitmap according to the
calling window's font size. Controls have been added to all the main
applications to let the user select scaling manually (these were omitted
from smaller apps that didn't already have a place to put them).

In addition, in eeschema only, the pixel height of the system font is
shown in the options dialog for diagnostics. This is only for collecting
feedback before 5.0 release from users with different displays and will
be removed.
This commit is contained in:
Chris Pavlina 2018-01-07 21:05:03 -07:00
parent 998d9179e9
commit 7e6a6540c8
50 changed files with 3498 additions and 926 deletions

View File

@ -182,6 +182,7 @@ set( COMMON_WIDGET_SRCS
widgets/two_column_tree_list.cpp widgets/two_column_tree_list.cpp
widgets/unit_binder.cpp widgets/unit_binder.cpp
widgets/widget_hotkey_list.cpp widgets/widget_hotkey_list.cpp
widgets/stepped_slider.cpp
) )
set( COMMON_PAGE_LAYOUT_SRCS set( COMMON_PAGE_LAYOUT_SRCS

View File

@ -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) 2011 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2011 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2017 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2017-2018 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
@ -28,10 +28,52 @@
#include <wx/mstream.h> #include <wx/mstream.h>
#include <wx/menu.h> #include <wx/menu.h>
#include <wx/menuitem.h> #include <wx/menuitem.h>
#include <wx/aui/auibar.h>
#include <cstdint>
#include <mutex>
#include <unordered_map>
#include <common.h> #include <common.h>
#include <bitmaps.h> #include <bitmaps.h>
#include <pgm_base.h> #include <pgm_base.h>
#include <wxstruct.h>
struct SCALED_BITMAP_ID {
BITMAP_DEF bitmap;
int scale;
bool operator==( SCALED_BITMAP_ID const& other ) const noexcept
{
return bitmap == other.bitmap && scale == other.scale;
}
};
namespace std {
template<> struct hash<SCALED_BITMAP_ID>
{
typedef SCALED_BITMAP_ID argument_type;
typedef std::size_t result_type;
result_type operator()( argument_type const& id ) const noexcept
{
static const bool sz64 = sizeof( uintptr_t ) == 8;
static const size_t mask = sz64 ? 0xF000000000000000uLL : 0xF0000000uL;
static const size_t offset = sz64 ? 28 : 60;
// The hash only needs to be fast and simple, not necessarily accurate - a collision
// only makes things slower, not broken. BITMAP_DEF is a pointer, so the most
// significant several bits are generally going to be the same for all. Just convert
// it to an integer and stuff the scale factor into those bits.
return
( (uintptr_t)( id.bitmap ) & ~mask ) |
( ( (uintptr_t)( id.scale ) & 0xF ) << offset );
}
};
}
wxBitmap KiBitmap( BITMAP_DEF aBitmap ) wxBitmap KiBitmap( BITMAP_DEF aBitmap )
{ {
@ -43,6 +85,82 @@ wxBitmap KiBitmap( BITMAP_DEF aBitmap )
} }
int KiIconScale( wxWindow* aWindow )
{
const int vert_size = aWindow->ConvertDialogToPixels( wxSize( 0, 8 ) ).y;
// Autoscale won't exceed unity until the system has quite high resolution,
// because we don't want the icons to look obviously scaled on a system
// where it's easy to see it.
if( vert_size > 34 ) return 8;
else if( vert_size > 29 ) return 7;
else if( vert_size > 24 ) return 6;
else return 4;
}
static int get_scale_factor( EDA_BASE_FRAME* aWindow )
{
const int requested_scale = aWindow->GetIconScale();
if( requested_scale > 0 )
return requested_scale;
else
return KiIconScale( aWindow );
}
wxBitmap KiScaledBitmap( BITMAP_DEF aBitmap, EDA_BASE_FRAME* aWindow )
{
// Bitmap conversions are cached because they can be slow.
static std::unordered_map<SCALED_BITMAP_ID, wxBitmap> bitmap_cache;
static std::mutex bitmap_cache_mutex;
const int scale = get_scale_factor( aWindow );
SCALED_BITMAP_ID id = { aBitmap, scale };
std::lock_guard<std::mutex> guard( bitmap_cache_mutex );
auto it = bitmap_cache.find( id );
if( it != bitmap_cache.end() )
{
return it->second;
}
else
{
wxMemoryInputStream is( aBitmap->png, aBitmap->byteCount );
wxImage image( is, wxBITMAP_TYPE_PNG );
// Bilinear seems to genuinely look better for these line-drawing icons
// than bicubic, despite claims in the wx documentation that bicubic is
// "highest quality". I don't recommend changing this. Bicubic looks
// blurry and makes me want an eye exam.
image.Rescale( scale * image.GetWidth() / 4, scale * image.GetHeight() / 4,
wxIMAGE_QUALITY_BILINEAR );
return bitmap_cache.emplace( id, wxBitmap( image ) ).first->second;
}
}
void KiScaledSeparator( wxAuiToolBar* aToolbar, EDA_BASE_FRAME* aWindow )
{
const int scale = get_scale_factor( aWindow );
if( scale > 4 )
{
aToolbar->AddSpacer( 16 * ( scale - 4 ) / 4 );
}
aToolbar->AddSeparator();
if( scale > 4 )
{
aToolbar->AddSpacer( 16 * ( scale - 4 ) / 4 );
}
}
wxBitmap* KiBitmapNew( BITMAP_DEF aBitmap ) wxBitmap* KiBitmapNew( BITMAP_DEF aBitmap )
{ {
wxMemoryInputStream is( aBitmap->png, aBitmap->byteCount ); wxMemoryInputStream is( aBitmap->png, aBitmap->byteCount );

View File

@ -0,0 +1,77 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2018 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#include <widgets/stepped_slider.h>
#include <wx/event.h>
BEGIN_EVENT_TABLE( STEPPED_SLIDER, wxSlider )
EVT_SCROLL( STEPPED_SLIDER::OnScroll )
END_EVENT_TABLE()
STEPPED_SLIDER::STEPPED_SLIDER(
wxWindow* aParent,
wxWindowID aId,
int aValue,
int aMinValue,
int aMaxValue,
const wxPoint& aPos,
const wxSize& aSize,
long aStyle,
const wxValidator& aValidator,
const wxString& aName )
:wxSlider( aParent, aId, aValue, aMinValue, aMaxValue,
aPos, aSize, aStyle, aValidator, aName ),
m_step( 1 )
{}
STEPPED_SLIDER::~STEPPED_SLIDER()
{}
void STEPPED_SLIDER::SetStep( int aSize )
{
wxASSERT( aSize > 0 );
m_step = ( aSize > 0 ) ? aSize : 1;
#ifdef __WXMSW__
ClearTicks();
if( aSize > 1 )
SetTickFreq( aSize );
#endif // __WXMSW__
}
int STEPPED_SLIDER::GetStep() const
{
return m_step;
}
void STEPPED_SLIDER::OnScroll( wxScrollEvent& aEvent )
{
const int value = GetValue();
const int rounded = value - value % m_step;
SetValue( rounded );
aEvent.Skip();
}

View File

@ -3,24 +3,20 @@
* *
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2007-2016 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2007-2018 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
* modify it under the terms of the GNU General Public License * under the terms of the GNU General Public License as published by the
* as published by the Free Software Foundation; either version 2 * Free Software Foundation, either version 3 of the License, or (at your
* of the License, or (at your option) any later version. * option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful, but
* but WITHOUT ANY WARRANTY; without even the implied warranty of * WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* GNU General Public License for more details. * General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License along
* along with this program; if not, you may find one here: * with this program. If not, see <http://www.gnu.org/licenses/>.
* 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
*/ */
/** /**
@ -41,66 +37,66 @@
void CVPCB_MAINFRAME::ReCreateHToolbar() void CVPCB_MAINFRAME::ReCreateHToolbar()
{ {
if( m_mainToolBar != NULL ) if( m_mainToolBar )
return; m_mainToolBar->Clear();
else
m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize, m_mainToolBar->AddTool( wxID_SAVE, wxEmptyString, KiScaledBitmap( save_xpm, this ), SAVE_HLP_MSG );
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
m_mainToolBar->AddTool( wxID_SAVE, wxEmptyString, KiBitmap( save_xpm ), SAVE_HLP_MSG ); KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_CVPCB_LIB_TABLE_EDIT, wxEmptyString, m_mainToolBar->AddTool( ID_CVPCB_LIB_TABLE_EDIT, wxEmptyString,
KiBitmap( config_xpm ), KiScaledBitmap( config_xpm, this ),
_( "Edit footprint library table" ) ); _( "Edit footprint library table" ) );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_CVPCB_CREATE_SCREENCMP, wxEmptyString, m_mainToolBar->AddTool( ID_CVPCB_CREATE_SCREENCMP, wxEmptyString,
KiBitmap( show_footprint_xpm ), KiScaledBitmap( show_footprint_xpm, this ),
_( "View selected footprint" ) ); _( "View selected footprint" ) );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_CVPCB_GOTO_PREVIOUSNA, wxEmptyString, m_mainToolBar->AddTool( ID_CVPCB_GOTO_PREVIOUSNA, wxEmptyString,
KiBitmap( left_xpm ), KiScaledBitmap( left_xpm, this ),
_( "Select previous unlinked symbol" ) ); _( "Select previous unlinked symbol" ) );
m_mainToolBar->AddTool( ID_CVPCB_GOTO_FIRSTNA, wxEmptyString, m_mainToolBar->AddTool( ID_CVPCB_GOTO_FIRSTNA, wxEmptyString,
KiBitmap( right_xpm ), KiScaledBitmap( right_xpm, this ),
_( "Select next unlinked symbol" ) ); _( "Select next unlinked symbol" ) );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_CVPCB_AUTO_ASSOCIE, wxEmptyString, m_mainToolBar->AddTool( ID_CVPCB_AUTO_ASSOCIE, wxEmptyString,
KiBitmap( auto_associe_xpm ), KiScaledBitmap( auto_associe_xpm, this ),
_( "Perform automatic footprint association" ) ); _( "Perform automatic footprint association" ) );
m_mainToolBar->AddTool( ID_CVPCB_DEL_ASSOCIATIONS, wxEmptyString, m_mainToolBar->AddTool( ID_CVPCB_DEL_ASSOCIATIONS, wxEmptyString,
KiBitmap( delete_association_xpm ), KiScaledBitmap( delete_association_xpm, this ),
_( "Delete all footprint associations" ) ); _( "Delete all footprint associations" ) );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, m_mainToolBar->AddTool( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST,
KiBitmap( module_filtered_list_xpm ), KiScaledBitmap( module_filtered_list_xpm, this ),
wxNullBitmap, wxNullBitmap,
true, NULL, true, NULL,
_( "Filter footprint list by schematic symbol keywords" ), _( "Filter footprint list by schematic symbol keywords" ),
wxEmptyString ); wxEmptyString );
m_mainToolBar->AddTool( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST, m_mainToolBar->AddTool( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST,
KiBitmap( module_pin_filtered_list_xpm ), KiScaledBitmap( module_pin_filtered_list_xpm, this ),
wxNullBitmap, wxNullBitmap,
true, NULL, true, NULL,
_( "Filter footprint list by pin count" ), _( "Filter footprint list by pin count" ),
wxEmptyString ); wxEmptyString );
m_mainToolBar->AddTool( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST, m_mainToolBar->AddTool( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST,
KiBitmap( module_library_list_xpm ), KiScaledBitmap( module_library_list_xpm, this ),
wxNullBitmap, true, NULL, wxNullBitmap, true, NULL,
_( "Filter footprint list by library" ), _( "Filter footprint list by library" ),
wxEmptyString ); wxEmptyString );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_CVPCB_FOOTPRINT_DISPLAY_BY_NAME, m_mainToolBar->AddTool( ID_CVPCB_FOOTPRINT_DISPLAY_BY_NAME,
KiBitmap( module_name_filtered_list_xpm ), KiScaledBitmap( module_name_filtered_list_xpm, this ),
wxNullBitmap, true, NULL, wxNullBitmap, true, NULL,
_( "Filter footprint list using a partial name or a pattern" ), _( "Filter footprint list using a partial name or a pattern" ),
wxEmptyString ); wxEmptyString );

View File

@ -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 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2009 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2018 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
@ -34,13 +34,15 @@
#include "../widgets/widget_eeschema_color_config.h" #include "../widgets/widget_eeschema_color_config.h"
#include <schframe.h> #include <schframe.h>
#include <hotkeys.h> #include <hotkeys.h>
#include <bitmap_types.h>
#include <wx/settings.h> #include <wx/settings.h>
int DIALOG_EESCHEMA_OPTIONS::m_lastPageSelected = 0; int DIALOG_EESCHEMA_OPTIONS::m_lastPageSelected = 0;
DIALOG_EESCHEMA_OPTIONS::DIALOG_EESCHEMA_OPTIONS( SCH_EDIT_FRAME* parent ) : DIALOG_EESCHEMA_OPTIONS::DIALOG_EESCHEMA_OPTIONS( SCH_EDIT_FRAME* parent ) :
DIALOG_EESCHEMA_OPTIONS_BASE( parent ) DIALOG_EESCHEMA_OPTIONS_BASE( parent ),
m_last_scale( -1 )
{ {
m_choiceUnits->SetFocus(); m_choiceUnits->SetFocus();
m_sdbSizerOK->SetDefault(); m_sdbSizerOK->SetDefault();
@ -53,6 +55,8 @@ DIALOG_EESCHEMA_OPTIONS::DIALOG_EESCHEMA_OPTIONS( SCH_EDIT_FRAME* parent ) :
m_fieldGrid->AutoSizeColLabelSize( i ); m_fieldGrid->AutoSizeColLabelSize( i );
} }
m_scaleSlider->SetStep( 25 );
// Embed the hotkeys list // Embed the hotkeys list
HOTKEY_SECTIONS sections = WIDGET_HOTKEY_LIST::GenSections( g_Eeschema_Hokeys_Descr ); HOTKEY_SECTIONS sections = WIDGET_HOTKEY_LIST::GenSections( g_Eeschema_Hokeys_Descr );
m_hotkeyListCtrl = new WIDGET_HOTKEY_LIST( m_panelHotkeys, sections ); m_hotkeyListCtrl = new WIDGET_HOTKEY_LIST( m_panelHotkeys, sections );
@ -128,6 +132,7 @@ void DIALOG_EESCHEMA_OPTIONS::SetRefIdSeparator( wxChar aSep, wxChar aFirstId)
m_choiceSeparatorRefId->SetSelection( sel ); m_choiceSeparatorRefId->SetSelection( sel );
} }
void DIALOG_EESCHEMA_OPTIONS::GetRefIdSeparator( int& aSep, int& aFirstId) void DIALOG_EESCHEMA_OPTIONS::GetRefIdSeparator( int& aSep, int& aFirstId)
{ {
// m_choiceSeparatorRefId displays one of // m_choiceSeparatorRefId displays one of
@ -191,7 +196,7 @@ void DIALOG_EESCHEMA_OPTIONS::OnAddButtonClick( wxCommandEvent& event )
} }
} }
TransferDataFromWindow(); TransferDataFromFieldGrid();
TEMPLATE_FIELDNAMES::iterator pos; TEMPLATE_FIELDNAMES::iterator pos;
@ -205,7 +210,7 @@ void DIALOG_EESCHEMA_OPTIONS::OnAddButtonClick( wxCommandEvent& event )
newFieldname.m_Value = wxT( "Value" ); newFieldname.m_Value = wxT( "Value" );
newFieldname.m_Visible = false; newFieldname.m_Visible = false;
templateFields.insert( pos, newFieldname ); templateFields.insert( pos, newFieldname );
TransferDataToWindow(); TransferDataToFieldGrid();
event.Skip(); event.Skip();
} }
@ -227,7 +232,7 @@ void DIALOG_EESCHEMA_OPTIONS::OnDeleteButtonClick( wxCommandEvent& event )
} }
} }
TransferDataFromWindow(); TransferDataFromFieldGrid();
int n_rows = m_fieldGrid->GetNumberRows(); int n_rows = m_fieldGrid->GetNumberRows();
@ -242,7 +247,28 @@ void DIALOG_EESCHEMA_OPTIONS::OnDeleteButtonClick( wxCommandEvent& event )
} }
} }
TransferDataToWindow(); TransferDataToFieldGrid();
}
void DIALOG_EESCHEMA_OPTIONS::OnScaleSlider( wxScrollEvent& aEvent )
{
m_scaleAuto->SetValue( false );
}
void DIALOG_EESCHEMA_OPTIONS::OnScaleAuto( wxCommandEvent& aEvent )
{
if( m_scaleAuto->GetValue() )
{
m_last_scale = m_scaleSlider->GetValue();
m_scaleSlider->SetValue( 25 * KiIconScale( GetParent() ) );
}
else
{
if( m_last_scale >= 0 )
m_scaleSlider->SetValue( m_last_scale );
}
} }
@ -254,6 +280,66 @@ bool DIALOG_EESCHEMA_OPTIONS::TransferDataToWindow()
if( !m_hotkeyListCtrl->TransferDataToControl() ) if( !m_hotkeyListCtrl->TransferDataToControl() )
return false; return false;
if( !TransferDataToFieldGrid() )
return false;
int scale_fourths = GetParent()->GetIconScale();
if( scale_fourths <= 0 )
{
m_scaleAuto->SetValue( true );
m_scaleSlider->SetValue( 25 * KiIconScale( GetParent() ) );
}
else
{
m_scaleAuto->SetValue( false );
m_scaleSlider->SetValue( scale_fourths * 25 );
}
m_stIconScale->SetLabel(
_( "Icon scale:" ) +
wxString::Format( " (diag: %d)",
GetParent()->ConvertDialogToPixels( wxSize( 0, 8 ) ).y ) );
Layout();
return true;
}
bool DIALOG_EESCHEMA_OPTIONS::TransferDataFromWindow()
{
m_lastPageSelected = m_notebook->GetSelection();
if( !wxDialog::TransferDataFromWindow() )
return false;
if( !m_hotkeyListCtrl->TransferDataFromControl() )
return false;
GetParent()->WriteHotkeyConfig( g_Eeschema_Hokeys_Descr );
if( !m_colorConfigCtrl->TransferDataFromControl() )
return false;
if( !TransferDataFromFieldGrid() )
return false;
const int scale_fourths = m_scaleAuto->GetValue() ? -1 : m_scaleSlider->GetValue() / 25;
if( GetParent()->GetIconScale() != scale_fourths )
GetParent()->SetIconScale( scale_fourths );
// Refresh hotkeys
GetParent()->ReCreateMenuBar();
GetParent()->Refresh();
return true;
}
bool DIALOG_EESCHEMA_OPTIONS::TransferDataToFieldGrid()
{
m_fieldGrid->Freeze(); m_fieldGrid->Freeze();
if( m_fieldGrid->GetNumberRows() ) if( m_fieldGrid->GetNumberRows() )
@ -281,30 +367,12 @@ bool DIALOG_EESCHEMA_OPTIONS::TransferDataToWindow()
m_fieldGrid->AutoSizeRows(); m_fieldGrid->AutoSizeRows();
m_fieldGrid->Thaw(); m_fieldGrid->Thaw();
Layout();
return true; return true;
} }
bool DIALOG_EESCHEMA_OPTIONS::TransferDataFromWindow() bool DIALOG_EESCHEMA_OPTIONS::TransferDataFromFieldGrid()
{ {
m_lastPageSelected = m_notebook->GetSelection();
if( !wxDialog::TransferDataFromWindow() )
return false;
if( !m_hotkeyListCtrl->TransferDataFromControl() )
return false;
GetParent()->WriteHotkeyConfig( g_Eeschema_Hokeys_Descr );
if( !m_colorConfigCtrl->TransferDataFromControl() )
return false;
// Refresh hotkeys
GetParent()->ReCreateMenuBar();
GetParent()->Refresh();
for( int row = 0; row < m_fieldGrid->GetNumberRows(); ++row ) for( int row = 0; row < m_fieldGrid->GetNumberRows(); ++row )
{ {
templateFields[row].m_Name = m_fieldGrid->GetCellValue( row, 0 ); templateFields[row].m_Name = m_fieldGrid->GetCellValue( row, 0 );
@ -315,14 +383,13 @@ bool DIALOG_EESCHEMA_OPTIONS::TransferDataFromWindow()
return true; return true;
} }
void DIALOG_EESCHEMA_OPTIONS::SetTemplateFields( const TEMPLATE_FIELDNAMES& aFields ) void DIALOG_EESCHEMA_OPTIONS::SetTemplateFields( const TEMPLATE_FIELDNAMES& aFields )
{ {
// Set the template fields object // Set the template fields object
templateFields = aFields; templateFields = aFields;
// Build and refresh the view // Build and refresh the view
TransferDataToWindow(); TransferDataToFieldGrid();
} }

View File

@ -43,6 +43,9 @@ class DIALOG_EESCHEMA_OPTIONS : public DIALOG_EESCHEMA_OPTIONS_BASE
private: private:
static int m_lastPageSelected; ///< the active notebook page when closing this dialog static int m_lastPageSelected; ///< the active notebook page when closing this dialog
///< strored to keep selection during a session ///< strored to keep selection during a session
int m_last_scale; ///< saved icon scale when Auto selected
protected: protected:
WIDGET_HOTKEY_LIST* m_hotkeyListCtrl; WIDGET_HOTKEY_LIST* m_hotkeyListCtrl;
WIDGET_EESCHEMA_COLOR_CONFIG* m_colorConfigCtrl; WIDGET_EESCHEMA_COLOR_CONFIG* m_colorConfigCtrl;
@ -72,6 +75,9 @@ protected:
*/ */
void OnDeleteButtonClick( wxCommandEvent& event ) override; void OnDeleteButtonClick( wxCommandEvent& event ) override;
void OnScaleSlider( wxScrollEvent& aEvent ) override;
void OnScaleAuto( wxCommandEvent& aEvent ) override;
/** /**
* Function TransferDataToWindow * Function TransferDataToWindow
* Transfer data into the GUI. * Transfer data into the GUI.
@ -84,6 +90,9 @@ protected:
*/ */
bool TransferDataFromWindow() override; bool TransferDataFromWindow() override;
bool TransferDataToFieldGrid();
bool TransferDataFromFieldGrid();
public: public:
/** /**
* Public constructor * Public constructor

View File

@ -11,6 +11,8 @@
BEGIN_EVENT_TABLE( DIALOG_EESCHEMA_OPTIONS_BASE, DIALOG_SHIM ) BEGIN_EVENT_TABLE( DIALOG_EESCHEMA_OPTIONS_BASE, DIALOG_SHIM )
EVT_SIZE( DIALOG_EESCHEMA_OPTIONS_BASE::_wxFB_OnSize ) EVT_SIZE( DIALOG_EESCHEMA_OPTIONS_BASE::_wxFB_OnSize )
EVT_SCROLL( DIALOG_EESCHEMA_OPTIONS_BASE::_wxFB_OnScaleSlider )
EVT_CHECKBOX( wxID_ANY, DIALOG_EESCHEMA_OPTIONS_BASE::_wxFB_OnScaleAuto )
EVT_CHOICE( wxID_ANY, DIALOG_EESCHEMA_OPTIONS_BASE::_wxFB_OnChooseUnits ) EVT_CHOICE( wxID_ANY, DIALOG_EESCHEMA_OPTIONS_BASE::_wxFB_OnChooseUnits )
EVT_BUTTON( wxID_ADD_FIELD, DIALOG_EESCHEMA_OPTIONS_BASE::_wxFB_OnAddButtonClick ) EVT_BUTTON( wxID_ADD_FIELD, DIALOG_EESCHEMA_OPTIONS_BASE::_wxFB_OnAddButtonClick )
EVT_BUTTON( wxID_DELETE_FIELD, DIALOG_EESCHEMA_OPTIONS_BASE::_wxFB_OnDeleteButtonClick ) EVT_BUTTON( wxID_DELETE_FIELD, DIALOG_EESCHEMA_OPTIONS_BASE::_wxFB_OnDeleteButtonClick )
@ -85,6 +87,26 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
fgSizer32->Add( m_choiceSeparatorRefId, 0, wxALL|wxEXPAND, 3 ); fgSizer32->Add( m_choiceSeparatorRefId, 0, wxALL|wxEXPAND, 3 );
fgSizer32->Add( 0, 0, 1, wxEXPAND, 5 );
m_stIconScale = new wxStaticText( m_panel5, wxID_ANY, _("Icon scale:"), wxDefaultPosition, wxDefaultSize, 0 );
m_stIconScale->Wrap( -1 );
fgSizer32->Add( m_stIconScale, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 3 );
m_scaleSlider = new STEPPED_SLIDER( m_panel5, wxID_ANY, 50, 50, 275, wxDefaultPosition, wxDefaultSize, wxSL_AUTOTICKS|wxSL_HORIZONTAL|wxSL_LABELS );
fgSizer32->Add( m_scaleSlider, 0, wxALL|wxEXPAND, 3 );
m_staticText211 = new wxStaticText( m_panel5, wxID_ANY, _("%"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText211->Wrap( -1 );
fgSizer32->Add( m_staticText211, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 3 );
fgSizer32->Add( 0, 0, 1, wxEXPAND, 5 );
m_scaleAuto = new wxCheckBox( m_panel5, wxID_ANY, _("Auto"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer32->Add( m_scaleAuto, 0, wxALL|wxEXPAND, 3 );
fgSizer32->Add( 0, 0, 1, wxEXPAND, 5 ); fgSizer32->Add( 0, 0, 1, wxEXPAND, 5 );
@ -119,7 +141,7 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
m_panel5->SetSizer( bSizer82 ); m_panel5->SetSizer( bSizer82 );
m_panel5->Layout(); m_panel5->Layout();
bSizer82->Fit( m_panel5 ); bSizer82->Fit( m_panel5 );
m_notebook->AddPage( m_panel5, _("Display"), false ); m_notebook->AddPage( m_panel5, _("Display"), true );
m_panel3 = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL ); m_panel3 = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
wxBoxSizer* bSizer8; wxBoxSizer* bSizer8;
bSizer8 = new wxBoxSizer( wxVERTICAL ); bSizer8 = new wxBoxSizer( wxVERTICAL );
@ -358,7 +380,7 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
m_panel2->SetSizer( bSizer6 ); m_panel2->SetSizer( bSizer6 );
m_panel2->Layout(); m_panel2->Layout();
bSizer6->Fit( m_panel2 ); bSizer6->Fit( m_panel2 );
m_notebook->AddPage( m_panel2, _("Default Fields"), true ); m_notebook->AddPage( m_panel2, _("Default Fields"), false );
bOptionsSizer->Add( m_notebook, 1, wxALL|wxEXPAND, 5 ); bOptionsSizer->Add( m_notebook, 1, wxALL|wxEXPAND, 5 );

View File

@ -187,7 +187,7 @@
<object class="notebookpage" expanded="1"> <object class="notebookpage" expanded="1">
<property name="bitmap"></property> <property name="bitmap"></property>
<property name="label">Display</property> <property name="label">Display</property>
<property name="select">0</property> <property name="select">1</property>
<object class="wxPanel" expanded="1"> <object class="wxPanel" expanded="1">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
@ -1226,6 +1226,388 @@
<property name="width">0</property> <property name="width">0</property>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxStaticText" 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="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">Icon scale:</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_stIconScale</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">; forward_declare</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>
<property name="wrap">-1</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">3</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxSlider" 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="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="maxValue">275</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="minValue">50</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_scaleSlider</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">wxSL_AUTOTICKS|wxSL_HORIZONTAL|wxSL_LABELS</property>
<property name="subclass">STEPPED_SLIDER; widgets/stepped_slider.h; Not forward_declare</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="value">50</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCommandScroll"></event>
<event name="OnCommandScrollBottom"></event>
<event name="OnCommandScrollChanged"></event>
<event name="OnCommandScrollLineDown"></event>
<event name="OnCommandScrollLineUp"></event>
<event name="OnCommandScrollPageDown"></event>
<event name="OnCommandScrollPageUp"></event>
<event name="OnCommandScrollThumbRelease"></event>
<event name="OnCommandScrollThumbTrack"></event>
<event name="OnCommandScrollTop"></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="OnScroll">OnScaleSlider</event>
<event name="OnScrollBottom"></event>
<event name="OnScrollChanged"></event>
<event name="OnScrollLineDown"></event>
<event name="OnScrollLineUp"></event>
<event name="OnScrollPageDown"></event>
<event name="OnScrollPageUp"></event>
<event name="OnScrollThumbRelease"></event>
<event name="OnScrollThumbTrack"></event>
<event name="OnScrollTop"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxStaticText" 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="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">%</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_staticText211</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">; forward_declare</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>
<property name="wrap">-1</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">wxEXPAND</property>
<property name="proportion">1</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALL|wxEXPAND</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">Auto</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_scaleAuto</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">; forward_declare</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">OnScaleAuto</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">wxEXPAND</property>
<property name="proportion">1</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="0"> <object class="sizeritem" expanded="0">
@ -4406,7 +4788,7 @@
<object class="notebookpage" expanded="0"> <object class="notebookpage" expanded="0">
<property name="bitmap"></property> <property name="bitmap"></property>
<property name="label">Default Fields</property> <property name="label">Default Fields</property>
<property name="select">1</property> <property name="select">0</property>
<object class="wxPanel" expanded="0"> <object class="wxPanel" expanded="0">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>

View File

@ -11,6 +11,7 @@
#include <wx/artprov.h> #include <wx/artprov.h>
#include <wx/xrc/xmlres.h> #include <wx/xrc/xmlres.h>
#include <wx/intl.h> #include <wx/intl.h>
#include "widgets/stepped_slider.h"
#include "dialog_shim.h" #include "dialog_shim.h"
#include <wx/string.h> #include <wx/string.h>
#include <wx/stattext.h> #include <wx/stattext.h>
@ -20,9 +21,10 @@
#include <wx/settings.h> #include <wx/settings.h>
#include <wx/choice.h> #include <wx/choice.h>
#include <wx/spinctrl.h> #include <wx/spinctrl.h>
#include <wx/slider.h>
#include <wx/checkbox.h>
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/statline.h> #include <wx/statline.h>
#include <wx/checkbox.h>
#include <wx/panel.h> #include <wx/panel.h>
#include <wx/bitmap.h> #include <wx/bitmap.h>
#include <wx/image.h> #include <wx/image.h>
@ -44,6 +46,8 @@ class DIALOG_EESCHEMA_OPTIONS_BASE : public DIALOG_SHIM
// Private event handlers // Private event handlers
void _wxFB_OnSize( wxSizeEvent& event ){ OnSize( event ); } void _wxFB_OnSize( wxSizeEvent& event ){ OnSize( event ); }
void _wxFB_OnScaleSlider( wxScrollEvent& event ){ OnScaleSlider( event ); }
void _wxFB_OnScaleAuto( wxCommandEvent& event ){ OnScaleAuto( event ); }
void _wxFB_OnChooseUnits( wxCommandEvent& event ){ OnChooseUnits( event ); } void _wxFB_OnChooseUnits( wxCommandEvent& event ){ OnChooseUnits( event ); }
void _wxFB_OnAddButtonClick( wxCommandEvent& event ){ OnAddButtonClick( event ); } void _wxFB_OnAddButtonClick( wxCommandEvent& event ){ OnAddButtonClick( event ); }
void _wxFB_OnDeleteButtonClick( wxCommandEvent& event ){ OnDeleteButtonClick( event ); } void _wxFB_OnDeleteButtonClick( wxCommandEvent& event ){ OnDeleteButtonClick( event ); }
@ -71,6 +75,10 @@ class DIALOG_EESCHEMA_OPTIONS_BASE : public DIALOG_SHIM
wxStaticText* m_staticLineWidthUnits; wxStaticText* m_staticLineWidthUnits;
wxStaticText* m_staticText26; wxStaticText* m_staticText26;
wxChoice* m_choiceSeparatorRefId; wxChoice* m_choiceSeparatorRefId;
wxStaticText* m_stIconScale;
STEPPED_SLIDER* m_scaleSlider;
wxStaticText* m_staticText211;
wxCheckBox* m_scaleAuto;
wxStaticLine* m_staticline3; wxStaticLine* m_staticline3;
wxCheckBox* m_checkShowGrid; wxCheckBox* m_checkShowGrid;
wxCheckBox* m_checkHVOrientation; wxCheckBox* m_checkHVOrientation;
@ -118,6 +126,8 @@ class DIALOG_EESCHEMA_OPTIONS_BASE : public DIALOG_SHIM
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnSize( wxSizeEvent& event ) { event.Skip(); } virtual void OnSize( wxSizeEvent& event ) { event.Skip(); }
virtual void OnScaleSlider( wxScrollEvent& event ) { event.Skip(); }
virtual void OnScaleAuto( wxCommandEvent& event ) { event.Skip(); }
virtual void OnChooseUnits( wxCommandEvent& event ) { event.Skip(); } virtual void OnChooseUnits( wxCommandEvent& event ) { event.Skip(); }
virtual void OnAddButtonClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnAddButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnDeleteButtonClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnDeleteButtonClick( wxCommandEvent& event ) { event.Skip(); }

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 2009 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2009 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2018 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
@ -35,7 +35,8 @@
DIALOG_LIBEDIT_OPTIONS::DIALOG_LIBEDIT_OPTIONS( LIB_EDIT_FRAME* parent ) : DIALOG_LIBEDIT_OPTIONS::DIALOG_LIBEDIT_OPTIONS( LIB_EDIT_FRAME* parent ) :
DIALOG_LIBEDIT_OPTIONS_BASE( parent ) DIALOG_LIBEDIT_OPTIONS_BASE( parent ),
m_last_scale( -1 )
{ {
m_sdbSizerOK->SetDefault(); m_sdbSizerOK->SetDefault();
@ -43,10 +44,72 @@ DIALOG_LIBEDIT_OPTIONS::DIALOG_LIBEDIT_OPTIONS( LIB_EDIT_FRAME* parent ) :
SetItemRepeatStep( Parent()->GetRepeatStep() ); SetItemRepeatStep( Parent()->GetRepeatStep() );
SetPinRepeatStep( Parent()->GetRepeatPinStep() ); SetPinRepeatStep( Parent()->GetRepeatPinStep() );
m_scaleSlider->SetStep( 25 );
// Now all widgets have the size fixed, call FinishDialogSettings // Now all widgets have the size fixed, call FinishDialogSettings
FinishDialogSettings(); FinishDialogSettings();
} }
void DIALOG_LIBEDIT_OPTIONS::OnScaleSlider( wxScrollEvent& aEvent )
{
m_scaleAuto->SetValue( false );
}
void DIALOG_LIBEDIT_OPTIONS::OnScaleAuto( wxCommandEvent& aEvent )
{
if( m_scaleAuto->GetValue() )
{
m_last_scale = m_scaleSlider->GetValue();
m_scaleSlider->SetValue( 25 * KiIconScale( GetParent() ) );
}
else
{
if( m_last_scale >= 0 )
m_scaleSlider->SetValue( m_last_scale );
}
}
bool DIALOG_LIBEDIT_OPTIONS::TransferDataToWindow()
{
if( !wxDialog::TransferDataToWindow() )
return false;
const auto parent = static_cast<LIB_EDIT_FRAME*>( GetParent() );
const int scale_fourths = parent->GetIconScale();
if( scale_fourths <= 0 )
{
m_scaleAuto->SetValue( true );
m_scaleSlider->SetValue( 25 * KiIconScale( GetParent() ) );
}
else
{
m_scaleAuto->SetValue( false );
m_scaleSlider->SetValue( scale_fourths * 25 );
}
return true;
}
bool DIALOG_LIBEDIT_OPTIONS::TransferDataFromWindow()
{
if( !wxDialog::TransferDataFromWindow() )
return false;
const int scale_fourths = m_scaleAuto->GetValue() ? -1 : m_scaleSlider->GetValue() / 25;
const auto parent = static_cast<LIB_EDIT_FRAME*>( GetParent() );
if( parent->GetIconScale() != scale_fourths )
parent->SetIconScale( scale_fourths );
return true;
}
void DIALOG_LIBEDIT_OPTIONS::SetGridSizes( const GRIDS& grid_sizes, int grid_id ) void DIALOG_LIBEDIT_OPTIONS::SetGridSizes( const GRIDS& grid_sizes, int grid_id )
{ {
wxASSERT( grid_sizes.size() > 0 ); wxASSERT( grid_sizes.size() > 0 );

View File

@ -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 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2009 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2018 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
@ -92,6 +92,14 @@ public:
return m_checkShowPinElectricalType->GetValue(); return m_checkShowPinElectricalType->GetValue();
} }
protected:
void OnScaleSlider( wxScrollEvent& aEvent ) override;
void OnScaleAuto( wxCommandEvent& aEvent ) override;
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
private:
int m_last_scale;
}; };
#endif // __DIALOG_LIBEDIT_OPTIONS__ #endif // __DIALOG_LIBEDIT_OPTIONS__

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 22 2017) // C++ code generated with wxFormBuilder (version Jan 2 2018)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
@ -9,6 +9,11 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
BEGIN_EVENT_TABLE( DIALOG_LIBEDIT_OPTIONS_BASE, DIALOG_SHIM )
EVT_SCROLL( DIALOG_LIBEDIT_OPTIONS_BASE::_wxFB_OnScaleSlider )
EVT_CHECKBOX( wxID_ANY, DIALOG_LIBEDIT_OPTIONS_BASE::_wxFB_OnScaleAuto )
END_EVENT_TABLE()
DIALOG_LIBEDIT_OPTIONS_BASE::DIALOG_LIBEDIT_OPTIONS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style ) DIALOG_LIBEDIT_OPTIONS_BASE::DIALOG_LIBEDIT_OPTIONS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{ {
this->SetSizeHints( wxDefaultSize, wxDefaultSize ); this->SetSizeHints( wxDefaultSize, wxDefaultSize );
@ -136,6 +141,26 @@ DIALOG_LIBEDIT_OPTIONS_BASE::DIALOG_LIBEDIT_OPTIONS_BASE( wxWindow* parent, wxWi
fgSizer->Add( 0, 0, 0, 0, 5 ); fgSizer->Add( 0, 0, 0, 0, 5 );
m_staticText18 = new wxStaticText( this, wxID_ANY, _("Icon scale:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText18->Wrap( -1 );
fgSizer->Add( m_staticText18, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_scaleSlider = new STEPPED_SLIDER( this, wxID_ANY, 50, 50, 275, wxDefaultPosition, wxDefaultSize, wxSL_AUTOTICKS|wxSL_HORIZONTAL|wxSL_LABELS );
fgSizer->Add( m_scaleSlider, 0, wxALL|wxEXPAND, 5 );
m_staticText19 = new wxStaticText( this, wxID_ANY, _("%"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText19->Wrap( -1 );
fgSizer->Add( m_staticText19, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
fgSizer->Add( 0, 0, 1, wxEXPAND, 5 );
m_scaleAuto = new wxCheckBox( this, wxID_ANY, _("Auto"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer->Add( m_scaleAuto, 0, wxALL, 5 );
fgSizer->Add( 0, 0, 1, wxEXPAND, 5 );
bSizer3->Add( fgSizer, 0, wxEXPAND, 0 ); bSizer3->Add( fgSizer, 0, wxEXPAND, 0 );

View File

@ -2349,6 +2349,388 @@
<property name="width">0</property> <property name="width">0</property>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticText" 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="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">Icon scale:</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_staticText18</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">; forward_declare</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>
<property name="wrap">-1</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|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxSlider" 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="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="maxValue">275</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="minValue">50</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_scaleSlider</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">wxSL_AUTOTICKS|wxSL_HORIZONTAL|wxSL_LABELS</property>
<property name="subclass">STEPPED_SLIDER; widgets/stepped_slider.h; Not forward_declare</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="value">50</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCommandScroll"></event>
<event name="OnCommandScrollBottom"></event>
<event name="OnCommandScrollChanged"></event>
<event name="OnCommandScrollLineDown"></event>
<event name="OnCommandScrollLineUp"></event>
<event name="OnCommandScrollPageDown"></event>
<event name="OnCommandScrollPageUp"></event>
<event name="OnCommandScrollThumbRelease"></event>
<event name="OnCommandScrollThumbTrack"></event>
<event name="OnCommandScrollTop"></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="OnScroll">OnScaleSlider</event>
<event name="OnScrollBottom"></event>
<event name="OnScrollChanged"></event>
<event name="OnScrollLineDown"></event>
<event name="OnScrollLineUp"></event>
<event name="OnScrollPageDown"></event>
<event name="OnScrollPageUp"></event>
<event name="OnScrollThumbRelease"></event>
<event name="OnScrollThumbTrack"></event>
<event name="OnScrollTop"></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">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticText" 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="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">%</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_staticText19</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">; forward_declare</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>
<property name="wrap">-1</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">wxEXPAND</property>
<property name="proportion">1</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</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">Auto</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_scaleAuto</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">; forward_declare</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">OnScaleAuto</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">wxEXPAND</property>
<property name="proportion">1</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 22 2017) // C++ code generated with wxFormBuilder (version Jan 2 2018)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
@ -11,6 +11,7 @@
#include <wx/artprov.h> #include <wx/artprov.h>
#include <wx/xrc/xmlres.h> #include <wx/xrc/xmlres.h>
#include <wx/intl.h> #include <wx/intl.h>
#include "widgets/stepped_slider.h"
#include "dialog_shim.h" #include "dialog_shim.h"
#include <wx/string.h> #include <wx/string.h>
#include <wx/stattext.h> #include <wx/stattext.h>
@ -20,9 +21,10 @@
#include <wx/settings.h> #include <wx/settings.h>
#include <wx/choice.h> #include <wx/choice.h>
#include <wx/spinctrl.h> #include <wx/spinctrl.h>
#include <wx/slider.h>
#include <wx/checkbox.h>
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/statline.h> #include <wx/statline.h>
#include <wx/checkbox.h>
#include <wx/button.h> #include <wx/button.h>
#include <wx/dialog.h> #include <wx/dialog.h>
@ -34,7 +36,13 @@
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
class DIALOG_LIBEDIT_OPTIONS_BASE : public DIALOG_SHIM class DIALOG_LIBEDIT_OPTIONS_BASE : public DIALOG_SHIM
{ {
DECLARE_EVENT_TABLE()
private: private:
// Private event handlers
void _wxFB_OnScaleSlider( wxScrollEvent& event ){ OnScaleSlider( event ); }
void _wxFB_OnScaleAuto( wxCommandEvent& event ){ OnScaleAuto( event ); }
protected: protected:
wxStaticText* m_staticText3; wxStaticText* m_staticText3;
@ -63,6 +71,10 @@ class DIALOG_LIBEDIT_OPTIONS_BASE : public DIALOG_SHIM
wxStaticText* m_staticText16; wxStaticText* m_staticText16;
wxStaticText* m_staticText17; wxStaticText* m_staticText17;
wxSpinCtrl* m_spinRepeatLabel; wxSpinCtrl* m_spinRepeatLabel;
wxStaticText* m_staticText18;
STEPPED_SLIDER* m_scaleSlider;
wxStaticText* m_staticText19;
wxCheckBox* m_scaleAuto;
wxStaticLine* m_staticline3; wxStaticLine* m_staticline3;
wxCheckBox* m_checkShowGrid; wxCheckBox* m_checkShowGrid;
wxCheckBox* m_checkShowPinElectricalType; wxCheckBox* m_checkShowPinElectricalType;
@ -70,6 +82,11 @@ class DIALOG_LIBEDIT_OPTIONS_BASE : public DIALOG_SHIM
wxStdDialogButtonSizer* m_sdbSizer; wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK; wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel; wxButton* m_sdbSizerCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnScaleSlider( wxScrollEvent& event ) { event.Skip(); }
virtual void OnScaleAuto( wxCommandEvent& event ) { event.Skip(); }
public: public:

View File

@ -430,6 +430,8 @@ const wxChar RescueNeverShowEntry[] = wxT( "RescueNeverShow" );
const wxChar AutoplaceFieldsEntry[] = wxT( "AutoplaceFields" ); const wxChar AutoplaceFieldsEntry[] = wxT( "AutoplaceFields" );
const wxChar AutoplaceJustifyEntry[] = wxT( "AutoplaceJustify" ); const wxChar AutoplaceJustifyEntry[] = wxT( "AutoplaceJustify" );
const wxChar AutoplaceAlignEntry[] = wxT( "AutoplaceAlign" ); const wxChar AutoplaceAlignEntry[] = wxT( "AutoplaceAlign" );
const wxChar SchIconScaleEntry[] = wxT( "SchIconScale" );
const wxChar LibIconScaleEntry[] = wxT( "LibIconScale" );
static const wxChar FootprintPreviewEntry[] = wxT( "FootprintPreview" ); static const wxChar FootprintPreviewEntry[] = wxT( "FootprintPreview" );
static const wxChar DefaultBusWidthEntry[] = wxT( "DefaultBusWidth" ); static const wxChar DefaultBusWidthEntry[] = wxT( "DefaultBusWidth" );
static const wxChar DefaultDrawLineWidthEntry[] = wxT( "DefaultDrawLineWidth" ); static const wxChar DefaultDrawLineWidthEntry[] = wxT( "DefaultDrawLineWidth" );

View File

@ -1,3 +1,22 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009-2018 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 3 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, see <http://www.gnu.org/licenses/>.
*/
/** /**
* @file eeschema_config.h * @file eeschema_config.h
*/ */
@ -11,5 +30,7 @@ extern const wxChar RescueNeverShowEntry[];
extern const wxChar AutoplaceFieldsEntry[]; extern const wxChar AutoplaceFieldsEntry[];
extern const wxChar AutoplaceJustifyEntry[]; extern const wxChar AutoplaceJustifyEntry[];
extern const wxChar AutoplaceAlignEntry[]; extern const wxChar AutoplaceAlignEntry[];
extern const wxChar LibIconScaleEntry[];
extern const wxChar SchIconScaleEntry[];
#endif // EESCHEMA_CONFIG_H #endif // EESCHEMA_CONFIG_H

View File

@ -54,6 +54,7 @@
#include <kicad_device_context.h> #include <kicad_device_context.h>
#include <hotkeys.h> #include <hotkeys.h>
#include <eeschema_config.h>
#include <dialogs/dialog_lib_edit_text.h> #include <dialogs/dialog_lib_edit_text.h>
#include <dialogs/dialog_edit_component_in_lib.h> #include <dialogs/dialog_edit_component_in_lib.h>
@ -280,7 +281,7 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_aliasName = part->GetName(); m_aliasName = part->GetName();
} }
CreateOptionToolbar(); ReCreateOptToolbar();
DisplayLibInfos(); DisplayLibInfos();
DisplayCmpDoc(); DisplayCmpDoc();
UpdateAliasSelectList(); UpdateAliasSelectList();
@ -1747,3 +1748,23 @@ void LIB_EDIT_FRAME::emptyScreen()
Zoom_Automatique( false ); Zoom_Automatique( false );
Refresh(); Refresh();
} }
int LIB_EDIT_FRAME::GetIconScale()
{
int scale = 0;
Kiface().KifaceSettings()->Read( LibIconScaleEntry, &scale, 0 );
return scale;
}
void LIB_EDIT_FRAME::SetIconScale( int aScale )
{
Kiface().KifaceSettings()->Write( LibIconScaleEntry, aScale );
ReCreateMenuBar();
ReCreateVToolbar();
ReCreateHToolbar();
ReCreateOptToolbar();
Layout();
SendSizeEvent();
}

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com> * Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2004-2017 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2004-2018 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2017 CERN * Copyright (C) 2017 CERN
* @author Maciej Suminski <maciej.suminski@cern.ch> * @author Maciej Suminski <maciej.suminski@cern.ch>
* *
@ -377,7 +377,7 @@ public:
void OnCloseWindow( wxCloseEvent& Event ); void OnCloseWindow( wxCloseEvent& Event );
void ReCreateHToolbar() override; void ReCreateHToolbar() override;
void ReCreateVToolbar() override; void ReCreateVToolbar() override;
void CreateOptionToolbar(); void ReCreateOptToolbar();
void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) override; void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) override;
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) override; bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) override;
double BestZoom() override; // Returns the best zoom double BestZoom() override; // Returns the best zoom
@ -697,6 +697,9 @@ public:
*/ */
void SyncLibraries( bool aLoad ); void SyncLibraries( bool aLoad );
int GetIconScale() override;
void SetIconScale( int aScale ) override;
private: private:
///> Helper screen used when no part is loaded ///> Helper screen used when no part is loaded
SCH_SCREEN* m_dummyScreen; SCH_SCREEN* m_dummyScreen;

View File

@ -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) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2018 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
@ -1498,3 +1498,23 @@ void SCH_EDIT_FRAME::OnConfigurePaths( wxCommandEvent& aEvent )
{ {
Pgm().ConfigurePaths( this ); Pgm().ConfigurePaths( this );
} }
int SCH_EDIT_FRAME::GetIconScale()
{
int scale = 0;
Kiface().KifaceSettings()->Read( SchIconScaleEntry, &scale, 0 );
return scale;
}
void SCH_EDIT_FRAME::SetIconScale( int aScale )
{
Kiface().KifaceSettings()->Write( SchIconScaleEntry, aScale );
ReCreateMenuBar();
ReCreateHToolbar();
ReCreateVToolbar();
ReCreateOptToolbar();
Layout();
SendSizeEvent();
}

View File

@ -1475,6 +1475,9 @@ public:
wxString GetNetListerCommand() const { return m_netListerCommand; } wxString GetNetListerCommand() const { return m_netListerCommand; }
int GetIconScale() override;
void SetIconScale( int aScale ) override;
///> Probe cursor, used by circuit simulator ///> Probe cursor, used by circuit simulator
const static wxCursor CURSOR_PROBE; const static wxCursor CURSOR_PROBE;

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com> * Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2004-2017 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2004-2018 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
@ -47,44 +47,44 @@
void LIB_EDIT_FRAME::ReCreateVToolbar() void LIB_EDIT_FRAME::ReCreateVToolbar()
{ {
if( m_drawToolBar != NULL ) if( m_drawToolBar )
return; m_drawToolBar->Clear();
else
m_drawToolBar = new wxAuiToolBar( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize, m_drawToolBar = new wxAuiToolBar( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL ); KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
// Set up toolbar // Set up toolbar
m_drawToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, KiBitmap( cursor_xpm ), m_drawToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, KiScaledBitmap( cursor_xpm, this ),
_( "Deselect current tool" ), wxITEM_CHECK ); _( "Deselect current tool" ), wxITEM_CHECK );
m_drawToolBar->AddTool( ID_LIBEDIT_PIN_BUTT, wxEmptyString, KiBitmap( pin_xpm ), m_drawToolBar->AddTool( ID_LIBEDIT_PIN_BUTT, wxEmptyString, KiScaledBitmap( pin_xpm, this ),
HELP_ADD_PIN, wxITEM_CHECK ); HELP_ADD_PIN, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_LIBEDIT_BODY_TEXT_BUTT, wxEmptyString, KiBitmap( text_xpm ), m_drawToolBar->AddTool( ID_LIBEDIT_BODY_TEXT_BUTT, wxEmptyString, KiScaledBitmap( text_xpm, this ),
HELP_ADD_BODYTEXT, wxITEM_CHECK ); HELP_ADD_BODYTEXT, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_LIBEDIT_BODY_RECT_BUTT, wxEmptyString, KiBitmap( add_rectangle_xpm ), m_drawToolBar->AddTool( ID_LIBEDIT_BODY_RECT_BUTT, wxEmptyString, KiScaledBitmap( add_rectangle_xpm, this ),
HELP_ADD_BODYRECT, wxITEM_CHECK ); HELP_ADD_BODYRECT, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_LIBEDIT_BODY_CIRCLE_BUTT, wxEmptyString, KiBitmap( add_circle_xpm ), m_drawToolBar->AddTool( ID_LIBEDIT_BODY_CIRCLE_BUTT, wxEmptyString, KiScaledBitmap( add_circle_xpm, this ),
HELP_ADD_BODYCIRCLE, wxITEM_CHECK ); HELP_ADD_BODYCIRCLE, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_LIBEDIT_BODY_ARC_BUTT, wxEmptyString, KiBitmap( add_arc_xpm ), m_drawToolBar->AddTool( ID_LIBEDIT_BODY_ARC_BUTT, wxEmptyString, KiScaledBitmap( add_arc_xpm, this ),
HELP_ADD_BODYARC, wxITEM_CHECK ); HELP_ADD_BODYARC, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_LIBEDIT_BODY_LINE_BUTT, wxEmptyString, KiBitmap( add_polygon_xpm ), m_drawToolBar->AddTool( ID_LIBEDIT_BODY_LINE_BUTT, wxEmptyString, KiScaledBitmap( add_polygon_xpm, this ),
HELP_ADD_BODYPOLYGON, wxITEM_CHECK ); HELP_ADD_BODYPOLYGON, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_LIBEDIT_ANCHOR_ITEM_BUTT, wxEmptyString, KiBitmap( anchor_xpm ), m_drawToolBar->AddTool( ID_LIBEDIT_ANCHOR_ITEM_BUTT, wxEmptyString, KiScaledBitmap( anchor_xpm, this ),
_( "Move symbol anchor" ), wxITEM_CHECK ); _( "Move symbol anchor" ), wxITEM_CHECK );
m_drawToolBar->AddTool( ID_LIBEDIT_IMPORT_BODY_BUTT, wxEmptyString, KiBitmap( import_xpm ), m_drawToolBar->AddTool( ID_LIBEDIT_IMPORT_BODY_BUTT, wxEmptyString, KiScaledBitmap( import_xpm, this ),
_( "Import existing drawings" ), wxITEM_CHECK ); _( "Import existing drawings" ), wxITEM_CHECK );
m_drawToolBar->AddTool( ID_LIBEDIT_EXPORT_BODY_BUTT, wxEmptyString, KiBitmap( export_xpm ), m_drawToolBar->AddTool( ID_LIBEDIT_EXPORT_BODY_BUTT, wxEmptyString, KiScaledBitmap( export_xpm, this ),
_( "Export current drawing" ), wxITEM_CHECK ); _( "Export current drawing" ), wxITEM_CHECK );
m_drawToolBar->AddTool( ID_LIBEDIT_DELETE_ITEM_BUTT, wxEmptyString, KiBitmap( delete_xpm ), m_drawToolBar->AddTool( ID_LIBEDIT_DELETE_ITEM_BUTT, wxEmptyString, KiScaledBitmap( delete_xpm, this ),
HELP_DELETE_ITEMS, wxITEM_CHECK ); HELP_DELETE_ITEMS, wxITEM_CHECK );
m_drawToolBar->Realize(); m_drawToolBar->Realize();
@ -95,99 +95,104 @@ void LIB_EDIT_FRAME::ReCreateHToolbar()
{ {
wxString msg; wxString msg;
// Create the toolbar if not exists if( m_mainToolBar )
if( m_mainToolBar != NULL ) m_mainToolBar->Clear();
return; else
m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize, KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
// Set up toolbar // Set up toolbar
m_mainToolBar->AddTool( ID_LIBEDIT_NEW_LIBRARY, wxEmptyString, m_mainToolBar->AddTool( ID_LIBEDIT_NEW_LIBRARY, wxEmptyString,
KiBitmap( new_library_xpm ), KiScaledBitmap( new_library_xpm, this ),
_( "Create a new library" ) ); _( "Create a new library" ) );
m_mainToolBar->AddTool( ID_LIBEDIT_ADD_LIBRARY, wxEmptyString, m_mainToolBar->AddTool( ID_LIBEDIT_ADD_LIBRARY, wxEmptyString,
KiBitmap( add_library_xpm ), KiScaledBitmap( add_library_xpm, this ),
_( "Add an existing library" ) ); _( "Add an existing library" ) );
m_mainToolBar->AddTool( ID_LIBEDIT_SAVE_LIBRARY, wxEmptyString, m_mainToolBar->AddTool( ID_LIBEDIT_SAVE_LIBRARY, wxEmptyString,
KiBitmap( save_library_xpm ), KiScaledBitmap( save_library_xpm, this ),
_( "Save current library" ) ); _( "Save current library" ) );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_LIBEDIT_NEW_PART, wxEmptyString, KiBitmap( new_component_xpm ),
m_mainToolBar->AddTool( ID_LIBEDIT_NEW_PART, wxEmptyString, KiScaledBitmap( new_component_xpm, this ),
_( "Create new symbol" ) ); _( "Create new symbol" ) );
m_mainToolBar->AddTool( ID_LIBEDIT_SAVE_PART, wxEmptyString, m_mainToolBar->AddTool( ID_LIBEDIT_SAVE_PART, wxEmptyString,
KiBitmap( save_part_xpm ), KiScaledBitmap( save_part_xpm, this ),
_( "Save current symbol" ) ); _( "Save current symbol" ) );
m_mainToolBar->AddTool( ID_LIBEDIT_IMPORT_PART, wxEmptyString, KiBitmap( import_part_xpm ), m_mainToolBar->AddTool( ID_LIBEDIT_IMPORT_PART, wxEmptyString, KiScaledBitmap( import_part_xpm, this ),
_( "Import symbol" ) ); _( "Import symbol" ) );
m_mainToolBar->AddTool( ID_LIBEDIT_EXPORT_PART, wxEmptyString, KiBitmap( export_part_xpm ), m_mainToolBar->AddTool( ID_LIBEDIT_EXPORT_PART, wxEmptyString, KiScaledBitmap( export_part_xpm, this ),
_( "Export symbol" ) ); _( "Export symbol" ) );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( wxID_PASTE, wxEmptyString, KiBitmap( paste_xpm ), m_mainToolBar->AddTool( wxID_PASTE, wxEmptyString, KiScaledBitmap( paste_xpm, this ),
_( "Paste" ) ); _( "Paste" ) );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
msg = AddHotkeyName( HELP_UNDO, g_Libedit_Hokeys_Descr, HK_UNDO, IS_COMMENT ); msg = AddHotkeyName( HELP_UNDO, g_Libedit_Hokeys_Descr, HK_UNDO, IS_COMMENT );
m_mainToolBar->AddTool( wxID_UNDO, wxEmptyString, KiBitmap( undo_xpm ), msg ); m_mainToolBar->AddTool( wxID_UNDO, wxEmptyString, KiScaledBitmap( undo_xpm, this ), msg );
msg = AddHotkeyName( HELP_REDO, g_Libedit_Hokeys_Descr, HK_REDO, IS_COMMENT ); msg = AddHotkeyName( HELP_REDO, g_Libedit_Hokeys_Descr, HK_REDO, IS_COMMENT );
m_mainToolBar->AddTool( wxID_REDO, wxEmptyString, KiBitmap( redo_xpm ), msg ); m_mainToolBar->AddTool( wxID_REDO, wxEmptyString, KiScaledBitmap( redo_xpm, this ), msg );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_LIBEDIT_GET_FRAME_EDIT_PART, wxEmptyString, m_mainToolBar->AddTool( ID_LIBEDIT_GET_FRAME_EDIT_PART, wxEmptyString,
KiBitmap( part_properties_xpm ), _( "Edit symbol properties" ) ); KiScaledBitmap( part_properties_xpm, this ), _( "Edit symbol properties" ) );
m_mainToolBar->AddTool( ID_LIBEDIT_GET_FRAME_EDIT_FIELDS, wxEmptyString, m_mainToolBar->AddTool( ID_LIBEDIT_GET_FRAME_EDIT_FIELDS, wxEmptyString,
KiBitmap( text_xpm ), KiScaledBitmap( text_xpm, this ),
_( "Edit field properties" ) ); _( "Edit field properties" ) );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_LIBEDIT_CHECK_PART, wxEmptyString, KiBitmap( erc_xpm ),
m_mainToolBar->AddTool( ID_LIBEDIT_CHECK_PART, wxEmptyString, KiScaledBitmap( erc_xpm, this ),
_( "Check duplicate and off grid pins" ) ); _( "Check duplicate and off grid pins" ) );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
msg = AddHotkeyName( HELP_ZOOM_REDRAW, g_Libedit_Hokeys_Descr, HK_ZOOM_REDRAW, IS_COMMENT ); msg = AddHotkeyName( HELP_ZOOM_REDRAW, g_Libedit_Hokeys_Descr, HK_ZOOM_REDRAW, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, KiBitmap( zoom_redraw_xpm ), msg ); m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, KiScaledBitmap( zoom_redraw_xpm, this ), msg );
msg = AddHotkeyName( HELP_ZOOM_IN, g_Libedit_Hokeys_Descr, HK_ZOOM_IN, IS_COMMENT ); msg = AddHotkeyName( HELP_ZOOM_IN, g_Libedit_Hokeys_Descr, HK_ZOOM_IN, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiBitmap( zoom_in_xpm ), msg ); m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiScaledBitmap( zoom_in_xpm, this ), msg );
msg = AddHotkeyName( HELP_ZOOM_OUT, g_Libedit_Hokeys_Descr, HK_ZOOM_OUT, IS_COMMENT ); msg = AddHotkeyName( HELP_ZOOM_OUT, g_Libedit_Hokeys_Descr, HK_ZOOM_OUT, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiBitmap( zoom_out_xpm ), msg ); m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiScaledBitmap( zoom_out_xpm, this ), msg );
msg = AddHotkeyName( HELP_ZOOM_FIT, g_Libedit_Hokeys_Descr, HK_ZOOM_AUTO, IS_COMMENT ); msg = AddHotkeyName( HELP_ZOOM_FIT, g_Libedit_Hokeys_Descr, HK_ZOOM_AUTO, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, KiBitmap( zoom_fit_in_page_xpm ), msg ); m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, KiScaledBitmap( zoom_fit_in_page_xpm, this ), msg );
m_mainToolBar->AddTool( ID_ZOOM_SELECTION, wxEmptyString, KiBitmap( zoom_area_xpm ), m_mainToolBar->AddTool( ID_ZOOM_SELECTION, wxEmptyString, KiScaledBitmap( zoom_area_xpm, this ),
_( "Zoom to selection" ), wxITEM_CHECK ); _( "Zoom to selection" ), wxITEM_CHECK );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_DE_MORGAN_NORMAL_BUTT, wxEmptyString, KiBitmap( morgan1_xpm ),
m_mainToolBar->AddTool( ID_DE_MORGAN_NORMAL_BUTT, wxEmptyString, KiScaledBitmap( morgan1_xpm, this ),
_( "Show as \"De Morgan\" normal symbol" ), wxITEM_CHECK ); _( "Show as \"De Morgan\" normal symbol" ), wxITEM_CHECK );
m_mainToolBar->AddTool( ID_DE_MORGAN_CONVERT_BUTT, wxEmptyString, KiBitmap( morgan2_xpm ), m_mainToolBar->AddTool( ID_DE_MORGAN_CONVERT_BUTT, wxEmptyString, KiScaledBitmap( morgan2_xpm, this ),
_( "Show as \"De Morgan\" convert symbol" ), wxITEM_CHECK ); _( "Show as \"De Morgan\" convert symbol" ), wxITEM_CHECK );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_LIBEDIT_VIEW_DOC, wxEmptyString, KiBitmap( datasheet_xpm ),
m_mainToolBar->AddTool( ID_LIBEDIT_VIEW_DOC, wxEmptyString, KiScaledBitmap( datasheet_xpm, this ),
_( "Show associated datasheet or document" ) ); _( "Show associated datasheet or document" ) );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
m_partSelectBox = new wxComboBox( m_mainToolBar, m_partSelectBox = new wxComboBox( m_mainToolBar,
ID_LIBEDIT_SELECT_PART_NUMBER, ID_LIBEDIT_SELECT_PART_NUMBER,
wxEmptyString, wxEmptyString,
wxDefaultPosition, wxDefaultPosition,
wxSize( LISTBOX_WIDTH, -1 ), wxSize( LISTBOX_WIDTH, -1 ),
0, NULL, wxCB_READONLY ); 0, nullptr, wxCB_READONLY );
m_mainToolBar->AddControl( m_partSelectBox ); m_mainToolBar->AddControl( m_partSelectBox );
m_aliasSelectBox = new wxComboBox( m_mainToolBar, m_aliasSelectBox = new wxComboBox( m_mainToolBar,
@ -195,19 +200,20 @@ void LIB_EDIT_FRAME::ReCreateHToolbar()
wxEmptyString, wxEmptyString,
wxDefaultPosition, wxDefaultPosition,
wxSize( LISTBOX_WIDTH, -1 ), wxSize( LISTBOX_WIDTH, -1 ),
0, NULL, wxCB_READONLY ); 0, nullptr, wxCB_READONLY );
m_mainToolBar->AddControl( m_aliasSelectBox ); m_mainToolBar->AddControl( m_aliasSelectBox );
m_mainToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
KiScaledSeparator( m_mainToolBar, this );
msg = _( "Allows disabling pin edition coupling between units.\n" msg = _( "Allows disabling pin edition coupling between units.\n"
"When not disabled, adding, deleting and moving pins are synchronized\n" "When not disabled, adding, deleting and moving pins are synchronized\n"
"between units for pins at the same location.\n" "between units for pins at the same location.\n"
"For instance, adding a pin to a unit also add a similar pin to other units at the same location.\n" "For instance, adding a pin to a unit also add a similar pin to other units at the same location.\n"
"However, pins can have a different number or size because they are specific to a unit.\n" "However, pins can have a different number or size because they are specific to a unit.\n"
"Usually synchronization is enabled when units are interchangeable and disabled if not." ); "Usually synchronization is enabled when units are interchangeable and disabled if not." );
m_mainToolBar->AddTool( ID_LIBEDIT_EDIT_PIN_BY_PIN, wxEmptyString, KiBitmap( pin2pin_xpm ), m_mainToolBar->AddTool( ID_LIBEDIT_EDIT_PIN_BY_PIN, wxEmptyString, KiScaledBitmap( pin2pin_xpm, this ),
msg, wxITEM_CHECK ); msg, wxITEM_CHECK );
m_mainToolBar->AddTool( ID_LIBEDIT_EDIT_PIN_BY_TABLE, wxEmptyString, KiBitmap( pin_table_xpm ), m_mainToolBar->AddTool( ID_LIBEDIT_EDIT_PIN_BY_TABLE, wxEmptyString, KiScaledBitmap( pin_table_xpm, this ),
_( "Show pin table" ) ); _( "Show pin table" ) );
// after adding the buttons to the toolbar, must call Realize() to reflect the changes // after adding the buttons to the toolbar, must call Realize() to reflect the changes
@ -215,37 +221,37 @@ void LIB_EDIT_FRAME::ReCreateHToolbar()
} }
void LIB_EDIT_FRAME::CreateOptionToolbar() void LIB_EDIT_FRAME::ReCreateOptToolbar()
{ {
if( m_optionsToolBar ) if( m_optionsToolBar )
return; m_optionsToolBar->Clear();
else
m_optionsToolBar = new wxAuiToolBar( this, ID_OPT_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
m_optionsToolBar = new wxAuiToolBar( this, ID_OPT_TOOLBAR, wxDefaultPosition, wxDefaultSize, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString, KiScaledBitmap( grid_xpm, this ),
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString, KiBitmap( grid_xpm ),
_( "Turn grid off" ), wxITEM_CHECK ); _( "Turn grid off" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, wxEmptyString,
KiBitmap( unit_inch_xpm ), _( "Set units to inches" ), KiScaledBitmap( unit_inch_xpm, this ), _( "Set units to inches" ),
wxITEM_CHECK ); wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_MM, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_MM, wxEmptyString,
KiBitmap( unit_mm_xpm ), KiScaledBitmap( unit_mm_xpm, this ),
_( "Set units to millimeters" ), wxITEM_CHECK ); _( "Set units to millimeters" ), wxITEM_CHECK );
#ifndef __APPLE__ #ifndef __APPLE__
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString,
KiBitmap( cursor_shape_xpm ), KiScaledBitmap( cursor_shape_xpm, this ),
_( "Change cursor shape" ), wxITEM_CHECK ); _( "Change cursor shape" ), wxITEM_CHECK );
#endif // !__APPLE__ #endif // !__APPLE__
m_optionsToolBar->AddTool( ID_LIBEDIT_SHOW_ELECTRICAL_TYPE, wxEmptyString, m_optionsToolBar->AddTool( ID_LIBEDIT_SHOW_ELECTRICAL_TYPE, wxEmptyString,
KiBitmap( pin_show_etype_xpm ), KiScaledBitmap( pin_show_etype_xpm, this ),
_( "Show pins electrical type" ), wxITEM_CHECK ); _( "Show pins electrical type" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_LIBEDIT_SHOW_HIDE_SEARCH_TREE, wxEmptyString, m_optionsToolBar->AddTool( ID_LIBEDIT_SHOW_HIDE_SEARCH_TREE, wxEmptyString,
KiBitmap( search_tree_xpm ), KiScaledBitmap( search_tree_xpm, this ),
_( "Toggles the search tree" ), wxITEM_CHECK ); _( "Toggles the search tree" ), wxITEM_CHECK );
m_optionsToolBar->Realize(); m_optionsToolBar->Realize();

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008-2017 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2008-2017 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2017 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2004-2018 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
@ -44,133 +44,140 @@
*/ */
void SCH_EDIT_FRAME::ReCreateHToolbar() void SCH_EDIT_FRAME::ReCreateHToolbar()
{ {
if( m_mainToolBar != NULL ) if( m_mainToolBar )
return; m_mainToolBar->Clear();
else
m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
wxString msg; wxString msg;
m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
// Set up toolbar // Set up toolbar
if( Kiface().IsSingle() ) // not when under a project mgr if( Kiface().IsSingle() ) // not when under a project mgr
{ {
// These 2 menus have meaning only outside a project, i.e. not under a project manager: // These 2 menus have meaning only outside a project, i.e. not under a project manager:
m_mainToolBar->AddTool( ID_NEW_PROJECT, wxEmptyString, KiBitmap( new_generic_xpm ), m_mainToolBar->AddTool( ID_NEW_PROJECT, wxEmptyString,
KiScaledBitmap( new_generic_xpm, this ),
_( "New schematic project" ) ); _( "New schematic project" ) );
m_mainToolBar->AddTool( ID_LOAD_PROJECT, wxEmptyString, KiBitmap( open_document_xpm ), m_mainToolBar->AddTool( ID_LOAD_PROJECT, wxEmptyString,
KiScaledBitmap( open_document_xpm, this ),
_( "Open schematic project" ) ); _( "Open schematic project" ) );
} }
m_mainToolBar->AddTool( ID_SAVE_PROJECT, wxEmptyString, KiBitmap( save_project_xpm ), m_mainToolBar->AddTool( ID_SAVE_PROJECT, wxEmptyString,
KiScaledBitmap( save_project_xpm, this ),
_( "Save schematic project" ) ); _( "Save schematic project" ) );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_SHEET_SET, wxEmptyString, KiBitmap( sheetset_xpm ), m_mainToolBar->AddTool( ID_SHEET_SET, wxEmptyString, KiScaledBitmap( sheetset_xpm, this ),
_( "Edit Page settings" ) ); _( "Edit Page settings" ) );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( wxID_PRINT, wxEmptyString, KiBitmap( print_button_xpm ), m_mainToolBar->AddTool( wxID_PRINT, wxEmptyString, KiScaledBitmap( print_button_xpm, this ),
_( "Print schematic" ) ); _( "Print schematic" ) );
m_mainToolBar->AddTool( ID_GEN_PLOT_SCHEMATIC, wxEmptyString, KiBitmap( plot_xpm ), m_mainToolBar->AddTool( ID_GEN_PLOT_SCHEMATIC, wxEmptyString, KiScaledBitmap( plot_xpm, this ),
_( "Plot schematic" ) ); _( "Plot schematic" ) );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( wxID_PASTE, wxEmptyString, KiBitmap( paste_xpm ), m_mainToolBar->AddTool( wxID_PASTE, wxEmptyString, KiScaledBitmap( paste_xpm, this ),
_( "Paste" ) ); _( "Paste" ) );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
msg = AddHotkeyName( HELP_UNDO, g_Schematic_Hokeys_Descr, HK_UNDO, IS_COMMENT ); msg = AddHotkeyName( HELP_UNDO, g_Schematic_Hokeys_Descr, HK_UNDO, IS_COMMENT );
m_mainToolBar->AddTool( wxID_UNDO, wxEmptyString, KiBitmap( undo_xpm ), msg ); m_mainToolBar->AddTool( wxID_UNDO, wxEmptyString, KiScaledBitmap( undo_xpm, this ), msg );
msg = AddHotkeyName( HELP_REDO, g_Schematic_Hokeys_Descr, HK_REDO, IS_COMMENT ); msg = AddHotkeyName( HELP_REDO, g_Schematic_Hokeys_Descr, HK_REDO, IS_COMMENT );
m_mainToolBar->AddTool( wxID_REDO, wxEmptyString, KiBitmap( redo_xpm ), msg ); m_mainToolBar->AddTool( wxID_REDO, wxEmptyString, KiScaledBitmap( redo_xpm, this ), msg );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
msg = AddHotkeyName( HELP_FIND, g_Schematic_Hokeys_Descr, HK_FIND_ITEM, IS_COMMENT ); msg = AddHotkeyName( HELP_FIND, g_Schematic_Hokeys_Descr, HK_FIND_ITEM, IS_COMMENT );
m_mainToolBar->AddTool( ID_FIND_ITEMS, wxEmptyString, KiBitmap( find_xpm ), msg ); m_mainToolBar->AddTool( ID_FIND_ITEMS, wxEmptyString, KiScaledBitmap( find_xpm, this ), msg );
m_mainToolBar->AddTool( wxID_REPLACE, wxEmptyString, KiBitmap( find_replace_xpm ), m_mainToolBar->AddTool( wxID_REPLACE, wxEmptyString, KiScaledBitmap( find_replace_xpm, this ),
wxNullBitmap, wxITEM_NORMAL, _( "Find and replace text" ), wxNullBitmap, wxITEM_NORMAL, _( "Find and replace text" ),
HELP_REPLACE, NULL ); HELP_REPLACE, nullptr );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
msg = AddHotkeyName( HELP_ZOOM_REDRAW, g_Schematic_Hokeys_Descr, HK_ZOOM_REDRAW, IS_COMMENT ); msg = AddHotkeyName( HELP_ZOOM_REDRAW, g_Schematic_Hokeys_Descr, HK_ZOOM_REDRAW, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, KiBitmap( zoom_redraw_xpm ), msg ); m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
KiScaledBitmap( zoom_redraw_xpm, this ), msg );
msg = AddHotkeyName( HELP_ZOOM_IN, g_Schematic_Hokeys_Descr, HK_ZOOM_IN, IS_COMMENT ); msg = AddHotkeyName( HELP_ZOOM_IN, g_Schematic_Hokeys_Descr, HK_ZOOM_IN, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiBitmap( zoom_in_xpm ), msg ); m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiScaledBitmap( zoom_in_xpm, this ), msg );
msg = AddHotkeyName( HELP_ZOOM_OUT, g_Schematic_Hokeys_Descr, HK_ZOOM_OUT, IS_COMMENT ); msg = AddHotkeyName( HELP_ZOOM_OUT, g_Schematic_Hokeys_Descr, HK_ZOOM_OUT, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiBitmap( zoom_out_xpm ), msg ); m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiScaledBitmap( zoom_out_xpm, this ), msg );
msg = AddHotkeyName( HELP_ZOOM_FIT, g_Schematic_Hokeys_Descr, HK_ZOOM_AUTO, IS_COMMENT ); msg = AddHotkeyName( HELP_ZOOM_FIT, g_Schematic_Hokeys_Descr, HK_ZOOM_AUTO, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, KiBitmap( zoom_fit_in_page_xpm ), msg ); m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
KiScaledBitmap( zoom_fit_in_page_xpm, this ), msg );
m_mainToolBar->AddTool( ID_ZOOM_SELECTION, wxEmptyString, KiBitmap( zoom_area_xpm ), m_mainToolBar->AddTool( ID_ZOOM_SELECTION, wxEmptyString, KiScaledBitmap( zoom_area_xpm, this ),
_( "Zoom to selection" ), wxITEM_CHECK ); _( "Zoom to selection" ), wxITEM_CHECK );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_HIERARCHY, wxEmptyString, KiBitmap( hierarchy_nav_xpm ), m_mainToolBar->AddTool( ID_HIERARCHY, wxEmptyString, KiScaledBitmap( hierarchy_nav_xpm, this ),
_( "Navigate schematic hierarchy" ) ); _( "Navigate schematic hierarchy" ) );
m_mainToolBar->AddTool( ID_POPUP_SCH_LEAVE_SHEET, wxEmptyString, KiBitmap( leave_sheet_xpm ), m_mainToolBar->AddTool( ID_POPUP_SCH_LEAVE_SHEET, wxEmptyString,
_( "Leave sheet" ) ); KiScaledBitmap( leave_sheet_xpm, this ), _( "Leave sheet" ) );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_RUN_LIBRARY, wxEmptyString, KiBitmap( libedit_xpm ), m_mainToolBar->AddTool( ID_RUN_LIBRARY, wxEmptyString, KiScaledBitmap( libedit_xpm, this ),
HELP_RUN_LIB_EDITOR ); HELP_RUN_LIB_EDITOR );
m_mainToolBar->AddTool( ID_TO_LIBVIEW, wxEmptyString, KiBitmap( library_browse_xpm ), m_mainToolBar->AddTool( ID_TO_LIBVIEW, wxEmptyString,
HELP_RUN_LIB_VIEWER ); KiScaledBitmap( library_browse_xpm, this ), HELP_RUN_LIB_VIEWER );
// modedit is with libedit in a "library section" because the user must have footprints before // modedit is with libedit in a "library section" because the user must have footprints before
// they can be assigned. // they can be assigned.
m_mainToolBar->AddTool( ID_RUN_PCB_MODULE_EDITOR, wxEmptyString, KiBitmap( module_editor_xpm ), m_mainToolBar->AddTool( ID_RUN_PCB_MODULE_EDITOR, wxEmptyString,
KiScaledBitmap( module_editor_xpm, this ),
_( "Footprint Editor - Create/edit footprints" ) ); _( "Footprint Editor - Create/edit footprints" ) );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_GET_ANNOTATE, wxEmptyString, KiBitmap( annotate_xpm ), m_mainToolBar->AddTool( ID_GET_ANNOTATE, wxEmptyString, KiScaledBitmap( annotate_xpm, this ),
HELP_ANNOTATE ); HELP_ANNOTATE );
m_mainToolBar->AddTool( ID_GET_ERC, wxEmptyString, KiBitmap( erc_xpm ), m_mainToolBar->AddTool( ID_GET_ERC, wxEmptyString, KiScaledBitmap( erc_xpm, this ),
_( "Perform electrical rules check" ) ); _( "Perform electrical rules check" ) );
m_mainToolBar->AddTool( ID_RUN_CVPCB, wxEmptyString, KiBitmap( cvpcb_xpm ), m_mainToolBar->AddTool( ID_RUN_CVPCB, wxEmptyString, KiScaledBitmap( cvpcb_xpm, this ),
_( "Run CvPcb to associate footprints to symbols" ) ); _( "Run CvPcb to associate footprints to symbols" ) );
m_mainToolBar->AddTool( ID_GET_NETLIST, wxEmptyString, KiBitmap( netlist_xpm ), m_mainToolBar->AddTool( ID_GET_NETLIST, wxEmptyString, KiScaledBitmap( netlist_xpm, this ),
_( "Generate netlist" ) ); _( "Generate netlist" ) );
m_mainToolBar->AddTool( ID_OPEN_CMP_TABLE, wxEmptyString, KiBitmap( spreadsheet_xpm ), m_mainToolBar->AddTool( ID_OPEN_CMP_TABLE, wxEmptyString,
_( "Edit symbol fields" ) ); KiScaledBitmap( spreadsheet_xpm, this ), _( "Edit symbol fields" ) );
m_mainToolBar->AddTool( ID_GET_TOOLS, wxEmptyString, KiBitmap( bom_xpm ), m_mainToolBar->AddTool( ID_GET_TOOLS, wxEmptyString, KiScaledBitmap( bom_xpm, this ),
HELP_GENERATE_BOM ); HELP_GENERATE_BOM );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_RUN_PCB, wxEmptyString, KiBitmap( pcbnew_xpm ), m_mainToolBar->AddTool( ID_RUN_PCB, wxEmptyString, KiScaledBitmap( pcbnew_xpm, this ),
_( "Run Pcbnew to layout printed circuit board" ) ); _( "Run Pcbnew to layout printed circuit board" ) );
m_mainToolBar->AddTool( ID_BACKANNO_ITEMS, wxEmptyString, m_mainToolBar->AddTool( ID_BACKANNO_ITEMS, wxEmptyString,
KiBitmap( import_footprint_names_xpm ), KiScaledBitmap( import_footprint_names_xpm, this ),
HELP_IMPORT_FOOTPRINTS ); HELP_IMPORT_FOOTPRINTS );
// after adding the tools to the toolbar, must call Realize() to reflect the changes // after adding the tools to the toolbar, must call Realize() to reflect the changes
@ -183,76 +190,83 @@ void SCH_EDIT_FRAME::ReCreateHToolbar()
void SCH_EDIT_FRAME::ReCreateVToolbar() void SCH_EDIT_FRAME::ReCreateVToolbar()
{ {
if( m_drawToolBar ) if( m_drawToolBar )
return; m_drawToolBar->Clear();
else
m_drawToolBar = new wxAuiToolBar( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize, m_drawToolBar = new wxAuiToolBar( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL ); KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
// Set up toolbar // Set up toolbar
m_drawToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, KiBitmap( cursor_xpm ), m_drawToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, KiScaledBitmap( cursor_xpm, this ),
wxEmptyString, wxITEM_CHECK ); wxEmptyString, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_HIGHLIGHT, wxEmptyString, KiBitmap( net_highlight_schematic_xpm ), m_drawToolBar->AddTool( ID_HIGHLIGHT, wxEmptyString,
KiScaledBitmap( net_highlight_schematic_xpm, this ),
_( "Highlight net" ), wxITEM_CHECK ); _( "Highlight net" ), wxITEM_CHECK );
m_drawToolBar->AddTool( ID_SCH_PLACE_COMPONENT, wxEmptyString, KiBitmap( add_component_xpm ), m_drawToolBar->AddTool( ID_SCH_PLACE_COMPONENT, wxEmptyString,
HELP_PLACE_COMPONENTS, wxITEM_CHECK ); KiScaledBitmap( add_component_xpm, this ), HELP_PLACE_COMPONENTS,
wxITEM_CHECK );
m_drawToolBar->AddTool( ID_PLACE_POWER_BUTT, wxEmptyString, KiBitmap( add_power_xpm ), m_drawToolBar->AddTool( ID_PLACE_POWER_BUTT, wxEmptyString,
KiScaledBitmap( add_power_xpm, this ),
HELP_PLACE_POWERPORT, wxITEM_CHECK ); HELP_PLACE_POWERPORT, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_WIRE_BUTT, wxEmptyString, KiBitmap( add_line_xpm ), m_drawToolBar->AddTool( ID_WIRE_BUTT, wxEmptyString, KiScaledBitmap( add_line_xpm, this ),
HELP_PLACE_WIRE, wxITEM_CHECK ); HELP_PLACE_WIRE, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_BUS_BUTT, wxEmptyString, KiBitmap( add_bus_xpm ), m_drawToolBar->AddTool( ID_BUS_BUTT, wxEmptyString, KiScaledBitmap( add_bus_xpm, this ),
HELP_PLACE_BUS, wxITEM_CHECK ); HELP_PLACE_BUS, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_WIRETOBUS_ENTRY_BUTT, wxEmptyString, KiBitmap( add_line2bus_xpm ), m_drawToolBar->AddTool( ID_WIRETOBUS_ENTRY_BUTT, wxEmptyString,
KiScaledBitmap( add_line2bus_xpm, this ),
HELP_PLACE_WIRE2BUS_ENTRY, wxITEM_CHECK ); HELP_PLACE_WIRE2BUS_ENTRY, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_BUSTOBUS_ENTRY_BUTT, wxEmptyString, KiBitmap( add_bus2bus_xpm ), m_drawToolBar->AddTool( ID_BUSTOBUS_ENTRY_BUTT, wxEmptyString,
KiScaledBitmap( add_bus2bus_xpm, this ),
HELP_PLACE_BUS2BUS_ENTRY, wxITEM_CHECK ); HELP_PLACE_BUS2BUS_ENTRY, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_NOCONN_BUTT, wxEmptyString, KiBitmap( noconn_xpm ), m_drawToolBar->AddTool( ID_NOCONN_BUTT, wxEmptyString, KiScaledBitmap( noconn_xpm, this ),
HELP_PLACE_NC_FLAG, wxITEM_CHECK ); HELP_PLACE_NC_FLAG, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_JUNCTION_BUTT, wxEmptyString, KiBitmap( add_junction_xpm ), m_drawToolBar->AddTool( ID_JUNCTION_BUTT, wxEmptyString,
KiScaledBitmap( add_junction_xpm, this ),
HELP_PLACE_JUNCTION, wxITEM_CHECK ); HELP_PLACE_JUNCTION, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_LABEL_BUTT, wxEmptyString, KiBitmap( add_line_label_xpm ), m_drawToolBar->AddTool( ID_LABEL_BUTT, wxEmptyString,
KiScaledBitmap( add_line_label_xpm, this ),
HELP_PLACE_NETLABEL, wxITEM_CHECK ); HELP_PLACE_NETLABEL, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_GLABEL_BUTT, wxEmptyString, KiBitmap( add_glabel_xpm ), m_drawToolBar->AddTool( ID_GLABEL_BUTT, wxEmptyString, KiScaledBitmap( add_glabel_xpm, this ),
HELP_PLACE_GLOBALLABEL, wxITEM_CHECK ); HELP_PLACE_GLOBALLABEL, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_HIERLABEL_BUTT, wxEmptyString, m_drawToolBar->AddTool( ID_HIERLABEL_BUTT, wxEmptyString,
KiBitmap( add_hierarchical_label_xpm ), KiScaledBitmap( add_hierarchical_label_xpm, this ),
HELP_PLACE_HIER_LABEL, wxITEM_CHECK ); HELP_PLACE_HIER_LABEL, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_SHEET_SYMBOL_BUTT, wxEmptyString, m_drawToolBar->AddTool( ID_SHEET_SYMBOL_BUTT, wxEmptyString,
KiBitmap( add_hierarchical_subsheet_xpm ), KiScaledBitmap( add_hierarchical_subsheet_xpm, this ),
HELP_PLACE_SHEET, wxITEM_CHECK ); HELP_PLACE_SHEET, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_IMPORT_HLABEL_BUTT, wxEmptyString, m_drawToolBar->AddTool( ID_IMPORT_HLABEL_BUTT, wxEmptyString,
KiBitmap( import_hierarchical_label_xpm ), KiScaledBitmap( import_hierarchical_label_xpm, this ),
HELP_IMPORT_SHEETPIN, wxITEM_CHECK ); HELP_IMPORT_SHEETPIN, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_SHEET_PIN_BUTT, wxEmptyString, m_drawToolBar->AddTool( ID_SHEET_PIN_BUTT, wxEmptyString,
KiBitmap( add_hierar_pin_xpm ), KiScaledBitmap( add_hierar_pin_xpm, this ),
HELP_PLACE_SHEETPIN, wxITEM_CHECK ); HELP_PLACE_SHEETPIN, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_LINE_COMMENT_BUTT, wxEmptyString, m_drawToolBar->AddTool( ID_LINE_COMMENT_BUTT, wxEmptyString,
KiBitmap( add_dashed_line_xpm ), KiScaledBitmap( add_dashed_line_xpm, this ),
HELP_PLACE_GRAPHICLINES, wxITEM_CHECK ); HELP_PLACE_GRAPHICLINES, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_TEXT_COMMENT_BUTT, wxEmptyString, KiBitmap( text_xpm ), m_drawToolBar->AddTool( ID_TEXT_COMMENT_BUTT, wxEmptyString, KiScaledBitmap( text_xpm, this ),
HELP_PLACE_GRAPHICTEXTS, wxITEM_CHECK ); HELP_PLACE_GRAPHICTEXTS, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_ADD_IMAGE_BUTT, wxEmptyString, KiBitmap( image_xpm ), m_drawToolBar->AddTool( ID_ADD_IMAGE_BUTT, wxEmptyString, KiScaledBitmap( image_xpm, this ),
_("Add bitmap image"), wxITEM_CHECK ); _("Add bitmap image"), wxITEM_CHECK );
m_drawToolBar->AddTool( ID_SCHEMATIC_DELETE_ITEM_BUTT, wxEmptyString, m_drawToolBar->AddTool( ID_SCHEMATIC_DELETE_ITEM_BUTT, wxEmptyString,
KiBitmap( delete_xpm ), KiScaledBitmap( delete_xpm, this ),
HELP_DELETE_ITEMS, wxITEM_CHECK ); HELP_DELETE_ITEMS, wxITEM_CHECK );
m_drawToolBar->Realize(); m_drawToolBar->Realize();
@ -264,37 +278,37 @@ void SCH_EDIT_FRAME::ReCreateVToolbar()
void SCH_EDIT_FRAME::ReCreateOptToolbar() void SCH_EDIT_FRAME::ReCreateOptToolbar()
{ {
if( m_optionsToolBar ) if( m_optionsToolBar )
return; m_optionsToolBar->Clear();
else
m_optionsToolBar = new wxAuiToolBar( this, ID_OPT_TOOLBAR, wxDefaultPosition, wxDefaultSize, m_optionsToolBar = new wxAuiToolBar( this, ID_OPT_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL ); KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString,
KiBitmap( grid_xpm ), KiScaledBitmap( grid_xpm, this ),
_( "Turn grid off" ), wxITEM_CHECK ); _( "Turn grid off" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, wxEmptyString,
KiBitmap( unit_inch_xpm ), KiScaledBitmap( unit_inch_xpm, this ),
_( "Set unit to inch" ), wxITEM_CHECK ); _( "Set unit to inch" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_MM, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_MM, wxEmptyString,
KiBitmap( unit_mm_xpm ), KiScaledBitmap( unit_mm_xpm, this ),
_( "Set unit to mm" ), wxITEM_CHECK ); _( "Set unit to mm" ), wxITEM_CHECK );
#ifndef __APPLE__ #ifndef __APPLE__
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString,
KiBitmap( cursor_shape_xpm ), KiScaledBitmap( cursor_shape_xpm, this ),
_( "Change cursor shape" ), wxITEM_CHECK ); _( "Change cursor shape" ), wxITEM_CHECK );
#endif // !__APPLE__ #endif // !__APPLE__
//m_optionsToolBar->AddSeparator(); //KiScaledSeparator( m_optionsToolBar, this );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_HIDDEN_PINS, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_HIDDEN_PINS, wxEmptyString,
KiBitmap( hidden_pin_xpm ), KiScaledBitmap( hidden_pin_xpm, this ),
_( "Show hidden pins" ), wxITEM_CHECK ); _( "Show hidden pins" ), wxITEM_CHECK );
//m_optionsToolBar->AddSeparator(); //KiScaledSeparator( m_optionsToolBar, this );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_BUS_WIRES_ORIENT, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_BUS_WIRES_ORIENT, wxEmptyString,
KiBitmap( lines90_xpm ), KiScaledBitmap( lines90_xpm, this ),
_( "HV orientation for wires and bus" ), _( "HV orientation for wires and bus" ),
wxITEM_CHECK ); wxITEM_CHECK );
@ -304,7 +318,7 @@ void SCH_EDIT_FRAME::ReCreateOptToolbar()
void SCH_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) void SCH_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
{ {
if( m_canvas == NULL ) if( m_canvas )
return; return;
int id = event.GetId(); int id = event.GetId();

View File

@ -3,24 +3,20 @@
* *
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com> * Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2004-2018 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2018 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
* modify it under the terms of the GNU General Public License * under the terms of the GNU General Public License as published by the
* as published by the Free Software Foundation; either version 2 * Free Software Foundation, either version 3 of the License, or (at your
* of the License, or (at your option) any later version. * option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful, but
* but WITHOUT ANY WARRANTY; without even the implied warranty of * WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* GNU General Public License for more details. * General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License along
* along with this program; if not, you may find one here: * with this program. If not, see <http://www.gnu.org/licenses/>.
* 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
*/ */
/** /**
@ -47,82 +43,82 @@ void LIB_VIEW_FRAME::ReCreateHToolbar()
wxString msg; wxString msg;
LIB_PART* part = NULL; LIB_PART* part = NULL;
if( m_mainToolBar == NULL ) if( m_mainToolBar )
{ m_mainToolBar->Clear();
else
m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize, m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT ); KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
m_mainToolBar->AddTool( ID_LIBVIEW_SELECT_PART, wxEmptyString, m_mainToolBar->AddTool( ID_LIBVIEW_SELECT_PART, wxEmptyString,
KiBitmap( add_component_xpm ), KiScaledBitmap( add_component_xpm, this ),
_( "Select symbol to browse" ) ); _( "Select symbol to browse" ) );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_LIBVIEW_PREVIOUS, wxEmptyString,
KiScaledBitmap( lib_previous_xpm, this ),
_( "Display previous symbol" ) );
m_mainToolBar->AddTool( ID_LIBVIEW_NEXT, wxEmptyString,
KiScaledBitmap( lib_next_xpm, this ),
_( "Display next symbol" ) );
m_mainToolBar->AddSeparator();
msg = AddHotkeyName( _( "Zoom in" ), g_Viewlib_Hokeys_Descr,
HK_ZOOM_IN, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString,
KiScaledBitmap( zoom_in_xpm, this ), msg );
msg = AddHotkeyName( _( "Zoom out" ), g_Viewlib_Hokeys_Descr,
HK_ZOOM_OUT, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString,
KiScaledBitmap( zoom_out_xpm, this ), msg );
msg = AddHotkeyName( _( "Redraw view" ), g_Viewlib_Hokeys_Descr,
HK_ZOOM_REDRAW, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
KiScaledBitmap( zoom_redraw_xpm, this ), msg );
msg = AddHotkeyName( _( "Zoom auto" ), g_Viewlib_Hokeys_Descr,
HK_ZOOM_AUTO, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
KiScaledBitmap( zoom_fit_in_page_xpm, this ), msg );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, wxEmptyString,
KiScaledBitmap( morgan1_xpm, this ),
_( "Show as \"De Morgan\" normal symbol" ),
wxITEM_CHECK );
m_mainToolBar->AddTool( ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, wxEmptyString,
KiScaledBitmap( morgan2_xpm, this ),
_( "Show as \"De Morgan\" convert symbol" ),
wxITEM_CHECK );
m_mainToolBar->AddSeparator();
m_selpartBox = new wxComboBox( m_mainToolBar, ID_LIBVIEW_SELECT_PART_NUMBER,
wxEmptyString, wxDefaultPosition,
wxSize( 150, -1 ), 0, NULL, wxCB_READONLY );
m_mainToolBar->AddControl( m_selpartBox );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_LIBVIEW_VIEWDOC, wxEmptyString,
KiScaledBitmap( datasheet_xpm, this ),
_( "View symbol documents" ) );
m_mainToolBar->EnableTool( ID_LIBVIEW_VIEWDOC, false );
if( IsModal() )
{
m_mainToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_LIBVIEW_PREVIOUS, wxEmptyString, m_mainToolBar->AddTool( ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC,
KiBitmap( lib_previous_xpm ), wxEmptyString, KiScaledBitmap( export_xpm, this ),
_( "Display previous symbol" ) ); _( "Insert symbol in schematic" ) );
m_mainToolBar->AddTool( ID_LIBVIEW_NEXT, wxEmptyString,
KiBitmap( lib_next_xpm ),
_( "Display next symbol" ) );
m_mainToolBar->AddSeparator();
msg = AddHotkeyName( _( "Zoom in" ), g_Viewlib_Hokeys_Descr,
HK_ZOOM_IN, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString,
KiBitmap( zoom_in_xpm ), msg );
msg = AddHotkeyName( _( "Zoom out" ), g_Viewlib_Hokeys_Descr,
HK_ZOOM_OUT, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString,
KiBitmap( zoom_out_xpm ), msg );
msg = AddHotkeyName( _( "Redraw view" ), g_Viewlib_Hokeys_Descr,
HK_ZOOM_REDRAW, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
KiBitmap( zoom_redraw_xpm ), msg );
msg = AddHotkeyName( _( "Zoom auto" ), g_Viewlib_Hokeys_Descr,
HK_ZOOM_AUTO, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
KiBitmap( zoom_fit_in_page_xpm ), msg );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, wxEmptyString,
KiBitmap( morgan1_xpm ),
_( "Show as \"De Morgan\" normal symbol" ),
wxITEM_CHECK );
m_mainToolBar->AddTool( ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, wxEmptyString,
KiBitmap( morgan2_xpm ),
_( "Show as \"De Morgan\" convert symbol" ),
wxITEM_CHECK );
m_mainToolBar->AddSeparator();
m_selpartBox = new wxComboBox( m_mainToolBar, ID_LIBVIEW_SELECT_PART_NUMBER,
wxEmptyString, wxDefaultPosition,
wxSize( 150, -1 ), 0, NULL, wxCB_READONLY );
m_mainToolBar->AddControl( m_selpartBox );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_LIBVIEW_VIEWDOC, wxEmptyString,
KiBitmap( datasheet_xpm ),
_( "View symbol documents" ) );
m_mainToolBar->EnableTool( ID_LIBVIEW_VIEWDOC, false );
if( IsModal() )
{
m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC,
wxEmptyString, KiBitmap( export_xpm ),
_( "Insert symbol in schematic" ) );
}
// after adding the buttons to the toolbar, must call Realize() to
// reflect the changes
m_mainToolBar->Realize();
} }
// after adding the buttons to the toolbar, must call Realize() to
// reflect the changes
m_mainToolBar->Realize();
if( m_libraryName.size() && m_entryName.size() ) if( m_libraryName.size() && m_entryName.size() )
{ {
if( Prj().SchSymbolLibTable()->HasLibrary( m_libraryName ) ) if( Prj().SchSymbolLibTable()->HasLibrary( m_libraryName ) )

View File

@ -2,24 +2,20 @@
* 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) 2010-2014 Jean-Pierre Charras jp.charras at wanadoo.fr * Copyright (C) 2010-2014 Jean-Pierre Charras jp.charras at wanadoo.fr
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2018 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
* modify it under the terms of the GNU General Public License * under the terms of the GNU General Public License as published by the
* as published by the Free Software Foundation; either version 2 * Free Software Foundation, either version 3 of the License, or (at your
* of the License, or (at your option) any later version. * option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful, but
* but WITHOUT ANY WARRANTY; without even the implied warranty of * WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* GNU General Public License for more details. * General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License along
* along with this program; if not, you may find one here: * with this program. If not, see <http://www.gnu.org/licenses/>.
* 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
*/ */
/** /**
@ -53,12 +49,19 @@ class DIALOG_DISPLAY_OPTIONS : public DIALOG_DISPLAY_OPTIONS_BASE
private: private:
GERBVIEW_FRAME* m_Parent; GERBVIEW_FRAME* m_Parent;
GAL_OPTIONS_PANEL* m_galOptsPanel; GAL_OPTIONS_PANEL* m_galOptsPanel;
int m_last_scale;
public: public:
DIALOG_DISPLAY_OPTIONS( GERBVIEW_FRAME* parent ); DIALOG_DISPLAY_OPTIONS( GERBVIEW_FRAME* parent );
~DIALOG_DISPLAY_OPTIONS() {}; ~DIALOG_DISPLAY_OPTIONS() {};
protected:
void OnScaleSlider( wxScrollEvent& aEvent ) override;
void OnScaleAuto( wxCommandEvent& aEvent ) override;
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
private: private:
void OnOKBUttonClick( wxCommandEvent& event ) override; void OnOKBUttonClick( wxCommandEvent& event ) override;
void OnCancelButtonClick( wxCommandEvent& event ) override; void OnCancelButtonClick( wxCommandEvent& event ) override;
@ -77,9 +80,11 @@ void GERBVIEW_FRAME::InstallGerberOptionsDialog( wxCommandEvent& event )
DIALOG_DISPLAY_OPTIONS::DIALOG_DISPLAY_OPTIONS( GERBVIEW_FRAME *parent) : DIALOG_DISPLAY_OPTIONS::DIALOG_DISPLAY_OPTIONS( GERBVIEW_FRAME *parent) :
DIALOG_DISPLAY_OPTIONS_BASE( parent, wxID_ANY ) DIALOG_DISPLAY_OPTIONS_BASE( parent, wxID_ANY ),
m_last_scale( -1 )
{ {
m_Parent = parent; m_Parent = parent;
m_scaleSlider->SetStep( 25 );
SetFocus(); SetFocus();
initOptDialog( ); initOptDialog( );
@ -139,6 +144,7 @@ void DIALOG_DISPLAY_OPTIONS::initOptDialog( )
void DIALOG_DISPLAY_OPTIONS::OnOKBUttonClick( wxCommandEvent& event ) void DIALOG_DISPLAY_OPTIONS::OnOKBUttonClick( wxCommandEvent& event )
{ {
TransferDataFromWindow();
auto displayOptions = (GBR_DISPLAY_OPTIONS*) m_Parent->GetDisplayOptions(); auto displayOptions = (GBR_DISPLAY_OPTIONS*) m_Parent->GetDisplayOptions();
m_Parent->m_DisplayOptions.m_DisplayPolarCood = m_Parent->m_DisplayOptions.m_DisplayPolarCood =
@ -192,3 +198,56 @@ void DIALOG_DISPLAY_OPTIONS::OnOKBUttonClick( wxCommandEvent& event )
EndModal( 1 ); EndModal( 1 );
} }
bool DIALOG_DISPLAY_OPTIONS::TransferDataToWindow()
{
const auto parent = static_cast<GERBVIEW_FRAME*>( GetParent() );
const int scale_fourths = parent->GetIconScale();
if( scale_fourths <= 0 )
{
m_scaleAuto->SetValue( true );
m_scaleSlider->SetValue( 25 * KiIconScale( parent ) );
}
else
{
m_scaleAuto->SetValue( false );
m_scaleSlider->SetValue( scale_fourths * 25 );
}
return true;
}
bool DIALOG_DISPLAY_OPTIONS::TransferDataFromWindow()
{
const auto parent = static_cast<GERBVIEW_FRAME*>( GetParent() );
const int scale_fourths = m_scaleAuto->GetValue() ? -1 : m_scaleSlider->GetValue() / 25;
if( parent->GetIconScale() != scale_fourths )
parent->SetIconScale( scale_fourths );
return true;
}
void DIALOG_DISPLAY_OPTIONS::OnScaleSlider( wxScrollEvent& aEvent )
{
m_scaleAuto->SetValue( false );
aEvent.Skip();
}
void DIALOG_DISPLAY_OPTIONS::OnScaleAuto( wxCommandEvent& aEvent )
{
if( m_scaleAuto->GetValue() )
{
m_last_scale = m_scaleSlider->GetValue();
m_scaleSlider->SetValue( 25 * KiIconScale( GetParent() ) );
}
else
{
if( m_last_scale >= 0 )
m_scaleSlider->SetValue( m_last_scale );
}
}

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 22 2017) // C++ code generated with wxFormBuilder (version Jan 2 2018)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
@ -56,7 +56,7 @@ DIALOG_DISPLAY_OPTIONS_BASE::DIALOG_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWi
bLeftSizer->Add( m_OptDisplayDCodes, 0, wxALL, 5 ); bLeftSizer->Add( m_OptDisplayDCodes, 0, wxALL, 5 );
m_UpperSizer->Add( bLeftSizer, 0, wxALL|wxEXPAND, 5 ); m_UpperSizer->Add( bLeftSizer, 0, wxEXPAND|wxLEFT|wxRIGHT, 5 );
wxBoxSizer* bRightSizer; wxBoxSizer* bRightSizer;
bRightSizer = new wxBoxSizer( wxVERTICAL ); bRightSizer = new wxBoxSizer( wxVERTICAL );
@ -83,8 +83,43 @@ DIALOG_DISPLAY_OPTIONS_BASE::DIALOG_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWi
bRightSizer->Add( bLeftBottomSizer, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 ); bRightSizer->Add( bLeftBottomSizer, 0, wxBOTTOM|wxEXPAND|wxLEFT|wxRIGHT, 5 );
wxStaticBoxSizer* sbSizer2;
sbSizer2 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("User Interface:") ), wxVERTICAL );
m_UpperSizer->Add( bRightSizer, 0, wxALL|wxEXPAND, 5 ); wxFlexGridSizer* fgSizer1;
fgSizer1 = new wxFlexGridSizer( 0, 3, 0, 0 );
fgSizer1->AddGrowableCol( 1 );
fgSizer1->SetFlexibleDirection( wxBOTH );
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticText1 = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("Icon scale:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1->Wrap( -1 );
fgSizer1->Add( m_staticText1, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_scaleSlider = new STEPPED_SLIDER( sbSizer2->GetStaticBox(), wxID_ANY, 50, 50, 275, wxDefaultPosition, wxDefaultSize, wxSL_AUTOTICKS|wxSL_HORIZONTAL|wxSL_LABELS );
fgSizer1->Add( m_scaleSlider, 0, wxALL|wxEXPAND, 3 );
m_staticText2 = new wxStaticText( sbSizer2->GetStaticBox(), wxID_ANY, _("%"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText2->Wrap( -1 );
fgSizer1->Add( m_staticText2, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
m_scaleAuto = new wxCheckBox( sbSizer2->GetStaticBox(), wxID_ANY, _("Auto"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_scaleAuto, 0, wxALL, 5 );
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
sbSizer2->Add( fgSizer1, 1, wxALL|wxEXPAND, 5 );
bRightSizer->Add( sbSizer2, 1, wxALL|wxEXPAND, 5 );
m_UpperSizer->Add( bRightSizer, 0, wxEXPAND|wxLEFT|wxRIGHT, 5 );
bDialogSizer->Add( m_UpperSizer, 1, wxEXPAND, 5 ); bDialogSizer->Add( m_UpperSizer, 1, wxEXPAND, 5 );
@ -107,6 +142,16 @@ DIALOG_DISPLAY_OPTIONS_BASE::DIALOG_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWi
bDialogSizer->Fit( this ); bDialogSizer->Fit( this );
// Connect Events // Connect Events
m_scaleSlider->Connect( wxEVT_SCROLL_TOP, wxScrollEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnScaleSlider ), NULL, this );
m_scaleSlider->Connect( wxEVT_SCROLL_BOTTOM, wxScrollEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnScaleSlider ), NULL, this );
m_scaleSlider->Connect( wxEVT_SCROLL_LINEUP, wxScrollEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnScaleSlider ), NULL, this );
m_scaleSlider->Connect( wxEVT_SCROLL_LINEDOWN, wxScrollEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnScaleSlider ), NULL, this );
m_scaleSlider->Connect( wxEVT_SCROLL_PAGEUP, wxScrollEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnScaleSlider ), NULL, this );
m_scaleSlider->Connect( wxEVT_SCROLL_PAGEDOWN, wxScrollEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnScaleSlider ), NULL, this );
m_scaleSlider->Connect( wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnScaleSlider ), NULL, this );
m_scaleSlider->Connect( wxEVT_SCROLL_THUMBRELEASE, wxScrollEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnScaleSlider ), NULL, this );
m_scaleSlider->Connect( wxEVT_SCROLL_CHANGED, wxScrollEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnScaleSlider ), NULL, this );
m_scaleAuto->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnScaleAuto ), NULL, this );
m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnCancelButtonClick ), NULL, this ); m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnCancelButtonClick ), NULL, this );
m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnOKBUttonClick ), NULL, this ); m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnOKBUttonClick ), NULL, this );
} }
@ -114,6 +159,16 @@ DIALOG_DISPLAY_OPTIONS_BASE::DIALOG_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWi
DIALOG_DISPLAY_OPTIONS_BASE::~DIALOG_DISPLAY_OPTIONS_BASE() DIALOG_DISPLAY_OPTIONS_BASE::~DIALOG_DISPLAY_OPTIONS_BASE()
{ {
// Disconnect Events // Disconnect Events
m_scaleSlider->Disconnect( wxEVT_SCROLL_TOP, wxScrollEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnScaleSlider ), NULL, this );
m_scaleSlider->Disconnect( wxEVT_SCROLL_BOTTOM, wxScrollEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnScaleSlider ), NULL, this );
m_scaleSlider->Disconnect( wxEVT_SCROLL_LINEUP, wxScrollEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnScaleSlider ), NULL, this );
m_scaleSlider->Disconnect( wxEVT_SCROLL_LINEDOWN, wxScrollEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnScaleSlider ), NULL, this );
m_scaleSlider->Disconnect( wxEVT_SCROLL_PAGEUP, wxScrollEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnScaleSlider ), NULL, this );
m_scaleSlider->Disconnect( wxEVT_SCROLL_PAGEDOWN, wxScrollEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnScaleSlider ), NULL, this );
m_scaleSlider->Disconnect( wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnScaleSlider ), NULL, this );
m_scaleSlider->Disconnect( wxEVT_SCROLL_THUMBRELEASE, wxScrollEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnScaleSlider ), NULL, this );
m_scaleSlider->Disconnect( wxEVT_SCROLL_CHANGED, wxScrollEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnScaleSlider ), NULL, this );
m_scaleAuto->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnScaleAuto ), NULL, this );
m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnCancelButtonClick ), NULL, this ); m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnCancelButtonClick ), NULL, this );
m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnOKBUttonClick ), NULL, this ); m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnOKBUttonClick ), NULL, this );

View File

@ -104,7 +104,7 @@
<property name="permission">protected</property> <property name="permission">protected</property>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property> <property name="flag">wxEXPAND|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1"> <object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property> <property name="minimum_size"></property>
@ -653,7 +653,7 @@
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property> <property name="flag">wxEXPAND|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1"> <object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property> <property name="minimum_size"></property>
@ -941,6 +941,421 @@
</object> </object>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">User Interface:</property>
<property name="minimum_size"></property>
<property name="name">sbSizer2</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxFlexGridSizer" expanded="1">
<property name="cols">3</property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols">1</property>
<property name="growablerows"></property>
<property name="hgap">0</property>
<property name="minimum_size"></property>
<property name="name">fgSizer1</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">none</property>
<property name="rows">0</property>
<property name="vgap">0</property>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticText" 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="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">Icon scale:</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_staticText1</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">; forward_declare</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>
<property name="wrap">-1</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">3</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxSlider" 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="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="maxValue">275</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="minValue">50</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_scaleSlider</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">wxSL_AUTOTICKS|wxSL_HORIZONTAL|wxSL_LABELS</property>
<property name="subclass">STEPPED_SLIDER; widgets/stepped_slider.h; Not forward_declare</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="value">50</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCommandScroll"></event>
<event name="OnCommandScrollBottom"></event>
<event name="OnCommandScrollChanged"></event>
<event name="OnCommandScrollLineDown"></event>
<event name="OnCommandScrollLineUp"></event>
<event name="OnCommandScrollPageDown"></event>
<event name="OnCommandScrollPageUp"></event>
<event name="OnCommandScrollThumbRelease"></event>
<event name="OnCommandScrollThumbTrack"></event>
<event name="OnCommandScrollTop"></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="OnScroll">OnScaleSlider</event>
<event name="OnScrollBottom"></event>
<event name="OnScrollChanged"></event>
<event name="OnScrollLineDown"></event>
<event name="OnScrollLineUp"></event>
<event name="OnScrollPageDown"></event>
<event name="OnScrollPageUp"></event>
<event name="OnScrollThumbRelease"></event>
<event name="OnScrollThumbTrack"></event>
<event name="OnScrollTop"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticText" 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="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">%</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_staticText2</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">; forward_declare</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>
<property name="wrap">-1</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">wxEXPAND</property>
<property name="proportion">1</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</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">Auto</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_scaleAuto</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">; forward_declare</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">OnScaleAuto</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">wxEXPAND</property>
<property name="proportion">1</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
</object>
</object>
</object>
</object>
</object> </object>
</object> </object>
</object> </object>

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 22 2017) // C++ code generated with wxFormBuilder (version Jan 2 2018)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO *NOT* EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
@ -11,6 +11,7 @@
#include <wx/artprov.h> #include <wx/artprov.h>
#include <wx/xrc/xmlres.h> #include <wx/xrc/xmlres.h>
#include <wx/intl.h> #include <wx/intl.h>
#include "widgets/stepped_slider.h"
#include "dialog_shim.h" #include "dialog_shim.h"
#include <wx/string.h> #include <wx/string.h>
#include <wx/radiobox.h> #include <wx/radiobox.h>
@ -21,6 +22,8 @@
#include <wx/checkbox.h> #include <wx/checkbox.h>
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/statbox.h> #include <wx/statbox.h>
#include <wx/stattext.h>
#include <wx/slider.h>
#include <wx/statline.h> #include <wx/statline.h>
#include <wx/button.h> #include <wx/button.h>
#include <wx/dialog.h> #include <wx/dialog.h>
@ -46,12 +49,18 @@ class DIALOG_DISPLAY_OPTIONS_BASE : public DIALOG_SHIM
wxRadioBox* m_ShowPageLimits; wxRadioBox* m_ShowPageLimits;
wxCheckBox* m_OptZoomNoCenter; wxCheckBox* m_OptZoomNoCenter;
wxCheckBox* m_OptMousewheelPan; wxCheckBox* m_OptMousewheelPan;
wxStaticText* m_staticText1;
STEPPED_SLIDER* m_scaleSlider;
wxStaticText* m_staticText2;
wxCheckBox* m_scaleAuto;
wxStaticLine* m_staticline1; wxStaticLine* m_staticline1;
wxStdDialogButtonSizer* m_sdbSizer1; wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK; wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel; wxButton* m_sdbSizer1Cancel;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnScaleSlider( wxScrollEvent& event ) { event.Skip(); }
virtual void OnScaleAuto( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelButtonClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnCancelButtonClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOKBUttonClick( wxCommandEvent& event ) { event.Skip(); } virtual void OnOKBUttonClick( wxCommandEvent& event ) { event.Skip(); }

View File

@ -2,24 +2,20 @@
* 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) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2018 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
* modify it under the terms of the GNU General Public License * under the terms of the GNU General Public License as published by the
* as published by the Free Software Foundation; either version 2 * Free Software Foundation, either version 3 of the License, or (at your
* of the License, or (at your option) any later version. * option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful, but
* but WITHOUT ANY WARRANTY; without even the implied warranty of * WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* GNU General Public License for more details. * General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License along
* along with this program; if not, you may find one here: * with this program. If not, see <http://www.gnu.org/licenses/>.
* 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
*/ */
/** /**
@ -63,7 +59,7 @@ static const wxString cfgShowPageSizeOption( wxT( "PageSizeOpt" ) );
static const wxString cfgShowDCodes( wxT( "ShowDCodesOpt" ) ); static const wxString cfgShowDCodes( wxT( "ShowDCodesOpt" ) );
static const wxString cfgShowNegativeObjects( wxT( "ShowNegativeObjectsOpt" ) ); static const wxString cfgShowNegativeObjects( wxT( "ShowNegativeObjectsOpt" ) );
static const wxString cfgShowBorderAndTitleBlock( wxT( "ShowBorderAndTitleBlock" ) ); static const wxString cfgShowBorderAndTitleBlock( wxT( "ShowBorderAndTitleBlock" ) );
static const wxString IconScaleEntry = "GvIconScale";
// Colors for layers and items // Colors for layers and items
COLORS_DESIGN_SETTINGS g_ColorsSettings( FRAME_GERBER ); COLORS_DESIGN_SETTINGS g_ColorsSettings( FRAME_GERBER );
@ -1147,3 +1143,22 @@ void GERBVIEW_FRAME::setupTools()
m_toolManager->InvokeTool( "gerbview.InteractiveSelection" ); m_toolManager->InvokeTool( "gerbview.InteractiveSelection" );
} }
int GERBVIEW_FRAME::GetIconScale()
{
int scale = 0;
Kiface().KifaceSettings()->Read( IconScaleEntry, &scale, 0 );
return scale;
}
void GERBVIEW_FRAME::SetIconScale( int aScale )
{
Kiface().KifaceSettings()->Write( IconScaleEntry, aScale );
ReCreateMenuBar();
ReCreateHToolbar();
ReCreateOptToolbar();
ReCreateAuxiliaryToolbar();
Layout();
SendSizeEvent();
}

View File

@ -3,24 +3,20 @@
* *
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2013 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2018 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
* modify it under the terms of the GNU General Public License * under the terms of the GNU General Public License as published by the
* as published by the Free Software Foundation; either version 2 * Free Software Foundation, either version 3 of the License, or (at your
* of the License, or (at your option) any later version. * option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful, but
* but WITHOUT ANY WARRANTY; without even the implied warranty of * WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* GNU General Public License for more details. * General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License along
* along with this program; if not, you may find one here: * with this program. If not, see <http://www.gnu.org/licenses/>.
* 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
*/ */
/** /**
@ -745,6 +741,9 @@ public:
*/ */
void OnUpdateSwitchCanvas( wxUpdateUIEvent& aEvent ); void OnUpdateSwitchCanvas( wxUpdateUIEvent& aEvent );
int GetIconScale() override;
void SetIconScale( int aScale ) override;
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };

View File

@ -3,24 +3,20 @@
* *
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2013 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2018 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
* modify it under the terms of the GNU General Public License * under the terms of the GNU General Public License as published by the
* as published by the Free Software Foundation; either version 2 * Free Software Foundation, either version 3 of the License, or (at your
* of the License, or (at your option) any later version. * option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful, but
* but WITHOUT ANY WARRANTY; without even the implied warranty of * WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* GNU General Public License for more details. * General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License along
* along with this program; if not, you may find one here: * with this program. If not, see <http://www.gnu.org/licenses/>.
* 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
*/ */
/** /**
@ -49,49 +45,49 @@ void GERBVIEW_FRAME::ReCreateHToolbar( void )
{ {
wxString msg; wxString msg;
if( m_mainToolBar != NULL ) if( m_mainToolBar )
return; m_mainToolBar->Clear();
else
m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize, m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT ); KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
// Set up toolbar // Set up toolbar
m_mainToolBar->AddTool( ID_GERBVIEW_ERASE_ALL, wxEmptyString, m_mainToolBar->AddTool( ID_GERBVIEW_ERASE_ALL, wxEmptyString,
KiBitmap( gerbview_clear_layers_xpm ), KiScaledBitmap( gerbview_clear_layers_xpm, this ),
_( "Erase all layers" ) ); _( "Erase all layers" ) );
m_mainToolBar->AddTool( wxID_FILE, wxEmptyString, KiBitmap( gerber_file_xpm ), m_mainToolBar->AddTool( wxID_FILE, wxEmptyString, KiScaledBitmap( gerber_file_xpm, this ),
_( "Load a new Gerber file on the current layer. Previous data will be deleted" ) ); _( "Load a new Gerber file on the current layer. Previous data will be deleted" ) );
m_mainToolBar->AddTool( ID_GERBVIEW_LOAD_DRILL_FILE, wxEmptyString, m_mainToolBar->AddTool( ID_GERBVIEW_LOAD_DRILL_FILE, wxEmptyString,
KiBitmap( gerbview_drill_file_xpm ), KiScaledBitmap( gerbview_drill_file_xpm, this ),
_( "Load an excellon drill file on the current layer. Previous data will be deleted" ) ); _( "Load an excellon drill file on the current layer. Previous data will be deleted" ) );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_GERBVIEW_SET_PAGE_BORDER, wxEmptyString, KiBitmap( sheetset_xpm ), m_mainToolBar->AddTool( ID_GERBVIEW_SET_PAGE_BORDER, wxEmptyString, KiScaledBitmap( sheetset_xpm, this ),
_( "Show/hide frame reference and select paper size for printing" ) ); _( "Show/hide frame reference and select paper size for printing" ) );
m_mainToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( wxID_PRINT, wxEmptyString, KiBitmap( print_button_xpm ), m_mainToolBar->AddTool( wxID_PRINT, wxEmptyString, KiScaledBitmap( print_button_xpm, this ),
_( "Print layers" ) ); _( "Print layers" ) );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
msg = AddHotkeyName( _( "Redraw view" ), GerbviewHokeysDescr, HK_ZOOM_REDRAW, IS_COMMENT ); msg = AddHotkeyName( _( "Redraw view" ), GerbviewHokeysDescr, HK_ZOOM_REDRAW, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, KiBitmap( zoom_redraw_xpm ), msg ); m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, KiScaledBitmap( zoom_redraw_xpm, this ), msg );
msg = AddHotkeyName( _( "Zoom in" ), GerbviewHokeysDescr, HK_ZOOM_IN, IS_COMMENT ); msg = AddHotkeyName( _( "Zoom in" ), GerbviewHokeysDescr, HK_ZOOM_IN, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiBitmap( zoom_in_xpm ), msg ); m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiScaledBitmap( zoom_in_xpm, this ), msg );
msg = AddHotkeyName( _( "Zoom out" ), GerbviewHokeysDescr, HK_ZOOM_OUT, IS_COMMENT ); msg = AddHotkeyName( _( "Zoom out" ), GerbviewHokeysDescr, HK_ZOOM_OUT, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiBitmap( zoom_out_xpm ), msg ); m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiScaledBitmap( zoom_out_xpm, this ), msg );
msg = AddHotkeyName( _( "Zoom auto" ), GerbviewHokeysDescr, HK_ZOOM_AUTO, IS_COMMENT ); msg = AddHotkeyName( _( "Zoom auto" ), GerbviewHokeysDescr, HK_ZOOM_AUTO, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, KiBitmap( zoom_fit_in_page_xpm ), msg ); m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, KiScaledBitmap( zoom_fit_in_page_xpm, this ), msg );
m_mainToolBar->AddTool( ID_ZOOM_SELECTION, wxEmptyString, KiBitmap( zoom_area_xpm ), m_mainToolBar->AddTool( ID_ZOOM_SELECTION, wxEmptyString, KiScaledBitmap( zoom_area_xpm, this ),
_( "Zoom to selection" ), wxITEM_CHECK ); _( "Zoom to selection" ), wxITEM_CHECK );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
m_SelLayerBox = new GBR_LAYER_BOX_SELECTOR( m_mainToolBar, m_SelLayerBox = new GBR_LAYER_BOX_SELECTOR( m_mainToolBar,
ID_TOOLBARH_GERBVIEW_SELECT_ACTIVE_LAYER, ID_TOOLBARH_GERBVIEW_SELECT_ACTIVE_LAYER,
@ -108,10 +104,12 @@ void GERBVIEW_FRAME::ReCreateHToolbar( void )
m_mainToolBar->Realize(); m_mainToolBar->Realize();
} }
void GERBVIEW_FRAME::ReCreateAuxiliaryToolbar() void GERBVIEW_FRAME::ReCreateAuxiliaryToolbar()
{ {
wxWindowUpdateLocker dummy( this ); wxWindowUpdateLocker dummy( this );
#if 0
if( m_auxiliaryToolBar ) if( m_auxiliaryToolBar )
{ {
updateComponentListSelectBox(); updateComponentListSelectBox();
@ -140,9 +138,13 @@ void GERBVIEW_FRAME::ReCreateAuxiliaryToolbar()
m_auimgr.Update(); m_auimgr.Update();
return; return;
} }
#endif
m_auxiliaryToolBar = new wxAuiToolBar( this, ID_AUX_TOOLBAR, wxDefaultPosition, wxDefaultSize, if( m_auxiliaryToolBar )
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT ); m_auxiliaryToolBar->Clear();
else
m_auxiliaryToolBar = new wxAuiToolBar( this, ID_AUX_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
// Creates box to display and choose components: // Creates box to display and choose components:
wxStaticText* text = new wxStaticText( m_auxiliaryToolBar, wxID_ANY, _("Cmp:") ); wxStaticText* text = new wxStaticText( m_auxiliaryToolBar, wxID_ANY, _("Cmp:") );
@ -152,7 +154,7 @@ void GERBVIEW_FRAME::ReCreateAuxiliaryToolbar()
m_SelComponentBox->SetToolTip( _("Select a component and highlight items belonging to this component") ); m_SelComponentBox->SetToolTip( _("Select a component and highlight items belonging to this component") );
updateComponentListSelectBox(); updateComponentListSelectBox();
m_auxiliaryToolBar->AddControl( m_SelComponentBox ); m_auxiliaryToolBar->AddControl( m_SelComponentBox );
m_auxiliaryToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
// Creates choice box to display net names and highlight selected: // Creates choice box to display net names and highlight selected:
text = new wxStaticText( m_auxiliaryToolBar, wxID_ANY, _("Net:") ); text = new wxStaticText( m_auxiliaryToolBar, wxID_ANY, _("Net:") );
@ -162,7 +164,7 @@ void GERBVIEW_FRAME::ReCreateAuxiliaryToolbar()
m_SelNetnameBox->SetToolTip( _("Select a net name and highlight graphic items belonging to this net") ); m_SelNetnameBox->SetToolTip( _("Select a net name and highlight graphic items belonging to this net") );
m_auxiliaryToolBar->AddControl( m_SelNetnameBox ); m_auxiliaryToolBar->AddControl( m_SelNetnameBox );
updateNetnameListSelectBox(); updateNetnameListSelectBox();
m_auxiliaryToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
// Creates choice box to display aperture attributes and highlight selected: // Creates choice box to display aperture attributes and highlight selected:
text = new wxStaticText( m_auxiliaryToolBar, wxID_ANY, _("Attr:") ); text = new wxStaticText( m_auxiliaryToolBar, wxID_ANY, _("Attr:") );
@ -173,7 +175,7 @@ void GERBVIEW_FRAME::ReCreateAuxiliaryToolbar()
m_auxiliaryToolBar->AddControl( m_SelAperAttributesBox ); m_auxiliaryToolBar->AddControl( m_SelAperAttributesBox );
updateAperAttributesSelectBox(); updateAperAttributesSelectBox();
m_auxiliaryToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
text = new wxStaticText( m_auxiliaryToolBar, wxID_ANY, _("DCode:") ); text = new wxStaticText( m_auxiliaryToolBar, wxID_ANY, _("DCode:") );
m_auxiliaryToolBar->AddControl( text ); m_auxiliaryToolBar->AddControl( text );
m_DCodeSelector = new DCODE_SELECTION_BOX( m_auxiliaryToolBar, m_DCodeSelector = new DCODE_SELECTION_BOX( m_auxiliaryToolBar,
@ -196,8 +198,8 @@ void GERBVIEW_FRAME::ReCreateVToolbar( void )
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL ); KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
// Set up toolbar // Set up toolbar
m_drawToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, KiBitmap( cursor_xpm ) ); m_drawToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, KiScaledBitmap( cursor_xpm, this ) );
m_drawToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
m_drawToolBar->Realize(); m_drawToolBar->Realize();
} }
@ -214,79 +216,79 @@ void GERBVIEW_FRAME::ReCreateOptToolbar( void )
// TODO: these can be moved to the 'proper' vertical toolbar if and when there are // TODO: these can be moved to the 'proper' vertical toolbar if and when there are
// actual tools to put there. That, or I'll get around to implementing configurable // actual tools to put there. That, or I'll get around to implementing configurable
// toolbars. // toolbars.
m_optionsToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, KiBitmap( cursor_xpm ), m_optionsToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, KiScaledBitmap( cursor_xpm, this ),
wxEmptyString, wxITEM_CHECK ); wxEmptyString, wxITEM_CHECK );
if( IsGalCanvasActive() ) if( IsGalCanvasActive() )
{ {
m_optionsToolBar->AddTool( ID_TB_MEASUREMENT_TOOL, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_MEASUREMENT_TOOL, wxEmptyString,
KiBitmap( measurement_xpm ), KiScaledBitmap( measurement_xpm, this ),
_( "Measure distance between two points" ), _( "Measure distance between two points" ),
wxITEM_CHECK ); wxITEM_CHECK );
} }
m_optionsToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString, KiBitmap( grid_xpm ), m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString, KiScaledBitmap( grid_xpm, this ),
_( "Turn grid off" ), wxITEM_CHECK ); _( "Turn grid off" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString,
KiBitmap( polar_coord_xpm ), KiScaledBitmap( polar_coord_xpm, this ),
_( "Turn polar coordinate on" ), wxITEM_CHECK ); _( "Turn polar coordinate on" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, wxEmptyString,
KiBitmap( unit_inch_xpm ), KiScaledBitmap( unit_inch_xpm, this ),
_( "Set units to inches" ), wxITEM_CHECK ); _( "Set units to inches" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_MM, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_MM, wxEmptyString,
KiBitmap( unit_mm_xpm ), KiScaledBitmap( unit_mm_xpm, this ),
_( "Set units to millimeters" ), wxITEM_CHECK ); _( "Set units to millimeters" ), wxITEM_CHECK );
#ifndef __APPLE__ #ifndef __APPLE__
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString,
KiBitmap( cursor_shape_xpm ), KiScaledBitmap( cursor_shape_xpm, this ),
_( "Change cursor shape" ), wxITEM_CHECK ); _( "Change cursor shape" ), wxITEM_CHECK );
#endif // !__APPLE__ #endif // !__APPLE__
m_optionsToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_FLASHED_ITEMS_SKETCH, wxEmptyString,
KiBitmap( pad_sketch_xpm ), KiScaledBitmap( pad_sketch_xpm, this ),
_( "Show spots in sketch mode" ), wxITEM_CHECK ); _( "Show spots in sketch mode" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_LINES_SKETCH, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_LINES_SKETCH, wxEmptyString,
KiBitmap( showtrack_xpm ), KiScaledBitmap( showtrack_xpm, this ),
_( "Show lines in sketch mode" ), wxITEM_CHECK ); _( "Show lines in sketch mode" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLYGONS_SKETCH, wxEmptyString,
KiBitmap( opt_show_polygon_xpm ), KiScaledBitmap( opt_show_polygon_xpm, this ),
_( "Show polygons in sketch mode" ), _( "Show polygons in sketch mode" ),
wxITEM_CHECK ); wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_NEGATIVE_ITEMS, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_NEGATIVE_ITEMS, wxEmptyString,
KiBitmap( gerbview_show_negative_objects_xpm ), KiScaledBitmap( gerbview_show_negative_objects_xpm, this ),
_( "Show negatives objects in ghost color" ), _( "Show negatives objects in ghost color" ),
wxITEM_CHECK ); wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_DCODES, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_DCODES, wxEmptyString,
KiBitmap( show_dcodenumber_xpm ), KiScaledBitmap( show_dcodenumber_xpm, this ),
_( "Show dcode number" ), wxITEM_CHECK ); _( "Show dcode number" ), wxITEM_CHECK );
// tools to select draw mode in GerbView, unused in GAL // tools to select draw mode in GerbView, unused in GAL
if( !IsGalCanvasActive() ) if( !IsGalCanvasActive() )
{ {
m_optionsToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GBR_MODE_0, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GBR_MODE_0, wxEmptyString,
KiBitmap( gbr_select_mode0_xpm ), KiScaledBitmap( gbr_select_mode0_xpm, this ),
_( "Show layers in raw mode\n" _( "Show layers in raw mode\n"
"(could have problems with negative items when more than one gerber file is shown)" ), "(could have problems with negative items when more than one gerber file is shown)" ),
wxITEM_CHECK ); wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GBR_MODE_1, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GBR_MODE_1, wxEmptyString,
KiBitmap( gbr_select_mode1_xpm ), KiScaledBitmap( gbr_select_mode1_xpm, this ),
_( "Show layers in stacked mode\n" _( "Show layers in stacked mode\n"
"(show negative items without artifacts)" ), "(show negative items without artifacts)" ),
wxITEM_CHECK ); wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GBR_MODE_2, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GBR_MODE_2, wxEmptyString,
KiBitmap( gbr_select_mode2_xpm ), KiScaledBitmap( gbr_select_mode2_xpm, this ),
_( "Show layers in transparency mode\n" _( "Show layers in transparency mode\n"
"(show negative items without artifacts)" ), "(show negative items without artifacts)" ),
wxITEM_CHECK ); wxITEM_CHECK );
@ -294,22 +296,22 @@ void GERBVIEW_FRAME::ReCreateOptToolbar( void )
else else
{ {
m_optionsToolBar->AddTool( ID_TB_OPTIONS_DIFF_MODE, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_DIFF_MODE, wxEmptyString,
KiBitmap( gbr_select_mode2_xpm ), KiScaledBitmap( gbr_select_mode2_xpm, this ),
_( "Show layers in diff (compare) mode" ), _( "Show layers in diff (compare) mode" ),
wxITEM_CHECK ); wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_HIGH_CONTRAST_MODE, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_HIGH_CONTRAST_MODE, wxEmptyString,
KiBitmap( contrast_mode_xpm ), KiScaledBitmap( contrast_mode_xpm, this ),
_( "Enable high contrast display mode" ), _( "Enable high contrast display mode" ),
wxITEM_CHECK ); wxITEM_CHECK );
} }
// Tools to show/hide toolbars: // Tools to show/hide toolbars:
m_optionsToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR,
wxEmptyString, wxEmptyString,
KiBitmap( layers_manager_xpm ), KiScaledBitmap( layers_manager_xpm, this ),
_( "Show/hide the layers manager toolbar" ), _( "Show/hide the layers manager toolbar" ),
wxITEM_CHECK ); wxITEM_CHECK );

View File

@ -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-2017 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2007-2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2017 KiCad Developers, see CHANGELOG.TXT for contributors. * Copyright (C) 1992-2018 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
@ -30,6 +30,9 @@
// test if it works under stable release // test if it works under stable release
// #include <wx/bitmap.h> // only to define wxBitmap // #include <wx/bitmap.h> // only to define wxBitmap
class wxBitmap; // only to define wxBitmap class wxBitmap; // only to define wxBitmap
class EDA_BASE_FRAME;
class wxWindow;
class wxAuiToolBar;
#include <config.h> #include <config.h>
@ -59,6 +62,32 @@ typedef const BITMAP_OPAQUE *BITMAP_DEF;
wxBitmap KiBitmap( BITMAP_DEF aBitmap ); wxBitmap KiBitmap( BITMAP_DEF aBitmap );
/**
* Function KiScaledBitmap
* Constructs a wxBitmap from a memory record, scaling it if device DPI demands it.
* Internally this may use caching to avoid scaling the same image twice. If caching
* is used, it's guaranteed threadsafe.
*
* @param aBitmap bitmap definition
* @param aWindow target window for scaling context
*/
wxBitmap KiScaledBitmap( BITMAP_DEF aBitmap, EDA_BASE_FRAME* aWindow );
/**
* Function KiScaledSeparator
* Adds a separator to the given toolbar scaled the same way as KiScaledBitmap.
*/
void KiScaledSeparator( wxAuiToolBar* aToolbar, EDA_BASE_FRAME* aWindow );
/**
* Function KiIconScale
* Returns the automatic scale factor that would be used for a given window by
* KiScaledBitmap and KiScaledSeparator.
*/
int KiIconScale( wxWindow* aWindow );
/** /**
* Function KiBitmapNew * Function KiBitmapNew
* allocates a wxBitmap on heap from a memory record, held in a * allocates a wxBitmap on heap from a memory record, held in a

View File

@ -0,0 +1,65 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2018 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 3 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, see <http://www.gnu.org/licenses/>.
*/
#ifndef STEPPED_SLIDER_H
#define STEPPED_SLIDER_H
#include <wx/slider.h>
/**
* Customized wxSlider with forced stepping.
*/
class STEPPED_SLIDER : public wxSlider
{
public:
STEPPED_SLIDER(
wxWindow* aParent,
wxWindowID aId,
int aValue,
int aMinValue,
int aMaxValue,
const wxPoint& aPos = wxDefaultPosition,
const wxSize& aSize = wxDefaultSize,
long aStyle = wxSL_HORIZONTAL,
const wxValidator& aValidator = wxDefaultValidator,
const wxString& aName = wxSliderNameStr );
virtual ~STEPPED_SLIDER();
/**
* Set the step size.
*/
void SetStep( int aSize );
/**
* Get the step size.
*/
int GetStep() const;
protected:
DECLARE_EVENT_TABLE()
private:
int m_step;
void OnScroll( wxScrollEvent& aEvent );
};
#endif // STEPPED_SLIDER_H

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 2009-2015 Jean-Pierre Charras, jp.charras wanadoo.fr * Copyright (C) 2009-2015 Jean-Pierre Charras, jp.charras wanadoo.fr
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com> * Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2018 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
@ -449,6 +449,21 @@ public:
* bound to menu items. * bound to menu items.
*/ */
bool PostCommandMenuEvent( int evt_type ); bool PostCommandMenuEvent( int evt_type );
/**
* Function GetIconScale
*
* Return the desired scaling for toolbar/menubar icons in fourths (e.g. 4 is unity).
* A negative number indicates autoscale based on font size.
*/
virtual int GetIconScale() { return -1; }
/**
* Function SetIconScale
*
* Modify the scale of icons in the window; should refresh them and save the setting.
*/
virtual void SetIconScale( int aScale ) {}
}; };

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2009 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2009 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2018 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
@ -505,26 +505,24 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar()
*/ */
void KICAD_MANAGER_FRAME::RecreateBaseHToolbar() void KICAD_MANAGER_FRAME::RecreateBaseHToolbar()
{ {
// Check if toolbar is not already created if( m_mainToolBar )
if( m_mainToolBar != NULL ) m_mainToolBar->Clear();
return; else
m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
// Allocate memory for m_mainToolBar KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
// New // New
m_mainToolBar->AddTool( ID_NEW_PROJECT, wxEmptyString, m_mainToolBar->AddTool( ID_NEW_PROJECT, wxEmptyString,
KiBitmap( new_project_xpm ), KiScaledBitmap( new_project_xpm, this ),
_( "Create new project" ) ); _( "Create new project" ) );
m_mainToolBar->AddTool( ID_NEW_PROJECT_FROM_TEMPLATE, wxEmptyString, m_mainToolBar->AddTool( ID_NEW_PROJECT_FROM_TEMPLATE, wxEmptyString,
KiBitmap( new_project_with_template_xpm ), KiScaledBitmap( new_project_with_template_xpm, this ),
_( "Create new project from template" ) ); _( "Create new project from template" ) );
// Load // Load
m_mainToolBar->AddTool( ID_LOAD_PROJECT, wxEmptyString, m_mainToolBar->AddTool( ID_LOAD_PROJECT, wxEmptyString,
KiBitmap( open_project_xpm ), KiScaledBitmap( open_project_xpm, this ),
_( "Open existing project" ) ); _( "Open existing project" ) );
// Currently there is nothing to save // Currently there is nothing to save
@ -532,29 +530,27 @@ void KICAD_MANAGER_FRAME::RecreateBaseHToolbar()
#if 0 #if 0
// Save // Save
m_mainToolBar->AddTool( ID_SAVE_PROJECT, wxEmptyString, m_mainToolBar->AddTool( ID_SAVE_PROJECT, wxEmptyString,
KiBitmap( save_project_xpm ), KiScaledBitmap( save_project_xpm, this ),
_( "Save current project" ) ); _( "Save current project" ) );
#endif #endif
// Separator KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddSeparator();
// Archive // Archive
m_mainToolBar->AddTool( ID_SAVE_AND_ZIP_FILES, wxEmptyString, m_mainToolBar->AddTool( ID_SAVE_AND_ZIP_FILES, wxEmptyString,
KiBitmap( zip_xpm ), KiScaledBitmap( zip_xpm, this ),
_( "Archive all project files" ) ); _( "Archive all project files" ) );
// Unarchive // Unarchive
m_mainToolBar->AddTool( ID_READ_ZIP_ARCHIVE, wxEmptyString, m_mainToolBar->AddTool( ID_READ_ZIP_ARCHIVE, wxEmptyString,
KiBitmap( unzip_xpm ), KiScaledBitmap( unzip_xpm, this ),
_( "Unarchive project files from zip archive" ) ); _( "Unarchive project files from zip archive" ) );
// Separator KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddSeparator();
// Refresh project tree // Refresh project tree
m_mainToolBar->AddTool( ID_PROJECT_TREE_REFRESH, wxEmptyString, m_mainToolBar->AddTool( ID_PROJECT_TREE_REFRESH, wxEmptyString,
KiBitmap( reload_xpm ), KiScaledBitmap( reload_xpm, this ),
_( "Refresh project tree" ) ); _( "Refresh project tree" ) );
// Create m_mainToolBar // Create m_mainToolBar

View File

@ -1,26 +1,22 @@
/* /*
* 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) 2016 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2016-2018 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2013 CERN * Copyright (C) 2013 CERN
* @author Jean-Pierre Charras, jp.charras at wanadoo.fr * @author Jean-Pierre Charras, jp.charras at wanadoo.fr
* *
* This program is free software; you can redistribute it and/or * This program is free software: you can redistribute it and/or modify it
* modify it under the terms of the GNU General Public License * under the terms of the GNU General Public License as published by the
* as published by the Free Software Foundation; either version 2 * Free Software Foundation, either version 3 of the License, or (at your
* of the License, or (at your option) any later version. * option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful, but
* but WITHOUT ANY WARRANTY; without even the implied warranty of * WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* GNU General Public License for more details. * General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License along
* along with this program; if not, you may find one here: * with this program. If not, see <http://www.gnu.org/licenses/>.
* 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
*/ */
/** /**
@ -39,77 +35,77 @@
void PL_EDITOR_FRAME::ReCreateHToolbar( void ) void PL_EDITOR_FRAME::ReCreateHToolbar( void )
{ {
if( m_mainToolBar != NULL ) if( m_mainToolBar )
return; m_mainToolBar->Clear();
else
m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
wxString msg; wxString msg;
// Standard file commands // Standard file commands
m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize, m_mainToolBar->AddTool( wxID_NEW, wxEmptyString, KiScaledBitmap( new_generic_xpm, this ),
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
m_mainToolBar->AddTool( wxID_NEW, wxEmptyString, KiBitmap( new_generic_xpm ),
_( "New page layout design" ) ); _( "New page layout design" ) );
m_mainToolBar->AddTool( wxID_OPEN, wxEmptyString, KiBitmap( pagelayout_load_xpm ), m_mainToolBar->AddTool( wxID_OPEN, wxEmptyString, KiScaledBitmap( pagelayout_load_xpm, this ),
_( "Open an existing page layout design file" ) ); _( "Open an existing page layout design file" ) );
m_mainToolBar->AddTool( wxID_SAVE, wxEmptyString, KiBitmap( save_project_xpm ), m_mainToolBar->AddTool( wxID_SAVE, wxEmptyString, KiScaledBitmap( save_project_xpm, this ),
_( "Save page layout design" ) ); _( "Save page layout design" ) );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_SHEET_SET, wxEmptyString, KiBitmap( sheetset_xpm ), m_mainToolBar->AddTool( ID_SHEET_SET, wxEmptyString, KiScaledBitmap( sheetset_xpm, this ),
_( "Page settings" ) ); _( "Page settings" ) );
m_mainToolBar->AddTool( wxID_PRINT, wxEmptyString, KiBitmap( print_button_xpm ), m_mainToolBar->AddTool( wxID_PRINT, wxEmptyString, KiScaledBitmap( print_button_xpm, this ),
_( "Print page layout" ) ); _( "Print page layout" ) );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( wxID_CUT, wxEmptyString, KiBitmap( delete_xpm ), m_mainToolBar->AddTool( wxID_CUT, wxEmptyString, KiScaledBitmap( delete_xpm, this ),
_( "Delete selected item" ) ); _( "Delete selected item" ) );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( wxID_UNDO, wxEmptyString, m_mainToolBar->AddTool( wxID_UNDO, wxEmptyString,
KiBitmap( undo_xpm ), _( "Undo" ) ); KiScaledBitmap( undo_xpm, this ), _( "Undo" ) );
m_mainToolBar->AddTool( wxID_REDO, wxEmptyString, m_mainToolBar->AddTool( wxID_REDO, wxEmptyString,
KiBitmap( redo_xpm ), _( "Redo" ) ); KiScaledBitmap( redo_xpm, this ), _( "Redo" ) );
// Standard Zoom controls: // Standard Zoom controls:
m_mainToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
msg = AddHotkeyName( _( "Redraw view" ), PlEditorHokeysDescr, HK_ZOOM_REDRAW, IS_COMMENT ); msg = AddHotkeyName( _( "Redraw view" ), PlEditorHokeysDescr, HK_ZOOM_REDRAW, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, KiBitmap( zoom_redraw_xpm ), msg ); m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, KiScaledBitmap( zoom_redraw_xpm, this ), msg );
msg = AddHotkeyName( _( "Zoom in" ), PlEditorHokeysDescr, HK_ZOOM_IN, IS_COMMENT ); msg = AddHotkeyName( _( "Zoom in" ), PlEditorHokeysDescr, HK_ZOOM_IN, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiBitmap( zoom_in_xpm ), msg ); m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiScaledBitmap( zoom_in_xpm, this ), msg );
msg = AddHotkeyName( _( "Zoom out" ), PlEditorHokeysDescr, HK_ZOOM_OUT, IS_COMMENT ); msg = AddHotkeyName( _( "Zoom out" ), PlEditorHokeysDescr, HK_ZOOM_OUT, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiBitmap( zoom_out_xpm ), msg ); m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiScaledBitmap( zoom_out_xpm, this ), msg );
msg = AddHotkeyName( _( "Zoom auto" ), PlEditorHokeysDescr, HK_ZOOM_AUTO, IS_COMMENT ); msg = AddHotkeyName( _( "Zoom auto" ), PlEditorHokeysDescr, HK_ZOOM_AUTO, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, KiBitmap( zoom_fit_in_page_xpm ), msg ); m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, KiScaledBitmap( zoom_fit_in_page_xpm, this ), msg );
// Zoom-to-selection // Zoom-to-selection
m_mainToolBar->AddTool( ID_ZOOM_SELECTION, wxEmptyString, KiBitmap( zoom_area_xpm ), m_mainToolBar->AddTool( ID_ZOOM_SELECTION, wxEmptyString, KiScaledBitmap( zoom_area_xpm, this ),
_( "Zoom to selection" ), wxITEM_CHECK ); _( "Zoom to selection" ), wxITEM_CHECK );
// Display mode switch // Display mode switch
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_SHOW_REAL_MODE, wxEmptyString, m_mainToolBar->AddTool( ID_SHOW_REAL_MODE, wxEmptyString,
KiBitmap( pagelayout_normal_view_mode_xpm ), KiScaledBitmap( pagelayout_normal_view_mode_xpm, this ),
_( "Show title block like it will be displayed in applications\n" _( "Show title block like it will be displayed in applications\n"
"texts with format are replaced by the full text"), "texts with format are replaced by the full text"),
wxITEM_CHECK ); wxITEM_CHECK );
m_mainToolBar->AddTool( ID_SHOW_PL_EDITOR_MODE, m_mainToolBar->AddTool( ID_SHOW_PL_EDITOR_MODE,
wxEmptyString, KiBitmap( pagelayout_special_view_mode_xpm ), wxEmptyString, KiScaledBitmap( pagelayout_special_view_mode_xpm, this ),
_( "Show title block in edit mode: texts are shown as is:\n" _( "Show title block in edit mode: texts are shown as is:\n"
"texts with format are displayed with no change"), "texts with format are displayed with no change"),
wxITEM_CHECK ); wxITEM_CHECK );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
wxString choiceList[5] = wxString choiceList[5] =
{ {
@ -158,14 +154,14 @@ void PL_EDITOR_FRAME::ReCreateHToolbar( void )
void PL_EDITOR_FRAME::ReCreateVToolbar( void ) void PL_EDITOR_FRAME::ReCreateVToolbar( void )
{ {
if( m_drawToolBar ) if( m_drawToolBar )
return; m_drawToolBar->Clear();
else
m_drawToolBar = new wxAuiToolBar( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize, m_drawToolBar = new wxAuiToolBar( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL ); KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
// Set up toolbar // Set up toolbar
m_drawToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, KiBitmap( cursor_xpm ) ); m_drawToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, KiScaledBitmap( cursor_xpm, this ) );
m_drawToolBar->AddSeparator(); KiScaledSeparator( m_drawToolBar, this );
m_drawToolBar->Realize(); m_drawToolBar->Realize();
} }

View File

@ -9,7 +9,7 @@
* *
* Copyright (C) 1992-2015 Jean-Pierre Charras <jean-pierre.charras@ujf-grenoble.fr> * Copyright (C) 1992-2015 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) 1992-2015 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 1992-2018 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
@ -118,7 +118,8 @@ void PCB_LAYER_BOX_SELECTOR::Resync()
minwidth = std::max( minwidth, w ); minwidth = std::max( minwidth, w );
} }
minwidth += BM_SIZE + 35; // Take in account the bitmap size and margins // Approximate bitmap size and margins
minwidth += BM_SIZE + 32 + ConvertDialogToPixels( wxSize( 8, 0 ) ).x;
SetMinSize( wxSize( minwidth, -1 ) ); SetMinSize( wxSize( minwidth, -1 ) );
} }

View File

@ -2,24 +2,20 @@
* 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) 2015 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr * Copyright (C) 2015 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2018 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
* modify it under the terms of the GNU General Public License * under the terms of the GNU General Public License as published by the
* as published by the Free Software Foundation; either version 2 * Free Software Foundation, either version 3 of the License, or (at your
* of the License, or (at your option) any later version. * option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful, but
* but WITHOUT ANY WARRANTY; without even the implied warranty of * WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* GNU General Public License for more details. * General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License along
* along with this program; if not, you may find one here: * with this program. If not, see <http://www.gnu.org/licenses/>.
* 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
*/ */
/* functions relatives to the dialog opened from the main menu : /* functions relatives to the dialog opened from the main menu :
@ -65,13 +61,16 @@ void PCB_EDIT_FRAME::InstallDisplayOptionsDialog( wxCommandEvent& aEvent )
DIALOG_DISPLAY_OPTIONS::DIALOG_DISPLAY_OPTIONS( PCB_EDIT_FRAME* parent ) : DIALOG_DISPLAY_OPTIONS::DIALOG_DISPLAY_OPTIONS( PCB_EDIT_FRAME* parent ) :
DIALOG_DISPLAY_OPTIONS_BASE( parent ), DIALOG_DISPLAY_OPTIONS_BASE( parent ),
m_parent( parent ) m_parent( parent ),
m_last_scale( -1 )
{ {
KIGFX::GAL_DISPLAY_OPTIONS& galOptions = m_parent->GetGalDisplayOptions(); KIGFX::GAL_DISPLAY_OPTIONS& galOptions = m_parent->GetGalDisplayOptions();
m_galOptsPanel = new GAL_OPTIONS_PANEL( this, galOptions ); m_galOptsPanel = new GAL_OPTIONS_PANEL( this, galOptions );
sLeftSizer->Add( m_galOptsPanel, 1, wxEXPAND, 0 ); sLeftSizer->Add( m_galOptsPanel, 1, wxEXPAND, 0 );
m_scaleSlider->SetStep( 25 );
SetFocus(); SetFocus();
m_sdbSizerOK->SetDefault(); m_sdbSizerOK->SetDefault();
@ -103,6 +102,19 @@ bool DIALOG_DISPLAY_OPTIONS::TransferDataToWindow()
m_OptDisplayDrawings->SetValue( displ_opts->m_DisplayDrawItemsFill == SKETCH ); m_OptDisplayDrawings->SetValue( displ_opts->m_DisplayDrawItemsFill == SKETCH );
m_ShowNetNamesOption->SetSelection( displ_opts->m_DisplayNetNamesMode ); m_ShowNetNamesOption->SetSelection( displ_opts->m_DisplayNetNamesMode );
const int scale_fourths = m_parent->GetIconScale();
if( scale_fourths <= 0 )
{
m_scaleAuto->SetValue( true );
m_scaleSlider->SetValue( 25 * KiIconScale( m_parent ) );
}
else
{
m_scaleAuto->SetValue( false );
m_scaleSlider->SetValue( scale_fourths * 25 );
}
m_galOptsPanel->TransferDataToWindow(); m_galOptsPanel->TransferDataToWindow();
return true; return true;
@ -150,7 +162,34 @@ bool DIALOG_DISPLAY_OPTIONS::TransferDataFromWindow()
view->RecacheAllItems(); view->RecacheAllItems();
view->MarkTargetDirty( KIGFX::TARGET_NONCACHED ); view->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
const int scale_fourths = m_scaleAuto->GetValue() ? -1 : m_scaleSlider->GetValue() / 25;
if( m_parent->GetIconScale() != scale_fourths )
m_parent->SetIconScale( scale_fourths );
m_parent->GetCanvas()->Refresh(); m_parent->GetCanvas()->Refresh();
return true; return true;
} }
void DIALOG_DISPLAY_OPTIONS::OnScaleSlider( wxScrollEvent& aEvent )
{
m_scaleAuto->SetValue( false );
aEvent.Skip();
}
void DIALOG_DISPLAY_OPTIONS::OnScaleAuto( wxCommandEvent& aEvent )
{
if( m_scaleAuto->GetValue() )
{
m_last_scale = m_scaleSlider->GetValue();
m_scaleSlider->SetValue( 25 * KiIconScale( GetParent() ) );
}
else
{
if( m_last_scale >= 0 )
m_scaleSlider->SetValue( m_last_scale );
}
}

View File

@ -2,24 +2,20 @@
* 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) 2010-2014 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr * Copyright (C) 2010-2014 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2018 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
* modify it under the terms of the GNU General Public License * under the terms of the GNU General Public License as published by the
* as published by the Free Software Foundation; either version 2 * Free Software Foundation, either version 3 of the License, or (at your
* of the License, or (at your option) any later version. * option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful, but
* but WITHOUT ANY WARRANTY; without even the implied warranty of * WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* GNU General Public License for more details. * General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License along
* along with this program; if not, you may find one here: * with this program. If not, see <http://www.gnu.org/licenses/>.
* 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
*/ */
/** /**
@ -38,8 +34,13 @@ public:
bool TransferDataFromWindow() override; bool TransferDataFromWindow() override;
bool TransferDataToWindow() override; bool TransferDataToWindow() override;
protected:
void OnScaleSlider( wxScrollEvent& aEvent ) override;
void OnScaleAuto( wxCommandEvent& aEvent ) override;
private: private:
PCB_EDIT_FRAME* m_parent; PCB_EDIT_FRAME* m_parent;
int m_last_scale;
GAL_OPTIONS_PANEL* m_galOptsPanel; GAL_OPTIONS_PANEL* m_galOptsPanel;
}; };

View File

@ -1,8 +1,8 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Feb 6 2017) // C++ code generated with wxFormBuilder (version Jan 2 2018)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
#include "dialog_display_options_base.h" #include "dialog_display_options_base.h"
@ -24,27 +24,62 @@ DIALOG_DISPLAY_OPTIONS_BASE::DIALOG_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWi
bupperSizer->Add( sLeftSizer, 1, wxEXPAND, 5 ); bupperSizer->Add( sLeftSizer, 1, wxEXPAND, 5 );
wxStaticBoxSizer* sMiddleSizer; wxBoxSizer* bSizer5;
sMiddleSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Routing Help:") ), wxVERTICAL ); bSizer5 = new wxBoxSizer( wxVERTICAL );
wxString m_ShowNetNamesOptionChoices[] = { _("Do not show"), _("On pads"), _("On tracks"), _("On pads and tracks") }; wxString m_ShowNetNamesOptionChoices[] = { _("Do not show"), _("On pads"), _("On tracks"), _("On pads and tracks") };
int m_ShowNetNamesOptionNChoices = sizeof( m_ShowNetNamesOptionChoices ) / sizeof( wxString ); int m_ShowNetNamesOptionNChoices = sizeof( m_ShowNetNamesOptionChoices ) / sizeof( wxString );
m_ShowNetNamesOption = new wxRadioBox( sMiddleSizer->GetStaticBox(), wxID_ANY, _("Show Net Names:"), wxDefaultPosition, wxDefaultSize, m_ShowNetNamesOptionNChoices, m_ShowNetNamesOptionChoices, 1, wxRA_SPECIFY_COLS ); m_ShowNetNamesOption = new wxRadioBox( this, wxID_ANY, _("Show Net Names:"), wxDefaultPosition, wxDefaultSize, m_ShowNetNamesOptionNChoices, m_ShowNetNamesOptionChoices, 1, wxRA_SPECIFY_COLS );
m_ShowNetNamesOption->SetSelection( 0 ); m_ShowNetNamesOption->SetSelection( 0 );
m_ShowNetNamesOption->SetToolTip( _("Show or hide net names on pads and/or tracks.") ); m_ShowNetNamesOption->SetToolTip( _("Show or hide net names on pads and/or tracks.") );
sMiddleSizer->Add( m_ShowNetNamesOption, 0, wxALL|wxEXPAND, 5 ); bSizer5->Add( m_ShowNetNamesOption, 1, wxALL|wxEXPAND, 5 );
wxString m_OptDisplayTracksClearanceChoices[] = { _("Never"), _("New track"), _("New track with via area"), _("New and edited tracks with via area"), _("Always") }; wxString m_OptDisplayTracksClearanceChoices[] = { _("Never"), _("New track"), _("New track with via area"), _("New and edited tracks with via area"), _("Always") };
int m_OptDisplayTracksClearanceNChoices = sizeof( m_OptDisplayTracksClearanceChoices ) / sizeof( wxString ); int m_OptDisplayTracksClearanceNChoices = sizeof( m_OptDisplayTracksClearanceChoices ) / sizeof( wxString );
m_OptDisplayTracksClearance = new wxRadioBox( sMiddleSizer->GetStaticBox(), ID_SHOW_CLEARANCE, _("Show Track Clearance:"), wxDefaultPosition, wxDefaultSize, m_OptDisplayTracksClearanceNChoices, m_OptDisplayTracksClearanceChoices, 1, wxRA_SPECIFY_COLS ); m_OptDisplayTracksClearance = new wxRadioBox( this, ID_SHOW_CLEARANCE, _("Show Track Clearance:"), wxDefaultPosition, wxDefaultSize, m_OptDisplayTracksClearanceNChoices, m_OptDisplayTracksClearanceChoices, 1, wxRA_SPECIFY_COLS );
m_OptDisplayTracksClearance->SetSelection( 0 ); m_OptDisplayTracksClearance->SetSelection( 0 );
m_OptDisplayTracksClearance->SetToolTip( _("Show or hide the track and via clearance area. If \"New track\" is selected, track clearance area is shown only when creating the track.") ); m_OptDisplayTracksClearance->SetToolTip( _("Show or hide the track and via clearance area. If \"New track\" is selected, track clearance area is shown only when creating the track.") );
sMiddleSizer->Add( m_OptDisplayTracksClearance, 1, wxALL|wxEXPAND, 5 ); bSizer5->Add( m_OptDisplayTracksClearance, 1, wxALL|wxEXPAND, 5 );
wxStaticBoxSizer* sbSizer5;
sbSizer5 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("User Interface:") ), wxVERTICAL );
wxFlexGridSizer* fgSizer1;
fgSizer1 = new wxFlexGridSizer( 0, 3, 0, 0 );
fgSizer1->AddGrowableCol( 1 );
fgSizer1->SetFlexibleDirection( wxBOTH );
fgSizer1->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_staticText1 = new wxStaticText( sbSizer5->GetStaticBox(), wxID_ANY, _("Icon scale:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1->Wrap( -1 );
fgSizer1->Add( m_staticText1, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 3 );
m_scaleSlider = new STEPPED_SLIDER( sbSizer5->GetStaticBox(), wxID_ANY, 50, 50, 275, wxDefaultPosition, wxDefaultSize, wxSL_AUTOTICKS|wxSL_HORIZONTAL|wxSL_LABELS );
fgSizer1->Add( m_scaleSlider, 0, wxEXPAND|wxLEFT|wxRIGHT, 3 );
m_staticText2 = new wxStaticText( sbSizer5->GetStaticBox(), wxID_ANY, _("%"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText2->Wrap( -1 );
fgSizer1->Add( m_staticText2, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT, 3 );
bupperSizer->Add( sMiddleSizer, 0, wxALL|wxEXPAND, 5 ); fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
m_scaleAuto = new wxCheckBox( sbSizer5->GetStaticBox(), wxID_ANY, _("Auto"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer1->Add( m_scaleAuto, 0, wxALL, 5 );
fgSizer1->Add( 0, 0, 1, wxEXPAND, 5 );
sbSizer5->Add( fgSizer1, 1, wxALL|wxEXPAND, 5 );
bSizer5->Add( sbSizer5, 1, wxALL|wxEXPAND, 5 );
bupperSizer->Add( bSizer5, 1, wxEXPAND, 5 );
wxBoxSizer* sRightSizer; wxBoxSizer* sRightSizer;
sRightSizer = new wxBoxSizer( wxVERTICAL ); sRightSizer = new wxBoxSizer( wxVERTICAL );
@ -122,8 +157,32 @@ DIALOG_DISPLAY_OPTIONS_BASE::DIALOG_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWi
this->SetSizer( bMainSizer ); this->SetSizer( bMainSizer );
this->Layout(); this->Layout();
bMainSizer->Fit( this ); bMainSizer->Fit( this );
// Connect Events
m_scaleSlider->Connect( wxEVT_SCROLL_TOP, wxScrollEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnScaleSlider ), NULL, this );
m_scaleSlider->Connect( wxEVT_SCROLL_BOTTOM, wxScrollEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnScaleSlider ), NULL, this );
m_scaleSlider->Connect( wxEVT_SCROLL_LINEUP, wxScrollEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnScaleSlider ), NULL, this );
m_scaleSlider->Connect( wxEVT_SCROLL_LINEDOWN, wxScrollEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnScaleSlider ), NULL, this );
m_scaleSlider->Connect( wxEVT_SCROLL_PAGEUP, wxScrollEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnScaleSlider ), NULL, this );
m_scaleSlider->Connect( wxEVT_SCROLL_PAGEDOWN, wxScrollEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnScaleSlider ), NULL, this );
m_scaleSlider->Connect( wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnScaleSlider ), NULL, this );
m_scaleSlider->Connect( wxEVT_SCROLL_THUMBRELEASE, wxScrollEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnScaleSlider ), NULL, this );
m_scaleSlider->Connect( wxEVT_SCROLL_CHANGED, wxScrollEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnScaleSlider ), NULL, this );
m_scaleAuto->Connect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnScaleAuto ), NULL, this );
} }
DIALOG_DISPLAY_OPTIONS_BASE::~DIALOG_DISPLAY_OPTIONS_BASE() DIALOG_DISPLAY_OPTIONS_BASE::~DIALOG_DISPLAY_OPTIONS_BASE()
{ {
// Disconnect Events
m_scaleSlider->Disconnect( wxEVT_SCROLL_TOP, wxScrollEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnScaleSlider ), NULL, this );
m_scaleSlider->Disconnect( wxEVT_SCROLL_BOTTOM, wxScrollEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnScaleSlider ), NULL, this );
m_scaleSlider->Disconnect( wxEVT_SCROLL_LINEUP, wxScrollEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnScaleSlider ), NULL, this );
m_scaleSlider->Disconnect( wxEVT_SCROLL_LINEDOWN, wxScrollEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnScaleSlider ), NULL, this );
m_scaleSlider->Disconnect( wxEVT_SCROLL_PAGEUP, wxScrollEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnScaleSlider ), NULL, this );
m_scaleSlider->Disconnect( wxEVT_SCROLL_PAGEDOWN, wxScrollEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnScaleSlider ), NULL, this );
m_scaleSlider->Disconnect( wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnScaleSlider ), NULL, this );
m_scaleSlider->Disconnect( wxEVT_SCROLL_THUMBRELEASE, wxScrollEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnScaleSlider ), NULL, this );
m_scaleSlider->Disconnect( wxEVT_SCROLL_CHANGED, wxScrollEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnScaleSlider ), NULL, this );
m_scaleAuto->Disconnect( wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_OPTIONS_BASE::OnScaleAuto ), NULL, this );
} }

View File

@ -115,21 +115,17 @@
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property> <property name="flag">wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">1</property>
<object class="wxStaticBoxSizer" expanded="1"> <object class="wxBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">Routing Help:</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">sMiddleSizer</property> <property name="name">bSizer5</property>
<property name="orient">wxVERTICAL</property> <property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property> <property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="0"> <object class="sizeritem" expanded="0">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property> <property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">1</property>
<object class="wxRadioBox" expanded="0"> <object class="wxRadioBox" expanded="0">
<property name="BottomDockable">1</property> <property name="BottomDockable">1</property>
<property name="LeftDockable">1</property> <property name="LeftDockable">1</property>
@ -306,6 +302,421 @@
<event name="OnUpdateUI"></event> <event name="OnUpdateUI"></event>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">User Interface:</property>
<property name="minimum_size"></property>
<property name="name">sbSizer5</property>
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxFlexGridSizer" expanded="1">
<property name="cols">3</property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols">1</property>
<property name="growablerows"></property>
<property name="hgap">0</property>
<property name="minimum_size"></property>
<property name="name">fgSizer1</property>
<property name="non_flexible_grow_mode">wxFLEX_GROWMODE_SPECIFIED</property>
<property name="permission">none</property>
<property name="rows">0</property>
<property name="vgap">0</property>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxStaticText" 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="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">Icon scale:</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_staticText1</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">; forward_declare</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>
<property name="wrap">-1</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">3</property>
<property name="flag">wxEXPAND|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxSlider" 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="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="maxValue">275</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="minValue">50</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_scaleSlider</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">wxSL_AUTOTICKS|wxSL_HORIZONTAL|wxSL_LABELS</property>
<property name="subclass">STEPPED_SLIDER; widgets/stepped_slider.h; Not forward_declare</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="value">50</property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCommandScroll"></event>
<event name="OnCommandScrollBottom"></event>
<event name="OnCommandScrollChanged"></event>
<event name="OnCommandScrollLineDown"></event>
<event name="OnCommandScrollLineUp"></event>
<event name="OnCommandScrollPageDown"></event>
<event name="OnCommandScrollPageUp"></event>
<event name="OnCommandScrollThumbRelease"></event>
<event name="OnCommandScrollThumbTrack"></event>
<event name="OnCommandScrollTop"></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="OnScroll">OnScaleSlider</event>
<event name="OnScrollBottom"></event>
<event name="OnScrollChanged"></event>
<event name="OnScrollLineDown"></event>
<event name="OnScrollLineUp"></event>
<event name="OnScrollPageDown"></event>
<event name="OnScrollPageUp"></event>
<event name="OnScrollThumbRelease"></event>
<event name="OnScrollThumbTrack"></event>
<event name="OnScrollTop"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">3</property>
<property name="flag">wxALIGN_CENTER_VERTICAL|wxLEFT|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxStaticText" 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="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">%</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_staticText2</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">; forward_declare</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>
<property name="wrap">-1</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">wxEXPAND</property>
<property name="proportion">1</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</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">Auto</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_scaleAuto</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">; forward_declare</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">OnScaleAuto</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">wxEXPAND</property>
<property name="proportion">1</property>
<object class="spacer" expanded="1">
<property name="height">0</property>
<property name="permission">protected</property>
<property name="width">0</property>
</object>
</object>
</object>
</object>
</object>
</object>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">

View File

@ -1,8 +1,8 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Feb 6 2017) // C++ code generated with wxFormBuilder (version Jan 2 2018)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO *NOT* EDIT THIS FILE!
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_DISPLAY_OPTIONS_BASE_H__ #ifndef __DIALOG_DISPLAY_OPTIONS_BASE_H__
@ -11,8 +11,7 @@
#include <wx/artprov.h> #include <wx/artprov.h>
#include <wx/xrc/xmlres.h> #include <wx/xrc/xmlres.h>
#include <wx/intl.h> #include <wx/intl.h>
class DIALOG_SHIM; #include "widgets/stepped_slider.h"
#include "dialog_shim.h" #include "dialog_shim.h"
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
@ -21,8 +20,10 @@ class DIALOG_SHIM;
#include <wx/font.h> #include <wx/font.h>
#include <wx/colour.h> #include <wx/colour.h>
#include <wx/settings.h> #include <wx/settings.h>
#include <wx/statbox.h> #include <wx/stattext.h>
#include <wx/slider.h>
#include <wx/checkbox.h> #include <wx/checkbox.h>
#include <wx/statbox.h>
#include <wx/button.h> #include <wx/button.h>
#include <wx/dialog.h> #include <wx/dialog.h>
@ -44,6 +45,10 @@ class DIALOG_DISPLAY_OPTIONS_BASE : public DIALOG_SHIM
wxBoxSizer* sLeftSizer; wxBoxSizer* sLeftSizer;
wxRadioBox* m_ShowNetNamesOption; wxRadioBox* m_ShowNetNamesOption;
wxRadioBox* m_OptDisplayTracksClearance; wxRadioBox* m_OptDisplayTracksClearance;
wxStaticText* m_staticText1;
STEPPED_SLIDER* m_scaleSlider;
wxStaticText* m_staticText2;
wxCheckBox* m_scaleAuto;
wxCheckBox* m_OptDisplayTracks; wxCheckBox* m_OptDisplayTracks;
wxCheckBox* m_OptDisplayVias; wxCheckBox* m_OptDisplayVias;
wxCheckBox* m_OptDisplayModOutlines; wxCheckBox* m_OptDisplayModOutlines;
@ -58,6 +63,11 @@ class DIALOG_DISPLAY_OPTIONS_BASE : public DIALOG_SHIM
wxStdDialogButtonSizer* m_sdbSizer; wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK; wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel; wxButton* m_sdbSizerCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnScaleSlider( wxScrollEvent& event ) { event.Skip(); }
virtual void OnScaleAuto( wxCommandEvent& event ) { event.Skip(); }
public: public:

View File

@ -1,24 +1,20 @@
/* /*
* 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) 2017 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2017-2018 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
* modify it under the terms of the GNU General Public License * under the terms of the GNU General Public License as published by the
* as published by the Free Software Foundation; either version 2 * Free Software Foundation, either version 3 of the License, or (at your
* of the License, or (at your option) any later version. * option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful, but
* but WITHOUT ANY WARRANTY; without even the implied warranty of * WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* GNU General Public License for more details. * General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License along
* along with this program; if not, you may find one here: * with this program. If not, see <http://www.gnu.org/licenses/>.
* 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 <dialog_modedit_display_options.h>
@ -29,6 +25,9 @@
#include <view/view.h> #include <view/view.h>
#include <widgets/gal_options_panel.h> #include <widgets/gal_options_panel.h>
#include <widgets/stepped_slider.h>
#include <wx/checkbox.h>
#include <wx/sizer.h>
bool DIALOG_MODEDIT_DISPLAY_OPTIONS::Invoke( FOOTPRINT_EDIT_FRAME& aCaller ) bool DIALOG_MODEDIT_DISPLAY_OPTIONS::Invoke( FOOTPRINT_EDIT_FRAME& aCaller )
@ -43,7 +42,8 @@ bool DIALOG_MODEDIT_DISPLAY_OPTIONS::Invoke( FOOTPRINT_EDIT_FRAME& aCaller )
DIALOG_MODEDIT_DISPLAY_OPTIONS::DIALOG_MODEDIT_DISPLAY_OPTIONS( FOOTPRINT_EDIT_FRAME& aParent ) : DIALOG_MODEDIT_DISPLAY_OPTIONS::DIALOG_MODEDIT_DISPLAY_OPTIONS( FOOTPRINT_EDIT_FRAME& aParent ) :
DIALOG_SHIM( &aParent, wxID_ANY, _( "Display Options" ) ), DIALOG_SHIM( &aParent, wxID_ANY, _( "Display Options" ) ),
m_parent( aParent ) m_parent( aParent ),
m_last_scale( -1 )
{ {
auto mainSizer = new wxBoxSizer( wxVERTICAL ); auto mainSizer = new wxBoxSizer( wxVERTICAL );
SetSizer( mainSizer ); SetSizer( mainSizer );
@ -54,6 +54,28 @@ DIALOG_MODEDIT_DISPLAY_OPTIONS::DIALOG_MODEDIT_DISPLAY_OPTIONS( FOOTPRINT_EDIT_F
m_galOptsPanel = new GAL_OPTIONS_PANEL( this, galOptions ); m_galOptsPanel = new GAL_OPTIONS_PANEL( this, galOptions );
mainSizer->Add( m_galOptsPanel, 1, wxEXPAND, 0 ); mainSizer->Add( m_galOptsPanel, 1, wxEXPAND, 0 );
auto fgsizer = new wxFlexGridSizer( 3 );
fgsizer->AddGrowableCol( 1 );
fgsizer->SetFlexibleDirection( wxBOTH );
fgsizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
fgsizer->Add(
new wxStaticText( this, wxID_ANY, _( "Icon scale:" ) ),
0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 3 );
m_scaleSlider = new STEPPED_SLIDER( this, wxID_ANY, 50, 50, 275,
wxDefaultPosition, wxDefaultSize,
wxSL_AUTOTICKS | wxSL_HORIZONTAL | wxSL_LABELS );
m_scaleSlider->SetStep( 25 );
fgsizer->Add( m_scaleSlider, 1, wxLEFT | wxRIGHT | wxEXPAND, 3 );
fgsizer->Add(
new wxStaticText( this, wxID_ANY, "%" ),
0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, 3 );
fgsizer->AddSpacer( 0 );
m_scaleAuto = new wxCheckBox( this, wxID_ANY, _( "Auto" ) );
fgsizer->Add( m_scaleAuto, wxLEFT | wxRIGHT | wxEXPAND, 3 );
fgsizer->AddSpacer( 0 );
mainSizer->Add( fgsizer, 0, wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT, 5 );
auto btnSizer = new wxStdDialogButtonSizer(); auto btnSizer = new wxStdDialogButtonSizer();
mainSizer->Add( btnSizer, 0, wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT, 5 ); mainSizer->Add( btnSizer, 0, wxEXPAND | wxBOTTOM | wxLEFT | wxRIGHT, 5 );
@ -62,6 +84,21 @@ DIALOG_MODEDIT_DISPLAY_OPTIONS::DIALOG_MODEDIT_DISPLAY_OPTIONS( FOOTPRINT_EDIT_F
btnSizer->Realize(); btnSizer->Realize();
std::vector<wxEventTypeTag<wxScrollEvent>> scroll_events = {
wxEVT_SCROLL_TOP, wxEVT_SCROLL_BOTTOM, wxEVT_SCROLL_LINEUP, wxEVT_SCROLL_LINEDOWN,
wxEVT_SCROLL_PAGEUP, wxEVT_SCROLL_PAGEDOWN, wxEVT_SCROLL_THUMBTRACK,
wxEVT_SCROLL_THUMBRELEASE };
for( auto evt : scroll_events )
m_scaleSlider->Connect(
evt, wxScrollEventHandler( DIALOG_MODEDIT_DISPLAY_OPTIONS::OnScaleSlider ),
NULL, this );
m_scaleAuto->Connect(
wxEVT_COMMAND_CHECKBOX_CLICKED,
wxCommandEventHandler( DIALOG_MODEDIT_DISPLAY_OPTIONS::OnScaleAuto ),
NULL, this );
GetSizer()->SetSizeHints( this ); GetSizer()->SetSizeHints( this );
Centre(); Centre();
} }
@ -70,7 +107,22 @@ DIALOG_MODEDIT_DISPLAY_OPTIONS::DIALOG_MODEDIT_DISPLAY_OPTIONS( FOOTPRINT_EDIT_F
bool DIALOG_MODEDIT_DISPLAY_OPTIONS::TransferDataToWindow() bool DIALOG_MODEDIT_DISPLAY_OPTIONS::TransferDataToWindow()
{ {
// update GAL options // update GAL options
return m_galOptsPanel->TransferDataToWindow(); m_galOptsPanel->TransferDataToWindow();
const int scale_fourths = m_parent.GetIconScale();
if( scale_fourths <= 0 )
{
m_scaleAuto->SetValue( true );
m_scaleSlider->SetValue( 25 * KiIconScale( &m_parent ) );
}
else
{
m_scaleAuto->SetValue( false );
m_scaleSlider->SetValue( scale_fourths * 25 );
}
return true;
} }
@ -79,6 +131,11 @@ bool DIALOG_MODEDIT_DISPLAY_OPTIONS::TransferDataFromWindow()
// update GAL options // update GAL options
m_galOptsPanel->TransferDataFromWindow(); m_galOptsPanel->TransferDataFromWindow();
const int scale_fourths = m_scaleAuto->GetValue() ? -1 : m_scaleSlider->GetValue() / 25;
if( m_parent.GetIconScale() != scale_fourths )
m_parent.SetIconScale( scale_fourths );
// refresh view // refresh view
KIGFX::VIEW* view = m_parent.GetGalCanvas()->GetView(); KIGFX::VIEW* view = m_parent.GetGalCanvas()->GetView();
view->RecacheAllItems(); view->RecacheAllItems();
@ -87,3 +144,25 @@ bool DIALOG_MODEDIT_DISPLAY_OPTIONS::TransferDataFromWindow()
return true; return true;
} }
void DIALOG_MODEDIT_DISPLAY_OPTIONS::OnScaleSlider( wxScrollEvent& aEvent )
{
m_scaleAuto->SetValue( false );
aEvent.Skip();
}
void DIALOG_MODEDIT_DISPLAY_OPTIONS::OnScaleAuto( wxCommandEvent& aEvent )
{
if( m_scaleAuto->GetValue() )
{
m_last_scale = m_scaleSlider->GetValue();
m_scaleSlider->SetValue( 25 * KiIconScale( GetParent() ) );
}
else
{
if( m_last_scale >= 0 )
m_scaleSlider->SetValue( m_last_scale );
}
}

View File

@ -1,30 +1,28 @@
/* /*
* 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) 2017 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2017-2018 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
* modify it under the terms of the GNU General Public License * under the terms of the GNU General Public License as published by the
* as published by the Free Software Foundation; either version 2 * Free Software Foundation, either version 3 of the License, or (at your
* of the License, or (at your option) any later version. * option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful, but
* but WITHOUT ANY WARRANTY; without even the implied warranty of * WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* GNU General Public License for more details. * General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License along
* along with this program; if not, you may find one here: * with this program. If not, see <http://www.gnu.org/licenses/>.
* 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> #include <dialog_shim.h>
class GAL_OPTIONS_PANEL; class GAL_OPTIONS_PANEL;
class FOOTPRINT_EDIT_FRAME; class FOOTPRINT_EDIT_FRAME;
class STEPPED_SLIDER;
class wxCheckBox;
class DIALOG_MODEDIT_DISPLAY_OPTIONS : public DIALOG_SHIM class DIALOG_MODEDIT_DISPLAY_OPTIONS : public DIALOG_SHIM
{ {
@ -33,6 +31,10 @@ public:
static bool Invoke( FOOTPRINT_EDIT_FRAME& aCaller ); static bool Invoke( FOOTPRINT_EDIT_FRAME& aCaller );
protected:
void OnScaleSlider( wxScrollEvent& aEvent );
void OnScaleAuto( wxCommandEvent& aEvent );
private: private:
bool TransferDataToWindow() override; bool TransferDataToWindow() override;
@ -42,4 +44,8 @@ private:
// subpanel // subpanel
GAL_OPTIONS_PANEL* m_galOptsPanel; GAL_OPTIONS_PANEL* m_galOptsPanel;
int m_last_scale;
wxCheckBox* m_scaleAuto;
STEPPED_SLIDER* m_scaleSlider;
}; };

View File

@ -1,24 +1,20 @@
/* /*
* 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) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2018 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
* modify it under the terms of the GNU General Public License * under the terms of the GNU General Public License as published by the
* as published by the Free Software Foundation; either version 2 * Free Software Foundation, either version 3 of the License, or (at your
* of the License, or (at your option) any later version. * option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful, but
* but WITHOUT ANY WARRANTY; without even the implied warranty of * WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* GNU General Public License for more details. * General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License along
* along with this program; if not, you may find one here: * with this program. If not, see <http://www.gnu.org/licenses/>.
* 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
*/ */
/** /**
@ -484,6 +480,8 @@ public:
*/ */
bool OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl = 0 ) override; bool OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl = 0 ) override;
int GetIconScale() override;
void SetIconScale( int aScale ) override;
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()

View File

@ -4,24 +4,20 @@
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2015-2016 Wayne Stambaugh <stambaughw@gmail.com> * Copyright (C) 2015-2016 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2018 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
* modify it under the terms of the GNU General Public License * under the terms of the GNU General Public License as published by the
* as published by the Free Software Foundation; either version 2 * Free Software Foundation, either version 3 of the License, or (at your
* of the License, or (at your option) any later version. * option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful, but
* but WITHOUT ANY WARRANTY; without even the implied warranty of * WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* GNU General Public License for more details. * General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License along
* along with this program; if not, you may find one here: * with this program. If not, see <http://www.gnu.org/licenses/>.
* 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
*/ */
/** /**
@ -31,6 +27,7 @@
#include <fctsys.h> #include <fctsys.h>
#include <pgm_base.h> #include <pgm_base.h>
#include <kiface_i.h>
#include <kiway.h> #include <kiway.h>
#include <project.h> #include <project.h>
#include <kicad_plugin.h> #include <kicad_plugin.h>
@ -75,6 +72,12 @@
#include "tools/pad_tool.h" #include "tools/pad_tool.h"
#include "tools/pcb_actions.h" #include "tools/pcb_actions.h"
///@{
/// \ingroup config
static const wxString IconScaleEntry = "ModIconScale";
///@}
BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME ) BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
EVT_MENU_RANGE( ID_POPUP_PCB_ITEM_SELECTION_START, ID_POPUP_PCB_ITEM_SELECTION_END, EVT_MENU_RANGE( ID_POPUP_PCB_ITEM_SELECTION_START, ID_POPUP_PCB_ITEM_SELECTION_END,
@ -1016,3 +1019,24 @@ void FOOTPRINT_EDIT_FRAME::UseGalCanvas( bool aEnable )
ReCreateMenuBar(); ReCreateMenuBar();
} }
int FOOTPRINT_EDIT_FRAME::GetIconScale()
{
int scale = 0;
Kiface().KifaceSettings()->Read( IconScaleEntry, &scale, 0 );
return scale;
}
void FOOTPRINT_EDIT_FRAME::SetIconScale( int aScale )
{
Kiface().KifaceSettings()->Write( IconScaleEntry, aScale );
ReCreateMenuBar();
ReCreateHToolbar();
ReCreateAuxiliaryToolbar();
ReCreateVToolbar();
ReCreateOptToolbar();
Layout();
SendSizeEvent();
}

View File

@ -4,24 +4,20 @@
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com> * Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2013-2017 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2013-2018 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
* modify it under the terms of the GNU General Public License * under the terms of the GNU General Public License as published by the
* as published by the Free Software Foundation; either version 2 * Free Software Foundation, either version 3 of the License, or (at your
* of the License, or (at your option) any later version. * option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful, but
* but WITHOUT ANY WARRANTY; without even the implied warranty of * WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* GNU General Public License for more details. * General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License along
* along with this program; if not, you may find one here: * with this program. If not, see <http://www.gnu.org/licenses/>.
* 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
*/ */
/** /**
@ -93,6 +89,7 @@ static const wxString MagneticTracksEntry = "PcbMagTrackOpt";
static const wxString ShowMicrowaveEntry = "ShowMicrowaveTools"; static const wxString ShowMicrowaveEntry = "ShowMicrowaveTools";
static const wxString ShowLayerManagerEntry = "ShowLayerManagerTools"; static const wxString ShowLayerManagerEntry = "ShowLayerManagerTools";
static const wxString ShowPageLimitsEntry = "ShowPageLimits"; static const wxString ShowPageLimitsEntry = "ShowPageLimits";
static const wxString IconScaleEntry = "PcbIconScale";
///@} ///@}
@ -1278,3 +1275,25 @@ int PCB_EDIT_FRAME::InstallExchangeModuleFrame( MODULE* Module )
return dialog.ShowQuasiModal(); return dialog.ShowQuasiModal();
} }
int PCB_EDIT_FRAME::GetIconScale()
{
int scale = 0;
Kiface().KifaceSettings()->Read( IconScaleEntry, &scale, 0 );
return scale;
}
void PCB_EDIT_FRAME::SetIconScale( int aScale )
{
Kiface().KifaceSettings()->Write( IconScaleEntry, aScale );
ReCreateMenuBar();
ReCreateHToolbar();
ReCreateAuxiliaryToolbar();
ReCreateVToolbar();
ReCreateOptToolbar();
ReCreateMicrowaveVToolbar();
Layout();
SendSizeEvent();
}

View File

@ -4,24 +4,20 @@
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2015 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 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2018 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
* modify it under the terms of the GNU General Public License * under the terms of the GNU General Public License as published by the
* as published by the Free Software Foundation; either version 2 * Free Software Foundation, either version 3 of the License, or (at your
* of the License, or (at your option) any later version. * option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful, but
* but WITHOUT ANY WARRANTY; without even the implied warranty of * WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* GNU General Public License for more details. * General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License along
* along with this program; if not, you may find one here: * with this program. If not, see <http://www.gnu.org/licenses/>.
* 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
*/ */
/** /**
@ -42,109 +38,109 @@
void FOOTPRINT_EDIT_FRAME::ReCreateHToolbar() void FOOTPRINT_EDIT_FRAME::ReCreateHToolbar()
{ {
if( m_mainToolBar != NULL ) if( m_mainToolBar )
return; m_mainToolBar->Clear();
else
m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
wxString msg; wxString msg;
m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
// Set up toolbar // Set up toolbar
m_mainToolBar->AddTool( ID_MODEDIT_SELECT_CURRENT_LIB, wxEmptyString, m_mainToolBar->AddTool( ID_MODEDIT_SELECT_CURRENT_LIB, wxEmptyString,
KiBitmap( open_library_xpm ), KiScaledBitmap( open_library_xpm, this ),
_( "Select active library" ) ); _( "Select active library" ) );
m_mainToolBar->AddTool( ID_MODEDIT_SAVE_LIBMODULE, wxEmptyString, KiBitmap( save_library_xpm ), m_mainToolBar->AddTool( ID_MODEDIT_SAVE_LIBMODULE, wxEmptyString, KiScaledBitmap( save_library_xpm, this ),
_( "Save footprint in active library" ) ); _( "Save footprint in active library" ) );
m_mainToolBar->AddTool( ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART, wxEmptyString, m_mainToolBar->AddTool( ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART, wxEmptyString,
KiBitmap( new_library_xpm ), KiScaledBitmap( new_library_xpm, this ),
_( "Create new library and save current footprint" ) ); _( "Create new library and save current footprint" ) );
m_mainToolBar->AddTool( ID_OPEN_MODULE_VIEWER, wxEmptyString, KiBitmap( modview_icon_xpm ), m_mainToolBar->AddTool( ID_OPEN_MODULE_VIEWER, wxEmptyString, KiScaledBitmap( modview_icon_xpm, this ),
_( "Open footprint viewer" ) ); _( "Open footprint viewer" ) );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_MODEDIT_DELETE_PART, wxEmptyString, KiBitmap( delete_xpm ), m_mainToolBar->AddTool( ID_MODEDIT_DELETE_PART, wxEmptyString, KiScaledBitmap( delete_xpm, this ),
_( "Delete part from active library" ) ); _( "Delete part from active library" ) );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_MODEDIT_NEW_MODULE, wxEmptyString, KiBitmap( new_footprint_xpm ), m_mainToolBar->AddTool( ID_MODEDIT_NEW_MODULE, wxEmptyString, KiScaledBitmap( new_footprint_xpm, this ),
_( "New footprint" ) ); _( "New footprint" ) );
#ifdef KICAD_SCRIPTING #ifdef KICAD_SCRIPTING
m_mainToolBar->AddTool( ID_MODEDIT_NEW_MODULE_FROM_WIZARD, wxEmptyString, m_mainToolBar->AddTool( ID_MODEDIT_NEW_MODULE_FROM_WIZARD, wxEmptyString,
KiBitmap( module_wizard_xpm ), KiScaledBitmap( module_wizard_xpm, this ),
_( "New footprint using footprint wizard" ) ); _( "New footprint using footprint wizard" ) );
#endif #endif
m_mainToolBar->AddTool( ID_MODEDIT_LOAD_MODULE, wxEmptyString, m_mainToolBar->AddTool( ID_MODEDIT_LOAD_MODULE, wxEmptyString,
KiBitmap( load_module_lib_xpm ), KiScaledBitmap( load_module_lib_xpm, this ),
_( "Load footprint from library" ) ); _( "Load footprint from library" ) );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_MODEDIT_LOAD_MODULE_FROM_BOARD, wxEmptyString, m_mainToolBar->AddTool( ID_MODEDIT_LOAD_MODULE_FROM_BOARD, wxEmptyString,
KiBitmap( load_module_board_xpm ), KiScaledBitmap( load_module_board_xpm, this ),
_( "Load footprint from current board" ) ); _( "Load footprint from current board" ) );
m_mainToolBar->AddTool( ID_MODEDIT_UPDATE_MODULE_IN_BOARD, wxEmptyString, m_mainToolBar->AddTool( ID_MODEDIT_UPDATE_MODULE_IN_BOARD, wxEmptyString,
KiBitmap( update_module_board_xpm ), KiScaledBitmap( update_module_board_xpm, this ),
_( "Update footprint into current board" ) ); _( "Update footprint into current board" ) );
m_mainToolBar->AddTool( ID_MODEDIT_INSERT_MODULE_IN_BOARD, wxEmptyString, m_mainToolBar->AddTool( ID_MODEDIT_INSERT_MODULE_IN_BOARD, wxEmptyString,
KiBitmap( insert_module_board_xpm ), KiScaledBitmap( insert_module_board_xpm, this ),
_( "Insert footprint into current board" ) ); _( "Insert footprint into current board" ) );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_MODEDIT_IMPORT_PART, wxEmptyString, KiBitmap( import_module_xpm ), m_mainToolBar->AddTool( ID_MODEDIT_IMPORT_PART, wxEmptyString, KiScaledBitmap( import_module_xpm, this ),
_( "Import footprint" ) ); _( "Import footprint" ) );
m_mainToolBar->AddTool( ID_MODEDIT_EXPORT_PART, wxEmptyString, KiBitmap( export_module_xpm ), m_mainToolBar->AddTool( ID_MODEDIT_EXPORT_PART, wxEmptyString, KiScaledBitmap( export_module_xpm, this ),
_( "Export footprint" ) ); _( "Export footprint" ) );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( wxID_UNDO, wxEmptyString, KiBitmap( undo_xpm ), m_mainToolBar->AddTool( wxID_UNDO, wxEmptyString, KiScaledBitmap( undo_xpm, this ),
_( "Undo last edition" ) ); _( "Undo last edition" ) );
m_mainToolBar->AddTool( wxID_REDO, wxEmptyString, KiBitmap( redo_xpm ), m_mainToolBar->AddTool( wxID_REDO, wxEmptyString, KiScaledBitmap( redo_xpm, this ),
_( "Redo last undo command" ) ); _( "Redo last undo command" ) );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_MODEDIT_EDIT_MODULE_PROPERTIES, wxEmptyString, m_mainToolBar->AddTool( ID_MODEDIT_EDIT_MODULE_PROPERTIES, wxEmptyString,
KiBitmap( module_options_xpm ), KiScaledBitmap( module_options_xpm, this ),
_( "Footprint properties" ) ); _( "Footprint properties" ) );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( wxID_PRINT, wxEmptyString, KiBitmap( print_button_xpm ), m_mainToolBar->AddTool( wxID_PRINT, wxEmptyString, KiScaledBitmap( print_button_xpm, this ),
_( "Print footprint" ) ); _( "Print footprint" ) );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
msg = AddHotkeyName( _( "Redraw view" ), g_Module_Editor_Hokeys_Descr, HK_ZOOM_REDRAW, msg = AddHotkeyName( _( "Redraw view" ), g_Module_Editor_Hokeys_Descr, HK_ZOOM_REDRAW,
IS_COMMENT ); IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, KiBitmap( zoom_redraw_xpm ), msg ); m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, KiScaledBitmap( zoom_redraw_xpm, this ), msg );
msg = AddHotkeyName( _( "Zoom in" ), g_Module_Editor_Hokeys_Descr, HK_ZOOM_IN, IS_COMMENT ); msg = AddHotkeyName( _( "Zoom in" ), g_Module_Editor_Hokeys_Descr, HK_ZOOM_IN, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiBitmap( zoom_in_xpm ), msg ); m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiScaledBitmap( zoom_in_xpm, this ), msg );
msg = AddHotkeyName( _( "Zoom out" ), g_Module_Editor_Hokeys_Descr, HK_ZOOM_OUT, IS_COMMENT ); msg = AddHotkeyName( _( "Zoom out" ), g_Module_Editor_Hokeys_Descr, HK_ZOOM_OUT, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiBitmap( zoom_out_xpm ), msg ); m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiScaledBitmap( zoom_out_xpm, this ), msg );
msg = AddHotkeyName( _( "Zoom auto" ), g_Module_Editor_Hokeys_Descr, HK_ZOOM_AUTO, IS_COMMENT ); msg = AddHotkeyName( _( "Zoom auto" ), g_Module_Editor_Hokeys_Descr, HK_ZOOM_AUTO, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, KiBitmap( zoom_fit_in_page_xpm ), msg ); m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, KiScaledBitmap( zoom_fit_in_page_xpm, this ), msg );
m_mainToolBar->AddTool( ID_ZOOM_SELECTION, wxEmptyString, KiBitmap( zoom_area_xpm ), m_mainToolBar->AddTool( ID_ZOOM_SELECTION, wxEmptyString, KiScaledBitmap( zoom_area_xpm, this ),
_( "Zoom to selection" ), wxITEM_CHECK ); _( "Zoom to selection" ), wxITEM_CHECK );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_MODEDIT_PAD_SETTINGS, wxEmptyString, KiBitmap( options_pad_xpm ), m_mainToolBar->AddTool( ID_MODEDIT_PAD_SETTINGS, wxEmptyString, KiScaledBitmap( options_pad_xpm, this ),
_( "Pad properties" ) ); _( "Pad properties" ) );
#if 0 // Currently there is no check footprint function defined, so do not show this tool #if 0 // Currently there is no check footprint function defined, so do not show this tool
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_MODEDIT_CHECK, wxEmptyString, m_mainToolBar->AddTool( ID_MODEDIT_CHECK, wxEmptyString,
KiBitmap( module_check_xpm ), KiScaledBitmap( module_check_xpm, this ),
_( "Check footprint" ) ); _( "Check footprint" ) );
#endif #endif
@ -156,51 +152,51 @@ void FOOTPRINT_EDIT_FRAME::ReCreateHToolbar()
void FOOTPRINT_EDIT_FRAME::ReCreateVToolbar() void FOOTPRINT_EDIT_FRAME::ReCreateVToolbar()
{ {
if( m_drawToolBar ) if( m_drawToolBar )
return; m_drawToolBar->Clear();
else
m_drawToolBar = new wxAuiToolBar( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize, m_drawToolBar = new wxAuiToolBar( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL ); KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
// Set up toolbar // Set up toolbar
m_drawToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, KiBitmap( cursor_xpm ), m_drawToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, KiScaledBitmap( cursor_xpm, this ),
wxEmptyString, wxITEM_CHECK ); wxEmptyString, wxITEM_CHECK );
m_drawToolBar->AddSeparator(); KiScaledSeparator( m_drawToolBar, this );
m_drawToolBar->AddTool( ID_MODEDIT_PAD_TOOL, wxEmptyString, KiBitmap( pad_xpm ), m_drawToolBar->AddTool( ID_MODEDIT_PAD_TOOL, wxEmptyString, KiScaledBitmap( pad_xpm, this ),
_( "Add pad" ), wxITEM_CHECK ); _( "Add pad" ), wxITEM_CHECK );
m_drawToolBar->AddSeparator(); KiScaledSeparator( m_drawToolBar, this );
m_drawToolBar->AddTool( ID_MODEDIT_LINE_TOOL, wxEmptyString, KiBitmap( add_graphical_segments_xpm ), m_drawToolBar->AddTool( ID_MODEDIT_LINE_TOOL, wxEmptyString, KiScaledBitmap( add_graphical_segments_xpm, this ),
_( "Add graphic line" ), wxITEM_CHECK ); _( "Add graphic line" ), wxITEM_CHECK );
m_drawToolBar->AddTool( ID_MODEDIT_CIRCLE_TOOL, wxEmptyString, KiBitmap( add_circle_xpm ), m_drawToolBar->AddTool( ID_MODEDIT_CIRCLE_TOOL, wxEmptyString, KiScaledBitmap( add_circle_xpm, this ),
_( "Add graphic circle" ), wxITEM_CHECK ); _( "Add graphic circle" ), wxITEM_CHECK );
m_drawToolBar->AddTool( ID_MODEDIT_ARC_TOOL, wxEmptyString, KiBitmap( add_arc_xpm ), m_drawToolBar->AddTool( ID_MODEDIT_ARC_TOOL, wxEmptyString, KiScaledBitmap( add_arc_xpm, this ),
_( "Add graphic arc" ), wxITEM_CHECK ); _( "Add graphic arc" ), wxITEM_CHECK );
m_drawToolBar->AddTool( ID_MODEDIT_POLYGON_TOOL, wxEmptyString, KiBitmap( add_graphical_polygon_xpm ), m_drawToolBar->AddTool( ID_MODEDIT_POLYGON_TOOL, wxEmptyString, KiScaledBitmap( add_graphical_polygon_xpm, this ),
_( "Add graphic polygon" ), wxITEM_CHECK ); _( "Add graphic polygon" ), wxITEM_CHECK );
m_drawToolBar->AddTool( ID_MODEDIT_TEXT_TOOL, wxEmptyString, KiBitmap( text_xpm ), m_drawToolBar->AddTool( ID_MODEDIT_TEXT_TOOL, wxEmptyString, KiScaledBitmap( text_xpm, this ),
_( "Add Text" ), wxITEM_CHECK ); _( "Add Text" ), wxITEM_CHECK );
m_drawToolBar->AddSeparator(); KiScaledSeparator( m_drawToolBar, this );
m_drawToolBar->AddTool( ID_MODEDIT_ANCHOR_TOOL, wxEmptyString, KiBitmap( anchor_xpm ), m_drawToolBar->AddTool( ID_MODEDIT_ANCHOR_TOOL, wxEmptyString, KiScaledBitmap( anchor_xpm, this ),
_( "Place footprint reference anchor" ), _( "Place footprint reference anchor" ),
wxITEM_CHECK ); wxITEM_CHECK );
m_drawToolBar->AddSeparator(); KiScaledSeparator( m_drawToolBar, this );
m_drawToolBar->AddTool( ID_MODEDIT_DELETE_TOOL, wxEmptyString, KiBitmap( delete_xpm ), m_drawToolBar->AddTool( ID_MODEDIT_DELETE_TOOL, wxEmptyString, KiScaledBitmap( delete_xpm, this ),
_( "Delete item" ), wxITEM_CHECK ); _( "Delete item" ), wxITEM_CHECK );
m_drawToolBar->AddTool( ID_MODEDIT_PLACE_GRID_COORD, wxEmptyString, m_drawToolBar->AddTool( ID_MODEDIT_PLACE_GRID_COORD, wxEmptyString,
KiBitmap( grid_select_axis_xpm ), KiScaledBitmap( grid_select_axis_xpm, this ),
_( "Set grid origin" ), _( "Set grid origin" ),
wxITEM_CHECK ); wxITEM_CHECK );
m_drawToolBar->AddTool( ID_MODEDIT_MEASUREMENT_TOOL, wxEmptyString, m_drawToolBar->AddTool( ID_MODEDIT_MEASUREMENT_TOOL, wxEmptyString,
KiBitmap( measurement_xpm ), KiScaledBitmap( measurement_xpm, this ),
_( "Measure distance" ), _( "Measure distance" ),
wxITEM_CHECK ); wxITEM_CHECK );
@ -211,47 +207,47 @@ void FOOTPRINT_EDIT_FRAME::ReCreateVToolbar()
void FOOTPRINT_EDIT_FRAME::ReCreateOptToolbar() void FOOTPRINT_EDIT_FRAME::ReCreateOptToolbar()
{ {
if( m_optionsToolBar ) if( m_optionsToolBar )
return; m_optionsToolBar->Clear();
else
m_optionsToolBar = new wxAuiToolBar( this, ID_OPT_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
// Create options tool bar. m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString, KiScaledBitmap( grid_xpm, this ),
m_optionsToolBar = new wxAuiToolBar( this, ID_OPT_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString, KiBitmap( grid_xpm ),
_( "Hide grid" ), wxITEM_CHECK ); _( "Hide grid" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString,
KiBitmap( polar_coord_xpm ), KiScaledBitmap( polar_coord_xpm, this ),
_( "Display Polar Coord ON" ), wxITEM_CHECK ); _( "Display Polar Coord ON" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, wxEmptyString,
KiBitmap( unit_inch_xpm ), KiScaledBitmap( unit_inch_xpm, this ),
_( "Set units to inches" ), wxITEM_CHECK ); _( "Set units to inches" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_MM, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_MM, wxEmptyString,
KiBitmap( unit_mm_xpm ), KiScaledBitmap( unit_mm_xpm, this ),
_( "Set units to millimeters" ), wxITEM_CHECK ); _( "Set units to millimeters" ), wxITEM_CHECK );
#ifndef __APPLE__ #ifndef __APPLE__
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString,
KiBitmap( cursor_shape_xpm ), KiScaledBitmap( cursor_shape_xpm, this ),
_( "Change Cursor Shape" ), wxITEM_CHECK ); _( "Change Cursor Shape" ), wxITEM_CHECK );
#endif // !__APPLE__ #endif // !__APPLE__
m_optionsToolBar->AddSeparator(); KiScaledSeparator( m_optionsToolBar, this );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH, wxEmptyString,
KiBitmap( pad_sketch_xpm ), KiScaledBitmap( pad_sketch_xpm, this ),
_( "Show Pads Sketch" ), wxITEM_CHECK ); _( "Show Pads Sketch" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH, wxEmptyString,
KiBitmap( text_sketch_xpm ), KiScaledBitmap( text_sketch_xpm, this ),
_( "Show Texts Sketch" ), wxITEM_CHECK ); _( "Show Texts Sketch" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH, wxEmptyString,
KiBitmap( show_mod_edge_xpm ), KiScaledBitmap( show_mod_edge_xpm, this ),
_( "Show Edges Sketch" ), wxITEM_CHECK ); _( "Show Edges Sketch" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE, wxEmptyString,
KiBitmap( contrast_mode_xpm ), KiScaledBitmap( contrast_mode_xpm, this ),
_( "Enable high contrast display mode" ), _( "Enable high contrast display mode" ),
wxITEM_CHECK ); wxITEM_CHECK );
@ -262,13 +258,13 @@ void FOOTPRINT_EDIT_FRAME::ReCreateOptToolbar()
void FOOTPRINT_EDIT_FRAME::ReCreateAuxiliaryToolbar() void FOOTPRINT_EDIT_FRAME::ReCreateAuxiliaryToolbar()
{ {
if( m_auxiliaryToolBar ) if( m_auxiliaryToolBar )
return; m_auxiliaryToolBar->Clear();
else
m_auxiliaryToolBar = new wxAuiToolBar( this, ID_AUX_TOOLBAR, wxDefaultPosition, wxDefaultSize, m_auxiliaryToolBar = new wxAuiToolBar( this, ID_AUX_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT ); KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
// Set up toolbar // Set up toolbar
m_auxiliaryToolBar->AddSeparator(); KiScaledSeparator( m_auxiliaryToolBar, this );
// Grid selection choice box. // Grid selection choice box.
m_gridSelectBox = new wxChoice( m_auxiliaryToolBar, m_gridSelectBox = new wxChoice( m_auxiliaryToolBar,
@ -280,7 +276,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateAuxiliaryToolbar()
m_auxiliaryToolBar->AddControl( m_gridSelectBox ); m_auxiliaryToolBar->AddControl( m_gridSelectBox );
// Zoom selection choice box. // Zoom selection choice box.
m_auxiliaryToolBar->AddSeparator(); KiScaledSeparator( m_auxiliaryToolBar, this );
m_zoomSelectBox = new wxChoice( m_auxiliaryToolBar, m_zoomSelectBox = new wxChoice( m_auxiliaryToolBar,
ID_ON_ZOOM_SELECT, ID_ON_ZOOM_SELECT,
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,

View File

@ -4,24 +4,20 @@
* 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-2015 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2012-2015 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2018 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
* modify it under the terms of the GNU General Public License * under the terms of the GNU General Public License as published by the
* as published by the Free Software Foundation; either version 2 * Free Software Foundation, either version 3 of the License, or (at your
* of the License, or (at your option) any later version. * option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful, but
* but WITHOUT ANY WARRANTY; without even the implied warranty of * WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* GNU General Public License for more details. * General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License along
* along with this program; if not, you may find one here: * with this program. If not, see <http://www.gnu.org/licenses/>.
* 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
*/ */
/** /**
@ -46,69 +42,71 @@ void FOOTPRINT_VIEWER_FRAME::ReCreateHToolbar()
{ {
wxString msg; wxString msg;
if( m_mainToolBar == NULL ) if( m_mainToolBar )
{ m_mainToolBar->Clear();
else
m_mainToolBar = new wxAuiToolBar( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_mainToolBar = new wxAuiToolBar( this, wxID_ANY, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT
| wxAUI_TB_OVERFLOW ); | wxAUI_TB_OVERFLOW );
// Set up toolbar // Set up toolbar
m_mainToolBar->AddTool( ID_MODVIEW_SELECT_LIB, wxEmptyString, m_mainToolBar->AddTool( ID_MODVIEW_SELECT_LIB, wxEmptyString,
KiBitmap( library_xpm ), KiScaledBitmap( library_xpm, this ),
_( "Select library to browse" ) ); _( "Select library to browse" ) );
m_mainToolBar->AddTool( ID_MODVIEW_SELECT_PART, wxEmptyString, m_mainToolBar->AddTool( ID_MODVIEW_SELECT_PART, wxEmptyString,
KiBitmap( module_xpm ), KiScaledBitmap( module_xpm, this ),
_( "Select footprint to browse" ) ); _( "Select footprint to browse" ) );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_MODVIEW_PREVIOUS, wxEmptyString,
KiBitmap( lib_previous_xpm ),
_( "Display previous footprint" ) );
m_mainToolBar->AddTool( ID_MODVIEW_NEXT, wxEmptyString, m_mainToolBar->AddTool( ID_MODVIEW_PREVIOUS, wxEmptyString,
KiBitmap( lib_next_xpm ), KiScaledBitmap( lib_previous_xpm, this ),
_( "Display next footprint" ) ); _( "Display previous footprint" ) );
m_mainToolBar->AddSeparator(); m_mainToolBar->AddTool( ID_MODVIEW_NEXT, wxEmptyString,
m_mainToolBar->AddTool( ID_MODVIEW_SHOW_3D_VIEW, wxEmptyString, KiScaledBitmap( lib_next_xpm, this ),
KiBitmap( three_d_xpm ), _( "Display next footprint" ) );
_( "Show footprint in 3D viewer" ) );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
msg = AddHotkeyName( _( "Zoom in" ), g_Module_Viewer_Hokeys_Descr,
HK_ZOOM_IN, IS_COMMENT );
m_mainToolBar->AddTool( ID_VIEWER_ZOOM_IN, wxEmptyString,
KiBitmap( zoom_in_xpm ), msg );
msg = AddHotkeyName( _( "Zoom out" ), g_Module_Viewer_Hokeys_Descr, m_mainToolBar->AddTool( ID_MODVIEW_SHOW_3D_VIEW, wxEmptyString,
HK_ZOOM_OUT, IS_COMMENT ); KiScaledBitmap( three_d_xpm, this ),
m_mainToolBar->AddTool( ID_VIEWER_ZOOM_OUT, wxEmptyString, _( "Show footprint in 3D viewer" ) );
KiBitmap( zoom_out_xpm ), msg );
msg = AddHotkeyName( _( "Redraw view" ), g_Module_Viewer_Hokeys_Descr, KiScaledSeparator( m_mainToolBar, this );
HK_ZOOM_REDRAW );
m_mainToolBar->AddTool( ID_VIEWER_ZOOM_REDRAW, wxEmptyString,
KiBitmap( zoom_redraw_xpm ), msg );
msg = AddHotkeyName( _( "Zoom auto" ), g_Module_Viewer_Hokeys_Descr, msg = AddHotkeyName( _( "Zoom in" ), g_Module_Viewer_Hokeys_Descr,
HK_ZOOM_AUTO ); HK_ZOOM_IN, IS_COMMENT );
m_mainToolBar->AddTool( ID_VIEWER_ZOOM_PAGE, wxEmptyString, m_mainToolBar->AddTool( ID_VIEWER_ZOOM_IN, wxEmptyString,
KiBitmap( zoom_fit_in_page_xpm ), msg ); KiScaledBitmap( zoom_in_xpm, this ), msg );
if( IsModal() ) msg = AddHotkeyName( _( "Zoom out" ), g_Module_Viewer_Hokeys_Descr,
{ HK_ZOOM_OUT, IS_COMMENT );
m_mainToolBar->AddSeparator(); m_mainToolBar->AddTool( ID_VIEWER_ZOOM_OUT, wxEmptyString,
m_mainToolBar->AddTool( ID_MODVIEW_FOOTPRINT_EXPORT_TO_BOARD, wxEmptyString, KiScaledBitmap( zoom_out_xpm, this ), msg );
KiBitmap( export_footprint_names_xpm ),
_( "Insert footprint in board" ) );
}
// after adding the buttons to the toolbar, must call Realize() to msg = AddHotkeyName( _( "Redraw view" ), g_Module_Viewer_Hokeys_Descr,
// reflect the changes HK_ZOOM_REDRAW );
m_mainToolBar->Realize(); m_mainToolBar->AddTool( ID_VIEWER_ZOOM_REDRAW, wxEmptyString,
KiScaledBitmap( zoom_redraw_xpm, this ), msg );
msg = AddHotkeyName( _( "Zoom auto" ), g_Module_Viewer_Hokeys_Descr,
HK_ZOOM_AUTO );
m_mainToolBar->AddTool( ID_VIEWER_ZOOM_PAGE, wxEmptyString,
KiScaledBitmap( zoom_fit_in_page_xpm, this ), msg );
if( IsModal() )
{
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_MODVIEW_FOOTPRINT_EXPORT_TO_BOARD, wxEmptyString,
KiScaledBitmap( export_footprint_names_xpm, this ),
_( "Insert footprint in board" ) );
} }
// after adding the buttons to the toolbar, must call Realize() to
// reflect the changes
m_mainToolBar->Realize();
m_mainToolBar->Refresh(); m_mainToolBar->Refresh();
} }

View File

@ -4,7 +4,7 @@
* 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=2015 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2012=2015 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2018 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
@ -47,6 +47,7 @@
#include <class_pcb_layer_box_selector.h> #include <class_pcb_layer_box_selector.h>
#include <wx/wupdlock.h> #include <wx/wupdlock.h>
#include <memory>
extern bool IsWxPythonLoaded(); extern bool IsWxPythonLoaded();
@ -55,7 +56,7 @@ extern bool IsWxPythonLoaded();
/* Data to build the layer pair indicator button */ /* Data to build the layer pair indicator button */
static wxBitmap* LayerPairBitmap = NULL; static std::unique_ptr<wxBitmap> LayerPairBitmap;
#define BM_LAYERICON_SIZE 24 #define BM_LAYERICON_SIZE 24
static const char s_BitmapLayerIcon[BM_LAYERICON_SIZE][BM_LAYERICON_SIZE] = static const char s_BitmapLayerIcon[BM_LAYERICON_SIZE][BM_LAYERICON_SIZE] =
@ -95,12 +96,19 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator()
COLOR4D active_layer_color, Route_Layer_TOP_color, COLOR4D active_layer_color, Route_Layer_TOP_color,
Route_Layer_BOTTOM_color, via_color; Route_Layer_BOTTOM_color, via_color;
bool change = false; bool change = false;
bool first_call = LayerPairBitmap == NULL;
static int previous_requested_scale;
static COLOR4D previous_active_layer_color, previous_Route_Layer_TOP_color, static COLOR4D previous_active_layer_color, previous_Route_Layer_TOP_color,
previous_Route_Layer_BOTTOM_color, previous_via_color; previous_Route_Layer_BOTTOM_color, previous_via_color;
/* get colors, and redraw bitmap button only on changes */ const int requested_scale = GetIconScale();
if( requested_scale != previous_requested_scale )
{
previous_requested_scale = requested_scale;
change = true;
}
active_layer_color = Settings().Colors().GetLayerColor(GetActiveLayer()); active_layer_color = Settings().Colors().GetLayerColor(GetActiveLayer());
if( previous_active_layer_color != active_layer_color ) if( previous_active_layer_color != active_layer_color )
@ -136,14 +144,10 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator()
change = true; change = true;
} }
if( !change && (LayerPairBitmap != NULL) ) if( !change && LayerPairBitmap )
return; return;
/* Create the bitmap and its Memory DC, if not already made */ LayerPairBitmap = std::make_unique<wxBitmap>( 24, 24 );
if( LayerPairBitmap == NULL )
{
LayerPairBitmap = new wxBitmap( 24, 24 );
}
/* Draw the icon, with colors according to the active layer and layer /* Draw the icon, with colors according to the active layer and layer
* pairs for via command (change layer) * pairs for via command (change layer)
@ -191,7 +195,17 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator()
* in order to delete the MemoryDC safely without deleting the bitmap */ * in order to delete the MemoryDC safely without deleting the bitmap */
iconDC.SelectObject( wxNullBitmap ); iconDC.SelectObject( wxNullBitmap );
if( m_mainToolBar && ! first_call ) // Scale the bitmap
const int scale = ( requested_scale <= 0 ) ? KiIconScale( this ) : requested_scale;
wxImage image = LayerPairBitmap->ConvertToImage();
// "NEAREST" causes less mixing of colors
image.Rescale( scale * image.GetWidth() / 4, scale * image.GetHeight() / 4,
wxIMAGE_QUALITY_NEAREST );
LayerPairBitmap = std::make_unique<wxBitmap>( image );
if( m_mainToolBar )
{ {
m_mainToolBar->SetToolBitmap( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, *LayerPairBitmap ); m_mainToolBar->SetToolBitmap( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, *LayerPairBitmap );
m_mainToolBar->Refresh(); m_mainToolBar->Refresh();
@ -203,79 +217,79 @@ void PCB_EDIT_FRAME::ReCreateHToolbar()
{ {
wxString msg; wxString msg;
if( m_mainToolBar )
return;
wxWindowUpdateLocker dummy( this ); wxWindowUpdateLocker dummy( this );
m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize, if( m_mainToolBar )
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT ); m_mainToolBar->Clear();
else
m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
// Set up toolbar // Set up toolbar
if( Kiface().IsSingle() ) if( Kiface().IsSingle() )
{ {
m_mainToolBar->AddTool( ID_NEW_BOARD, wxEmptyString, KiBitmap( new_generic_xpm ), m_mainToolBar->AddTool( ID_NEW_BOARD, wxEmptyString, KiScaledBitmap( new_generic_xpm, this ),
_( "New board" ) ); _( "New board" ) );
m_mainToolBar->AddTool( ID_LOAD_FILE, wxEmptyString, KiBitmap( open_brd_file_xpm ), m_mainToolBar->AddTool( ID_LOAD_FILE, wxEmptyString, KiScaledBitmap( open_brd_file_xpm, this ),
_( "Open existing board" ) ); _( "Open existing board" ) );
} }
m_mainToolBar->AddTool( ID_SAVE_BOARD, wxEmptyString, KiBitmap( save_xpm ), m_mainToolBar->AddTool( ID_SAVE_BOARD, wxEmptyString, KiScaledBitmap( save_xpm, this ),
_( "Save board" ) ); _( "Save board" ) );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_SHEET_SET, wxEmptyString, KiBitmap( sheetset_xpm ), m_mainToolBar->AddTool( ID_SHEET_SET, wxEmptyString, KiScaledBitmap( sheetset_xpm, this ),
_( "Page settings for paper size and texts" ) ); _( "Page settings for paper size and texts" ) );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_OPEN_MODULE_EDITOR, wxEmptyString, m_mainToolBar->AddTool( ID_OPEN_MODULE_EDITOR, wxEmptyString,
KiBitmap( module_editor_xpm ), KiScaledBitmap( module_editor_xpm, this ),
_( "Open footprint editor" ) ); _( "Open footprint editor" ) );
m_mainToolBar->AddTool( ID_OPEN_MODULE_VIEWER, wxEmptyString, m_mainToolBar->AddTool( ID_OPEN_MODULE_VIEWER, wxEmptyString,
KiBitmap( modview_icon_xpm ), KiScaledBitmap( modview_icon_xpm, this ),
_( "Open footprint viewer" ) ); _( "Open footprint viewer" ) );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
msg = AddHotkeyName( HELP_UNDO, g_Board_Editor_Hokeys_Descr, HK_UNDO, IS_COMMENT ); msg = AddHotkeyName( HELP_UNDO, g_Board_Editor_Hokeys_Descr, HK_UNDO, IS_COMMENT );
m_mainToolBar->AddTool( wxID_UNDO, wxEmptyString, KiBitmap( undo_xpm ), msg ); m_mainToolBar->AddTool( wxID_UNDO, wxEmptyString, KiScaledBitmap( undo_xpm, this ), msg );
msg = AddHotkeyName( HELP_REDO, g_Board_Editor_Hokeys_Descr, HK_REDO, IS_COMMENT ); msg = AddHotkeyName( HELP_REDO, g_Board_Editor_Hokeys_Descr, HK_REDO, IS_COMMENT );
m_mainToolBar->AddTool( wxID_REDO, wxEmptyString, KiBitmap( redo_xpm ), msg ); m_mainToolBar->AddTool( wxID_REDO, wxEmptyString, KiScaledBitmap( redo_xpm, this ), msg );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( wxID_PRINT, wxEmptyString, KiBitmap( print_button_xpm ), m_mainToolBar->AddTool( wxID_PRINT, wxEmptyString, KiScaledBitmap( print_button_xpm, this ),
_( "Print board" ) ); _( "Print board" ) );
m_mainToolBar->AddTool( ID_GEN_PLOT, wxEmptyString, KiBitmap( plot_xpm ), m_mainToolBar->AddTool( ID_GEN_PLOT, wxEmptyString, KiScaledBitmap( plot_xpm, this ),
_( "Plot (HPGL, PostScript, or GERBER format)" ) ); _( "Plot (HPGL, PostScript, or GERBER format)" ) );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
msg = AddHotkeyName( HELP_ZOOM_REDRAW, g_Board_Editor_Hokeys_Descr, HK_ZOOM_REDRAW, msg = AddHotkeyName( HELP_ZOOM_REDRAW, g_Board_Editor_Hokeys_Descr, HK_ZOOM_REDRAW,
IS_COMMENT ); IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, KiBitmap( zoom_redraw_xpm ), msg ); m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, KiScaledBitmap( zoom_redraw_xpm, this ), msg );
msg = AddHotkeyName( HELP_ZOOM_IN, g_Board_Editor_Hokeys_Descr, HK_ZOOM_IN, IS_COMMENT ); msg = AddHotkeyName( HELP_ZOOM_IN, g_Board_Editor_Hokeys_Descr, HK_ZOOM_IN, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiBitmap( zoom_in_xpm ), msg ); m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiScaledBitmap( zoom_in_xpm, this ), msg );
msg = AddHotkeyName( HELP_ZOOM_OUT, g_Board_Editor_Hokeys_Descr, HK_ZOOM_OUT, IS_COMMENT ); msg = AddHotkeyName( HELP_ZOOM_OUT, g_Board_Editor_Hokeys_Descr, HK_ZOOM_OUT, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiBitmap( zoom_out_xpm ), msg ); m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiScaledBitmap( zoom_out_xpm, this ), msg );
msg = AddHotkeyName( HELP_ZOOM_FIT, g_Board_Editor_Hokeys_Descr, HK_ZOOM_AUTO, IS_COMMENT ); msg = AddHotkeyName( HELP_ZOOM_FIT, g_Board_Editor_Hokeys_Descr, HK_ZOOM_AUTO, IS_COMMENT );
m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, KiBitmap( zoom_fit_in_page_xpm ), msg ); m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, KiScaledBitmap( zoom_fit_in_page_xpm, this ), msg );
m_mainToolBar->AddTool( ID_ZOOM_SELECTION, wxEmptyString, KiBitmap( zoom_area_xpm ), m_mainToolBar->AddTool( ID_ZOOM_SELECTION, wxEmptyString, KiScaledBitmap( zoom_area_xpm, this ),
_( "Zoom to selection" ), wxITEM_CHECK ); _( "Zoom to selection" ), wxITEM_CHECK );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
msg = AddHotkeyName( HELP_FIND, g_Board_Editor_Hokeys_Descr, HK_FIND_ITEM, IS_COMMENT ); msg = AddHotkeyName( HELP_FIND, g_Board_Editor_Hokeys_Descr, HK_FIND_ITEM, IS_COMMENT );
m_mainToolBar->AddTool( ID_FIND_ITEMS, wxEmptyString, KiBitmap( find_xpm ), msg ); m_mainToolBar->AddTool( ID_FIND_ITEMS, wxEmptyString, KiScaledBitmap( find_xpm, this ), msg );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_GET_NETLIST, wxEmptyString, KiBitmap( netlist_xpm ), m_mainToolBar->AddTool( ID_GET_NETLIST, wxEmptyString, KiScaledBitmap( netlist_xpm, this ),
_( "Read netlist" ) ); _( "Read netlist" ) );
m_mainToolBar->AddTool( ID_DRC_CONTROL, wxEmptyString, KiBitmap( erc_xpm ), m_mainToolBar->AddTool( ID_DRC_CONTROL, wxEmptyString, KiScaledBitmap( erc_xpm, this ),
_( "Perform design rules check" ) ); _( "Perform design rules check" ) );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
if( m_SelLayerBox == NULL ) if( m_SelLayerBox == NULL )
{ {
@ -291,27 +305,27 @@ void PCB_EDIT_FRAME::ReCreateHToolbar()
m_mainToolBar->AddTool( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, wxEmptyString, m_mainToolBar->AddTool( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, wxEmptyString,
*LayerPairBitmap, SEL_LAYER_HELP ); *LayerPairBitmap, SEL_LAYER_HELP );
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_TOOLBARH_PCB_MODE_MODULE, wxEmptyString, KiBitmap( mode_module_xpm ), m_mainToolBar->AddTool( ID_TOOLBARH_PCB_MODE_MODULE, wxEmptyString, KiScaledBitmap( mode_module_xpm, this ),
_( "Mode footprint: manual and automatic movement and placement" ), _( "Mode footprint: manual and automatic movement and placement" ),
wxITEM_CHECK ); wxITEM_CHECK );
m_mainToolBar->AddTool( ID_TOOLBARH_PCB_MODE_TRACKS, wxEmptyString, KiBitmap( mode_track_xpm ), m_mainToolBar->AddTool( ID_TOOLBARH_PCB_MODE_TRACKS, wxEmptyString, KiScaledBitmap( mode_track_xpm, this ),
_( "Mode track: autorouting" ), wxITEM_CHECK ); _( "Mode track: autorouting" ), wxITEM_CHECK );
// Fast call to FreeROUTE Web Bases router // Fast call to FreeROUTE Web Bases router
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_TOOLBARH_PCB_FREEROUTE_ACCESS, wxEmptyString, m_mainToolBar->AddTool( ID_TOOLBARH_PCB_FREEROUTE_ACCESS, wxEmptyString,
KiBitmap( web_support_xpm ), KiScaledBitmap( web_support_xpm, this ),
_( "Fast access to the FreeROUTE external advanced router" ) ); _( "Fast access to the FreeROUTE external advanced router" ) );
// Access to the scripting console // Access to the scripting console
#if defined(KICAD_SCRIPTING_WXPYTHON) #if defined(KICAD_SCRIPTING_WXPYTHON)
if( IsWxPythonLoaded() ) if( IsWxPythonLoaded() )
{ {
m_mainToolBar->AddSeparator(); KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_TOOLBARH_PCB_SCRIPTING_CONSOLE, wxEmptyString, m_mainToolBar->AddTool( ID_TOOLBARH_PCB_SCRIPTING_CONSOLE, wxEmptyString,
KiBitmap( py_script_xpm ), KiScaledBitmap( py_script_xpm, this ),
_( "Show/Hide the Python Scripting console" ), _( "Show/Hide the Python Scripting console" ),
wxITEM_CHECK ); wxITEM_CHECK );
} }
@ -324,174 +338,174 @@ void PCB_EDIT_FRAME::ReCreateHToolbar()
void PCB_EDIT_FRAME::ReCreateOptToolbar() void PCB_EDIT_FRAME::ReCreateOptToolbar()
{ {
if( m_optionsToolBar )
return;
wxWindowUpdateLocker dummy( this ); wxWindowUpdateLocker dummy( this );
m_optionsToolBar = new wxAuiToolBar( this, ID_OPT_TOOLBAR, wxDefaultPosition, wxDefaultSize, if( m_optionsToolBar )
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL ); m_optionsToolBar->Clear();
else
m_optionsToolBar = new wxAuiToolBar( this, ID_OPT_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_DRC_OFF, wxEmptyString, KiBitmap( drc_off_xpm ), m_optionsToolBar->AddTool( ID_TB_OPTIONS_DRC_OFF, wxEmptyString, KiScaledBitmap( drc_off_xpm, this ),
_( "Enable design rule checking" ), wxITEM_CHECK ); _( "Enable design rule checking" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString, KiBitmap( grid_xpm ), m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString, KiScaledBitmap( grid_xpm, this ),
_( "Hide grid" ), wxITEM_CHECK ); _( "Hide grid" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString,
KiBitmap( polar_coord_xpm ), KiScaledBitmap( polar_coord_xpm, this ),
_( "Display polar coordinates" ), wxITEM_CHECK ); _( "Display polar coordinates" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, wxEmptyString,
KiBitmap( unit_inch_xpm ), KiScaledBitmap( unit_inch_xpm, this ),
_( "Set units to inches" ), wxITEM_CHECK ); _( "Set units to inches" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_MM, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_MM, wxEmptyString,
KiBitmap( unit_mm_xpm ), KiScaledBitmap( unit_mm_xpm, this ),
_( "Set units to millimeters" ), wxITEM_CHECK ); _( "Set units to millimeters" ), wxITEM_CHECK );
#ifndef __APPLE__ #ifndef __APPLE__
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString,
KiBitmap( cursor_shape_xpm ), KiScaledBitmap( cursor_shape_xpm, this ),
_( "Change cursor shape" ), wxITEM_CHECK ); _( "Change cursor shape" ), wxITEM_CHECK );
#endif // !__APPLE__ #endif // !__APPLE__
m_optionsToolBar->AddSeparator(); KiScaledSeparator( m_optionsToolBar, this );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_RATSNEST, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_RATSNEST, wxEmptyString,
KiBitmap( general_ratsnest_xpm ), KiScaledBitmap( general_ratsnest_xpm, this ),
_( "Show board ratsnest" ), wxITEM_CHECK ); _( "Show board ratsnest" ), wxITEM_CHECK );
m_optionsToolBar->AddSeparator(); KiScaledSeparator( m_optionsToolBar, this );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_AUTO_DEL_TRACK, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_AUTO_DEL_TRACK, wxEmptyString,
KiBitmap( auto_delete_track_xpm ), KiScaledBitmap( auto_delete_track_xpm, this ),
_( "Enable automatic track deletion" ), _( "Enable automatic track deletion" ),
wxITEM_CHECK ); wxITEM_CHECK );
m_optionsToolBar->AddSeparator(); KiScaledSeparator( m_optionsToolBar, this );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_ZONES, wxEmptyString, KiBitmap( show_zone_xpm ), m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_ZONES, wxEmptyString, KiScaledBitmap( show_zone_xpm, this ),
_( "Show filled areas in zones" ), wxITEM_CHECK ); _( "Show filled areas in zones" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_ZONES_DISABLE, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_ZONES_DISABLE, wxEmptyString,
KiBitmap( show_zone_disable_xpm ), KiScaledBitmap( show_zone_disable_xpm, this ),
_( "Do not show filled areas in zones" ) , wxITEM_CHECK ); _( "Do not show filled areas in zones" ) , wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY, wxEmptyString,
KiBitmap( show_zone_outline_only_xpm ), KiScaledBitmap( show_zone_outline_only_xpm, this ),
_( "Show outlines of filled areas only in zones" ), wxITEM_CHECK ); _( "Show outlines of filled areas only in zones" ), wxITEM_CHECK );
m_optionsToolBar->AddSeparator(); KiScaledSeparator( m_optionsToolBar, this );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH, wxEmptyString,
KiBitmap( pad_sketch_xpm ), KiScaledBitmap( pad_sketch_xpm, this ),
_( "Show pads in outline mode" ), wxITEM_CHECK ); _( "Show pads in outline mode" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_VIAS_SKETCH, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_VIAS_SKETCH, wxEmptyString,
KiBitmap( via_sketch_xpm ), KiScaledBitmap( via_sketch_xpm, this ),
_( "Show vias in outline mode" ), wxITEM_CHECK ); _( "Show vias in outline mode" ), wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH, wxEmptyString,
KiBitmap( showtrack_xpm ), KiScaledBitmap( showtrack_xpm, this ),
_( "Show tracks in outline mode" ), _( "Show tracks in outline mode" ),
wxITEM_CHECK ); wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE, wxEmptyString,
KiBitmap( contrast_mode_xpm ), KiScaledBitmap( contrast_mode_xpm, this ),
_( "Enable high contrast display mode" ), _( "Enable high contrast display mode" ),
wxITEM_CHECK ); wxITEM_CHECK );
// Tools to show/hide toolbars: // Tools to show/hide toolbars:
m_optionsToolBar->AddSeparator(); KiScaledSeparator( m_optionsToolBar, this );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR,
wxEmptyString, wxEmptyString,
KiBitmap( layers_manager_xpm ), KiScaledBitmap( layers_manager_xpm, this ),
HELP_SHOW_HIDE_LAYERMANAGER, HELP_SHOW_HIDE_LAYERMANAGER,
wxITEM_CHECK ); wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE,
wxEmptyString, wxEmptyString,
KiBitmap( mw_toolbar_xpm ), KiScaledBitmap( mw_toolbar_xpm, this ),
HELP_SHOW_HIDE_MICROWAVE_TOOLS, HELP_SHOW_HIDE_MICROWAVE_TOOLS,
wxITEM_CHECK ); wxITEM_CHECK );
m_optionsToolBar->AddSeparator(); KiScaledSeparator( m_optionsToolBar, this );
m_optionsToolBar->Realize(); m_optionsToolBar->Realize();
} }
void PCB_EDIT_FRAME::ReCreateVToolbar() void PCB_EDIT_FRAME::ReCreateVToolbar()
{ {
if( m_drawToolBar )
return;
wxWindowUpdateLocker dummy( this ); wxWindowUpdateLocker dummy( this );
m_drawToolBar = new wxAuiToolBar( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize, if( m_drawToolBar )
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL ); m_drawToolBar->Clear();
else
m_drawToolBar = new wxAuiToolBar( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
// Set up toolbar // Set up toolbar
m_drawToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, KiBitmap( cursor_xpm ), m_drawToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, KiScaledBitmap( cursor_xpm, this ),
wxEmptyString, wxITEM_CHECK ); wxEmptyString, wxITEM_CHECK );
m_drawToolBar->AddSeparator(); KiScaledSeparator( m_drawToolBar, this );
m_drawToolBar->AddTool( ID_PCB_HIGHLIGHT_BUTT, wxEmptyString, KiBitmap( net_highlight_xpm ), m_drawToolBar->AddTool( ID_PCB_HIGHLIGHT_BUTT, wxEmptyString, KiScaledBitmap( net_highlight_xpm, this ),
_( "Highlight net" ), wxITEM_CHECK ); _( "Highlight net" ), wxITEM_CHECK );
m_drawToolBar->AddTool( ID_PCB_SHOW_1_RATSNEST_BUTT, wxEmptyString, m_drawToolBar->AddTool( ID_PCB_SHOW_1_RATSNEST_BUTT, wxEmptyString,
KiBitmap( tool_ratsnest_xpm ), KiScaledBitmap( tool_ratsnest_xpm, this ),
_( "Display local ratsnest" ), wxITEM_CHECK ); _( "Display local ratsnest" ), wxITEM_CHECK );
m_drawToolBar->AddSeparator(); KiScaledSeparator( m_drawToolBar, this );
m_drawToolBar->AddTool( ID_PCB_MODULE_BUTT, wxEmptyString, KiBitmap( module_xpm ), m_drawToolBar->AddTool( ID_PCB_MODULE_BUTT, wxEmptyString, KiScaledBitmap( module_xpm, this ),
_( "Add footprints" ), wxITEM_CHECK ); _( "Add footprints" ), wxITEM_CHECK );
m_drawToolBar->AddTool( ID_TRACK_BUTT, wxEmptyString, KiBitmap( add_tracks_xpm ), m_drawToolBar->AddTool( ID_TRACK_BUTT, wxEmptyString, KiScaledBitmap( add_tracks_xpm, this ),
_( "Route tracks" ), wxITEM_CHECK ); _( "Route tracks" ), wxITEM_CHECK );
m_drawToolBar->AddTool( ID_PCB_DRAW_VIA_BUTT, wxEmptyString, KiBitmap( add_via_xpm ), m_drawToolBar->AddTool( ID_PCB_DRAW_VIA_BUTT, wxEmptyString, KiScaledBitmap( add_via_xpm, this ),
_( "Add vias" ), wxITEM_CHECK ); _( "Add vias" ), wxITEM_CHECK );
m_drawToolBar->AddTool( ID_PCB_ZONES_BUTT, wxEmptyString, KiBitmap( add_zone_xpm ), m_drawToolBar->AddTool( ID_PCB_ZONES_BUTT, wxEmptyString, KiScaledBitmap( add_zone_xpm, this ),
_( "Add filled zones" ), wxITEM_CHECK ); _( "Add filled zones" ), wxITEM_CHECK );
m_drawToolBar->AddTool( ID_PCB_KEEPOUT_AREA_BUTT, wxEmptyString, m_drawToolBar->AddTool( ID_PCB_KEEPOUT_AREA_BUTT, wxEmptyString,
KiBitmap( add_keepout_area_xpm ), KiScaledBitmap( add_keepout_area_xpm, this ),
_( "Add keepout areas" ), wxITEM_CHECK ); _( "Add keepout areas" ), wxITEM_CHECK );
m_drawToolBar->AddSeparator(); KiScaledSeparator( m_drawToolBar, this );
m_drawToolBar->AddTool( ID_PCB_ADD_LINE_BUTT, wxEmptyString, KiBitmap( add_graphical_segments_xpm ), m_drawToolBar->AddTool( ID_PCB_ADD_LINE_BUTT, wxEmptyString, KiScaledBitmap( add_graphical_segments_xpm, this ),
_( "Add graphic lines" ), wxITEM_CHECK ); _( "Add graphic lines" ), wxITEM_CHECK );
m_drawToolBar->AddTool( ID_PCB_CIRCLE_BUTT, wxEmptyString, KiBitmap( add_circle_xpm ), m_drawToolBar->AddTool( ID_PCB_CIRCLE_BUTT, wxEmptyString, KiScaledBitmap( add_circle_xpm, this ),
_( "Add graphic circle" ), wxITEM_CHECK ); _( "Add graphic circle" ), wxITEM_CHECK );
m_drawToolBar->AddTool( ID_PCB_ARC_BUTT, wxEmptyString, KiBitmap( add_arc_xpm ), m_drawToolBar->AddTool( ID_PCB_ARC_BUTT, wxEmptyString, KiScaledBitmap( add_arc_xpm, this ),
_( "Add graphic arc" ), wxITEM_CHECK ); _( "Add graphic arc" ), wxITEM_CHECK );
m_drawToolBar->AddTool( ID_PCB_ADD_POLYGON_BUTT, wxEmptyString, KiBitmap( add_graphical_polygon_xpm ), m_drawToolBar->AddTool( ID_PCB_ADD_POLYGON_BUTT, wxEmptyString, KiScaledBitmap( add_graphical_polygon_xpm, this ),
_( "Add graphic polygon" ), wxITEM_CHECK ); _( "Add graphic polygon" ), wxITEM_CHECK );
m_drawToolBar->AddTool( ID_PCB_ADD_TEXT_BUTT, wxEmptyString, KiBitmap( text_xpm ), m_drawToolBar->AddTool( ID_PCB_ADD_TEXT_BUTT, wxEmptyString, KiScaledBitmap( text_xpm, this ),
_( "Add text on copper layers or graphic text" ), wxITEM_CHECK ); _( "Add text on copper layers or graphic text" ), wxITEM_CHECK );
m_drawToolBar->AddSeparator(); KiScaledSeparator( m_drawToolBar, this );
m_drawToolBar->AddTool( ID_PCB_DIMENSION_BUTT, wxEmptyString, KiBitmap( add_dimension_xpm ), m_drawToolBar->AddTool( ID_PCB_DIMENSION_BUTT, wxEmptyString, KiScaledBitmap( add_dimension_xpm, this ),
_( "Add dimension" ), wxITEM_CHECK ); _( "Add dimension" ), wxITEM_CHECK );
m_drawToolBar->AddTool( ID_PCB_TARGET_BUTT, wxEmptyString, KiBitmap( add_pcb_target_xpm ), m_drawToolBar->AddTool( ID_PCB_TARGET_BUTT, wxEmptyString, KiScaledBitmap( add_pcb_target_xpm, this ),
_( "Add layer alignment target" ), wxITEM_CHECK ); _( "Add layer alignment target" ), wxITEM_CHECK );
m_drawToolBar->AddSeparator(); KiScaledSeparator( m_drawToolBar, this );
m_drawToolBar->AddTool( ID_PCB_DELETE_ITEM_BUTT, wxEmptyString, KiBitmap( delete_xpm ), m_drawToolBar->AddTool( ID_PCB_DELETE_ITEM_BUTT, wxEmptyString, KiScaledBitmap( delete_xpm, this ),
_( "Delete items" ), wxITEM_CHECK ); _( "Delete items" ), wxITEM_CHECK );
m_drawToolBar->AddSeparator(); KiScaledSeparator( m_drawToolBar, this );
m_drawToolBar->AddTool( ID_PCB_PLACE_OFFSET_COORD_BUTT, wxEmptyString, m_drawToolBar->AddTool( ID_PCB_PLACE_OFFSET_COORD_BUTT, wxEmptyString,
KiBitmap( pcb_offset_xpm ), KiScaledBitmap( pcb_offset_xpm, this ),
_( "Place the origin point for drill and place files" ), _( "Place the origin point for drill and place files" ),
wxITEM_CHECK ); wxITEM_CHECK );
m_drawToolBar->AddTool( ID_PCB_PLACE_GRID_COORD_BUTT, wxEmptyString, m_drawToolBar->AddTool( ID_PCB_PLACE_GRID_COORD_BUTT, wxEmptyString,
KiBitmap( grid_select_axis_xpm ), KiScaledBitmap( grid_select_axis_xpm, this ),
_( "Set the origin point for the grid" ), _( "Set the origin point for the grid" ),
wxITEM_CHECK ); wxITEM_CHECK );
m_drawToolBar->AddTool( ID_PCB_MEASUREMENT_TOOL, wxEmptyString, m_drawToolBar->AddTool( ID_PCB_MEASUREMENT_TOOL, wxEmptyString,
KiBitmap( measurement_xpm ), KiScaledBitmap( measurement_xpm, this ),
_( "Measure distance" ), _( "Measure distance" ),
wxITEM_CHECK ); wxITEM_CHECK );
@ -503,39 +517,40 @@ void PCB_EDIT_FRAME::ReCreateVToolbar()
*/ */
void PCB_EDIT_FRAME::ReCreateMicrowaveVToolbar() void PCB_EDIT_FRAME::ReCreateMicrowaveVToolbar()
{ {
if( m_microWaveToolBar )
return;
wxWindowUpdateLocker dummy(this); wxWindowUpdateLocker dummy(this);
m_microWaveToolBar = new wxAuiToolBar( this, ID_MICROWAVE_V_TOOLBAR, wxDefaultPosition, if( m_microWaveToolBar )
wxDefaultSize, KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL ); m_microWaveToolBar->Clear();
else
m_microWaveToolBar = new wxAuiToolBar( this, ID_MICROWAVE_V_TOOLBAR, wxDefaultPosition,
wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
// Set up toolbar // Set up toolbar
m_microWaveToolBar->AddTool( ID_PCB_MUWAVE_TOOL_SELF_CMD, wxEmptyString, m_microWaveToolBar->AddTool( ID_PCB_MUWAVE_TOOL_SELF_CMD, wxEmptyString,
KiBitmap( mw_add_line_xpm ), KiScaledBitmap( mw_add_line_xpm, this ),
_( "Create line of specified length for microwave applications" ), _( "Create line of specified length for microwave applications" ),
wxITEM_CHECK ); wxITEM_CHECK );
m_microWaveToolBar->AddTool( ID_PCB_MUWAVE_TOOL_GAP_CMD, wxEmptyString, m_microWaveToolBar->AddTool( ID_PCB_MUWAVE_TOOL_GAP_CMD, wxEmptyString,
KiBitmap( mw_add_gap_xpm ), KiScaledBitmap( mw_add_gap_xpm, this ),
_( "Create gap of specified length for microwave applications" ), _( "Create gap of specified length for microwave applications" ),
wxITEM_CHECK ); wxITEM_CHECK );
m_microWaveToolBar->AddSeparator(); KiScaledSeparator( m_microWaveToolBar, this );
m_microWaveToolBar->AddTool( ID_PCB_MUWAVE_TOOL_STUB_CMD, wxEmptyString, m_microWaveToolBar->AddTool( ID_PCB_MUWAVE_TOOL_STUB_CMD, wxEmptyString,
KiBitmap( mw_add_stub_xpm ), KiScaledBitmap( mw_add_stub_xpm, this ),
_( "Create stub of specified length for microwave applications" ), _( "Create stub of specified length for microwave applications" ),
wxITEM_CHECK ); wxITEM_CHECK );
m_microWaveToolBar->AddTool( ID_PCB_MUWAVE_TOOL_STUB_ARC_CMD, wxEmptyString, m_microWaveToolBar->AddTool( ID_PCB_MUWAVE_TOOL_STUB_ARC_CMD, wxEmptyString,
KiBitmap( mw_add_stub_arc_xpm ), KiScaledBitmap( mw_add_stub_arc_xpm, this ),
_( "Create stub (arc) of specified length for microwave applications" ), _( "Create stub (arc) of specified length for microwave applications" ),
wxITEM_CHECK ); wxITEM_CHECK );
m_microWaveToolBar->AddTool( ID_PCB_MUWAVE_TOOL_FUNCTION_SHAPE_CMD, wxEmptyString, m_microWaveToolBar->AddTool( ID_PCB_MUWAVE_TOOL_FUNCTION_SHAPE_CMD, wxEmptyString,
KiBitmap( mw_add_shape_xpm ), KiScaledBitmap( mw_add_shape_xpm, this ),
_( "Create a polynomial shape for microwave applications" ), _( "Create a polynomial shape for microwave applications" ),
wxITEM_CHECK ); wxITEM_CHECK );
@ -583,18 +598,18 @@ void PCB_EDIT_FRAME::ReCreateAuxiliaryToolbar()
0, NULL ); 0, NULL );
updateViaSizeSelectBox(); updateViaSizeSelectBox();
m_auxiliaryToolBar->AddControl( m_SelViaSizeBox ); m_auxiliaryToolBar->AddControl( m_SelViaSizeBox );
m_auxiliaryToolBar->AddSeparator(); KiScaledSeparator( m_auxiliaryToolBar, this );
// Creates box to display and choose strategy to handle tracks an vias sizes: // Creates box to display and choose strategy to handle tracks an vias sizes:
m_auxiliaryToolBar->AddTool( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH, m_auxiliaryToolBar->AddTool( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH,
wxEmptyString, wxEmptyString,
KiBitmap( auto_track_width_xpm ), KiScaledBitmap( auto_track_width_xpm, this ),
_( "Auto track width: when starting on an existing track " _( "Auto track width: when starting on an existing track "
"use its width\notherwise, use current width setting" ), "use its width\notherwise, use current width setting" ),
wxITEM_CHECK ); wxITEM_CHECK );
// Add the box to display and select the current grid size: // Add the box to display and select the current grid size:
m_auxiliaryToolBar->AddSeparator(); KiScaledSeparator( m_auxiliaryToolBar, this );
m_gridSelectBox = new wxChoice( m_auxiliaryToolBar, m_gridSelectBox = new wxChoice( m_auxiliaryToolBar,
ID_ON_GRID_SELECT, ID_ON_GRID_SELECT,
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,
@ -603,7 +618,7 @@ void PCB_EDIT_FRAME::ReCreateAuxiliaryToolbar()
m_auxiliaryToolBar->AddControl( m_gridSelectBox ); m_auxiliaryToolBar->AddControl( m_gridSelectBox );
// Add the box to display and select the current Zoom // Add the box to display and select the current Zoom
m_auxiliaryToolBar->AddSeparator(); KiScaledSeparator( m_auxiliaryToolBar, this );
m_zoomSelectBox = new wxChoice( m_auxiliaryToolBar, m_zoomSelectBox = new wxChoice( m_auxiliaryToolBar,
ID_ON_ZOOM_SELECT, ID_ON_ZOOM_SELECT,
wxDefaultPosition, wxDefaultSize, wxDefaultPosition, wxDefaultSize,

View File

@ -2,26 +2,21 @@
* 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) 2010 Jean-Pierre Charras, jp.charras@wanadoo.fr * Copyright (C) 2010 Jean-Pierre Charras, jp.charras@wanadoo.fr
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2018 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
* modify it under the terms of the GNU General Public License * under the terms of the GNU General Public License as published by the
* as published by the Free Software Foundation; either version 2 * Free Software Foundation, either version 3 of the License, or (at your
* of the License, or (at your option) any later version. * option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful, but
* but WITHOUT ANY WARRANTY; without even the implied warranty of * WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* GNU General Public License for more details. * General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License along
* along with this program; if not, you may find one here: * with this program. If not, see <http://www.gnu.org/licenses/>.
* 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
*/ */
/** /**
* @file wxPcbStruct.h * @file wxPcbStruct.h
*/ */
@ -1719,6 +1714,9 @@ public:
*/ */
void UpdateTitle(); void UpdateTitle();
int GetIconScale() override;
void SetIconScale( int aScale ) override;
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };