7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-11 10:40:13 +00:00

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/unit_binder.cpp
widgets/widget_hotkey_list.cpp
widgets/stepped_slider.cpp
)
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.
*
* 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
* modify it under the terms of the GNU General Public License
@ -28,10 +28,52 @@
#include <wx/mstream.h>
#include <wx/menu.h>
#include <wx/menuitem.h>
#include <wx/aui/auibar.h>
#include <cstdint>
#include <mutex>
#include <unordered_map>
#include <common.h>
#include <bitmaps.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 )
{
@ -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 )
{
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) 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
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is 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.
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
@ -41,66 +37,66 @@
void CVPCB_MAINFRAME::ReCreateHToolbar()
{
if( m_mainToolBar != NULL )
return;
if( m_mainToolBar )
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,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
m_mainToolBar->AddTool( wxID_SAVE, wxEmptyString, KiScaledBitmap( save_xpm, this ), SAVE_HLP_MSG );
m_mainToolBar->AddTool( wxID_SAVE, wxEmptyString, KiBitmap( save_xpm ), SAVE_HLP_MSG );
m_mainToolBar->AddSeparator();
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_CVPCB_LIB_TABLE_EDIT, wxEmptyString,
KiBitmap( config_xpm ),
KiScaledBitmap( config_xpm, this ),
_( "Edit footprint library table" ) );
m_mainToolBar->AddSeparator();
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_CVPCB_CREATE_SCREENCMP, wxEmptyString,
KiBitmap( show_footprint_xpm ),
KiScaledBitmap( show_footprint_xpm, this ),
_( "View selected footprint" ) );
m_mainToolBar->AddSeparator();
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_CVPCB_GOTO_PREVIOUSNA, wxEmptyString,
KiBitmap( left_xpm ),
KiScaledBitmap( left_xpm, this ),
_( "Select previous unlinked symbol" ) );
m_mainToolBar->AddTool( ID_CVPCB_GOTO_FIRSTNA, wxEmptyString,
KiBitmap( right_xpm ),
KiScaledBitmap( right_xpm, this ),
_( "Select next unlinked symbol" ) );
m_mainToolBar->AddSeparator();
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_CVPCB_AUTO_ASSOCIE, wxEmptyString,
KiBitmap( auto_associe_xpm ),
KiScaledBitmap( auto_associe_xpm, this ),
_( "Perform automatic footprint association" ) );
m_mainToolBar->AddTool( ID_CVPCB_DEL_ASSOCIATIONS, wxEmptyString,
KiBitmap( delete_association_xpm ),
KiScaledBitmap( delete_association_xpm, this ),
_( "Delete all footprint associations" ) );
m_mainToolBar->AddSeparator();
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST,
KiBitmap( module_filtered_list_xpm ),
KiScaledBitmap( module_filtered_list_xpm, this ),
wxNullBitmap,
true, NULL,
_( "Filter footprint list by schematic symbol keywords" ),
wxEmptyString );
m_mainToolBar->AddTool( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST,
KiBitmap( module_pin_filtered_list_xpm ),
KiScaledBitmap( module_pin_filtered_list_xpm, this ),
wxNullBitmap,
true, NULL,
_( "Filter footprint list by pin count" ),
wxEmptyString );
m_mainToolBar->AddTool( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST,
KiBitmap( module_library_list_xpm ),
KiScaledBitmap( module_library_list_xpm, this ),
wxNullBitmap, true, NULL,
_( "Filter footprint list by library" ),
wxEmptyString );
m_mainToolBar->AddSeparator();
KiScaledSeparator( m_mainToolBar, this );
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,
_( "Filter footprint list using a partial name or a pattern" ),
wxEmptyString );

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* 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
* modify it under the terms of the GNU General Public License
@ -34,13 +34,15 @@
#include "../widgets/widget_eeschema_color_config.h"
#include <schframe.h>
#include <hotkeys.h>
#include <bitmap_types.h>
#include <wx/settings.h>
int DIALOG_EESCHEMA_OPTIONS::m_lastPageSelected = 0;
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_sdbSizerOK->SetDefault();
@ -53,6 +55,8 @@ DIALOG_EESCHEMA_OPTIONS::DIALOG_EESCHEMA_OPTIONS( SCH_EDIT_FRAME* parent ) :
m_fieldGrid->AutoSizeColLabelSize( i );
}
m_scaleSlider->SetStep( 25 );
// Embed the hotkeys list
HOTKEY_SECTIONS sections = WIDGET_HOTKEY_LIST::GenSections( g_Eeschema_Hokeys_Descr );
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 );
}
void DIALOG_EESCHEMA_OPTIONS::GetRefIdSeparator( int& aSep, int& aFirstId)
{
// m_choiceSeparatorRefId displays one of
@ -191,7 +196,7 @@ void DIALOG_EESCHEMA_OPTIONS::OnAddButtonClick( wxCommandEvent& event )
}
}
TransferDataFromWindow();
TransferDataFromFieldGrid();
TEMPLATE_FIELDNAMES::iterator pos;
@ -205,7 +210,7 @@ void DIALOG_EESCHEMA_OPTIONS::OnAddButtonClick( wxCommandEvent& event )
newFieldname.m_Value = wxT( "Value" );
newFieldname.m_Visible = false;
templateFields.insert( pos, newFieldname );
TransferDataToWindow();
TransferDataToFieldGrid();
event.Skip();
}
@ -227,7 +232,7 @@ void DIALOG_EESCHEMA_OPTIONS::OnDeleteButtonClick( wxCommandEvent& event )
}
}
TransferDataFromWindow();
TransferDataFromFieldGrid();
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() )
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();
if( m_fieldGrid->GetNumberRows() )
@ -281,30 +367,12 @@ bool DIALOG_EESCHEMA_OPTIONS::TransferDataToWindow()
m_fieldGrid->AutoSizeRows();
m_fieldGrid->Thaw();
Layout();
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 )
{
templateFields[row].m_Name = m_fieldGrid->GetCellValue( row, 0 );
@ -315,14 +383,13 @@ bool DIALOG_EESCHEMA_OPTIONS::TransferDataFromWindow()
return true;
}
void DIALOG_EESCHEMA_OPTIONS::SetTemplateFields( const TEMPLATE_FIELDNAMES& aFields )
{
// Set the template fields object
templateFields = aFields;
// Build and refresh the view
TransferDataToWindow();
TransferDataToFieldGrid();
}

View File

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

View File

@ -11,6 +11,8 @@
BEGIN_EVENT_TABLE( DIALOG_EESCHEMA_OPTIONS_BASE, DIALOG_SHIM )
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_BUTTON( wxID_ADD_FIELD, DIALOG_EESCHEMA_OPTIONS_BASE::_wxFB_OnAddButtonClick )
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( 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 );
@ -119,7 +141,7 @@ DIALOG_EESCHEMA_OPTIONS_BASE::DIALOG_EESCHEMA_OPTIONS_BASE( wxWindow* parent, wx
m_panel5->SetSizer( bSizer82 );
m_panel5->Layout();
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 );
wxBoxSizer* bSizer8;
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->Layout();
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 );

View File

@ -187,7 +187,7 @@
<object class="notebookpage" expanded="1">
<property name="bitmap"></property>
<property name="label">Display</property>
<property name="select">0</property>
<property name="select">1</property>
<object class="wxPanel" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
@ -1226,6 +1226,388 @@
<property name="width">0</property>
</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 class="sizeritem" expanded="0">
@ -4406,7 +4788,7 @@
<object class="notebookpage" expanded="0">
<property name="bitmap"></property>
<property name="label">Default Fields</property>
<property name="select">1</property>
<property name="select">0</property>
<object class="wxPanel" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>

View File

@ -11,6 +11,7 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include "widgets/stepped_slider.h"
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
@ -20,9 +21,10 @@
#include <wx/settings.h>
#include <wx/choice.h>
#include <wx/spinctrl.h>
#include <wx/slider.h>
#include <wx/checkbox.h>
#include <wx/sizer.h>
#include <wx/statline.h>
#include <wx/checkbox.h>
#include <wx/panel.h>
#include <wx/bitmap.h>
#include <wx/image.h>
@ -44,6 +46,8 @@ class DIALOG_EESCHEMA_OPTIONS_BASE : public DIALOG_SHIM
// Private event handlers
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_OnAddButtonClick( wxCommandEvent& event ){ OnAddButtonClick( 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_staticText26;
wxChoice* m_choiceSeparatorRefId;
wxStaticText* m_stIconScale;
STEPPED_SLIDER* m_scaleSlider;
wxStaticText* m_staticText211;
wxCheckBox* m_scaleAuto;
wxStaticLine* m_staticline3;
wxCheckBox* m_checkShowGrid;
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 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 OnAddButtonClick( 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) 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
* 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_BASE( parent )
DIALOG_LIBEDIT_OPTIONS_BASE( parent ),
m_last_scale( -1 )
{
m_sdbSizerOK->SetDefault();
@ -43,10 +44,72 @@ DIALOG_LIBEDIT_OPTIONS::DIALOG_LIBEDIT_OPTIONS( LIB_EDIT_FRAME* parent ) :
SetItemRepeatStep( Parent()->GetRepeatStep() );
SetPinRepeatStep( Parent()->GetRepeatPinStep() );
m_scaleSlider->SetStep( 25 );
// Now all widgets have the size fixed, call 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 )
{
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.
*
* 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
* modify it under the terms of the GNU General Public License
@ -92,6 +92,14 @@ public:
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__

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/
//
// 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 )
{
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 );
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 );

View File

@ -2349,6 +2349,388 @@
<property name="width">0</property>
</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 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/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -11,6 +11,7 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include "widgets/stepped_slider.h"
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
@ -20,9 +21,10 @@
#include <wx/settings.h>
#include <wx/choice.h>
#include <wx/spinctrl.h>
#include <wx/slider.h>
#include <wx/checkbox.h>
#include <wx/sizer.h>
#include <wx/statline.h>
#include <wx/checkbox.h>
#include <wx/button.h>
#include <wx/dialog.h>
@ -34,7 +36,13 @@
///////////////////////////////////////////////////////////////////////////////
class DIALOG_LIBEDIT_OPTIONS_BASE : public DIALOG_SHIM
{
DECLARE_EVENT_TABLE()
private:
// Private event handlers
void _wxFB_OnScaleSlider( wxScrollEvent& event ){ OnScaleSlider( event ); }
void _wxFB_OnScaleAuto( wxCommandEvent& event ){ OnScaleAuto( event ); }
protected:
wxStaticText* m_staticText3;
@ -63,6 +71,10 @@ class DIALOG_LIBEDIT_OPTIONS_BASE : public DIALOG_SHIM
wxStaticText* m_staticText16;
wxStaticText* m_staticText17;
wxSpinCtrl* m_spinRepeatLabel;
wxStaticText* m_staticText18;
STEPPED_SLIDER* m_scaleSlider;
wxStaticText* m_staticText19;
wxCheckBox* m_scaleAuto;
wxStaticLine* m_staticline3;
wxCheckBox* m_checkShowGrid;
wxCheckBox* m_checkShowPinElectricalType;
@ -70,6 +82,11 @@ class DIALOG_LIBEDIT_OPTIONS_BASE : public DIALOG_SHIM
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
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:

View File

@ -430,6 +430,8 @@ const wxChar RescueNeverShowEntry[] = wxT( "RescueNeverShow" );
const wxChar AutoplaceFieldsEntry[] = wxT( "AutoplaceFields" );
const wxChar AutoplaceJustifyEntry[] = wxT( "AutoplaceJustify" );
const wxChar AutoplaceAlignEntry[] = wxT( "AutoplaceAlign" );
const wxChar SchIconScaleEntry[] = wxT( "SchIconScale" );
const wxChar LibIconScaleEntry[] = wxT( "LibIconScale" );
static const wxChar FootprintPreviewEntry[] = wxT( "FootprintPreview" );
static const wxChar DefaultBusWidthEntry[] = wxT( "DefaultBusWidth" );
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
*/
@ -11,5 +30,7 @@ extern const wxChar RescueNeverShowEntry[];
extern const wxChar AutoplaceFieldsEntry[];
extern const wxChar AutoplaceJustifyEntry[];
extern const wxChar AutoplaceAlignEntry[];
extern const wxChar LibIconScaleEntry[];
extern const wxChar SchIconScaleEntry[];
#endif // EESCHEMA_CONFIG_H

View File

@ -54,6 +54,7 @@
#include <kicad_device_context.h>
#include <hotkeys.h>
#include <eeschema_config.h>
#include <dialogs/dialog_lib_edit_text.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();
}
CreateOptionToolbar();
ReCreateOptToolbar();
DisplayLibInfos();
DisplayCmpDoc();
UpdateAliasSelectList();
@ -1747,3 +1748,23 @@ void LIB_EDIT_FRAME::emptyScreen()
Zoom_Automatique( false );
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) 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
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
@ -377,7 +377,7 @@ public:
void OnCloseWindow( wxCloseEvent& Event );
void ReCreateHToolbar() override;
void ReCreateVToolbar() override;
void CreateOptionToolbar();
void ReCreateOptToolbar();
void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) override;
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) override;
double BestZoom() override; // Returns the best zoom
@ -697,6 +697,9 @@ public:
*/
void SyncLibraries( bool aLoad );
int GetIconScale() override;
void SetIconScale( int aScale ) override;
private:
///> Helper screen used when no part is loaded
SCH_SCREEN* m_dummyScreen;

View File

@ -2,7 +2,7 @@
* 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) 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
* 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 );
}
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; }
int GetIconScale() override;
void SetIconScale( int aScale ) override;
///> Probe cursor, used by circuit simulator
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) 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
* modify it under the terms of the GNU General Public License
@ -47,44 +47,44 @@
void LIB_EDIT_FRAME::ReCreateVToolbar()
{
if( m_drawToolBar != NULL )
return;
m_drawToolBar = new wxAuiToolBar( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
if( m_drawToolBar )
m_drawToolBar->Clear();
else
m_drawToolBar = new wxAuiToolBar( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
// 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 );
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 );
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 );
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 );
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 );
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 );
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 );
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 );
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 );
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 );
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 );
m_drawToolBar->Realize();
@ -95,99 +95,104 @@ void LIB_EDIT_FRAME::ReCreateHToolbar()
{
wxString msg;
// Create the toolbar if not exists
if( m_mainToolBar != NULL )
return;
m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
if( m_mainToolBar )
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
m_mainToolBar->AddTool( ID_LIBEDIT_NEW_LIBRARY, wxEmptyString,
KiBitmap( new_library_xpm ),
KiScaledBitmap( new_library_xpm, this ),
_( "Create a new library" ) );
m_mainToolBar->AddTool( ID_LIBEDIT_ADD_LIBRARY, wxEmptyString,
KiBitmap( add_library_xpm ),
KiScaledBitmap( add_library_xpm, this ),
_( "Add an existing library" ) );
m_mainToolBar->AddTool( ID_LIBEDIT_SAVE_LIBRARY, wxEmptyString,
KiBitmap( save_library_xpm ),
KiScaledBitmap( save_library_xpm, this ),
_( "Save current library" ) );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_LIBEDIT_NEW_PART, wxEmptyString, KiBitmap( new_component_xpm ),
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_LIBEDIT_NEW_PART, wxEmptyString, KiScaledBitmap( new_component_xpm, this ),
_( "Create new symbol" ) );
m_mainToolBar->AddTool( ID_LIBEDIT_SAVE_PART, wxEmptyString,
KiBitmap( save_part_xpm ),
KiScaledBitmap( save_part_xpm, this ),
_( "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" ) );
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" ) );
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" ) );
m_mainToolBar->AddSeparator();
KiScaledSeparator( m_mainToolBar, this );
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 );
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,
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,
KiBitmap( text_xpm ),
KiScaledBitmap( text_xpm, this ),
_( "Edit field properties" ) );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_LIBEDIT_CHECK_PART, wxEmptyString, KiBitmap( erc_xpm ),
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_LIBEDIT_CHECK_PART, wxEmptyString, KiScaledBitmap( erc_xpm, this ),
_( "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 );
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 );
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 );
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 );
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 );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_DE_MORGAN_NORMAL_BUTT, wxEmptyString, KiBitmap( morgan1_xpm ),
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_DE_MORGAN_NORMAL_BUTT, wxEmptyString, KiScaledBitmap( morgan1_xpm, this ),
_( "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 );
m_mainToolBar->AddSeparator();
m_mainToolBar->AddTool( ID_LIBEDIT_VIEW_DOC, wxEmptyString, KiBitmap( datasheet_xpm ),
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_LIBEDIT_VIEW_DOC, wxEmptyString, KiScaledBitmap( datasheet_xpm, this ),
_( "Show associated datasheet or document" ) );
m_mainToolBar->AddSeparator();
KiScaledSeparator( m_mainToolBar, this );
m_partSelectBox = new wxComboBox( m_mainToolBar,
ID_LIBEDIT_SELECT_PART_NUMBER,
wxEmptyString,
wxDefaultPosition,
wxSize( LISTBOX_WIDTH, -1 ),
0, NULL, wxCB_READONLY );
0, nullptr, wxCB_READONLY );
m_mainToolBar->AddControl( m_partSelectBox );
m_aliasSelectBox = new wxComboBox( m_mainToolBar,
@ -195,19 +200,20 @@ void LIB_EDIT_FRAME::ReCreateHToolbar()
wxEmptyString,
wxDefaultPosition,
wxSize( LISTBOX_WIDTH, -1 ),
0, NULL, wxCB_READONLY );
0, nullptr, wxCB_READONLY );
m_mainToolBar->AddControl( m_aliasSelectBox );
m_mainToolBar->AddSeparator();
KiScaledSeparator( m_mainToolBar, this );
msg = _( "Allows disabling pin edition coupling between units.\n"
"When not disabled, adding, deleting and moving pins are synchronized\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"
"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." );
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 );
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" ) );
// 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 )
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,
KICAD_AUI_TB_STYLE | wxAUI_TB_VERTICAL );
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 );
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 );
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 );
#ifndef __APPLE__
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString,
KiBitmap( cursor_shape_xpm ),
KiScaledBitmap( cursor_shape_xpm, this ),
_( "Change cursor shape" ), wxITEM_CHECK );
#endif // !__APPLE__
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 );
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 );
m_optionsToolBar->Realize();

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
* 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
* modify it under the terms of the GNU General Public License
@ -44,133 +44,140 @@
*/
void SCH_EDIT_FRAME::ReCreateHToolbar()
{
if( m_mainToolBar != NULL )
return;
if( m_mainToolBar )
m_mainToolBar->Clear();
else
m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
wxString msg;
m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
// Set up toolbar
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:
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" ) );
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" ) );
}
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" ) );
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" ) );
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" ) );
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" ) );
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" ) );
m_mainToolBar->AddSeparator();
KiScaledSeparator( m_mainToolBar, this );
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 );
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 );
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" ),
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 );
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 );
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 );
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 );
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 );
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" ) );
m_mainToolBar->AddTool( ID_POPUP_SCH_LEAVE_SHEET, wxEmptyString, KiBitmap( leave_sheet_xpm ),
_( "Leave sheet" ) );
m_mainToolBar->AddTool( ID_POPUP_SCH_LEAVE_SHEET, wxEmptyString,
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 );
m_mainToolBar->AddTool( ID_TO_LIBVIEW, wxEmptyString, KiBitmap( library_browse_xpm ),
HELP_RUN_LIB_VIEWER );
m_mainToolBar->AddTool( ID_TO_LIBVIEW, wxEmptyString,
KiScaledBitmap( library_browse_xpm, this ), HELP_RUN_LIB_VIEWER );
// modedit is with libedit in a "library section" because the user must have footprints before
// 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" ) );
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 );
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" ) );
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" ) );
m_mainToolBar->AddTool( ID_GET_NETLIST, wxEmptyString, KiBitmap( netlist_xpm ),
m_mainToolBar->AddTool( ID_GET_NETLIST, wxEmptyString, KiScaledBitmap( netlist_xpm, this ),
_( "Generate netlist" ) );
m_mainToolBar->AddTool( ID_OPEN_CMP_TABLE, wxEmptyString, KiBitmap( spreadsheet_xpm ),
_( "Edit symbol fields" ) );
m_mainToolBar->AddTool( ID_OPEN_CMP_TABLE, wxEmptyString,
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 );
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" ) );
m_mainToolBar->AddTool( ID_BACKANNO_ITEMS, wxEmptyString,
KiBitmap( import_footprint_names_xpm ),
KiScaledBitmap( import_footprint_names_xpm, this ),
HELP_IMPORT_FOOTPRINTS );
// 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()
{
if( m_drawToolBar )
return;
m_drawToolBar = new wxAuiToolBar( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize,
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
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 );
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 );
m_drawToolBar->AddTool( ID_SCH_PLACE_COMPONENT, wxEmptyString, KiBitmap( add_component_xpm ),
HELP_PLACE_COMPONENTS, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_SCH_PLACE_COMPONENT, wxEmptyString,
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 );
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 );
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 );
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 );
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 );
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 );
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 );
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 );
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 );
m_drawToolBar->AddTool( ID_HIERLABEL_BUTT, wxEmptyString,
KiBitmap( add_hierarchical_label_xpm ),
KiScaledBitmap( add_hierarchical_label_xpm, this ),
HELP_PLACE_HIER_LABEL, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_SHEET_SYMBOL_BUTT, wxEmptyString,
KiBitmap( add_hierarchical_subsheet_xpm ),
KiScaledBitmap( add_hierarchical_subsheet_xpm, this ),
HELP_PLACE_SHEET, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_IMPORT_HLABEL_BUTT, wxEmptyString,
KiBitmap( import_hierarchical_label_xpm ),
KiScaledBitmap( import_hierarchical_label_xpm, this ),
HELP_IMPORT_SHEETPIN, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_SHEET_PIN_BUTT, wxEmptyString,
KiBitmap( add_hierar_pin_xpm ),
KiScaledBitmap( add_hierar_pin_xpm, this ),
HELP_PLACE_SHEETPIN, wxITEM_CHECK );
m_drawToolBar->AddTool( ID_LINE_COMMENT_BUTT, wxEmptyString,
KiBitmap( add_dashed_line_xpm ),
KiScaledBitmap( add_dashed_line_xpm, this ),
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 );
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 );
m_drawToolBar->AddTool( ID_SCHEMATIC_DELETE_ITEM_BUTT, wxEmptyString,
KiBitmap( delete_xpm ),
KiScaledBitmap( delete_xpm, this ),
HELP_DELETE_ITEMS, wxITEM_CHECK );
m_drawToolBar->Realize();
@ -264,37 +278,37 @@ void SCH_EDIT_FRAME::ReCreateVToolbar()
void SCH_EDIT_FRAME::ReCreateOptToolbar()
{
if( m_optionsToolBar )
return;
m_optionsToolBar = new wxAuiToolBar( this, ID_OPT_TOOLBAR, wxDefaultPosition, wxDefaultSize,
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_SHOW_GRID, wxEmptyString,
KiBitmap( grid_xpm ),
KiScaledBitmap( grid_xpm, this ),
_( "Turn grid off" ), wxITEM_CHECK );
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 );
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 );
#ifndef __APPLE__
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString,
KiBitmap( cursor_shape_xpm ),
KiScaledBitmap( cursor_shape_xpm, this ),
_( "Change cursor shape" ), wxITEM_CHECK );
#endif // !__APPLE__
//m_optionsToolBar->AddSeparator();
//KiScaledSeparator( m_optionsToolBar, this );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_HIDDEN_PINS, wxEmptyString,
KiBitmap( hidden_pin_xpm ),
KiScaledBitmap( hidden_pin_xpm, this ),
_( "Show hidden pins" ), wxITEM_CHECK );
//m_optionsToolBar->AddSeparator();
//KiScaledSeparator( m_optionsToolBar, this );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_BUS_WIRES_ORIENT, wxEmptyString,
KiBitmap( lines90_xpm ),
KiScaledBitmap( lines90_xpm, this ),
_( "HV orientation for wires and bus" ),
wxITEM_CHECK );
@ -304,7 +318,7 @@ void SCH_EDIT_FRAME::ReCreateOptToolbar()
void SCH_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
{
if( m_canvas == NULL )
if( m_canvas )
return;
int id = event.GetId();

View File

@ -3,24 +3,20 @@
*
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
* 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
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is 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.
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
@ -47,82 +43,82 @@ void LIB_VIEW_FRAME::ReCreateHToolbar()
wxString msg;
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,
KICAD_AUI_TB_STYLE | wxAUI_TB_HORZ_LAYOUT );
m_mainToolBar->AddTool( ID_LIBVIEW_SELECT_PART, wxEmptyString,
KiBitmap( add_component_xpm ),
_( "Select symbol to browse" ) );
m_mainToolBar->AddTool( ID_LIBVIEW_SELECT_PART, wxEmptyString,
KiScaledBitmap( add_component_xpm, this ),
_( "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->AddTool( ID_LIBVIEW_PREVIOUS, wxEmptyString,
KiBitmap( lib_previous_xpm ),
_( "Display previous symbol" ) );
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();
m_mainToolBar->AddTool( ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC,
wxEmptyString, KiScaledBitmap( export_xpm, this ),
_( "Insert symbol in schematic" ) );
}
// 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( 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.
*
* 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
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is 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.
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
@ -53,12 +49,19 @@ class DIALOG_DISPLAY_OPTIONS : public DIALOG_DISPLAY_OPTIONS_BASE
private:
GERBVIEW_FRAME* m_Parent;
GAL_OPTIONS_PANEL* m_galOptsPanel;
int m_last_scale;
public:
DIALOG_DISPLAY_OPTIONS( GERBVIEW_FRAME* parent );
~DIALOG_DISPLAY_OPTIONS() {};
protected:
void OnScaleSlider( wxScrollEvent& aEvent ) override;
void OnScaleAuto( wxCommandEvent& aEvent ) override;
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
private:
void OnOKBUttonClick( 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_BASE( parent, wxID_ANY )
DIALOG_DISPLAY_OPTIONS_BASE( parent, wxID_ANY ),
m_last_scale( -1 )
{
m_Parent = parent;
m_scaleSlider->SetStep( 25 );
SetFocus();
initOptDialog( );
@ -139,6 +144,7 @@ void DIALOG_DISPLAY_OPTIONS::initOptDialog( )
void DIALOG_DISPLAY_OPTIONS::OnOKBUttonClick( wxCommandEvent& event )
{
TransferDataFromWindow();
auto displayOptions = (GBR_DISPLAY_OPTIONS*) m_Parent->GetDisplayOptions();
m_Parent->m_DisplayOptions.m_DisplayPolarCood =
@ -192,3 +198,56 @@ void DIALOG_DISPLAY_OPTIONS::OnOKBUttonClick( wxCommandEvent& event )
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/
//
// 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 );
m_UpperSizer->Add( bLeftSizer, 0, wxALL|wxEXPAND, 5 );
m_UpperSizer->Add( bLeftSizer, 0, wxEXPAND|wxLEFT|wxRIGHT, 5 );
wxBoxSizer* bRightSizer;
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 );
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 );
@ -107,6 +142,16 @@ DIALOG_DISPLAY_OPTIONS_BASE::DIALOG_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWi
bDialogSizer->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 );
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 );
}
@ -114,6 +159,16 @@ DIALOG_DISPLAY_OPTIONS_BASE::DIALOG_DISPLAY_OPTIONS_BASE( wxWindow* parent, wxWi
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 );
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 );

Some files were not shown because too many files have changed in this diff Show More