From fac288cffa46727ec1d725cb7ad998b713579e23 Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Fri, 16 Dec 2011 08:32:23 -0500 Subject: [PATCH] More encapsulation work and other minor improvements. * EDA_DRAW_FRAME completely encapsulated except for DrawFrame member. * Moved members specific to Pcbnew from EDA_DRAW_FRAME to PCB_BASE_FRAME or PCB_EDIT_FRAME as appropriate. * Replace EDA_TOOLBAR with wxAuiToolBar as EDA_TOOL bar provided no additional functionality and made code less readable. * Remove EDA_TOOLBAR class definition from wxstruct.h and delete file wineda_toolbar.cpp. * Rename tool bar members to something more descriptive since the horizontal and vertical references wont mean anything once the tool bars are movable. * Lots of dead code removal. --- 3d-viewer/3d_toolbar.cpp | 3 +- 3d-viewer/3d_viewer.h | 4 +- common/CMakeLists.txt | 1 - common/basicframe.cpp | 2 +- common/class_layer_box_selector.cpp | 4 +- common/copy_to_clipboard.cpp | 2 +- common/drawframe.cpp | 26 ++- common/msgpanel.cpp | 28 ++- common/wineda_toolbar.cpp | 36 ---- common/worksheet.cpp | 2 +- common/zoom.cpp | 4 +- cvpcb/class_DisplayFootprintsFrame.cpp | 42 ++-- cvpcb/cvframe.cpp | 16 +- cvpcb/cvpcb_mainframe.h | 4 +- cvpcb/tool_cvpcb.cpp | 136 ++++++++----- eeschema/dialogs/dialog_SVG_print.cpp | 10 +- eeschema/dialogs/dialog_edit_label.cpp | 4 +- eeschema/dialogs/dialog_lib_edit_pin.cpp | 2 +- eeschema/dialogs/dialog_lib_edit_text.cpp | 6 +- eeschema/find.cpp | 4 +- eeschema/libedit.cpp | 2 +- eeschema/libeditframe.cpp | 10 +- eeschema/pinedit.cpp | 12 +- eeschema/schframe.cpp | 6 +- eeschema/sheet.cpp | 8 +- eeschema/sheetlab.cpp | 8 +- eeschema/symbdraw.cpp | 4 +- eeschema/tool_lib.cpp | 125 ++++++------ eeschema/tool_sch.cpp | 161 ++++++++------- eeschema/tool_viewlib.cpp | 145 ++++++++------ eeschema/viewlib_frame.cpp | 4 +- eeschema/viewlibs.cpp | 8 +- gerbview/class_DCodeSelectionbox.cpp | 2 +- gerbview/class_DCodeSelectionbox.h | 2 +- gerbview/gerbview_frame.cpp | 6 +- gerbview/options.cpp | 2 +- gerbview/toolbars_gerber.cpp | 68 ++++--- include/class_layer_box_selector.h | 6 +- include/wxBasePcbFrame.h | 7 +- include/wxPcbStruct.h | 12 +- include/wxstruct.h | 71 +------ kicad/kicad.h | 2 +- kicad/mainframe.cpp | 6 +- kicad/menubar.cpp | 45 ++--- pcbnew/automove.cpp | 66 +++---- pcbnew/basepcbframe.cpp | 6 +- pcbnew/controle.cpp | 12 +- pcbnew/dialogs/dialog_SVG_print.cpp | 12 +- pcbnew/dialogs/dialog_copper_zones.cpp | 10 +- pcbnew/dialogs/dialog_design_rules.cpp | 56 +++--- pcbnew/dialogs/dialog_drc.cpp | 6 +- .../dialog_edit_module_for_BoardEditor.cpp | 8 +- .../dialog_edit_module_for_Modedit.cpp | 4 +- pcbnew/dialogs/dialog_edit_module_text.cpp | 20 +- pcbnew/dialogs/dialog_general_options.cpp | 2 +- .../dialog_global_edit_tracks_and_vias.cpp | 2 +- .../dialog_graphic_item_properties.cpp | 26 +-- pcbnew/dialogs/dialog_mask_clearance.cpp | 6 +- pcbnew/dialogs/dialog_pad_properties.cpp | 4 +- pcbnew/dialogs/dialog_pcb_text_properties.cpp | 20 +- pcbnew/dialogs/dialog_print_using_printer.cpp | 6 +- pcbnew/dimension.cpp | 20 +- pcbnew/drc.cpp | 6 +- pcbnew/mirepcb.cpp | 4 +- pcbnew/modeditoptions.cpp | 35 +++- pcbnew/moduleframe.cpp | 4 +- pcbnew/onrightclick.cpp | 72 +++++-- pcbnew/pcbframe.cpp | 29 ++- pcbnew/pcbplot.cpp | 2 +- pcbnew/print_board_functions.cpp | 4 +- pcbnew/printout_controler.cpp | 4 +- pcbnew/set_grid.cpp | 2 +- pcbnew/tool_modedit.cpp | 163 ++++++++------- pcbnew/tool_pcb.cpp | 187 ++++++++++-------- pcbnew/toolbars_update_user_interface.cpp | 41 ++++ pcbnew/zones_non_copper_type_functions.cpp | 4 +- 76 files changed, 1056 insertions(+), 845 deletions(-) delete mode 100644 common/wineda_toolbar.cpp diff --git a/3d-viewer/3d_toolbar.cpp b/3d-viewer/3d_toolbar.cpp index 73d49fad5a..c3436b7613 100644 --- a/3d-viewer/3d_toolbar.cpp +++ b/3d-viewer/3d_toolbar.cpp @@ -41,7 +41,8 @@ void EDA_3D_FRAME::ReCreateHToolbar() return; } - m_HToolBar = new EDA_TOOLBAR( TOOLBAR_MAIN, this, ID_H_TOOLBAR, true ); + m_HToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize, + wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_HORZ_LAYOUT ); // Set up toolbar m_HToolBar->AddTool( ID_RELOAD3D_BOARD, wxEmptyString, diff --git a/3d-viewer/3d_viewer.h b/3d-viewer/3d_viewer.h index 3f284e2226..c6193a552b 100644 --- a/3d-viewer/3d_viewer.h +++ b/3d-viewer/3d_viewer.h @@ -268,8 +268,8 @@ public: private: wxString m_FrameName; // name used for writing and reading setup. It is "Frame3D" EDA_3D_CANVAS* m_Canvas; - EDA_TOOLBAR* m_HToolBar; - EDA_TOOLBAR* m_VToolBar; + wxAuiToolBar* m_HToolBar; + wxAuiToolBar* m_VToolBar; int m_InternalUnits; wxPoint m_FramePos; wxSize m_FrameSize; diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index 7414db0bf2..7222af5420 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -65,7 +65,6 @@ set(COMMON_SRCS richio.cpp selcolor.cpp string.cpp - wineda_toolbar.cpp trigo.cpp worksheet.cpp wxwineda.cpp diff --git a/common/basicframe.cpp b/common/basicframe.cpp index 5c788a0e7c..d758a45b6f 100644 --- a/common/basicframe.cpp +++ b/common/basicframe.cpp @@ -66,7 +66,7 @@ EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* father, wxSize minsize; m_Ident = idtype; - m_HToolBar = NULL; + m_mainToolBar = NULL; m_FrameIsActive = true; m_hasAutoSave = false; m_autoSaveState = false; diff --git a/common/class_layer_box_selector.cpp b/common/class_layer_box_selector.cpp index e2ef3fc538..dbaf30fb4b 100644 --- a/common/class_layer_box_selector.cpp +++ b/common/class_layer_box_selector.cpp @@ -21,7 +21,7 @@ * */ -LAYER_BOX_SELECTOR::LAYER_BOX_SELECTOR( EDA_TOOLBAR* parent, wxWindowID id, +LAYER_BOX_SELECTOR::LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, int n, const wxString choices[] ) : wxBitmapComboBox( parent, id, wxEmptyString, pos, size, n, choices, wxCB_READONLY ) @@ -35,7 +35,7 @@ LAYER_BOX_SELECTOR::LAYER_BOX_SELECTOR( EDA_TOOLBAR* parent, wxWindowID id, } -LAYER_BOX_SELECTOR::LAYER_BOX_SELECTOR( EDA_TOOLBAR* parent, wxWindowID id, +LAYER_BOX_SELECTOR::LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, const wxArrayString& choices ) : wxBitmapComboBox( parent, id, wxEmptyString, pos, size, choices, wxCB_READONLY ) diff --git a/common/copy_to_clipboard.cpp b/common/copy_to_clipboard.cpp index 5237a1fc43..ea4eb62c9c 100644 --- a/common/copy_to_clipboard.cpp +++ b/common/copy_to_clipboard.cpp @@ -51,7 +51,7 @@ bool DrawPageOnClipboard( EDA_DRAW_FRAME* aFrame ) BASE_SCREEN* screen = aFrame->DrawPanel->GetScreen(); /* scale is the ratio resolution/internal units */ - float scale = 82.0 / aFrame->m_InternalUnits; + float scale = 82.0 / aFrame->GetInternalUnits(); if( screen->IsBlockActive() ) { diff --git a/common/drawframe.cpp b/common/drawframe.cpp index d8fde8b4e7..11856f095c 100644 --- a/common/drawframe.cpp +++ b/common/drawframe.cpp @@ -99,10 +99,8 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* father, int idtype, const wxString& ti m_currentScreen = NULL; m_toolId = ID_NO_TOOL_SELECTED; m_lastDrawToolId = ID_NO_TOOL_SELECTED; - m_HTOOL_current_state = 0; m_showAxis = false; // true to draw axis. m_showBorderAndTitleBlock = false; // true to display reference sheet. - m_Print_Sheet_Ref = true; // true to print reference sheet. m_showGridAxis = false; // true to draw the grid axis m_cursorShape = 0; m_LastGridSizeId = 0; @@ -111,7 +109,7 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* father, int idtype, const wxString& ti m_snapToGrid = true; // Internal units per inch: = 1000 for schema, = 10000 for PCB - m_InternalUnits = EESCHEMA_INTERNAL_UNIT; + m_internalUnits = EESCHEMA_INTERNAL_UNIT; minsize.x = 470; minsize.y = 350 + m_MsgFrameHeight; @@ -757,8 +755,8 @@ void EDA_DRAW_FRAME::UpdateStatusBar() SetStatusText( Line, 1 ); /* Display absolute coordinates: */ - double dXpos = To_User_Unit( g_UserUnit, screen->GetCrossHairPosition().x, m_InternalUnits ); - double dYpos = To_User_Unit( g_UserUnit, screen->GetCrossHairPosition().y, m_InternalUnits ); + double dXpos = To_User_Unit( g_UserUnit, screen->GetCrossHairPosition().x, m_internalUnits ); + double dYpos = To_User_Unit( g_UserUnit, screen->GetCrossHairPosition().y, m_internalUnits ); /* * Converting from inches to mm can give some coordinates due to @@ -767,8 +765,8 @@ void EDA_DRAW_FRAME::UpdateStatusBar() */ if ( g_UserUnit == MILLIMETRES ) { - dXpos = RoundTo0( dXpos, (double)( m_InternalUnits / 10 ) ); - dYpos = RoundTo0( dYpos, (double)( m_InternalUnits / 10 ) ); + dXpos = RoundTo0( dXpos, (double)( m_internalUnits / 10 ) ); + dYpos = RoundTo0( dYpos, (double)( m_internalUnits / 10 ) ); } /* The following sadly is an if Eeschema/if Pcbnew */ @@ -777,7 +775,7 @@ void EDA_DRAW_FRAME::UpdateStatusBar() switch( g_UserUnit ) { case INCHES: - if( m_InternalUnits == EESCHEMA_INTERNAL_UNIT ) + if( m_internalUnits == EESCHEMA_INTERNAL_UNIT ) { absformatter = wxT( "X %.3f Y %.3f" ); locformatter = wxT( "dx %.3f dy %.3f" ); @@ -790,7 +788,7 @@ void EDA_DRAW_FRAME::UpdateStatusBar() break; case MILLIMETRES: - if( m_InternalUnits == EESCHEMA_INTERNAL_UNIT ) + if( m_internalUnits == EESCHEMA_INTERNAL_UNIT ) { absformatter = wxT( "X %.2f Y %.2f" ); locformatter = wxT( "dx %.2f dy %.2f" ); @@ -814,13 +812,13 @@ void EDA_DRAW_FRAME::UpdateStatusBar() /* Display relative coordinates: */ dx = screen->GetCrossHairPosition().x - screen->m_O_Curseur.x; dy = screen->GetCrossHairPosition().y - screen->m_O_Curseur.y; - dXpos = To_User_Unit( g_UserUnit, dx, m_InternalUnits ); - dYpos = To_User_Unit( g_UserUnit, dy, m_InternalUnits ); + dXpos = To_User_Unit( g_UserUnit, dx, m_internalUnits ); + dYpos = To_User_Unit( g_UserUnit, dy, m_internalUnits ); if( g_UserUnit == MILLIMETRES ) { - dXpos = RoundTo0( dXpos, (double) ( m_InternalUnits / 10 ) ); - dYpos = RoundTo0( dYpos, (double) ( m_InternalUnits / 10 ) ); + dXpos = RoundTo0( dXpos, (double) ( m_internalUnits / 10 ) ); + dYpos = RoundTo0( dYpos, (double) ( m_internalUnits / 10 ) ); } /* We already decided the formatter above */ @@ -887,5 +885,5 @@ void EDA_DRAW_FRAME::ClearMsgPanel( void ) wxString EDA_DRAW_FRAME::CoordinateToString( int aValue, bool aConvertToMils ) { - return ::CoordinateToString( aValue, m_InternalUnits, aConvertToMils ); + return ::CoordinateToString( aValue, m_internalUnits, aConvertToMils ); } diff --git a/common/msgpanel.cpp b/common/msgpanel.cpp index 0c30659c92..999d068afc 100644 --- a/common/msgpanel.cpp +++ b/common/msgpanel.cpp @@ -1,6 +1,27 @@ -/****************/ -/* msgpanel.cpp */ -/****************/ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com + * Copyright (C) 2011 Wayne Stambaugh + * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ #ifdef __GNUG__ #pragma implementation @@ -21,7 +42,6 @@ EDA_MSG_PANEL::EDA_MSG_PANEL( EDA_DRAW_FRAME* parent, int id, const wxPoint& pos, const wxSize& size ) : wxPanel( parent, id, pos, size ) { - m_Parent = parent; SetFont( wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ) ); SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) ); m_last_x = 0; diff --git a/common/wineda_toolbar.cpp b/common/wineda_toolbar.cpp deleted file mode 100644 index 2078d8b103..0000000000 --- a/common/wineda_toolbar.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/****************/ -/* toolbars.cpp */ -/****************/ - -#ifdef __GNUG__ -#pragma implementation -#endif - -#include "fctsys.h" -#include "wxstruct.h" - - -EDA_TOOLBAR::EDA_TOOLBAR( id_toolbar type, wxWindow * parent, wxWindowID id, bool horizontal ): - wxAuiToolBar( parent, id, wxDefaultPosition, wxDefaultSize, - wxAUI_TB_DEFAULT_STYLE | ( ( horizontal ) ? - wxAUI_TB_HORZ_LAYOUT : - wxAUI_TB_VERTICAL ) ) -{ - m_Parent = parent; - m_Ident = type; - m_Horizontal = horizontal; - - SetToolBitmapSize(wxSize(16,16)); - SetMargins(0,0); - SetToolSeparation(1); - SetToolPacking(1); -} - - -int EDA_TOOLBAR::GetDimension( ) -{ - if( m_Horizontal ) - return GetSize().y; - else - return GetSize().x; -} diff --git a/common/worksheet.cpp b/common/worksheet.cpp index 008e53df7b..f37ab1ba5f 100644 --- a/common/worksheet.cpp +++ b/common/worksheet.cpp @@ -1003,7 +1003,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid EDA_Colors Color; wxString Line; Ki_WorkSheetData* WsItem; - int scale = m_InternalUnits / 1000; + int scale = m_internalUnits / 1000; wxSize size( SIZETEXT * scale, SIZETEXT * scale ); #if defined(KICAD_GOST) wxSize size2( SIZETEXT * scale * 2, SIZETEXT * scale * 2); diff --git a/common/zoom.cpp b/common/zoom.cpp index b81f375778..3938a8a736 100644 --- a/common/zoom.cpp +++ b/common/zoom.cpp @@ -197,8 +197,8 @@ void EDA_DRAW_FRAME::AddMenuZoomAndGrid( wxMenu* MasterMenu ) for( size_t i = 0; i < screen->GetGridCount(); i++ ) { tmp = screen->GetGrid( i ); - double gridValueInch = To_User_Unit( INCHES, tmp.m_Size.x, m_InternalUnits ); - double gridValue_mm = To_User_Unit( MILLIMETRES, tmp.m_Size.x, m_InternalUnits ); + double gridValueInch = To_User_Unit( INCHES, tmp.m_Size.x, m_internalUnits ); + double gridValue_mm = To_User_Unit( MILLIMETRES, tmp.m_Size.x, m_internalUnits ); if( tmp.m_Id == ID_POPUP_GRID_USER ) { diff --git a/cvpcb/class_DisplayFootprintsFrame.cpp b/cvpcb/class_DisplayFootprintsFrame.cpp index 09eb5bbdc8..459650f36c 100644 --- a/cvpcb/class_DisplayFootprintsFrame.cpp +++ b/cvpcb/class_DisplayFootprintsFrame.cpp @@ -121,8 +121,8 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* father, - m_auimgr.AddPane( m_HToolBar, - wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top(). Row( 0 ) ); + m_auimgr.AddPane( m_mainToolBar, + wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top(). Row( 0 ) ); if( m_drawToolBar ) // Currently, no vertical right toolbar. m_auimgr.AddPane( m_drawToolBar, @@ -178,7 +178,8 @@ void DISPLAY_FOOTPRINTS_FRAME::ReCreateOptToolbar() return; // Create options tool bar. - m_optionsToolBar = new EDA_TOOLBAR( TOOLBAR_OPTION, this, ID_OPT_TOOLBAR, false ); + m_optionsToolBar = new wxAuiToolBar( this, ID_OPT_TOOLBAR, wxDefaultPosition, wxDefaultSize, + wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_VERTICAL ); m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString, KiBitmap( grid_xpm ), _( "Hide grid" ), wxITEM_CHECK ); @@ -218,35 +219,36 @@ void DISPLAY_FOOTPRINTS_FRAME::ReCreateOptToolbar() void DISPLAY_FOOTPRINTS_FRAME::ReCreateHToolbar() { - if( m_HToolBar != NULL ) + if( m_mainToolBar != NULL ) return; - m_HToolBar = new EDA_TOOLBAR( TOOLBAR_MAIN, this, ID_H_TOOLBAR, true ); + m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize, + wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_HORZ_LAYOUT ); - m_HToolBar->AddTool( ID_OPTIONS_SETUP, wxEmptyString, KiBitmap( display_options_xpm ), - _( "Display options" ) ); + m_mainToolBar->AddTool( ID_OPTIONS_SETUP, wxEmptyString, KiBitmap( display_options_xpm ), + _( "Display options" ) ); - m_HToolBar->AddSeparator(); + m_mainToolBar->AddSeparator(); - m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiBitmap( zoom_in_xpm ), - _( "Zoom in (F1)" ) ); + m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiBitmap( zoom_in_xpm ), + _( "Zoom in (F1)" ) ); - m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiBitmap( zoom_out_xpm ), - _( "Zoom out (F2)" ) ); + m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiBitmap( zoom_out_xpm ), + _( "Zoom out (F2)" ) ); - m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, KiBitmap( zoom_redraw_xpm ), - _( "Redraw view (F3)" ) ); + m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, KiBitmap( zoom_redraw_xpm ), + _( "Redraw view (F3)" ) ); - m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, KiBitmap( zoom_fit_in_page_xpm ), - _( "Zoom auto (Home)" ) ); + m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, KiBitmap( zoom_fit_in_page_xpm ), + _( "Zoom auto (Home)" ) ); - m_HToolBar->AddSeparator(); - m_HToolBar->AddTool( ID_CVPCB_SHOW3D_FRAME, wxEmptyString, KiBitmap( three_d_xpm ), - _( "3D Display" ) ); + m_mainToolBar->AddSeparator(); + m_mainToolBar->AddTool( ID_CVPCB_SHOW3D_FRAME, wxEmptyString, KiBitmap( three_d_xpm ), + _( "3D Display" ) ); // after adding the buttons to the toolbar, must call Realize() to reflect // the changes - m_HToolBar->Realize(); + m_mainToolBar->Realize(); } diff --git a/cvpcb/cvframe.cpp b/cvpcb/cvframe.cpp index 4b52238608..be982cd4cf 100644 --- a/cvpcb/cvframe.cpp +++ b/cvpcb/cvframe.cpp @@ -109,7 +109,7 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( const wxString& title, long style ) : m_ListCmp = NULL; m_FootprintList = NULL; m_DisplayFootprintFrame = NULL; - m_HToolBar = NULL; + m_mainToolBar = NULL; m_modified = false; m_isEESchemaNetlist = false; m_KeepCvpcbOpen = false; @@ -166,9 +166,9 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( const wxString& title, long style ) : info.InfoToolbarPane(); - if( m_HToolBar ) - m_auimgr.AddPane( m_HToolBar, - wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top() ); + if( m_mainToolBar ) + m_auimgr.AddPane( m_mainToolBar, + wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top() ); if( m_ListCmp ) m_auimgr.AddPane( m_ListCmp, @@ -189,7 +189,7 @@ CVPCB_MAINFRAME::~CVPCB_MAINFRAME() if( config ) { - int state = m_HToolBar->GetToolState( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST ); + int state = m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST ); config->Write( wxT( FILTERFOOTPRINTKEY ), state ); } @@ -504,7 +504,7 @@ void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event ) { int selection; - if( !m_HToolBar->GetToolState( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST ) ) + if( !m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST ) ) { m_FootprintList->SetActiveFootprintList( true, true ); return; @@ -554,11 +554,11 @@ void CVPCB_MAINFRAME::OnSelectFilteringFootprint( wxCommandEvent& event ) switch( event.GetId() ) { case ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST: - m_HToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST, false ); + m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST, false ); break; case ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST: - m_HToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, false ); + m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, false ); break; default: diff --git a/cvpcb/cvpcb_mainframe.h b/cvpcb/cvpcb_mainframe.h index bbdc80a76b..bbe2125631 100644 --- a/cvpcb/cvpcb_mainframe.h +++ b/cvpcb/cvpcb_mainframe.h @@ -15,7 +15,7 @@ /* Forward declarations of all top-level window classes. */ -class EDA_TOOLBAR; +class wxAuiToolBar; class FOOTPRINTS_LISTBOX; class COMPONENTS_LISTBOX; class DISPLAY_FOOTPRINTS_FRAME; @@ -32,7 +32,7 @@ public: FOOTPRINTS_LISTBOX* m_FootprintList; COMPONENTS_LISTBOX* m_ListCmp; DISPLAY_FOOTPRINTS_FRAME* m_DisplayFootprintFrame; - EDA_TOOLBAR* m_HToolBar; + wxAuiToolBar* m_mainToolBar; wxFileName m_NetlistFileName; wxArrayString m_ModuleLibNames; wxArrayString m_AliasLibNames; diff --git a/cvpcb/tool_cvpcb.cpp b/cvpcb/tool_cvpcb.cpp index 8302e4c6a0..5562ba51aa 100644 --- a/cvpcb/tool_cvpcb.cpp +++ b/cvpcb/tool_cvpcb.cpp @@ -1,6 +1,31 @@ -/********************/ -/* tool_cvpcb.cpp */ -/********************/ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2007 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com + * Copyright (C) 2011 Wayne Stambaugh + * Copyright (C) 2007-2011 KiCad Developers, see AUTHORS.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +/** + * @file tool_cvpcb.cpp + */ #include "fctsys.h" #include "appl_wxstruct.h" @@ -16,78 +41,81 @@ void CVPCB_MAINFRAME::ReCreateHToolbar() { wxConfig* config = wxGetApp().m_EDA_Config; - if( m_HToolBar != NULL ) + if( m_mainToolBar != NULL ) return; - m_HToolBar = new EDA_TOOLBAR( TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE ); + m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize, + wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_HORZ_LAYOUT ); - m_HToolBar->AddTool( ID_CVPCB_READ_INPUT_NETLIST, wxEmptyString, - KiBitmap( open_document_xpm ), - _( "Open a net list file" ) ); + m_mainToolBar->AddTool( ID_CVPCB_READ_INPUT_NETLIST, wxEmptyString, + KiBitmap( open_document_xpm ), + _( "Open a net list file" ) ); - m_HToolBar->AddTool( wxID_SAVE, wxEmptyString, KiBitmap( save_xpm ), - _( "Save net list and footprint files" ) ); + m_mainToolBar->AddTool( wxID_SAVE, wxEmptyString, KiBitmap( save_xpm ), + _( "Save net list and footprint files" ) ); - m_HToolBar->AddSeparator(); - m_HToolBar->AddTool( ID_CVPCB_CREATE_CONFIGWINDOW, wxEmptyString, - KiBitmap( config_xpm ), - _( "Configuration" ) ); + m_mainToolBar->AddSeparator(); + m_mainToolBar->AddTool( ID_CVPCB_CREATE_CONFIGWINDOW, wxEmptyString, + KiBitmap( config_xpm ), + _( "Configuration" ) ); - m_HToolBar->AddSeparator(); - m_HToolBar->AddTool( ID_CVPCB_CREATE_SCREENCMP, wxEmptyString, - KiBitmap( show_footprint_xpm ), - _( "View selected footprint" ) ); + m_mainToolBar->AddSeparator(); + m_mainToolBar->AddTool( ID_CVPCB_CREATE_SCREENCMP, wxEmptyString, + KiBitmap( show_footprint_xpm ), + _( "View selected footprint" ) ); - m_HToolBar->AddTool( ID_CVPCB_AUTO_ASSOCIE, wxEmptyString, - KiBitmap( auto_associe_xpm ), - _( "Perform automatic footprint association" ) ); + m_mainToolBar->AddTool( ID_CVPCB_AUTO_ASSOCIE, wxEmptyString, + KiBitmap( auto_associe_xpm ), + _( "Perform automatic footprint association" ) ); - m_HToolBar->AddSeparator(); - m_HToolBar->AddTool( ID_CVPCB_GOTO_PREVIOUSNA, wxEmptyString, - KiBitmap( left_xpm ), - _( "Select previous free component" ) ); + m_mainToolBar->AddSeparator(); + m_mainToolBar->AddTool( ID_CVPCB_GOTO_PREVIOUSNA, wxEmptyString, + KiBitmap( left_xpm ), + _( "Select previous free component" ) ); - m_HToolBar->AddTool( ID_CVPCB_GOTO_FIRSTNA, wxEmptyString, - KiBitmap( right_xpm ), - _( "Select next free component" ) ); + m_mainToolBar->AddTool( ID_CVPCB_GOTO_FIRSTNA, wxEmptyString, + KiBitmap( right_xpm ), + _( "Select next free component" ) ); - m_HToolBar->AddSeparator(); - m_HToolBar->AddTool( ID_CVPCB_DEL_ASSOCIATIONS, wxEmptyString, - KiBitmap( delete_association_xpm ), - _( "Delete all associations" ) ); + m_mainToolBar->AddSeparator(); + m_mainToolBar->AddTool( ID_CVPCB_DEL_ASSOCIATIONS, wxEmptyString, + KiBitmap( delete_association_xpm ), + _( "Delete all associations" ) ); - m_HToolBar->AddSeparator(); - m_HToolBar->AddTool( ID_CVPCB_CREATE_STUFF_FILE, wxEmptyString, - KiBitmap( export_footprint_names_xpm ), - _( "Create export file (component/footprint list, \ + m_mainToolBar->AddSeparator(); + m_mainToolBar->AddTool( ID_CVPCB_CREATE_STUFF_FILE, wxEmptyString, + KiBitmap( export_footprint_names_xpm ), + _( "Create export file (component/footprint list, \ used by Eeschema to fill the footprint field of components)" ) ); - m_HToolBar->AddSeparator(); - m_HToolBar->AddTool( ID_PCB_DISPLAY_FOOTPRINT_DOC, wxEmptyString, - KiBitmap( datasheet_xpm ), - _( "Display footprints list documentation" ) ); + m_mainToolBar->AddSeparator(); + m_mainToolBar->AddTool( ID_PCB_DISPLAY_FOOTPRINT_DOC, wxEmptyString, + KiBitmap( datasheet_xpm ), + _( "Display footprints list documentation" ) ); - m_HToolBar->AddSeparator(); - m_HToolBar->AddSeparator(); - m_HToolBar->AddRadioTool( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, - wxEmptyString, - KiBitmap( module_filtered_list_xpm ), - wxNullBitmap, - _( "Display the filtered footprint list for the current component" ) ); + m_mainToolBar->AddSeparator(); + m_mainToolBar->AddSeparator(); + m_mainToolBar->AddTool( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, + KiBitmap( module_filtered_list_xpm ), + wxNullBitmap, + true, NULL, + _( "Display the filtered footprint list for the current component" ), + wxEmptyString ); - m_HToolBar->AddRadioTool( ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST, - wxEmptyString, KiBitmap( module_full_list_xpm ), - wxNullBitmap, - _( "Display the full footprint list (without filtering)" ) ); + m_mainToolBar->AddTool( ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST, + KiBitmap( module_full_list_xpm ), + wxNullBitmap, true, NULL, + _( "Display the full footprint list (without filtering)" ), + wxEmptyString ); if( config ) { wxString key = wxT( FILTERFOOTPRINTKEY ); int opt = config->Read( key, (long) 1 ); - m_HToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, opt ); - m_HToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST, !opt ); + m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, opt ); + m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST, !opt ); } // after adding the buttons to the toolbar, must call Realize() to reflect the changes - m_HToolBar->Realize(); + m_mainToolBar->Realize(); } diff --git a/eeschema/dialogs/dialog_SVG_print.cpp b/eeschema/dialogs/dialog_SVG_print.cpp index d7cb86e29b..770d493ac3 100644 --- a/eeschema/dialogs/dialog_SVG_print.cpp +++ b/eeschema/dialogs/dialog_SVG_print.cpp @@ -79,7 +79,7 @@ void DIALOG_SVG_PRINT::OnInitDialog( wxInitDialogEvent& event ) AddUnitSymbol( *m_TextPenWidth, g_UserUnit ); m_DialogPenWidth->SetValue( ReturnStringFromValue( g_UserUnit, g_DrawDefaultLineThickness, - m_Parent->m_InternalUnits ) ); + m_Parent->GetInternalUnits() ) ); m_Print_Sheet_Ref->SetValue( s_Print_Frame_Ref ); if( GetSizer() ) @@ -92,7 +92,7 @@ void DIALOG_SVG_PRINT::OnInitDialog( wxInitDialogEvent& event ) void DIALOG_SVG_PRINT::SetPenWidth() { g_DrawDefaultLineThickness = - ReturnValueFromTextCtrl( *m_DialogPenWidth, m_Parent->m_InternalUnits ); + ReturnValueFromTextCtrl( *m_DialogPenWidth, m_Parent->GetInternalUnits() ); if( g_DrawDefaultLineThickness > WIDTH_MAX_VALUE ) { @@ -106,7 +106,7 @@ void DIALOG_SVG_PRINT::SetPenWidth() m_DialogPenWidth->SetValue( ReturnStringFromValue( g_UserUnit, g_DrawDefaultLineThickness, - m_Parent->m_InternalUnits ) ); + m_Parent->GetInternalUnits() ) ); } @@ -118,7 +118,7 @@ void DIALOG_SVG_PRINT::PrintSVGDoc( bool aPrintAll, bool aPrint_Sheet_Ref ) SetPenWidth(); g_DrawDefaultLineThickness = - ReturnValueFromTextCtrl( *m_DialogPenWidth, m_Parent->m_InternalUnits ); + ReturnValueFromTextCtrl( *m_DialogPenWidth, m_Parent->GetInternalUnits() ); SCH_SCREEN* screen = (SCH_SCREEN*) m_Parent->GetScreen(); @@ -217,7 +217,7 @@ bool DIALOG_SVG_PRINT::DrawSVGPage( EDA_DRAW_FRAME* frame, SetLocaleTo_C_standard(); // Switch the locale to standard C (needed // to print floating point numbers like 1.3) - float dpi = (float) frame->m_InternalUnits; + float dpi = (float) frame->GetInternalUnits(); wxSVGFileDC dc( FullFileName, SheetSize.x, SheetSize.y, dpi ); EDA_RECT tmp = panel->m_ClipBox; diff --git a/eeschema/dialogs/dialog_edit_label.cpp b/eeschema/dialogs/dialog_edit_label.cpp index 0fc8ee9302..da07cef478 100644 --- a/eeschema/dialogs/dialog_edit_label.cpp +++ b/eeschema/dialogs/dialog_edit_label.cpp @@ -175,7 +175,7 @@ void DialogLabelEditor::InitDialog() m_staticSizeUnits->SetLabel( msg ); msg = ReturnStringFromValue( g_UserUnit, m_CurrentText->m_Size.x, - m_Parent->m_InternalUnits ); + m_Parent->GetInternalUnits() ); m_TextSize->SetValue( msg ); if( m_CurrentText->Type() != SCH_GLOBAL_LABEL_T @@ -239,7 +239,7 @@ void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& aEvent ) m_CurrentText->SetOrientation( m_TextOrient->GetSelection() ); text = m_TextSize->GetValue(); - value = ReturnValueFromString( g_UserUnit, text, m_Parent->m_InternalUnits ); + value = ReturnValueFromString( g_UserUnit, text, m_Parent->GetInternalUnits() ); m_CurrentText->m_Size.x = m_CurrentText->m_Size.y = value; if( m_TextShape ) diff --git a/eeschema/dialogs/dialog_lib_edit_pin.cpp b/eeschema/dialogs/dialog_lib_edit_pin.cpp index d674dd1d55..b5e3628d64 100644 --- a/eeschema/dialogs/dialog_lib_edit_pin.cpp +++ b/eeschema/dialogs/dialog_lib_edit_pin.cpp @@ -119,7 +119,7 @@ void DIALOG_LIB_EDIT_PIN::OnPropertiesChange( wxCommandEvent& event ) { if( ! IsShown() ) // do nothing at init time return; - int units = ((LIB_EDIT_FRAME*)GetParent())->m_InternalUnits; + int units = ((LIB_EDIT_FRAME*)GetParent())->GetInternalUnits(); int pinNameSize = ReturnValueFromString( g_UserUnit, GetNameTextSize(), units ); int pinNumSize = ReturnValueFromString( g_UserUnit, GetPadNameTextSize(), units); int pinOrient = LIB_PIN::GetOrientationCode( GetOrientation() ); diff --git a/eeschema/dialogs/dialog_lib_edit_text.cpp b/eeschema/dialogs/dialog_lib_edit_text.cpp index 4019f0c1fb..95a2fec0c9 100644 --- a/eeschema/dialogs/dialog_lib_edit_text.cpp +++ b/eeschema/dialogs/dialog_lib_edit_text.cpp @@ -61,7 +61,7 @@ void DIALOG_LIB_EDIT_TEXT::initDlg( ) if ( m_GraphicText ) { msg = ReturnStringFromValue( g_UserUnit, m_GraphicText->m_Size.x, - m_Parent->m_InternalUnits ); + m_Parent->GetInternalUnits() ); m_TextSize->SetValue( msg ); m_TextValue->SetValue( m_GraphicText->m_Text ); @@ -114,7 +114,7 @@ void DIALOG_LIB_EDIT_TEXT::initDlg( ) else { msg = ReturnStringFromValue( g_UserUnit, m_Parent->m_textSize, - m_Parent->m_InternalUnits ); + m_Parent->GetInternalUnits() ); m_TextSize->SetValue( msg ); if ( ! m_Parent->m_drawSpecificUnit ) @@ -146,7 +146,7 @@ void DIALOG_LIB_EDIT_TEXT::OnOkClick( wxCommandEvent& event ) Line = m_TextValue->GetValue(); m_Parent->m_textOrientation = m_Orient->GetValue() ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ; wxString msg = m_TextSize->GetValue(); - m_Parent->m_textSize = ReturnValueFromString( g_UserUnit, msg, m_Parent->m_InternalUnits ); + m_Parent->m_textSize = ReturnValueFromString( g_UserUnit, msg, m_Parent->GetInternalUnits() ); m_Parent->m_drawSpecificConvert = m_CommonConvert->GetValue() ? false : true; m_Parent->m_drawSpecificUnit = m_CommonUnit->GetValue() ? false : true; diff --git a/eeschema/find.cpp b/eeschema/find.cpp index 4b4a1edb24..53ac012b6e 100644 --- a/eeschema/find.cpp +++ b/eeschema/find.cpp @@ -96,9 +96,9 @@ void SCH_EDIT_FRAME::OnFindDrcMarker( wxFindDialogEvent& event ) wxString path = sheetFoundIn->Path(); wxString units = GetAbbreviatedUnitsLabel(); double x = To_User_Unit( g_UserUnit, (double) lastMarker->GetPosition().x, - m_InternalUnits ); + m_internalUnits ); double y = To_User_Unit( g_UserUnit, (double) lastMarker->GetPosition().y, - m_InternalUnits ); + m_internalUnits ); msg.Printf( _( "Design rule check marker found in sheet %s at %0.3f%s, %0.3f%s" ), GetChars( path ), x, GetChars( units ), y, GetChars( units) ); SetStatusText( msg ); diff --git a/eeschema/libedit.cpp b/eeschema/libedit.cpp index d432ec8f95..da89d3a476 100644 --- a/eeschema/libedit.cpp +++ b/eeschema/libedit.cpp @@ -635,7 +635,7 @@ lost!\n\nClear the current component from the screen?" ) ) ) GetScreen()->ClearUndoRedoList(); OnModify(); DrawPanel->Refresh(); - m_HToolBar->Refresh(); + m_mainToolBar->Refresh(); } diff --git a/eeschema/libeditframe.cpp b/eeschema/libeditframe.cpp index 4c0fc554d4..20cabd7dc2 100644 --- a/eeschema/libeditframe.cpp +++ b/eeschema/libeditframe.cpp @@ -247,8 +247,8 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent, EDA_PANEINFO mesg; mesg.MessageToolbarPane(); - m_auimgr.AddPane( m_HToolBar, - wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().Row( 0 ) ); + m_auimgr.AddPane( m_mainToolBar, + wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top().Row( 0 ) ); m_auimgr.AddPane( m_drawToolBar, wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right() ); @@ -522,7 +522,7 @@ void LIB_EDIT_FRAME::OnUpdatePartNumber( wxUpdateUIEvent& event ) void LIB_EDIT_FRAME::OnUpdateDeMorganNormal( wxUpdateUIEvent& event ) { - if( m_HToolBar == NULL ) + if( m_mainToolBar == NULL ) return; event.Enable( GetShowDeMorgan() || ( m_component && m_component->HasConversion() ) ); @@ -532,7 +532,7 @@ void LIB_EDIT_FRAME::OnUpdateDeMorganNormal( wxUpdateUIEvent& event ) void LIB_EDIT_FRAME::OnUpdateDeMorganConvert( wxUpdateUIEvent& event ) { - if( m_HToolBar == NULL ) + if( m_mainToolBar == NULL ) return; event.Enable( GetShowDeMorgan() || ( m_component && m_component->HasConversion() ) ); @@ -674,7 +674,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; case ID_LIBEDIT_EDIT_PIN_BY_PIN: - m_editPinsPerPartOrConvert = m_HToolBar->GetToolState( ID_LIBEDIT_EDIT_PIN_BY_PIN ); + m_editPinsPerPartOrConvert = m_mainToolBar->GetToolToggled( ID_LIBEDIT_EDIT_PIN_BY_PIN ); break; case ID_POPUP_LIBEDIT_END_CREATE_ITEM: diff --git a/eeschema/pinedit.cpp b/eeschema/pinedit.cpp index 4dd7456e1a..be16e2f2a7 100644 --- a/eeschema/pinedit.cpp +++ b/eeschema/pinedit.cpp @@ -86,15 +86,15 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event ) dlg.SetName( pin->GetName() ); dlg.SetNameTextSize( ReturnStringFromValue( g_UserUnit, pin->GetNameTextSize(), - m_InternalUnits ) ); + m_internalUnits ) ); dlg.SetNameTextSizeUnits( units ); dlg.SetPadName( pin->GetNumberString() ); dlg.SetPadNameTextSize( ReturnStringFromValue( g_UserUnit, pin->GetNumberTextSize(), - m_InternalUnits ) ); + m_internalUnits ) ); dlg.SetPadNameTextSizeUnits( units ); - dlg.SetLength( ReturnStringFromValue( g_UserUnit, pin->GetLength(), m_InternalUnits ) ); + dlg.SetLength( ReturnStringFromValue( g_UserUnit, pin->GetLength(), m_internalUnits ) ); dlg.SetLengthUnits( units ); dlg.SetAddToAllParts( pin->GetUnit() == 0 ); dlg.SetAddToAllBodyStyles( pin->GetConvert() == 0 ); @@ -122,10 +122,10 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event ) } /* Save the pin properties to use for the next new pin. */ - LastPinNameSize = ReturnValueFromString( g_UserUnit, dlg.GetNameTextSize(), m_InternalUnits ); - LastPinNumSize = ReturnValueFromString( g_UserUnit, dlg.GetPadNameTextSize(), m_InternalUnits ); + LastPinNameSize = ReturnValueFromString( g_UserUnit, dlg.GetNameTextSize(), m_internalUnits ); + LastPinNumSize = ReturnValueFromString( g_UserUnit, dlg.GetPadNameTextSize(), m_internalUnits ); LastPinOrient = LIB_PIN::GetOrientationCode( dlg.GetOrientation() ); - LastPinLength = ReturnValueFromString( g_UserUnit, dlg.GetLength(), m_InternalUnits ); + LastPinLength = ReturnValueFromString( g_UserUnit, dlg.GetLength(), m_internalUnits ); LastPinShape = LIB_PIN::GetStyleCode( dlg.GetStyle() ); LastPinType = dlg.GetElectricalType(); LastPinCommonConvert = dlg.GetAddToAllBodyStyles(); diff --git a/eeschema/schframe.cpp b/eeschema/schframe.cpp index a2fe211f4a..462e11ec4b 100644 --- a/eeschema/schframe.cpp +++ b/eeschema/schframe.cpp @@ -249,9 +249,9 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( wxWindow* father, - if( m_HToolBar ) - m_auimgr.AddPane( m_HToolBar, - wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().Row( 0 ) ); + if( m_mainToolBar ) + m_auimgr.AddPane( m_mainToolBar, + wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top().Row( 0 ) ); if( m_drawToolBar ) m_auimgr.AddPane( m_drawToolBar, wxAuiPaneInfo( vert ).Name( wxT( "m_drawToolBar" ) ).Right() ); diff --git a/eeschema/sheet.cpp b/eeschema/sheet.cpp index 25697d9ad7..5c1cd57b70 100644 --- a/eeschema/sheet.cpp +++ b/eeschema/sheet.cpp @@ -51,12 +51,12 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC ) dlg.SetFileName( aSheet->GetFileName() ); dlg.SetFileNameTextSize( ReturnStringFromValue( g_UserUnit, aSheet->GetFileNameSize(), - m_InternalUnits ) ); + m_internalUnits ) ); dlg.SetFileNameTextSizeUnits( units ); dlg.SetSheetName( aSheet->GetName() ); dlg.SetSheetNameTextSize( ReturnStringFromValue( g_UserUnit, aSheet->GetSheetNameSize(), - m_InternalUnits ) ); + m_internalUnits ) ); dlg.SetSheetNameTextSizeUnits( units ); /* This ugly hack fixes a bug in wxWidgets 2.8.7 and likely earlier @@ -194,11 +194,11 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC ) aSheet->SetFileNameSize( ReturnValueFromString( g_UserUnit, dlg.GetFileNameTextSize(), - m_InternalUnits ) ); + m_internalUnits ) ); aSheet->SetName( dlg.GetSheetName() ); aSheet->SetSheetNameSize( ReturnValueFromString( g_UserUnit, dlg.GetSheetNameTextSize(), - m_InternalUnits ) ); + m_internalUnits ) ); if( aSheet->GetName().IsEmpty() ) aSheet->SetName( wxString::Format( wxT( "Sheet%8.8lX" ), aSheet->GetTimeStamp() ) ); diff --git a/eeschema/sheetlab.cpp b/eeschema/sheetlab.cpp index 8397497b9e..959eadb0d6 100644 --- a/eeschema/sheetlab.cpp +++ b/eeschema/sheetlab.cpp @@ -56,9 +56,9 @@ int SCH_EDIT_FRAME::EditSheetPin( SCH_SHEET_PIN* aSheetPin, wxDC* aDC ) DIALOG_SCH_EDIT_SHEET_PIN dlg( this ); dlg.SetLabelName( aSheetPin->m_Text ); - dlg.SetTextHeight( ReturnStringFromValue( g_UserUnit, aSheetPin->m_Size.y, m_InternalUnits ) ); + dlg.SetTextHeight( ReturnStringFromValue( g_UserUnit, aSheetPin->m_Size.y, m_internalUnits ) ); dlg.SetTextHeightUnits( GetUnitsLabel( g_UserUnit ) ); - dlg.SetTextWidth( ReturnStringFromValue( g_UserUnit, aSheetPin->m_Size.x, m_InternalUnits ) ); + dlg.SetTextWidth( ReturnStringFromValue( g_UserUnit, aSheetPin->m_Size.x, m_internalUnits ) ); dlg.SetTextWidthUnits( GetUnitsLabel( g_UserUnit ) ); dlg.SetConnectionType( aSheetPin->GetShape() ); @@ -84,8 +84,8 @@ int SCH_EDIT_FRAME::EditSheetPin( SCH_SHEET_PIN* aSheetPin, wxDC* aDC ) } aSheetPin->m_Text = dlg.GetLabelName(); - aSheetPin->m_Size.y = ReturnValueFromString( g_UserUnit, dlg.GetTextHeight(), m_InternalUnits ); - aSheetPin->m_Size.x = ReturnValueFromString( g_UserUnit, dlg.GetTextWidth(), m_InternalUnits ); + aSheetPin->m_Size.y = ReturnValueFromString( g_UserUnit, dlg.GetTextHeight(), m_internalUnits ); + aSheetPin->m_Size.x = ReturnValueFromString( g_UserUnit, dlg.GetTextWidth(), m_internalUnits ); aSheetPin->SetShape( dlg.GetConnectionType() ); if( aDC ) diff --git a/eeschema/symbdraw.cpp b/eeschema/symbdraw.cpp index 138d6ca8a1..5fd26b99e8 100644 --- a/eeschema/symbdraw.cpp +++ b/eeschema/symbdraw.cpp @@ -42,7 +42,7 @@ void LIB_EDIT_FRAME::EditGraphicSymbol( wxDC* DC, LIB_ITEM* DrawItem ) dialog.SetWidthUnits( ReturnUnitSymbol( g_UserUnit ) ); - wxString val = ReturnStringFromValue( g_UserUnit, m_drawLineWidth, m_InternalUnits ); + wxString val = ReturnStringFromValue( g_UserUnit, m_drawLineWidth, m_internalUnits ); dialog.SetWidth( val ); dialog.SetApplyToAllUnits( !m_drawSpecificUnit ); dialog.EnableApplyToAllUnits( component && component->GetPartCount() > 1 ); @@ -56,7 +56,7 @@ void LIB_EDIT_FRAME::EditGraphicSymbol( wxDC* DC, LIB_ITEM* DrawItem ) return; val = dialog.GetWidth(); - m_drawLineWidth = ReturnValueFromString( g_UserUnit, val, m_InternalUnits ); + m_drawLineWidth = ReturnValueFromString( g_UserUnit, val, m_internalUnits ); m_drawSpecificConvert = !dialog.GetApplyToAllConversions(); m_drawSpecificUnit = !dialog.GetApplyToAllUnits(); diff --git a/eeschema/tool_lib.cpp b/eeschema/tool_lib.cpp index ff7ef33fab..d68116b732 100644 --- a/eeschema/tool_lib.cpp +++ b/eeschema/tool_lib.cpp @@ -55,7 +55,8 @@ void LIB_EDIT_FRAME::ReCreateVToolbar() if( m_drawToolBar != NULL ) return; - m_drawToolBar = new EDA_TOOLBAR( TOOLBAR_TOOL, this, ID_V_TOOLBAR, false ); + m_drawToolBar = new wxAuiToolBar( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize, + wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_VERTICAL ); // Set up toolbar m_drawToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, KiBitmap( cursor_xpm ), @@ -100,111 +101,114 @@ void LIB_EDIT_FRAME::ReCreateHToolbar() wxString msg; // Create the toolbar if not exists - if( m_HToolBar != NULL ) + if( m_mainToolBar != NULL ) return; - m_HToolBar = new EDA_TOOLBAR( TOOLBAR_MAIN, this, ID_H_TOOLBAR, true ); + m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize, + wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_HORZ_LAYOUT ); // Set up toolbar - m_HToolBar->AddTool( ID_LIBEDIT_SAVE_CURRENT_LIB, wxEmptyString, KiBitmap( save_library_xpm ), - _( "Save current library to disk" ) ); + m_mainToolBar->AddTool( ID_LIBEDIT_SAVE_CURRENT_LIB, wxEmptyString, + KiBitmap( save_library_xpm ), + _( "Save current library to disk" ) ); - m_HToolBar->AddTool( ID_LIBEDIT_SELECT_CURRENT_LIB, wxEmptyString, KiBitmap( library_xpm ), - _( "Select working library" ) ); + m_mainToolBar->AddTool( ID_LIBEDIT_SELECT_CURRENT_LIB, wxEmptyString, KiBitmap( library_xpm ), + _( "Select working library" ) ); - m_HToolBar->AddTool( ID_LIBEDIT_DELETE_PART, wxEmptyString, KiBitmap( delete_xpm ), - _( "Delete component in current library" ) ); + m_mainToolBar->AddTool( ID_LIBEDIT_DELETE_PART, wxEmptyString, KiBitmap( delete_xpm ), + _( "Delete component in current library" ) ); - m_HToolBar->AddSeparator(); - m_HToolBar->AddTool( ID_LIBEDIT_NEW_PART, wxEmptyString, KiBitmap( new_component_xpm ), - _( "Create a new component" ) ); + m_mainToolBar->AddSeparator(); + m_mainToolBar->AddTool( ID_LIBEDIT_NEW_PART, wxEmptyString, KiBitmap( new_component_xpm ), + _( "Create a new component" ) ); - m_HToolBar->AddTool( ID_LIBEDIT_SELECT_PART, wxEmptyString, - KiBitmap( import_cmp_from_lib_xpm ), - _( "Load component to edit from the current library" ) ); + m_mainToolBar->AddTool( ID_LIBEDIT_SELECT_PART, wxEmptyString, + KiBitmap( import_cmp_from_lib_xpm ), + _( "Load component to edit from the current library" ) ); - m_HToolBar->AddTool( ID_LIBEDIT_NEW_PART_FROM_EXISTING, wxEmptyString, - KiBitmap( copycomponent_xpm ), - _( "Create a new component from the current one" ) ); + m_mainToolBar->AddTool( ID_LIBEDIT_NEW_PART_FROM_EXISTING, wxEmptyString, + KiBitmap( copycomponent_xpm ), + _( "Create a new component from the current one" ) ); - m_HToolBar->AddTool( ID_LIBEDIT_SAVE_CURRENT_PART, wxEmptyString, + m_mainToolBar->AddTool( ID_LIBEDIT_SAVE_CURRENT_PART, wxEmptyString, KiBitmap( save_part_in_mem_xpm ), - _( "Update current component in current library" ) ); + _( "Update current component in current library" ) ); - m_HToolBar->AddTool( ImportPartId, wxEmptyString, KiBitmap( import_xpm ), - _( "Import component" ) ); + m_mainToolBar->AddTool( ImportPartId, wxEmptyString, KiBitmap( import_xpm ), + _( "Import component" ) ); - m_HToolBar->AddTool( ExportPartId, wxEmptyString, KiBitmap( export_xpm ), - _( "Export component" ) ); + m_mainToolBar->AddTool( ExportPartId, wxEmptyString, KiBitmap( export_xpm ), + _( "Export component" ) ); - m_HToolBar->AddTool( CreateNewLibAndSavePartId, wxEmptyString, KiBitmap( new_library_xpm ), - _( "Save current component to new library" ) ); + m_mainToolBar->AddTool( CreateNewLibAndSavePartId, wxEmptyString, KiBitmap( new_library_xpm ), + _( "Save current component to new library" ) ); - m_HToolBar->AddSeparator(); + m_mainToolBar->AddSeparator(); msg = AddHotkeyName( _( "Undo last command" ), s_Schematic_Hokeys_Descr, HK_UNDO, IS_COMMENT ); - m_HToolBar->AddTool( wxID_UNDO, wxEmptyString, KiBitmap( undo_xpm ), msg ); + m_mainToolBar->AddTool( wxID_UNDO, wxEmptyString, KiBitmap( undo_xpm ), msg ); msg = AddHotkeyName( _( "Redo the last command" ), s_Schematic_Hokeys_Descr, HK_REDO, IS_COMMENT ); - m_HToolBar->AddTool( wxID_REDO, wxEmptyString, KiBitmap( redo_xpm ), msg ); + m_mainToolBar->AddTool( wxID_REDO, wxEmptyString, KiBitmap( redo_xpm ), msg ); - m_HToolBar->AddSeparator(); - m_HToolBar->AddTool( ID_LIBEDIT_GET_FRAME_EDIT_PART, wxEmptyString, - KiBitmap( part_properties_xpm ), _( "Edit component properties" ) ); + m_mainToolBar->AddSeparator(); + m_mainToolBar->AddTool( ID_LIBEDIT_GET_FRAME_EDIT_PART, wxEmptyString, + KiBitmap( part_properties_xpm ), _( "Edit component properties" ) ); - m_HToolBar->AddTool( ID_LIBEDIT_GET_FRAME_EDIT_FIELDS, wxEmptyString, KiBitmap( add_text_xpm ), - _( "Add and remove fields and edit field properties" ) ); + m_mainToolBar->AddTool( ID_LIBEDIT_GET_FRAME_EDIT_FIELDS, wxEmptyString, + KiBitmap( add_text_xpm ), + _( "Add and remove fields and edit field properties" ) ); - m_HToolBar->AddSeparator(); - m_HToolBar->AddTool( ID_LIBEDIT_CHECK_PART, wxEmptyString, KiBitmap( erc_xpm ), - _( "Test for duplicate and off grid pins" ) ); + m_mainToolBar->AddSeparator(); + m_mainToolBar->AddTool( ID_LIBEDIT_CHECK_PART, wxEmptyString, KiBitmap( erc_xpm ), + _( "Test for duplicate and off grid pins" ) ); - m_HToolBar->AddSeparator(); + m_mainToolBar->AddSeparator(); msg = AddHotkeyName( HELP_ZOOM_IN, s_Libedit_Hokeys_Descr, HK_ZOOM_IN, IS_COMMENT ); - m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiBitmap( zoom_in_xpm ), msg ); + m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiBitmap( zoom_in_xpm ), msg ); msg = AddHotkeyName( HELP_ZOOM_OUT, s_Libedit_Hokeys_Descr, HK_ZOOM_OUT, IS_COMMENT ); - m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiBitmap( zoom_out_xpm ), msg ); + m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiBitmap( zoom_out_xpm ), msg ); msg = AddHotkeyName( HELP_ZOOM_REDRAW, s_Libedit_Hokeys_Descr, HK_ZOOM_REDRAW, IS_COMMENT ); - m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, KiBitmap( zoom_redraw_xpm ), msg ); + m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, KiBitmap( zoom_redraw_xpm ), msg ); msg = AddHotkeyName( HELP_ZOOM_FIT, s_Libedit_Hokeys_Descr, HK_ZOOM_AUTO, IS_COMMENT ); - m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, KiBitmap( zoom_fit_in_page_xpm ), msg ); + m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, KiBitmap( zoom_fit_in_page_xpm ), msg ); - m_HToolBar->AddSeparator(); - m_HToolBar->AddTool( ID_DE_MORGAN_NORMAL_BUTT, wxEmptyString, KiBitmap( morgan1_xpm ), - _( "Show as \"De Morgan\" normal part" ), wxITEM_CHECK ); - m_HToolBar->AddTool( ID_DE_MORGAN_CONVERT_BUTT, wxEmptyString, KiBitmap( morgan2_xpm ), - _( "Show as \"De Morgan\" convert part" ), wxITEM_CHECK ); + m_mainToolBar->AddSeparator(); + m_mainToolBar->AddTool( ID_DE_MORGAN_NORMAL_BUTT, wxEmptyString, KiBitmap( morgan1_xpm ), + _( "Show as \"De Morgan\" normal part" ), wxITEM_CHECK ); + m_mainToolBar->AddTool( ID_DE_MORGAN_CONVERT_BUTT, wxEmptyString, KiBitmap( morgan2_xpm ), + _( "Show as \"De Morgan\" convert part" ), wxITEM_CHECK ); - m_HToolBar->AddSeparator(); - m_HToolBar->AddTool( ID_LIBEDIT_VIEW_DOC, wxEmptyString, KiBitmap( datasheet_xpm ), - _( "Edit document file" ) ); + m_mainToolBar->AddSeparator(); + m_mainToolBar->AddTool( ID_LIBEDIT_VIEW_DOC, wxEmptyString, KiBitmap( datasheet_xpm ), + _( "Edit document file" ) ); - m_HToolBar->AddSeparator(); - m_partSelectBox = new wxComboBox( m_HToolBar, + m_mainToolBar->AddSeparator(); + m_partSelectBox = new wxComboBox( m_mainToolBar, ID_LIBEDIT_SELECT_PART_NUMBER, wxEmptyString, wxDefaultPosition, wxSize( LISTBOX_WIDTH, -1 ), 0, NULL, wxCB_READONLY ); - m_HToolBar->AddControl( m_partSelectBox ); + m_mainToolBar->AddControl( m_partSelectBox ); - m_aliasSelectBox = new wxComboBox( m_HToolBar, + m_aliasSelectBox = new wxComboBox( m_mainToolBar, ID_LIBEDIT_SELECT_ALIAS, wxEmptyString, wxDefaultPosition, wxSize( LISTBOX_WIDTH, -1 ), 0, NULL, wxCB_READONLY ); - m_HToolBar->AddControl( m_aliasSelectBox ); + m_mainToolBar->AddControl( m_aliasSelectBox ); - m_HToolBar->AddSeparator(); + m_mainToolBar->AddSeparator(); msg = _( "Edit pins per part or body style (Use carefully!)" ); - m_HToolBar->AddTool( ID_LIBEDIT_EDIT_PIN_BY_PIN, wxEmptyString, KiBitmap( pin2pin_xpm ), - msg, wxITEM_CHECK ); + m_mainToolBar->AddTool( ID_LIBEDIT_EDIT_PIN_BY_PIN, wxEmptyString, KiBitmap( pin2pin_xpm ), + msg, wxITEM_CHECK ); // after adding the buttons to the toolbar, must call Realize() to reflect the changes - m_HToolBar->Realize(); + m_mainToolBar->Realize(); } @@ -213,7 +217,8 @@ void LIB_EDIT_FRAME::CreateOptionToolbar() if( m_optionsToolBar ) return; - m_optionsToolBar = new EDA_TOOLBAR( TOOLBAR_OPTION, this, ID_OPT_TOOLBAR, false ); + m_optionsToolBar = new wxAuiToolBar( this, ID_OPT_TOOLBAR, wxDefaultPosition, wxDefaultSize, + wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_VERTICAL ); m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString, KiBitmap( grid_xpm ), _( "Turn grid off" ), wxITEM_CHECK ); diff --git a/eeschema/tool_sch.cpp b/eeschema/tool_sch.cpp index 89b4555960..cf2b0e616b 100644 --- a/eeschema/tool_sch.cpp +++ b/eeschema/tool_sch.cpp @@ -1,3 +1,28 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com + * Copyright (C) 2008-2011 Wayne Stambaugh + * Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + /** * @file tool_sch.cpp */ @@ -17,138 +42,140 @@ */ void SCH_EDIT_FRAME::ReCreateHToolbar() { - if( m_HToolBar != NULL ) + if( m_mainToolBar != NULL ) return; wxString msg; - m_HToolBar = new EDA_TOOLBAR( TOOLBAR_MAIN, this, ID_H_TOOLBAR, true ); + m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize, + wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_HORZ_LAYOUT ); // Set up toolbar - m_HToolBar->AddTool( ID_NEW_PROJECT, wxEmptyString, KiBitmap( new_xpm ), - _( "New schematic project" ) ); + m_mainToolBar->AddTool( ID_NEW_PROJECT, wxEmptyString, KiBitmap( new_xpm ), + _( "New schematic project" ) ); - m_HToolBar->AddTool( ID_LOAD_PROJECT, wxEmptyString, KiBitmap( open_document_xpm ), - _( "Open schematic project" ) ); + m_mainToolBar->AddTool( ID_LOAD_PROJECT, wxEmptyString, KiBitmap( open_document_xpm ), + _( "Open schematic project" ) ); - m_HToolBar->AddTool( ID_SAVE_PROJECT, wxEmptyString, KiBitmap( save_project_xpm ), - _( "Save schematic project" ) ); + m_mainToolBar->AddTool( ID_SAVE_PROJECT, wxEmptyString, KiBitmap( save_project_xpm ), + _( "Save schematic project" ) ); - m_HToolBar->AddSeparator(); + m_mainToolBar->AddSeparator(); - m_HToolBar->AddTool( ID_SHEET_SET, wxEmptyString, KiBitmap( sheetset_xpm ), - _( "Page settings" ) ); + m_mainToolBar->AddTool( ID_SHEET_SET, wxEmptyString, KiBitmap( sheetset_xpm ), + _( "Page settings" ) ); - m_HToolBar->AddSeparator(); + m_mainToolBar->AddSeparator(); - m_HToolBar->AddTool( wxID_PRINT, wxEmptyString, KiBitmap( print_button_xpm ), - _( "Print schematic" ) ); + m_mainToolBar->AddTool( wxID_PRINT, wxEmptyString, KiBitmap( print_button_xpm ), + _( "Print schematic" ) ); - m_HToolBar->AddSeparator(); + m_mainToolBar->AddSeparator(); - m_HToolBar->AddTool( wxID_CUT, wxEmptyString, KiBitmap( cut_button_xpm ), - _( "Cut selected item" ) ); + m_mainToolBar->AddTool( wxID_CUT, wxEmptyString, KiBitmap( cut_button_xpm ), + _( "Cut selected item" ) ); - m_HToolBar->AddTool( wxID_COPY, wxEmptyString, KiBitmap( copy_button_xpm ), - _( "Copy selected item" ) ); + m_mainToolBar->AddTool( wxID_COPY, wxEmptyString, KiBitmap( copy_button_xpm ), + _( "Copy selected item" ) ); - m_HToolBar->AddTool( wxID_PASTE, wxEmptyString, KiBitmap( paste_xpm ), - _( "Paste" ) ); + m_mainToolBar->AddTool( wxID_PASTE, wxEmptyString, KiBitmap( paste_xpm ), + _( "Paste" ) ); - m_HToolBar->AddSeparator(); + m_mainToolBar->AddSeparator(); msg = AddHotkeyName( HELP_UNDO, s_Schematic_Hokeys_Descr, HK_UNDO, IS_COMMENT ); - m_HToolBar->AddTool( wxID_UNDO, wxEmptyString, KiBitmap( undo_xpm ), msg ); + m_mainToolBar->AddTool( wxID_UNDO, wxEmptyString, KiBitmap( undo_xpm ), msg ); msg = AddHotkeyName( HELP_REDO, s_Schematic_Hokeys_Descr, HK_REDO, IS_COMMENT ); - m_HToolBar->AddTool( wxID_REDO, wxEmptyString, KiBitmap( redo_xpm ), msg ); + m_mainToolBar->AddTool( wxID_REDO, wxEmptyString, KiBitmap( redo_xpm ), msg ); - m_HToolBar->AddSeparator(); + m_mainToolBar->AddSeparator(); msg = AddHotkeyName( HELP_FIND, s_Schematic_Hokeys_Descr, HK_FIND_ITEM, IS_COMMENT ); - m_HToolBar->AddTool( ID_FIND_ITEMS, wxEmptyString, KiBitmap( find_xpm ), msg ); + m_mainToolBar->AddTool( ID_FIND_ITEMS, wxEmptyString, KiBitmap( find_xpm ), msg ); - m_HToolBar->AddTool( wxID_REPLACE, wxEmptyString, KiBitmap( find_replace_xpm ), - wxNullBitmap, wxITEM_NORMAL, _( "Find and replace text" ), - HELP_REPLACE, NULL ); + m_mainToolBar->AddTool( wxID_REPLACE, wxEmptyString, KiBitmap( find_replace_xpm ), + wxNullBitmap, wxITEM_NORMAL, _( "Find and replace text" ), + HELP_REPLACE, NULL ); - m_HToolBar->AddSeparator(); + m_mainToolBar->AddSeparator(); msg = AddHotkeyName( HELP_ZOOM_IN, s_Schematic_Hokeys_Descr, HK_ZOOM_IN, IS_COMMENT ); - m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiBitmap( zoom_in_xpm ), msg ); + m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiBitmap( zoom_in_xpm ), msg ); msg = AddHotkeyName( HELP_ZOOM_OUT, s_Schematic_Hokeys_Descr, HK_ZOOM_OUT, IS_COMMENT ); - m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiBitmap( zoom_out_xpm ), msg ); + m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiBitmap( zoom_out_xpm ), msg ); msg = AddHotkeyName( HELP_ZOOM_REDRAW, s_Schematic_Hokeys_Descr, HK_ZOOM_REDRAW, IS_COMMENT ); - m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, KiBitmap( zoom_redraw_xpm ), msg ); + m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, KiBitmap( zoom_redraw_xpm ), msg ); msg = AddHotkeyName( HELP_ZOOM_FIT, s_Schematic_Hokeys_Descr, HK_ZOOM_AUTO, IS_COMMENT ); - m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, KiBitmap( zoom_fit_in_page_xpm ), msg ); + m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, KiBitmap( zoom_fit_in_page_xpm ), msg ); - m_HToolBar->AddSeparator(); + m_mainToolBar->AddSeparator(); - m_HToolBar->AddTool( ID_HIERARCHY, wxEmptyString, KiBitmap( hierarchy_nav_xpm ), - _( "Navigate schematic hierarchy" ) ); + m_mainToolBar->AddTool( ID_HIERARCHY, wxEmptyString, KiBitmap( hierarchy_nav_xpm ), + _( "Navigate schematic hierarchy" ) ); - m_HToolBar->AddSeparator(); + m_mainToolBar->AddSeparator(); - m_HToolBar->AddTool( ID_TO_LIBRARY, wxEmptyString, KiBitmap( libedit_xpm ), - _( "Library editor - Create and edit components" ) ); + m_mainToolBar->AddTool( ID_TO_LIBRARY, wxEmptyString, KiBitmap( libedit_xpm ), + _( "Library editor - Create and edit components" ) ); - m_HToolBar->AddTool( ID_TO_LIBVIEW, wxEmptyString, KiBitmap( library_browse_xpm ), - _( "Library browser - Browse components" ) ); + m_mainToolBar->AddTool( ID_TO_LIBVIEW, wxEmptyString, KiBitmap( library_browse_xpm ), + _( "Library browser - Browse components" ) ); - m_HToolBar->AddSeparator(); + m_mainToolBar->AddSeparator(); - m_HToolBar->AddTool( ID_GET_ANNOTATE, wxEmptyString, KiBitmap( annotate_xpm ), - _( "Annotate schematic" ) ); + m_mainToolBar->AddTool( ID_GET_ANNOTATE, wxEmptyString, KiBitmap( annotate_xpm ), + _( "Annotate schematic" ) ); - m_HToolBar->AddTool( ID_GET_ERC, wxEmptyString, KiBitmap( erc_xpm ), - _( "Perform electric rules check" ) ); + m_mainToolBar->AddTool( ID_GET_ERC, wxEmptyString, KiBitmap( erc_xpm ), + _( "Perform electric rules check" ) ); - m_HToolBar->AddTool( ID_GET_NETLIST, wxEmptyString, KiBitmap( netlist_xpm ), - _( "Generate netlist" ) ); + m_mainToolBar->AddTool( ID_GET_NETLIST, wxEmptyString, KiBitmap( netlist_xpm ), + _( "Generate netlist" ) ); - m_HToolBar->AddTool( ID_GET_TOOLS, wxEmptyString, KiBitmap( bom_xpm ), - _( "Generate bill of materials and/or cross references" ) ); + m_mainToolBar->AddTool( ID_GET_TOOLS, wxEmptyString, KiBitmap( bom_xpm ), + _( "Generate bill of materials and/or cross references" ) ); - m_HToolBar->AddSeparator(); + m_mainToolBar->AddSeparator(); - m_HToolBar->AddTool( ID_TO_CVPCB, wxEmptyString, KiBitmap( cvpcb_xpm ), - _( "Run CvPcb to associate components and footprints" ) ); + m_mainToolBar->AddTool( ID_TO_CVPCB, wxEmptyString, KiBitmap( cvpcb_xpm ), + _( "Run CvPcb to associate components and footprints" ) ); - m_HToolBar->AddTool( ID_TO_PCB, wxEmptyString, KiBitmap( pcbnew_xpm ), - _( "Run Pcbnew to layout printed circuit board" ) ); + m_mainToolBar->AddTool( ID_TO_PCB, wxEmptyString, KiBitmap( pcbnew_xpm ), + _( "Run Pcbnew to layout printed circuit board" ) ); - m_HToolBar->AddTool( ID_BACKANNO_ITEMS, wxEmptyString, KiBitmap( import_footprint_names_xpm ), - _( "Back annotate component foot prints" ) ); + m_mainToolBar->AddTool( ID_BACKANNO_ITEMS, wxEmptyString, + KiBitmap( import_footprint_names_xpm ), + _( "Back annotate component foot prints" ) ); // set icon paddings - m_HToolBar->SetToolBorderPadding(3); // padding - m_HToolBar->SetToolSeparation(0); - //m_HToolBar->SetMargins(0,1); // margins width and height + m_mainToolBar->SetToolBorderPadding(3); // padding + m_mainToolBar->SetToolSeparation(0); + //m_mainToolBar->SetMargins(0,1); // margins width and height // after adding the tools to the toolbar, must call Realize() to reflect the changes - m_HToolBar->Realize(); + m_mainToolBar->Realize(); } @@ -159,7 +186,8 @@ void SCH_EDIT_FRAME::ReCreateVToolbar() if( m_drawToolBar ) return; - m_drawToolBar = new EDA_TOOLBAR( TOOLBAR_TOOL, this, ID_V_TOOLBAR, false ); + m_drawToolBar = new wxAuiToolBar( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize, + wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_VERTICAL ); // Set up toolbar m_drawToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, KiBitmap( cursor_xpm ), @@ -245,7 +273,8 @@ void SCH_EDIT_FRAME::ReCreateOptToolbar() if( m_optionsToolBar ) return; - m_optionsToolBar = new EDA_TOOLBAR( TOOLBAR_OPTION, this, ID_OPT_TOOLBAR, false ); + m_optionsToolBar = new wxAuiToolBar( this, ID_OPT_TOOLBAR, wxDefaultPosition, wxDefaultSize, + wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_VERTICAL ); m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString, KiBitmap( grid_xpm ), @@ -292,12 +321,12 @@ void SCH_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) switch( id ) { case ID_TB_OPTIONS_HIDDEN_PINS: - m_showAllPins = m_optionsToolBar->GetToolState( id ); + m_showAllPins = m_optionsToolBar->GetToolToggled( id ); DrawPanel->Refresh( ); break; case ID_TB_OPTIONS_BUS_WIRES_ORIENT: - g_HVLines = m_optionsToolBar->GetToolState( id ); + g_HVLines = m_optionsToolBar->GetToolToggled( id ); break; default: diff --git a/eeschema/tool_viewlib.cpp b/eeschema/tool_viewlib.cpp index f78ef443af..371e3be708 100644 --- a/eeschema/tool_viewlib.cpp +++ b/eeschema/tool_viewlib.cpp @@ -1,6 +1,32 @@ -/****************************************************************/ -/* tool_viewlib.cpp: Build the toolbars for the library browser */ -/****************************************************************/ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com + * Copyright (C) 2008-2011 Wayne Stambaugh + * Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +/** + * @file tool_viewlib.cpp + * @brief Build the toolbars for the library browser. + */ #include "fctsys.h" #include "macros.h" @@ -23,85 +49,86 @@ void LIB_VIEW_FRAME::ReCreateHToolbar() LIB_ALIAS* entry = NULL; bool asdeMorgan = false; - if( m_HToolBar == NULL ) + if( m_mainToolBar == NULL ) { - m_HToolBar = new EDA_TOOLBAR( TOOLBAR_MAIN, this, ID_H_TOOLBAR, true ); + m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize, + wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_HORZ_LAYOUT ); // Set up toolbar - m_HToolBar->AddTool( ID_LIBVIEW_SELECT_LIB, wxEmptyString, - KiBitmap( library_xpm ), - _( "Select library to browse" ) ); + m_mainToolBar->AddTool( ID_LIBVIEW_SELECT_LIB, wxEmptyString, + KiBitmap( library_xpm ), + _( "Select library to browse" ) ); - m_HToolBar->AddTool( ID_LIBVIEW_SELECT_PART, wxEmptyString, - KiBitmap( add_component_xpm ), - _( "Select part to browse" ) ); + m_mainToolBar->AddTool( ID_LIBVIEW_SELECT_PART, wxEmptyString, + KiBitmap( add_component_xpm ), + _( "Select part to browse" ) ); - m_HToolBar->AddSeparator(); - m_HToolBar->AddTool( ID_LIBVIEW_PREVIOUS, wxEmptyString, - KiBitmap( lib_previous_xpm ), - _( "Display previous part" ) ); + m_mainToolBar->AddSeparator(); + m_mainToolBar->AddTool( ID_LIBVIEW_PREVIOUS, wxEmptyString, + KiBitmap( lib_previous_xpm ), + _( "Display previous part" ) ); - m_HToolBar->AddTool( ID_LIBVIEW_NEXT, wxEmptyString, - KiBitmap( lib_next_xpm ), - _( "Display next part" ) ); + m_mainToolBar->AddTool( ID_LIBVIEW_NEXT, wxEmptyString, + KiBitmap( lib_next_xpm ), + _( "Display next part" ) ); - m_HToolBar->AddSeparator(); + m_mainToolBar->AddSeparator(); msg = AddHotkeyName( _( "Zoom in" ), s_Viewlib_Hokeys_Descr, HK_ZOOM_IN, IS_COMMENT ); - m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, - KiBitmap( zoom_in_xpm ), msg ); + m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, + KiBitmap( zoom_in_xpm ), msg ); msg = AddHotkeyName( _( "Zoom out" ), s_Viewlib_Hokeys_Descr, HK_ZOOM_OUT, IS_COMMENT ); - m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, - KiBitmap( zoom_out_xpm ), msg ); + m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, + KiBitmap( zoom_out_xpm ), msg ); msg = AddHotkeyName( _( "Redraw view" ), s_Viewlib_Hokeys_Descr, HK_ZOOM_REDRAW, IS_COMMENT ); - m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, + m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, KiBitmap( zoom_redraw_xpm ), msg ); msg = AddHotkeyName( _( "Zoom auto" ), s_Viewlib_Hokeys_Descr, HK_ZOOM_AUTO, IS_COMMENT ); - m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, - KiBitmap( zoom_fit_in_page_xpm ), msg ); + m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, + KiBitmap( zoom_fit_in_page_xpm ), msg ); - m_HToolBar->AddSeparator(); - m_HToolBar->AddTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, wxEmptyString, - KiBitmap( morgan1_xpm ), - _( "Show as \"De Morgan\" normal part" ), - wxITEM_CHECK ); + m_mainToolBar->AddSeparator(); + m_mainToolBar->AddTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, wxEmptyString, + KiBitmap( morgan1_xpm ), + _( "Show as \"De Morgan\" normal part" ), + wxITEM_CHECK ); - m_HToolBar->AddTool( ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, wxEmptyString, - KiBitmap( morgan2_xpm ), - _( "Show as \"De Morgan\" convert part" ), - wxITEM_CHECK ); + m_mainToolBar->AddTool( ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, wxEmptyString, + KiBitmap( morgan2_xpm ), + _( "Show as \"De Morgan\" convert part" ), + wxITEM_CHECK ); - m_HToolBar->AddSeparator(); + m_mainToolBar->AddSeparator(); - SelpartBox = new wxComboBox( m_HToolBar, ID_LIBVIEW_SELECT_PART_NUMBER, + SelpartBox = new wxComboBox( m_mainToolBar, ID_LIBVIEW_SELECT_PART_NUMBER, wxEmptyString, wxDefaultPosition, wxSize( 150, -1 ), 0, NULL, wxCB_READONLY ); - m_HToolBar->AddControl( SelpartBox ); + m_mainToolBar->AddControl( SelpartBox ); - m_HToolBar->AddSeparator(); - m_HToolBar->AddTool( ID_LIBVIEW_VIEWDOC, wxEmptyString, - KiBitmap( datasheet_xpm ), - _( "View component documents" ) ); - m_HToolBar->EnableTool( ID_LIBVIEW_VIEWDOC, false ); + m_mainToolBar->AddSeparator(); + m_mainToolBar->AddTool( ID_LIBVIEW_VIEWDOC, wxEmptyString, + KiBitmap( datasheet_xpm ), + _( "View component documents" ) ); + m_mainToolBar->EnableTool( ID_LIBVIEW_VIEWDOC, false ); if( m_Semaphore ) { // The library browser is called from a "load component" command - m_HToolBar->AddSeparator(); - m_HToolBar->AddTool( ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC, - wxEmptyString, KiBitmap( export_xpm ), - _( "Insert component in schematic" ) ); + m_mainToolBar->AddSeparator(); + m_mainToolBar->AddTool( ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC, + wxEmptyString, KiBitmap( export_xpm ), + _( "Insert component in schematic" ) ); } // after adding the buttons to the toolbar, must call Realize() to // reflect the changes - m_HToolBar->Realize(); + m_mainToolBar->Realize(); } if( (m_libraryName != wxEmptyString) && (m_entryName != wxEmptyString) ) @@ -120,25 +147,29 @@ void LIB_VIEW_FRAME::ReCreateHToolbar() } // Must be AFTER Realize(): - m_HToolBar->EnableTool( ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, asdeMorgan ); - m_HToolBar->EnableTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, asdeMorgan ); + m_mainToolBar->EnableTool( ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, asdeMorgan ); + m_mainToolBar->EnableTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, asdeMorgan ); + if( asdeMorgan ) { bool normal = m_convert <= 1; - m_HToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT,normal ); - m_HToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, !normal ); + m_mainToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT,normal ); + m_mainToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, !normal ); } else { - m_HToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, true ); - m_HToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, false ); + m_mainToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, true ); + m_mainToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, false ); } int parts_count = 1; + if( component ) parts_count = MAX( component->GetPartCount(), 1 ); + SelpartBox->Clear(); + for( ii = 0; ii < parts_count; ii++ ) { wxString msg; @@ -149,10 +180,10 @@ void LIB_VIEW_FRAME::ReCreateHToolbar() SelpartBox->SetSelection( (m_unit > 0 ) ? m_unit - 1 : 0 ); SelpartBox->Enable( parts_count > 1 ); - m_HToolBar->EnableTool( ID_LIBVIEW_VIEWDOC, - entry && ( entry->GetDocFileName() != wxEmptyString ) ); + m_mainToolBar->EnableTool( ID_LIBVIEW_VIEWDOC, + entry && ( entry->GetDocFileName() != wxEmptyString ) ); - m_HToolBar->Refresh(); + m_mainToolBar->Refresh(); } diff --git a/eeschema/viewlib_frame.cpp b/eeschema/viewlib_frame.cpp index 28cc221d40..594f79d36f 100644 --- a/eeschema/viewlib_frame.cpp +++ b/eeschema/viewlib_frame.cpp @@ -211,8 +211,8 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library, wxSemaph // Manage main toolbal - m_auimgr.AddPane( m_HToolBar, - wxAuiPaneInfo( horiz ).Name( wxT ("m_HToolBar" ) ).Top().Row( 0 ) ); + m_auimgr.AddPane( m_mainToolBar, + wxAuiPaneInfo( horiz ).Name( wxT ("m_mainToolBar" ) ).Top().Row( 0 ) ); wxSize minsize( 60, -1 ); diff --git a/eeschema/viewlibs.cpp b/eeschema/viewlibs.cpp index 8986d3f714..995cd60c3d 100644 --- a/eeschema/viewlibs.cpp +++ b/eeschema/viewlibs.cpp @@ -56,15 +56,15 @@ void LIB_VIEW_FRAME::Process_Special_Functions( wxCommandEvent& event ) break; case ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT: - m_HToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, true ); - m_HToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, FALSE ); + m_mainToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, true ); + m_mainToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, FALSE ); m_convert = 1; DrawPanel->Refresh(); break; case ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT: - m_HToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, FALSE ); - m_HToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, true ); + m_mainToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, FALSE ); + m_mainToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, true ); m_convert = 2; DrawPanel->Refresh(); break; diff --git a/gerbview/class_DCodeSelectionbox.cpp b/gerbview/class_DCodeSelectionbox.cpp index 116e3de921..0c3e308707 100644 --- a/gerbview/class_DCodeSelectionbox.cpp +++ b/gerbview/class_DCodeSelectionbox.cpp @@ -14,7 +14,7 @@ /* Helper class for displaying DCodes list */ /*******************************************/ -DCODE_SELECTION_BOX::DCODE_SELECTION_BOX( EDA_TOOLBAR* aParent, wxWindowID aId, +DCODE_SELECTION_BOX::DCODE_SELECTION_BOX( wxAuiToolBar* aParent, wxWindowID aId, const wxPoint& aLocation, const wxSize& aSize, const wxArrayString& aChoices ) : wxComboBox( aParent, aId, wxEmptyString, aLocation, aSize, 0, NULL, wxCB_READONLY ) diff --git a/gerbview/class_DCodeSelectionbox.h b/gerbview/class_DCodeSelectionbox.h index 9a5e8c24f0..e52a7020bf 100644 --- a/gerbview/class_DCodeSelectionbox.h +++ b/gerbview/class_DCodeSelectionbox.h @@ -14,7 +14,7 @@ class DCODE_SELECTION_BOX : public wxComboBox private: const wxArrayString* m_dcodeList; -public: DCODE_SELECTION_BOX( EDA_TOOLBAR* aParent, wxWindowID aId, +public: DCODE_SELECTION_BOX( wxAuiToolBar* aParent, wxWindowID aId, const wxPoint& aLocation, const wxSize& aSize, const wxArrayString& aChoices); ~DCODE_SELECTION_BOX(); diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp index c4bc7cdea5..fff4ba8b94 100644 --- a/gerbview/gerbview_frame.cpp +++ b/gerbview/gerbview_frame.cpp @@ -128,9 +128,9 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* father, lyrs.Caption( _( "Visibles" ) ); - if( m_HToolBar ) - m_auimgr.AddPane( m_HToolBar, - wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().Row( 0 ) ); + if( m_mainToolBar ) + m_auimgr.AddPane( m_mainToolBar, + wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top().Row( 0 ) ); if( m_drawToolBar ) m_auimgr.AddPane( m_drawToolBar, diff --git a/gerbview/options.cpp b/gerbview/options.cpp index 03e79d14ef..ed4b977ea1 100644 --- a/gerbview/options.cpp +++ b/gerbview/options.cpp @@ -28,7 +28,7 @@ void GERBVIEW_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) break; default: - state = m_optionsToolBar->GetToolState( id ); + state = m_optionsToolBar->GetToolToggled( id ); break; } diff --git a/gerbview/toolbars_gerber.cpp b/gerbview/toolbars_gerber.cpp index 05cfdfa69a..d853682d47 100644 --- a/gerbview/toolbars_gerber.cpp +++ b/gerbview/toolbars_gerber.cpp @@ -46,45 +46,46 @@ void GERBVIEW_FRAME::ReCreateHToolbar( void ) int ii; wxString msg; - if( m_HToolBar != NULL ) + if( m_mainToolBar != NULL ) return; - m_HToolBar = new EDA_TOOLBAR( TOOLBAR_MAIN, this, ID_H_TOOLBAR, true ); + m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize, + wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_HORZ_LAYOUT ); // Set up toolbar - m_HToolBar->AddTool( ID_GERBVIEW_ERASE_ALL, wxEmptyString, - KiBitmap( gerbview_clear_layers_xpm ), - _( "Erase all layers" ) ); + m_mainToolBar->AddTool( ID_GERBVIEW_ERASE_ALL, wxEmptyString, + KiBitmap( gerbview_clear_layers_xpm ), + _( "Erase all layers" ) ); - m_HToolBar->AddTool( wxID_FILE, wxEmptyString, KiBitmap( gerber_file_xpm ), - _( "Load a new Gerber file on the current layer. Previous data will be deleted" ) ); + m_mainToolBar->AddTool( wxID_FILE, wxEmptyString, KiBitmap( gerber_file_xpm ), + _( "Load a new Gerber file on the current layer. Previous data will be deleted" ) ); - m_HToolBar->AddTool( ID_GERBVIEW_LOAD_DRILL_FILE, wxEmptyString, - KiBitmap( gerbview_drill_file_xpm ), - _( "Load an excellon drill file on the current layer. Previous data will be deleted" ) ); + m_mainToolBar->AddTool( ID_GERBVIEW_LOAD_DRILL_FILE, wxEmptyString, + KiBitmap( gerbview_drill_file_xpm ), + _( "Load an excellon drill file on the current layer. Previous data will be deleted" ) ); - m_HToolBar->AddSeparator(); - m_HToolBar->AddTool( ID_GERBVIEW_SET_PAGE_BORDER, wxEmptyString, KiBitmap( sheetset_xpm ), - _( "Show/hide frame reference and select paper size for printing" ) ); + m_mainToolBar->AddSeparator(); + m_mainToolBar->AddTool( ID_GERBVIEW_SET_PAGE_BORDER, wxEmptyString, KiBitmap( sheetset_xpm ), + _( "Show/hide frame reference and select paper size for printing" ) ); - m_HToolBar->AddSeparator(); - m_HToolBar->AddTool( wxID_PRINT, wxEmptyString, KiBitmap( print_button_xpm ), - _( "Print layers" ) ); + m_mainToolBar->AddSeparator(); + m_mainToolBar->AddTool( wxID_PRINT, wxEmptyString, KiBitmap( print_button_xpm ), + _( "Print layers" ) ); - m_HToolBar->AddSeparator(); + m_mainToolBar->AddSeparator(); msg = AddHotkeyName( _( "Zoom in" ), s_Gerbview_Hokeys_Descr, HK_ZOOM_IN, IS_COMMENT ); - m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiBitmap( zoom_in_xpm ), msg ); + m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiBitmap( zoom_in_xpm ), msg ); msg = AddHotkeyName( _( "Zoom out" ), s_Gerbview_Hokeys_Descr, HK_ZOOM_OUT, IS_COMMENT ); - m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiBitmap( zoom_out_xpm ), msg ); + m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiBitmap( zoom_out_xpm ), msg ); msg = AddHotkeyName( _( "Redraw view" ), s_Gerbview_Hokeys_Descr, HK_ZOOM_REDRAW, IS_COMMENT ); - m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, KiBitmap( zoom_redraw_xpm ), msg ); + m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, KiBitmap( zoom_redraw_xpm ), msg ); msg = AddHotkeyName( _( "Zoom auto" ), s_Gerbview_Hokeys_Descr, HK_ZOOM_AUTO, IS_COMMENT ); - m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, KiBitmap( zoom_fit_in_page_xpm ), msg ); + m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, KiBitmap( zoom_fit_in_page_xpm ), msg ); - m_HToolBar->AddSeparator(); + m_mainToolBar->AddSeparator(); wxArrayString choices; @@ -94,11 +95,11 @@ void GERBVIEW_FRAME::ReCreateHToolbar( void ) choices.Add( msg ); } - m_SelLayerBox = new LAYER_BOX_SELECTOR( m_HToolBar, ID_TOOLBARH_GERBVIEW_SELECT_ACTIVE_LAYER, + m_SelLayerBox = new LAYER_BOX_SELECTOR( m_mainToolBar, ID_TOOLBARH_GERBVIEW_SELECT_ACTIVE_LAYER, wxDefaultPosition, wxSize( 150, -1 ), choices ); - m_HToolBar->AddControl( m_SelLayerBox ); + m_mainToolBar->AddControl( m_SelLayerBox ); - m_HToolBar->AddSeparator(); + m_mainToolBar->AddSeparator(); m_DCodesList.Alloc(TOOLS_MAX_COUNT+1); m_DCodesList.Add( _( "No tool" ) ); @@ -110,17 +111,18 @@ void GERBVIEW_FRAME::ReCreateHToolbar( void ) m_DCodesList.Add( msg ); } - m_DCodeSelector = new DCODE_SELECTION_BOX( m_HToolBar, ID_TOOLBARH_GERBER_SELECT_ACTIVE_DCODE, + m_DCodeSelector = new DCODE_SELECTION_BOX( m_mainToolBar, + ID_TOOLBARH_GERBER_SELECT_ACTIVE_DCODE, wxDefaultPosition, wxSize( 150, -1 ), m_DCodesList ); - m_HToolBar->AddControl( m_DCodeSelector ); + m_mainToolBar->AddControl( m_DCodeSelector ); - m_TextInfo = new wxTextCtrl( m_HToolBar, wxID_ANY, wxEmptyString, wxDefaultPosition, + m_TextInfo = new wxTextCtrl( m_mainToolBar, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(150,-1), wxTE_READONLY ); - m_HToolBar->AddControl( m_TextInfo ); + m_mainToolBar->AddControl( m_TextInfo ); // after adding the buttons to the toolbar, must call Realize() to reflect the changes - m_HToolBar->Realize(); + m_mainToolBar->Realize(); } @@ -129,7 +131,8 @@ void GERBVIEW_FRAME::ReCreateVToolbar( void ) if( m_drawToolBar ) return; - m_drawToolBar = new EDA_TOOLBAR( TOOLBAR_TOOL, this, ID_V_TOOLBAR, FALSE ); + m_drawToolBar = new wxAuiToolBar( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize, + wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_VERTICAL ); // Set up toolbar m_drawToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, KiBitmap( cursor_xpm ) ); @@ -145,7 +148,8 @@ void GERBVIEW_FRAME::ReCreateOptToolbar( void ) return; // creation of tool bar options - m_optionsToolBar = new EDA_TOOLBAR( TOOLBAR_OPTION, this, ID_OPT_TOOLBAR, FALSE ); + m_optionsToolBar = new wxAuiToolBar( this, ID_OPT_TOOLBAR, wxDefaultPosition, wxDefaultSize, + wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_VERTICAL ); m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString, KiBitmap( grid_xpm ), _( "Turn grid off" ), wxITEM_CHECK ); diff --git a/include/class_layer_box_selector.h b/include/class_layer_box_selector.h index ab9c3a83cc..91e216fddd 100644 --- a/include/class_layer_box_selector.h +++ b/include/class_layer_box_selector.h @@ -5,7 +5,7 @@ #include -class EDA_TOOLBAR; +class wxAuiToolBar; /* class to display a layer list. @@ -18,12 +18,12 @@ private: bool m_layerhotkeys; bool m_layerorder; public: - LAYER_BOX_SELECTOR( EDA_TOOLBAR* parent, wxWindowID id, + LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, int n = 0, const wxString choices[] = NULL ); - LAYER_BOX_SELECTOR( EDA_TOOLBAR* parent, wxWindowID id, + LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, const wxArrayString& choices ); diff --git a/include/wxBasePcbFrame.h b/include/wxBasePcbFrame.h index 9bd6ae7838..282de446a8 100644 --- a/include/wxBasePcbFrame.h +++ b/include/wxBasePcbFrame.h @@ -86,7 +86,10 @@ protected: /// Auxiliary tool bar typically shown below the main tool bar at the top of the /// main window. - EDA_TOOLBAR* m_auxiliaryToolBar; + wxAuiToolBar* m_auxiliaryToolBar; + + /// True prints or plots the drawing border and title block. + bool m_printBorderAndTitleBlock; void updateGridSelectBox(); void updateZoomSelectBox(); @@ -99,6 +102,8 @@ public: ~PCB_BASE_FRAME(); + bool GetPrintBorderAndTitleBlock() const { return m_printBorderAndTitleBlock; } + /** * Function GetBoardBoundingBox * calculates the bounding box containing all board items (or board edge segments). diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h index 86019f35c3..261942cc4c 100644 --- a/include/wxPcbStruct.h +++ b/include/wxPcbStruct.h @@ -82,8 +82,12 @@ class PCB_EDIT_FRAME : public PCB_BASE_FRAME int m_RecordingMacros; MACROS_RECORDED m_Macros[10]; + /// The command ID of the current auto place mode which will be set for either + /// automatic placement of tracks or modules. + int m_autoPlaceModeId; + /// The auxiliary right vertical tool bar used to access the microwave tools. - EDA_TOOLBAR* m_microWaveToolBar; + wxAuiToolBar* m_microWaveToolBar; protected: @@ -236,6 +240,8 @@ public: void OnUpdateZoneDisplayStyle( wxUpdateUIEvent& aEvent ); void OnUpdateSelectTrackWidth( wxUpdateUIEvent& aEvent ); void OnUpdateSelectAutoTrackWidth( wxUpdateUIEvent& aEvent ); + void OnUpdateAutoPlaceModulesMode( wxUpdateUIEvent& aEvent ); + void OnUpdateAutoPlaceTracksMode( wxUpdateUIEvent& aEvent ); /** * Function RecordMacros. @@ -474,7 +480,7 @@ public: void ReCreateMicrowaveVToolbar(); void ReCreateOptToolbar(); void ReCreateMenuBar(); - LAYER_BOX_SELECTOR* ReCreateLayerBox( EDA_TOOLBAR* parent ); + LAYER_BOX_SELECTOR* ReCreateLayerBox( wxAuiToolBar* parent ); /** * Function OnModify @@ -1321,6 +1327,8 @@ public: // Autoplacement: void AutoPlace( wxCommandEvent& event ); + void OnSelectAutoPlaceMode( wxCommandEvent& aEvent ); + /** * Function OnOrientFootprints * install the dialog box for the common Orient Footprints diff --git a/include/wxstruct.h b/include/wxstruct.h index 5ff49f34ec..7c7da45e53 100644 --- a/include/wxstruct.h +++ b/include/wxstruct.h @@ -71,7 +71,6 @@ class EDA_RECT; class EDA_DRAW_PANEL; class EDA_MSG_PANEL; class BASE_SCREEN; -class EDA_TOOLBAR; class PARAM_CFG_BASE; class Ki_PageDescr; class PLOTTER; @@ -98,13 +97,6 @@ enum id_drawframe { KICAD_MAIN_FRAME }; -enum id_toolbar { - TOOLBAR_MAIN = 1, // Main horizontal Toolbar - TOOLBAR_TOOL, // Right vertical Toolbar (list of tools) - TOOLBAR_OPTION, // Left vertical Toolbar (option toolbar - TOOLBAR_AUX // Secondary horizontal Toolbar -}; - /// Custom trace mask to enable and disable auto save tracing. extern const wxChar* traceAutoSave; @@ -123,7 +115,7 @@ protected: wxSize m_FrameSize; int m_MsgFrameHeight; - EDA_TOOLBAR* m_HToolBar; // Standard horizontal Toolbar + wxAuiToolBar* m_mainToolBar; // Standard horizontal Toolbar bool m_FrameIsActive; wxString m_FrameName; // name used for writing and reading setup // It is "SchematicFrame", "PcbFrame" .... @@ -376,14 +368,6 @@ class EDA_DRAW_FRAME : public EDA_BASE_FRAME public: EDA_DRAW_PANEL* DrawPanel; // Draw area - int m_HTOOL_current_state; // Id of active button on - // horizontal toolbar - - int m_InternalUnits; // Internal units count in 1 inch - // = 1000 for Eeschema, = 10000 - // for Pcbnew and GerbView - - bool m_Print_Sheet_Ref; // true to print frame references protected: EDA_HOTKEY_CONFIG* m_HotkeysZoomAndGridList; @@ -391,6 +375,10 @@ protected: bool m_DrawGrid; // hide/Show grid int m_GridColor; // Grid color + /// Internal units count that is equivalent to 1 inch. Set to 1000 (0.001") for + /// schematic drawing and 10000 (0.0001") for PCB drawing. + int m_internalUnits; + /// Tool ID of previously active draw tool bar button. int m_lastDrawToolId; // on the vertical toolbar @@ -423,10 +411,10 @@ protected: /// The tool bar that contains the buttons for quick access to the application draw /// tools. It typically is located on the right side of the main window. - EDA_TOOLBAR* m_drawToolBar; + wxAuiToolBar* m_drawToolBar; /// The options tool bar typcially located on the left edge of the main window. - EDA_TOOLBAR* m_optionsToolBar; + wxAuiToolBar* m_optionsToolBar; /// Panel used to display information at the bottom of the main window. EDA_MSG_PANEL* m_messagePanel; @@ -473,6 +461,8 @@ public: void SetShowBorderAndTitleBlock( bool aShow ) { m_showBorderAndTitleBlock = aShow; } + int GetInternalUnits() const { return m_internalUnits; } + virtual wxString GetScreenDesc(); /** @@ -876,10 +866,6 @@ protected: */ wxSize computeTextSize( const wxString& text ); -public: - EDA_DRAW_FRAME* m_Parent; - int m_BgColor; - public: EDA_MSG_PANEL( EDA_DRAW_FRAME* parent, int id, const wxPoint& pos, const wxSize& size ); ~EDA_MSG_PANEL(); @@ -927,45 +913,6 @@ public: }; -/** - * Class EDA_TOOLBAR - * is the base class for deriving KiCad tool bars. - */ -class EDA_TOOLBAR : public wxAuiToolBar -{ -public: - wxWindow* m_Parent; - id_toolbar m_Ident; - bool m_Horizontal; // some auxiliary TB are horizontal, others vertical - -public: - EDA_TOOLBAR( id_toolbar type, wxWindow* parent, wxWindowID id, bool horizontal ); - - bool GetToolState( int toolId ) { return GetToolToggled(toolId); }; - - void AddRadioTool( int toolid, - const wxString& label, - const wxBitmap& bitmap, - const wxBitmap& bmpDisabled = wxNullBitmap, - const wxString& shortHelp = wxEmptyString, - const wxString& longHelp = wxEmptyString, - wxObject* data = NULL ) - { - AddTool( toolid, label, bitmap, bmpDisabled, wxITEM_CHECK, - shortHelp, longHelp, data ); - }; - - void SetToolNormalBitmap( int id, const wxBitmap& bitmap ) {}; - void SetRows( int nRows ) {}; - - /** - * Function GetDimension - * @return the dimension of this toolbar (Height if horizontal, Width if vertical. - */ - int GetDimension(); -}; - - /** * Function AddMenuItem * is an inline helper function to create and insert a menu item with an image diff --git a/kicad/kicad.h b/kicad/kicad.h index 4090a051c5..978517d05e 100644 --- a/kicad/kicad.h +++ b/kicad/kicad.h @@ -63,7 +63,7 @@ class KICAD_MANAGER_FRAME : public EDA_BASE_FRAME public: TREE_PROJECT_FRAME* m_LeftWin; RIGHT_KM_FRAME* m_RightWin; - EDA_TOOLBAR* m_VToolBar; // Vertical toolbar (not used) + wxAuiToolBar* m_VToolBar; // Vertical toolbar (not used) wxString m_BoardFileName; wxString m_SchematicRootFileName; wxFileName m_ProjectFileName; diff --git a/kicad/mainframe.cpp b/kicad/mainframe.cpp index 2e2b83d0c1..c08230d5e2 100644 --- a/kicad/mainframe.cpp +++ b/kicad/mainframe.cpp @@ -75,9 +75,9 @@ KICAD_MANAGER_FRAME::KICAD_MANAGER_FRAME( wxWindow* parent, EDA_PANEINFO info; info.InfoToolbarPane(); - if( m_HToolBar ) - m_auimgr.AddPane( m_HToolBar, - wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().Layer( 1 ) ); + if( m_mainToolBar ) + m_auimgr.AddPane( m_mainToolBar, + wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top().Layer( 1 ) ); if( m_RightWin ) m_auimgr.AddPane( m_RightWin, diff --git a/kicad/menubar.cpp b/kicad/menubar.cpp index 9fcf13b8bd..36a935b10b 100644 --- a/kicad/menubar.cpp +++ b/kicad/menubar.cpp @@ -296,43 +296,44 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar() void KICAD_MANAGER_FRAME::RecreateBaseHToolbar() { // Check if toolbar is not already created - if( m_HToolBar != NULL ) + if( m_mainToolBar != NULL ) return; - // Allocate memory for m_HToolBar - m_HToolBar = new EDA_TOOLBAR( TOOLBAR_MAIN, this, ID_H_TOOLBAR, TRUE ); + // Allocate memory for m_mainToolBar + m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize, + wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_HORZ_LAYOUT ); // New - m_HToolBar->AddTool( ID_NEW_PROJECT, wxEmptyString, - KiBitmap( new_project_xpm ), - _( "Start a new project" ) ); + m_mainToolBar->AddTool( ID_NEW_PROJECT, wxEmptyString, + KiBitmap( new_project_xpm ), + _( "Start a new project" ) ); // Load - m_HToolBar->AddTool( ID_LOAD_PROJECT, wxEmptyString, - KiBitmap( open_project_xpm ), - _( "Load existing project" ) ); + m_mainToolBar->AddTool( ID_LOAD_PROJECT, wxEmptyString, + KiBitmap( open_project_xpm ), + _( "Load existing project" ) ); // Save - m_HToolBar->AddTool( ID_SAVE_PROJECT, wxEmptyString, - KiBitmap( save_project_xpm ), - _( "Save current project" ) ); + m_mainToolBar->AddTool( ID_SAVE_PROJECT, wxEmptyString, + KiBitmap( save_project_xpm ), + _( "Save current project" ) ); // Separator - m_HToolBar->AddSeparator(); + m_mainToolBar->AddSeparator(); // Archive - m_HToolBar->AddTool( ID_SAVE_AND_ZIP_FILES, wxEmptyString, - KiBitmap( zip_xpm ), - _( "Archive all project files" ) ); + m_mainToolBar->AddTool( ID_SAVE_AND_ZIP_FILES, wxEmptyString, + KiBitmap( zip_xpm ), + _( "Archive all project files" ) ); // Separator - m_HToolBar->AddSeparator(); + m_mainToolBar->AddSeparator(); // Refresh project tree - m_HToolBar->AddTool( ID_PROJECT_TREE_REFRESH, wxEmptyString, - KiBitmap( reload_xpm ), - _( "Refresh project tree" ) ); + m_mainToolBar->AddTool( ID_PROJECT_TREE_REFRESH, wxEmptyString, + KiBitmap( reload_xpm ), + _( "Refresh project tree" ) ); - // Create m_HToolBar - m_HToolBar->Realize(); + // Create m_mainToolBar + m_mainToolBar->Realize(); } diff --git a/pcbnew/automove.cpp b/pcbnew/automove.cpp index 7fb839335b..d948e24b93 100644 --- a/pcbnew/automove.cpp +++ b/pcbnew/automove.cpp @@ -1,6 +1,32 @@ -/****************************************************************/ -/* Routines for automatic displacement and rotation of modules. */ -/****************************************************************/ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com + * Copyright (C) 2011 Wayne Stambaugh + * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +/** + * @file automove.cpp + * @brief Routines for automatic displacement and rotation of modules. + */ #include @@ -39,46 +65,14 @@ wxString ModulesMaskSelection = wxT( "*" ); void PCB_EDIT_FRAME::AutoPlace( wxCommandEvent& event ) { int id = event.GetId(); - bool on_state; - if( m_HToolBar == NULL ) + if( m_mainToolBar == NULL ) return; INSTALL_UNBUFFERED_DC( dc, DrawPanel ); switch( id ) { - case ID_TOOLBARH_PCB_MODE_MODULE: - on_state = m_HToolBar->GetToolState( ID_TOOLBARH_PCB_MODE_MODULE ); - - if( on_state ) - { - m_HToolBar->ToggleTool( ID_TOOLBARH_PCB_MODE_TRACKS, false ); - m_HTOOL_current_state = ID_TOOLBARH_PCB_MODE_MODULE; - } - else - { - m_HTOOL_current_state = 0; - } - - return; - - case ID_TOOLBARH_PCB_MODE_TRACKS: - on_state = m_HToolBar->GetToolState( ID_TOOLBARH_PCB_MODE_TRACKS ); - - if( on_state ) - { - m_HToolBar->ToggleTool( ID_TOOLBARH_PCB_MODE_MODULE, false ); - m_HTOOL_current_state = ID_TOOLBARH_PCB_MODE_TRACKS; - } - else - { - m_HTOOL_current_state = 0; - } - - return; - - case ID_POPUP_PCB_AUTOROUTE_SELECT_LAYERS: return; diff --git a/pcbnew/basepcbframe.cpp b/pcbnew/basepcbframe.cpp index ce97767a2a..21f26d67dd 100644 --- a/pcbnew/basepcbframe.cpp +++ b/pcbnew/basepcbframe.cpp @@ -85,7 +85,7 @@ PCB_BASE_FRAME::PCB_BASE_FRAME( wxWindow* father, long style) : EDA_DRAW_FRAME( father, idtype, title, pos, size, style ) { - m_InternalUnits = PCB_INTERNAL_UNIT; // Internal unit = 1/10000 inch + m_internalUnits = PCB_INTERNAL_UNIT; // Internal unit = 1/10000 inch m_Pcb = NULL; m_DisplayPadFill = true; // How to draw pads @@ -504,7 +504,7 @@ void PCB_BASE_FRAME::UpdateStatusBar() break; } - Line.Printf( formatter, To_User_Unit( g_UserUnit, ro, m_InternalUnits ), theta ); + Line.Printf( formatter, To_User_Unit( g_UserUnit, ro, m_internalUnits ), theta ); // overwrite the absolute cartesian coordinates SetStatusText( Line, 2 ); @@ -624,7 +624,7 @@ void PCB_BASE_FRAME::updateGridSelectBox() for( size_t i = 0; i < GetScreen()->GetGridCount(); i++ ) { GRID_TYPE& grid = GetScreen()->GetGrid( i ); - double value = To_User_Unit( g_UserUnit, grid.m_Size.x, m_InternalUnits ); + double value = To_User_Unit( g_UserUnit, grid.m_Size.x, m_internalUnits ); if( grid.m_Id != ID_POPUP_GRID_USER ) { diff --git a/pcbnew/controle.cpp b/pcbnew/controle.cpp index 1c952a113c..41036300e5 100644 --- a/pcbnew/controle.cpp +++ b/pcbnew/controle.cpp @@ -107,18 +107,12 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode ) } else if( GetToolId() == ID_NO_TOOL_SELECTED ) { - switch( m_HTOOL_current_state ) - { - case ID_TOOLBARH_PCB_MODE_MODULE: + if( m_mainToolBar->GetToolToggled( ID_TOOLBARH_PCB_MODE_MODULE ) ) scanList = GENERAL_COLLECTOR::ModuleItems; - break; - - default: - scanList = DisplayOpt.DisplayZonesMode == 0 ? + else + scanList = (DisplayOpt.DisplayZonesMode == 0) ? GENERAL_COLLECTOR::AllBoardItems : GENERAL_COLLECTOR::AllButZones; - break; - } } else { diff --git a/pcbnew/dialogs/dialog_SVG_print.cpp b/pcbnew/dialogs/dialog_SVG_print.cpp index e7bdd9cbff..5f0d129d6f 100644 --- a/pcbnew/dialogs/dialog_SVG_print.cpp +++ b/pcbnew/dialogs/dialog_SVG_print.cpp @@ -73,7 +73,7 @@ void DIALOG_SVG_PRINT::initDialog( ) AddUnitSymbol( *m_TextPenWidth, g_UserUnit ); m_DialogPenWidth->SetValue( ReturnStringFromValue( g_UserUnit, s_Parameters.m_PenDefaultSize, - m_Parent->m_InternalUnits ) ); + m_Parent->GetInternalUnits() ) ); m_Print_Frame_Ref_Ctrl->SetValue( s_Parameters.m_Print_Sheet_Ref ); @@ -138,7 +138,7 @@ void DIALOG_SVG_PRINT::initDialog( ) void DIALOG_SVG_PRINT::SetPenWidth() { s_Parameters.m_PenDefaultSize = ReturnValueFromTextCtrl( *m_DialogPenWidth, - m_Parent->m_InternalUnits ); + m_Parent->GetInternalUnits() ); if( s_Parameters.m_PenDefaultSize > WIDTH_MAX_VALUE ) { @@ -153,7 +153,7 @@ void DIALOG_SVG_PRINT::SetPenWidth() g_DrawDefaultLineThickness = s_Parameters.m_PenDefaultSize; m_DialogPenWidth->SetValue( ReturnStringFromValue( g_UserUnit, s_Parameters.m_PenDefaultSize, - m_Parent->m_InternalUnits ) ); + m_Parent->GetInternalUnits() ) ); } @@ -239,11 +239,11 @@ bool DIALOG_SVG_PRINT::DrawPage( const wxString& FullFileName, screen->m_DrawOrg.x = screen->m_DrawOrg.y = 0; screen->m_StartVisu.x = screen->m_StartVisu.y = 0; SheetSize = screen->m_CurrentSheetDesc->m_Size; // size in 1/1000 inch - SheetSize.x *= m_Parent->m_InternalUnits / 1000; - SheetSize.y *= m_Parent->m_InternalUnits / 1000; // size in pixels + SheetSize.x *= m_Parent->GetInternalUnits() / 1000; + SheetSize.y *= m_Parent->GetInternalUnits() / 1000; // size in pixels screen->SetScalingFactor( 1.0 ); - float dpi = (float)m_Parent->m_InternalUnits; + float dpi = (float)m_Parent->GetInternalUnits(); EDA_DRAW_PANEL* panel = m_Parent->DrawPanel; diff --git a/pcbnew/dialogs/dialog_copper_zones.cpp b/pcbnew/dialogs/dialog_copper_zones.cpp index 9d08478969..c6d54676da 100644 --- a/pcbnew/dialogs/dialog_copper_zones.cpp +++ b/pcbnew/dialogs/dialog_copper_zones.cpp @@ -84,13 +84,13 @@ void DIALOG_COPPER_ZONE::initDialog() AddUnitSymbol( *m_ClearanceValueTitle, g_UserUnit ); msg = ReturnStringFromValue( g_UserUnit, m_Zone_Setting->m_ZoneClearance, - m_Parent->m_InternalUnits ); + m_Parent->GetInternalUnits() ); m_ZoneClearanceCtrl->SetValue( msg ); AddUnitSymbol( *m_MinThicknessValueTitle, g_UserUnit ); msg = ReturnStringFromValue( g_UserUnit, m_Zone_Setting->m_ZoneMinThickness, - m_Parent->m_InternalUnits ); + m_Parent->GetInternalUnits() ); m_ZoneMinThicknessCtrl->SetValue( msg ); switch( m_Zone_Setting->m_Zone_Pad_Options ) @@ -298,7 +298,7 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aPromptForErrors, bool aUseExportab wxString txtvalue = m_ZoneClearanceCtrl->GetValue(); m_Zone_Setting->m_ZoneClearance = - ReturnValueFromString( g_UserUnit, txtvalue, m_Parent->m_InternalUnits ); + ReturnValueFromString( g_UserUnit, txtvalue, m_Parent->GetInternalUnits() ); // Test if this is a reasonnable value for this parameter // A too large value can hang Pcbnew @@ -311,7 +311,7 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aPromptForErrors, bool aUseExportab txtvalue = m_ZoneMinThicknessCtrl->GetValue(); m_Zone_Setting->m_ZoneMinThickness = - ReturnValueFromString( g_UserUnit, txtvalue, m_Parent->m_InternalUnits ); + ReturnValueFromString( g_UserUnit, txtvalue, m_Parent->GetInternalUnits() ); if( m_Zone_Setting->m_ZoneMinThickness < 10 ) { DisplayError( this, @@ -321,7 +321,7 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aPromptForErrors, bool aUseExportab m_Zone_Setting->SetCornerSmoothingType( m_cornerSmoothingChoice->GetSelection() ); txtvalue = m_cornerSmoothingCtrl->GetValue(); - m_Zone_Setting->SetCornerRadius( ReturnValueFromString( g_UserUnit, txtvalue, m_Parent->m_InternalUnits ) ); + m_Zone_Setting->SetCornerRadius( ReturnValueFromString( g_UserUnit, txtvalue, m_Parent->GetInternalUnits() ) ); if( m_OrientEdgesOpt->GetSelection() == 0 ) g_Zone_45_Only = FALSE; diff --git a/pcbnew/dialogs/dialog_design_rules.cpp b/pcbnew/dialogs/dialog_design_rules.cpp index 64ff315798..f1100ee942 100644 --- a/pcbnew/dialogs/dialog_design_rules.cpp +++ b/pcbnew/dialogs/dialog_design_rules.cpp @@ -207,7 +207,7 @@ DIALOG_DESIGN_RULES::DIALOG_DESIGN_RULES( PCB_EDIT_FRAME* parent ) : void DIALOG_DESIGN_RULES::PrintCurrentSettings() { wxString msg, value; - int internal_units = m_Parent->m_InternalUnits; + int internal_units = m_Parent->GetInternalUnits(); m_MessagesList->AppendToPage( _( "Current general settings:
" ) ); @@ -290,7 +290,7 @@ void DIALOG_DESIGN_RULES::InitGlobalRules() AddUnitSymbol( *m_MicroViaMinDrillTitle ); AddUnitSymbol( *m_TrackMinWidthTitle ); - int Internal_Unit = m_Parent->m_InternalUnits; + int Internal_Unit = m_Parent->GetInternalUnits(); PutValueInLocalUnits( *m_SetViasMinSizeCtrl, m_BrdSettings.m_ViasMinSize, Internal_Unit ); PutValueInLocalUnits( *m_SetViasMinDrillCtrl, m_BrdSettings.m_ViasMinDrill, Internal_Unit ); @@ -326,7 +326,7 @@ void DIALOG_DESIGN_RULES::InitDimensionsLists() */ { wxString msg; - int Internal_Unit = m_Parent->m_InternalUnits; + int Internal_Unit = m_Parent->GetInternalUnits(); // Compute the column widths here, after setting texts msg = wxT("000000.000000"); // This is a very long text to display values. @@ -530,7 +530,7 @@ void DIALOG_DESIGN_RULES::InitRulesList() } // enter the Default NETCLASS. - class2gridRow( m_grid, 0, netclasses.GetDefault(), m_Parent->m_InternalUnits ); + class2gridRow( m_grid, 0, netclasses.GetDefault(), m_Parent->GetInternalUnits() ); // enter others netclasses int row = 1; @@ -538,7 +538,7 @@ void DIALOG_DESIGN_RULES::InitRulesList() { NETCLASS* netclass = i->second; - class2gridRow( m_grid, row, netclass, m_Parent->m_InternalUnits ); + class2gridRow( m_grid, row, netclass, m_Parent->GetInternalUnits() ); } } @@ -567,7 +567,7 @@ void DIALOG_DESIGN_RULES::CopyRulesListToBoard() netclasses.Clear(); // Copy the default NetClass: - gridRow2class( m_grid, 0, netclasses.GetDefault(), m_Parent->m_InternalUnits ); + gridRow2class( m_grid, 0, netclasses.GetDefault(), m_Parent->GetInternalUnits() ); // Copy other NetClasses : for( int row = 1; row < m_grid->GetNumberRows(); ++row ) @@ -586,7 +586,7 @@ void DIALOG_DESIGN_RULES::CopyRulesListToBoard() continue; } - gridRow2class( m_grid, row, nc, m_Parent->m_InternalUnits ); + gridRow2class( m_grid, row, nc, m_Parent->GetInternalUnits() ); } // Now read all nets and push them in the corresponding netclass net buffer @@ -611,21 +611,21 @@ void DIALOG_DESIGN_RULES::CopyGlobalRulesToBoard() // Update vias minimum values for DRC m_BrdSettings.m_ViasMinSize = - ReturnValueFromTextCtrl( *m_SetViasMinSizeCtrl, m_Parent->m_InternalUnits ); + ReturnValueFromTextCtrl( *m_SetViasMinSizeCtrl, m_Parent->GetInternalUnits() ); m_BrdSettings.m_ViasMinDrill = - ReturnValueFromTextCtrl( *m_SetViasMinDrillCtrl, m_Parent->m_InternalUnits ); + ReturnValueFromTextCtrl( *m_SetViasMinDrillCtrl, m_Parent->GetInternalUnits() ); m_BrdSettings.m_MicroViasAllowed = m_AllowMicroViaCtrl->GetSelection() == 1; // Update microvias minimum values for DRC m_BrdSettings.m_MicroViasMinSize = - ReturnValueFromTextCtrl( *m_SetMicroViasMinSizeCtrl, m_Parent->m_InternalUnits ); + ReturnValueFromTextCtrl( *m_SetMicroViasMinSizeCtrl, m_Parent->GetInternalUnits() ); m_BrdSettings.m_MicroViasMinDrill = - ReturnValueFromTextCtrl( *m_SetMicroViasMinDrillCtrl, m_Parent->m_InternalUnits ); + ReturnValueFromTextCtrl( *m_SetMicroViasMinDrillCtrl, m_Parent->GetInternalUnits() ); // Update tracks minimum values for DRC m_BrdSettings.m_TrackMinWidth = - ReturnValueFromTextCtrl( *m_SetTrackMinWidthCtrl, m_Parent->m_InternalUnits ); + ReturnValueFromTextCtrl( *m_SetTrackMinWidthCtrl, m_Parent->GetInternalUnits() ); } @@ -642,7 +642,7 @@ void DIALOG_DESIGN_RULES::CopyDimensionsListsToBoard() msg = m_gridTrackWidthList->GetCellValue( row, 0 ); if( msg.IsEmpty() ) continue; - int value = ReturnValueFromString( g_UserUnit, msg, m_Parent->m_InternalUnits ); + int value = ReturnValueFromString( g_UserUnit, msg, m_Parent->GetInternalUnits() ); m_TracksWidthList.push_back( value ); } @@ -656,13 +656,13 @@ void DIALOG_DESIGN_RULES::CopyDimensionsListsToBoard() msg = m_gridViaSizeList->GetCellValue( row, 0 ); if( msg.IsEmpty() ) continue; - int value = ReturnValueFromString( g_UserUnit, msg, m_Parent->m_InternalUnits ); + int value = ReturnValueFromString( g_UserUnit, msg, m_Parent->GetInternalUnits() ); VIA_DIMENSION via_dim; via_dim.m_Diameter = value; msg = m_gridViaSizeList->GetCellValue( row, 1 ); if( !msg.IsEmpty() ) { - value = ReturnValueFromString( g_UserUnit, msg, m_Parent->m_InternalUnits ); + value = ReturnValueFromString( g_UserUnit, msg, m_Parent->GetInternalUnits() ); via_dim.m_Drill = value; } m_ViasDimensionsList.push_back( via_dim ); @@ -995,22 +995,22 @@ bool DIALOG_DESIGN_RULES::TestDataValidity() wxString msg; int minViaDia = ReturnValueFromTextCtrl( *m_SetViasMinSizeCtrl, - m_Parent->m_InternalUnits ); + m_Parent->GetInternalUnits() ); int minViaDrill = ReturnValueFromTextCtrl( *m_SetViasMinDrillCtrl, - m_Parent->m_InternalUnits ); + m_Parent->GetInternalUnits() ); int minUViaDia = ReturnValueFromTextCtrl( *m_SetMicroViasMinSizeCtrl, - m_Parent->m_InternalUnits ); + m_Parent->GetInternalUnits() ); int minUViaDrill = ReturnValueFromTextCtrl( *m_SetMicroViasMinDrillCtrl, - m_Parent->m_InternalUnits ); + m_Parent->GetInternalUnits() ); int minTrackWidth = ReturnValueFromTextCtrl( *m_SetTrackMinWidthCtrl, - m_Parent->m_InternalUnits ); + m_Parent->GetInternalUnits() ); for( int row = 0; row < m_grid->GetNumberRows(); row++ ) { int tracksize = ReturnValueFromString( g_UserUnit, m_grid->GetCellValue( row, GRID_TRACKSIZE ), - m_Parent->m_InternalUnits ); + m_Parent->GetInternalUnits() ); if( tracksize < minTrackWidth ) { result = false; @@ -1023,7 +1023,7 @@ bool DIALOG_DESIGN_RULES::TestDataValidity() // Test vias int viadia = ReturnValueFromString( g_UserUnit, m_grid->GetCellValue( row, GRID_VIASIZE ), - m_Parent->m_InternalUnits ); + m_Parent->GetInternalUnits() ); if( viadia < minViaDia ) { @@ -1036,7 +1036,7 @@ bool DIALOG_DESIGN_RULES::TestDataValidity() int viadrill = ReturnValueFromString( g_UserUnit, m_grid->GetCellValue( row, GRID_VIADRILL ), - m_Parent->m_InternalUnits ); + m_Parent->GetInternalUnits() ); if( viadrill >= viadia ) { result = false; @@ -1058,7 +1058,7 @@ bool DIALOG_DESIGN_RULES::TestDataValidity() // Test Micro vias int muviadia = ReturnValueFromString( g_UserUnit, m_grid->GetCellValue( row, GRID_uVIASIZE ), - m_Parent->m_InternalUnits ); + m_Parent->GetInternalUnits() ); if( muviadia < minUViaDia ) { @@ -1071,7 +1071,7 @@ bool DIALOG_DESIGN_RULES::TestDataValidity() int muviadrill = ReturnValueFromString( g_UserUnit, m_grid->GetCellValue( row, GRID_uVIADRILL ), - m_Parent->m_InternalUnits ); + m_Parent->GetInternalUnits() ); if( muviadrill >= muviadia ) { result = false; @@ -1101,7 +1101,7 @@ bool DIALOG_DESIGN_RULES::TestDataValidity() int tracksize = ReturnValueFromString( g_UserUnit, tvalue, - m_Parent->m_InternalUnits ); + m_Parent->GetInternalUnits() ); if( tracksize < minTrackWidth ) { result = false; @@ -1128,12 +1128,12 @@ bool DIALOG_DESIGN_RULES::TestDataValidity() continue; int viadia = ReturnValueFromString( g_UserUnit, tvalue, - m_Parent->m_InternalUnits ); + m_Parent->GetInternalUnits() ); int viadrill = 0; wxString drlvalue = m_gridViaSizeList->GetCellValue( row, 1 ); if( !drlvalue.IsEmpty() ) viadrill = ReturnValueFromString( g_UserUnit, drlvalue, - m_Parent->m_InternalUnits ); + m_Parent->GetInternalUnits() ); if( viadia < minViaDia ) { result = false; diff --git a/pcbnew/dialogs/dialog_drc.cpp b/pcbnew/dialogs/dialog_drc.cpp index 7e90c0d22b..0803bea006 100644 --- a/pcbnew/dialogs/dialog_drc.cpp +++ b/pcbnew/dialogs/dialog_drc.cpp @@ -131,11 +131,11 @@ void DIALOG_DRC_CONTROL::InitValues() void DIALOG_DRC_CONTROL::SetDrcParmeters( ) { m_BrdSettings.m_TrackMinWidth = - ReturnValueFromTextCtrl( *m_SetTrackMinWidthCtrl, m_Parent->m_InternalUnits ); + ReturnValueFromTextCtrl( *m_SetTrackMinWidthCtrl, m_Parent->GetInternalUnits() ); m_BrdSettings.m_ViasMinSize = - ReturnValueFromTextCtrl( *m_SetViaMinSizeCtrl, m_Parent->m_InternalUnits ); + ReturnValueFromTextCtrl( *m_SetViaMinSizeCtrl, m_Parent->GetInternalUnits() ); m_BrdSettings.m_MicroViasMinSize = - ReturnValueFromTextCtrl( *m_SetMicroViakMinSizeCtrl, m_Parent->m_InternalUnits ); + ReturnValueFromTextCtrl( *m_SetMicroViakMinSizeCtrl, m_Parent->GetInternalUnits() ); m_Parent->GetBoard()->SetDesignSettings( m_BrdSettings ); } diff --git a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp index 274a4ae53b..bda7bd1800 100644 --- a/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp +++ b/pcbnew/dialogs/dialog_edit_module_for_BoardEditor.cpp @@ -110,7 +110,7 @@ void DIALOG_MODULE_BOARD_EDITOR::InitBoardProperties() m_SolderMaskMarginUnits->SetLabel( GetUnitsLabel( g_UserUnit ) ); m_SolderPasteMarginUnits->SetLabel( GetUnitsLabel( g_UserUnit ) ); - int internalUnit = m_Parent->m_InternalUnits; + int internalUnit = m_Parent->GetInternalUnits(); PutValueInLocalUnits( *m_NetClearanceValueCtrl, m_CurrentModule->m_LocalClearance, internalUnit ); PutValueInLocalUnits( *m_SolderMaskMarginCtrl, @@ -463,11 +463,11 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event ) // Initialize masks clearances m_CurrentModule->m_LocalClearance = - ReturnValueFromTextCtrl( *m_NetClearanceValueCtrl, m_Parent->m_InternalUnits ); + ReturnValueFromTextCtrl( *m_NetClearanceValueCtrl, m_Parent->GetInternalUnits() ); m_CurrentModule->m_LocalSolderMaskMargin = - ReturnValueFromTextCtrl( *m_SolderMaskMarginCtrl, m_Parent->m_InternalUnits ); + ReturnValueFromTextCtrl( *m_SolderMaskMarginCtrl, m_Parent->GetInternalUnits() ); m_CurrentModule->m_LocalSolderPasteMargin = - ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl, m_Parent->m_InternalUnits ); + ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl, m_Parent->GetInternalUnits() ); double dtmp = 0.0; msg = m_SolderPasteMarginRatioCtrl->GetValue(); msg.ToDouble( &dtmp ); diff --git a/pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp b/pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp index 5fb114d205..54e8ab964b 100644 --- a/pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp +++ b/pcbnew/dialogs/dialog_edit_module_for_Modedit.cpp @@ -147,7 +147,7 @@ void DIALOG_MODULE_MODULE_EDITOR::InitModeditProperties() m_SolderPasteMarginUnits->SetLabel( GetUnitsLabel( g_UserUnit ) ); wxString msg; - int internalUnit = m_Parent->m_InternalUnits; + int internalUnit = m_Parent->GetInternalUnits(); PutValueInLocalUnits( *m_NetClearanceValueCtrl, m_CurrentModule->m_LocalClearance, internalUnit ); PutValueInLocalUnits( *m_SolderMaskMarginCtrl, @@ -368,7 +368,7 @@ void DIALOG_MODULE_MODULE_EDITOR::OnOkClick( wxCommandEvent& event ) m_CurrentModule->m_Value->Copy(m_ValueCopy ); // Initialize masks clearances - int internalUnit = m_Parent->m_InternalUnits; + int internalUnit = m_Parent->GetInternalUnits(); m_CurrentModule->m_LocalClearance = ReturnValueFromTextCtrl( *m_NetClearanceValueCtrl, internalUnit ); m_CurrentModule->m_LocalSolderMaskMargin = diff --git a/pcbnew/dialogs/dialog_edit_module_text.cpp b/pcbnew/dialogs/dialog_edit_module_text.cpp index 4ba044924b..41472aee32 100644 --- a/pcbnew/dialogs/dialog_edit_module_text.cpp +++ b/pcbnew/dialogs/dialog_edit_module_text.cpp @@ -121,23 +121,23 @@ void DialogEditModuleText::initDlg( ) AddUnitSymbol( *m_SizeXTitle ); PutValueInLocalUnits( *m_TxtSizeCtrlX, m_currentText->m_Size.x, - m_parent->m_InternalUnits ); + m_parent->GetInternalUnits() ); AddUnitSymbol( *m_SizeYTitle ); PutValueInLocalUnits( *m_TxtSizeCtrlY, m_currentText->m_Size.y, - m_parent->m_InternalUnits ); + m_parent->GetInternalUnits() ); AddUnitSymbol( *m_PosXTitle ); PutValueInLocalUnits( *m_TxtPosCtrlX, m_currentText->GetPos0().x, - m_parent->m_InternalUnits ); + m_parent->GetInternalUnits() ); AddUnitSymbol( *m_PosYTitle ); PutValueInLocalUnits( *m_TxtPosCtrlY, m_currentText->GetPos0().y, - m_parent->m_InternalUnits ); + m_parent->GetInternalUnits() ); AddUnitSymbol( *m_WidthTitle ); PutValueInLocalUnits( *m_TxtWidthCtlr, m_currentText->m_Thickness, - m_parent->m_InternalUnits ); + m_parent->GetInternalUnits() ); int text_orient = m_currentText->m_Orient; NORMALIZE_ANGLE_90(text_orient) @@ -169,19 +169,19 @@ void DialogEditModuleText::OnOkClick( wxCommandEvent& event ) wxPoint tmp; msg = m_TxtPosCtrlX->GetValue(); - tmp.x = ReturnValueFromString( g_UserUnit, msg, m_parent->m_InternalUnits ); + tmp.x = ReturnValueFromString( g_UserUnit, msg, m_parent->GetInternalUnits() ); msg = m_TxtPosCtrlY->GetValue(); - tmp.y = ReturnValueFromString( g_UserUnit, msg, m_parent->m_InternalUnits ); + tmp.y = ReturnValueFromString( g_UserUnit, msg, m_parent->GetInternalUnits() ); m_currentText->SetPos0( tmp ); msg = m_TxtSizeCtrlX->GetValue(); m_currentText->m_Size.x = ReturnValueFromString( g_UserUnit, msg, - m_parent->m_InternalUnits ); + m_parent->GetInternalUnits() ); msg = m_TxtSizeCtrlY->GetValue(); m_currentText->m_Size.y = ReturnValueFromString( g_UserUnit, msg, - m_parent->m_InternalUnits ); + m_parent->GetInternalUnits() ); // Test for a reasonnable size: if( m_currentText->m_Size.x< TEXTS_MIN_SIZE ) @@ -190,7 +190,7 @@ void DialogEditModuleText::OnOkClick( wxCommandEvent& event ) m_currentText->m_Size.y = TEXTS_MIN_SIZE; msg = m_TxtWidthCtlr->GetValue(); - int width = ReturnValueFromString( g_UserUnit, msg, m_parent->m_InternalUnits ); + int width = ReturnValueFromString( g_UserUnit, msg, m_parent->GetInternalUnits() ); // Test for a reasonnable width: if( width <= 1 ) diff --git a/pcbnew/dialogs/dialog_general_options.cpp b/pcbnew/dialogs/dialog_general_options.cpp index 8971f2aa77..59c87f76d1 100644 --- a/pcbnew/dialogs/dialog_general_options.cpp +++ b/pcbnew/dialogs/dialog_general_options.cpp @@ -149,7 +149,7 @@ void Dialog_GeneralOptions::OnOkClick( wxCommandEvent& event ) void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) { int id = event.GetId(); - bool state = m_optionsToolBar->GetToolState( id ); + bool state = m_optionsToolBar->GetToolToggled( id ); switch( id ) { diff --git a/pcbnew/dialogs/dialog_global_edit_tracks_and_vias.cpp b/pcbnew/dialogs/dialog_global_edit_tracks_and_vias.cpp index aad1fd3e49..f9ac29a994 100644 --- a/pcbnew/dialogs/dialog_global_edit_tracks_and_vias.cpp +++ b/pcbnew/dialogs/dialog_global_edit_tracks_and_vias.cpp @@ -44,7 +44,7 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::MyInit() wxString msg; // Display current setup for tracks and vias - int Internal_Unit = m_Parent->m_InternalUnits; + int Internal_Unit = m_Parent->GetInternalUnits(); BOARD* board = m_Parent->GetBoard(); NETCLASSES& netclasses = board->m_NetClasses; NETINFO_ITEM* net = board->FindNet( m_Netcode ); diff --git a/pcbnew/dialogs/dialog_graphic_item_properties.cpp b/pcbnew/dialogs/dialog_graphic_item_properties.cpp index 5c4a47961c..6cb8513770 100644 --- a/pcbnew/dialogs/dialog_graphic_item_properties.cpp +++ b/pcbnew/dialogs/dialog_graphic_item_properties.cpp @@ -119,23 +119,23 @@ void DialogGraphicItemProperties::initDlg( ) AddUnitSymbol( *m_Start_Center_XText ); PutValueInLocalUnits( *m_Center_StartXCtrl, m_Item->GetStart().x, - m_Parent->m_InternalUnits ); + m_Parent->GetInternalUnits() ); AddUnitSymbol( *m_Start_Center_YText ); PutValueInLocalUnits( *m_Center_StartYCtrl, m_Item->GetStart().y, - m_Parent->m_InternalUnits ); + m_Parent->GetInternalUnits() ); AddUnitSymbol( *m_EndX_Radius_Text ); PutValueInLocalUnits( *m_EndX_Radius_Ctrl, m_Item->GetEnd().x, - m_Parent->m_InternalUnits ); + m_Parent->GetInternalUnits() ); AddUnitSymbol( *m_EndY_Text ); PutValueInLocalUnits( *m_EndY_Ctrl, m_Item->GetEnd().y, - m_Parent->m_InternalUnits ); + m_Parent->GetInternalUnits() ); AddUnitSymbol( *m_ItemThicknessText ); PutValueInLocalUnits( *m_ThicknessCtrl, m_Item->GetWidth(), - m_Parent->m_InternalUnits ); + m_Parent->GetInternalUnits() ); AddUnitSymbol( *m_DefaultThicknessText ); @@ -147,7 +147,7 @@ void DialogGraphicItemProperties::initDlg( ) thickness = m_BrdSettings.m_DrawSegmentWidth; PutValueInLocalUnits( *m_DefaultThicknessCtrl, thickness, - m_Parent->m_InternalUnits ); + m_Parent->GetInternalUnits() ); for( int layer=FIRST_NO_COPPER_LAYER; layer <= LAST_NO_COPPER_LAYER; ++layer ) { @@ -176,7 +176,7 @@ void DialogGraphicItemProperties::OnLayerChoice( wxCommandEvent& event ) thickness = m_BrdSettings.m_DrawSegmentWidth; PutValueInLocalUnits( *m_DefaultThicknessCtrl, thickness, - m_Parent->m_InternalUnits ); + m_Parent->GetInternalUnits() ); } /*******************************************************************/ @@ -192,22 +192,22 @@ void DialogGraphicItemProperties::OnOkClick( wxCommandEvent& event ) m_Item->Draw( m_Parent->DrawPanel, m_DC, GR_XOR ); msg = m_Center_StartXCtrl->GetValue(); - m_Item->SetStartX( ReturnValueFromString( g_UserUnit, msg, m_Parent->m_InternalUnits )); + m_Item->SetStartX( ReturnValueFromString( g_UserUnit, msg, m_Parent->GetInternalUnits() )); msg = m_Center_StartYCtrl->GetValue(); - m_Item->SetStartY( ReturnValueFromString( g_UserUnit, msg, m_Parent->m_InternalUnits )); + m_Item->SetStartY( ReturnValueFromString( g_UserUnit, msg, m_Parent->GetInternalUnits() )); msg = m_EndX_Radius_Ctrl->GetValue(); - m_Item->SetEndX( ReturnValueFromString( g_UserUnit, msg, m_Parent->m_InternalUnits )); + m_Item->SetEndX( ReturnValueFromString( g_UserUnit, msg, m_Parent->GetInternalUnits() )); msg = m_EndY_Ctrl->GetValue(); - m_Item->SetEndY( ReturnValueFromString( g_UserUnit, msg, m_Parent->m_InternalUnits )); + m_Item->SetEndY( ReturnValueFromString( g_UserUnit, msg, m_Parent->GetInternalUnits() )); msg = m_ThicknessCtrl->GetValue(); - m_Item->SetWidth( ReturnValueFromString( g_UserUnit, msg, m_Parent->m_InternalUnits )); + m_Item->SetWidth( ReturnValueFromString( g_UserUnit, msg, m_Parent->GetInternalUnits() )); msg = m_DefaultThicknessCtrl->GetValue(); - int thickness = ReturnValueFromString( g_UserUnit, msg, m_Parent->m_InternalUnits ); + int thickness = ReturnValueFromString( g_UserUnit, msg, m_Parent->GetInternalUnits() ); m_Item->SetLayer( m_LayerSelection->GetCurrentSelection() + FIRST_NO_COPPER_LAYER); diff --git a/pcbnew/dialogs/dialog_mask_clearance.cpp b/pcbnew/dialogs/dialog_mask_clearance.cpp index 1484c3cb85..8a6dbf49b8 100644 --- a/pcbnew/dialogs/dialog_mask_clearance.cpp +++ b/pcbnew/dialogs/dialog_mask_clearance.cpp @@ -42,7 +42,7 @@ void DIALOG_PADS_MASK_CLEARANCE::MyInit() m_SolderMaskMarginUnits->SetLabel( GetUnitsLabel( g_UserUnit ) ); m_SolderPasteMarginUnits->SetLabel( GetUnitsLabel( g_UserUnit ) ); - int Internal_Unit = m_Parent->m_InternalUnits; + int Internal_Unit = m_Parent->GetInternalUnits(); PutValueInLocalUnits( *m_SolderMaskMarginCtrl, m_BrdSettings.m_SolderMaskMargin, Internal_Unit ); @@ -70,10 +70,10 @@ void DIALOG_PADS_MASK_CLEARANCE::OnButtonOkClick( wxCommandEvent& event ) /*******************************************************************/ { m_BrdSettings.m_SolderMaskMargin = - ReturnValueFromTextCtrl( *m_SolderMaskMarginCtrl, m_Parent->m_InternalUnits ); + ReturnValueFromTextCtrl( *m_SolderMaskMarginCtrl, m_Parent->GetInternalUnits() ); m_BrdSettings.m_SolderPasteMargin = - ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl, m_Parent->m_InternalUnits ); + ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl, m_Parent->GetInternalUnits() ); double dtmp = 0; wxString msg = m_SolderPasteMarginRatioCtrl->GetValue(); diff --git a/pcbnew/dialogs/dialog_pad_properties.cpp b/pcbnew/dialogs/dialog_pad_properties.cpp index 4c6fb45256..a0661700ce 100644 --- a/pcbnew/dialogs/dialog_pad_properties.cpp +++ b/pcbnew/dialogs/dialog_pad_properties.cpp @@ -190,7 +190,7 @@ void DIALOG_PAD_PROPERTIES::initValues() { SetFocus(); // Required under wxGTK if we want to demiss the dialog with the ESC key - int internalUnits = m_Parent->m_InternalUnits; + int internalUnits = m_Parent->GetInternalUnits(); wxString msg; m_isFlipped = false; if( m_CurrentPad ) @@ -688,7 +688,7 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event ) bool DIALOG_PAD_PROPERTIES::TransfertDataToPad( D_PAD* aPad, bool aPromptOnError ) { long PadLayerMask; - int internalUnits = m_Parent->m_InternalUnits; + int internalUnits = m_Parent->GetInternalUnits(); wxString msg; aPad->m_Attribut = CodeType[m_PadType->GetSelection()]; diff --git a/pcbnew/dialogs/dialog_pcb_text_properties.cpp b/pcbnew/dialogs/dialog_pcb_text_properties.cpp index 771f5dcb1b..4043e3c506 100644 --- a/pcbnew/dialogs/dialog_pcb_text_properties.cpp +++ b/pcbnew/dialogs/dialog_pcb_text_properties.cpp @@ -91,15 +91,15 @@ void DIALOG_PCB_TEXT_PROPERTIES::MyInit() *m_TextContentCtrl << m_SelectedPCBText->m_Text; PutValueInLocalUnits( *m_SizeXCtrl, m_SelectedPCBText->m_Size.x, - m_Parent->m_InternalUnits ); + m_Parent->GetInternalUnits() ); PutValueInLocalUnits( *m_SizeYCtrl, m_SelectedPCBText->m_Size.y, - m_Parent->m_InternalUnits ); + m_Parent->GetInternalUnits() ); PutValueInLocalUnits( *m_ThicknessCtrl, m_SelectedPCBText->m_Thickness, - m_Parent->m_InternalUnits ); + m_Parent->GetInternalUnits() ); PutValueInLocalUnits( *m_PositionXCtrl, m_SelectedPCBText->m_Pos.x, - m_Parent->m_InternalUnits ); + m_Parent->GetInternalUnits() ); PutValueInLocalUnits( *m_PositionYCtrl, m_SelectedPCBText->m_Pos.y, - m_Parent->m_InternalUnits ); + m_Parent->GetInternalUnits() ); int enabledLayers = m_Parent->GetBoard()->GetEnabledLayers(); for( int layer = 0; layer < NB_LAYERS; ++layer ) @@ -195,13 +195,13 @@ void DIALOG_PCB_TEXT_PROPERTIES::OnOkClick( wxCommandEvent& event ) } // Set PCB Text position - newPosition.x = ReturnValueFromString( g_UserUnit, m_PositionXCtrl->GetValue(), m_Parent->m_InternalUnits ); - newPosition.y = ReturnValueFromString( g_UserUnit, m_PositionYCtrl->GetValue(), m_Parent->m_InternalUnits ); + newPosition.x = ReturnValueFromString( g_UserUnit, m_PositionXCtrl->GetValue(), m_Parent->GetInternalUnits() ); + newPosition.y = ReturnValueFromString( g_UserUnit, m_PositionYCtrl->GetValue(), m_Parent->GetInternalUnits() ); m_SelectedPCBText->m_Pos = newPosition; // Check constraints and set PCB Text size - newSize.x = ReturnValueFromString( g_UserUnit, m_SizeXCtrl->GetValue(), m_Parent->m_InternalUnits ); - newSize.y = ReturnValueFromString( g_UserUnit, m_SizeYCtrl->GetValue(), m_Parent->m_InternalUnits ); + newSize.x = ReturnValueFromString( g_UserUnit, m_SizeXCtrl->GetValue(), m_Parent->GetInternalUnits() ); + newSize.y = ReturnValueFromString( g_UserUnit, m_SizeYCtrl->GetValue(), m_Parent->GetInternalUnits() ); if( newSize.x < TEXTS_MIN_SIZE ) newSize.x = TEXTS_MIN_SIZE; @@ -214,7 +214,7 @@ void DIALOG_PCB_TEXT_PROPERTIES::OnOkClick( wxCommandEvent& event ) m_SelectedPCBText->m_Size = newSize; // Set the new thickness - m_SelectedPCBText->m_Thickness = ReturnValueFromString( g_UserUnit, m_ThicknessCtrl->GetValue(), m_Parent->m_InternalUnits ); + m_SelectedPCBText->m_Thickness = ReturnValueFromString( g_UserUnit, m_ThicknessCtrl->GetValue(), m_Parent->GetInternalUnits() ); // Test for acceptable values for thickness and size and clamp if fails int maxthickness = Clamp_Text_PenSize( m_SelectedPCBText->m_Thickness, m_SelectedPCBText->m_Size ); diff --git a/pcbnew/dialogs/dialog_print_using_printer.cpp b/pcbnew/dialogs/dialog_print_using_printer.cpp index 27bd634b2c..af5577953f 100644 --- a/pcbnew/dialogs/dialog_print_using_printer.cpp +++ b/pcbnew/dialogs/dialog_print_using_printer.cpp @@ -266,7 +266,7 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( ) s_Parameters.m_PenDefaultSize = g_DrawDefaultLineThickness; AddUnitSymbol( *m_TextPenWidth, g_UserUnit ); m_DialogPenWidth->SetValue( - ReturnStringFromValue( g_UserUnit, s_Parameters.m_PenDefaultSize, m_Parent->m_InternalUnits ) ); + ReturnStringFromValue( g_UserUnit, s_Parameters.m_PenDefaultSize, m_Parent->GetInternalUnits() ) ); // Create scale adjust option @@ -420,7 +420,7 @@ void DIALOG_PRINT_USING_PRINTER::SetPenWidth() * NOTE: s_Parameters.m_PenDefaultSize is in internal units */ { - s_Parameters.m_PenDefaultSize = ReturnValueFromTextCtrl( *m_DialogPenWidth, m_Parent->m_InternalUnits ); + s_Parameters.m_PenDefaultSize = ReturnValueFromTextCtrl( *m_DialogPenWidth, m_Parent->GetInternalUnits() ); if( s_Parameters.m_PenDefaultSize > WIDTH_MAX_VALUE ) { @@ -435,7 +435,7 @@ void DIALOG_PRINT_USING_PRINTER::SetPenWidth() g_DrawDefaultLineThickness = s_Parameters.m_PenDefaultSize; m_DialogPenWidth->SetValue( - ReturnStringFromValue( g_UserUnit, s_Parameters.m_PenDefaultSize, m_Parent->m_InternalUnits ) ); + ReturnStringFromValue( g_UserUnit, s_Parameters.m_PenDefaultSize, m_Parent->GetInternalUnits() ) ); } void DIALOG_PRINT_USING_PRINTER::OnScaleSelectionClick( wxCommandEvent& event ) diff --git a/pcbnew/dimension.cpp b/pcbnew/dimension.cpp index b8cdfa3bf8..d18b8dd7a8 100644 --- a/pcbnew/dimension.cpp +++ b/pcbnew/dimension.cpp @@ -92,23 +92,23 @@ DIALOG_DIMENSION_EDITOR::DIALOG_DIMENSION_EDITOR( PCB_EDIT_FRAME* aParent, // Enter size value in dialog PutValueInLocalUnits( *m_TxtSizeXCtrl, aDimension->m_Text.m_Size.x, - m_Parent->m_InternalUnits ); + m_Parent->GetInternalUnits() ); AddUnitSymbol( *m_staticTextSizeX ); PutValueInLocalUnits( *m_TxtSizeYCtrl, aDimension->m_Text.m_Size.y, - m_Parent->m_InternalUnits ); + m_Parent->GetInternalUnits() ); AddUnitSymbol( *m_staticTextSizeY ); // Enter lines thickness value in dialog PutValueInLocalUnits( *m_TxtWidthCtrl, aDimension->m_Width, - m_Parent->m_InternalUnits ); + m_Parent->GetInternalUnits() ); AddUnitSymbol( *m_staticTextWidth ); // Enter position value in dialog PutValueInLocalUnits( *m_textCtrlPosX, aDimension->m_Text.m_Pos.x, - m_Parent->m_InternalUnits ); + m_Parent->GetInternalUnits() ); AddUnitSymbol( *m_staticTextPosX ); PutValueInLocalUnits( *m_textCtrlPosY, aDimension->m_Text.m_Pos.y, - m_Parent->m_InternalUnits ); + m_Parent->GetInternalUnits() ); AddUnitSymbol( *m_staticTextPosY ); for( int layer = FIRST_NO_COPPER_LAYER; layerGetValue(); CurrentDimension->m_Text.m_Size.x = ReturnValueFromString( g_UserUnit, msg, - m_Parent->m_InternalUnits ); + m_Parent->GetInternalUnits() ); msg = m_TxtSizeYCtrl->GetValue(); CurrentDimension->m_Text.m_Size.y = ReturnValueFromString( g_UserUnit, msg, - m_Parent->m_InternalUnits ); + m_Parent->GetInternalUnits() ); // Get new position value: // It will be copied later in dimension, because msg = m_textCtrlPosX->GetValue(); CurrentDimension->m_Text.m_Pos.x = ReturnValueFromString( g_UserUnit, msg, - m_Parent->m_InternalUnits ); + m_Parent->GetInternalUnits() ); msg = m_textCtrlPosY->GetValue(); CurrentDimension->m_Text.m_Pos.y = ReturnValueFromString( g_UserUnit, msg, - m_Parent->m_InternalUnits ); + m_Parent->GetInternalUnits() ); // Get new line thickness value: msg = m_TxtWidthCtrl->GetValue(); int width = ReturnValueFromString( g_UserUnit, msg, - m_Parent->m_InternalUnits ); + m_Parent->GetInternalUnits() ); int maxthickness = Clamp_Text_PenSize( width, CurrentDimension->m_Text.m_Size ); if( width > maxthickness ) diff --git a/pcbnew/drc.cpp b/pcbnew/drc.cpp index 88dc114904..c6d0dad691 100644 --- a/pcbnew/drc.cpp +++ b/pcbnew/drc.cpp @@ -56,13 +56,13 @@ void DRC::ShowDialog() PutValueInLocalUnits( *m_ui->m_SetTrackMinWidthCtrl, m_pcb->GetDesignSettings().m_TrackMinWidth, - m_mainWindow->m_InternalUnits ); + m_mainWindow->GetInternalUnits() ); PutValueInLocalUnits( *m_ui->m_SetViaMinSizeCtrl, m_pcb->GetDesignSettings().m_ViasMinSize, - m_mainWindow->m_InternalUnits ); + m_mainWindow->GetInternalUnits() ); PutValueInLocalUnits( *m_ui->m_SetMicroViakMinSizeCtrl, m_pcb->GetDesignSettings().m_MicroViasMinSize, - m_mainWindow->m_InternalUnits ); + m_mainWindow->GetInternalUnits() ); m_ui->m_CreateRptCtrl->SetValue( m_doCreateRptFile ); m_ui->m_RptFilenameCtrl->SetValue( m_rptFilename ); diff --git a/pcbnew/mirepcb.cpp b/pcbnew/mirepcb.cpp index 91051f272b..6f68bf62ed 100644 --- a/pcbnew/mirepcb.cpp +++ b/pcbnew/mirepcb.cpp @@ -104,13 +104,13 @@ TARGET_PROPERTIES_DIALOG_EDITOR::TARGET_PROPERTIES_DIALOG_EDITOR( PCB_EDIT_FRAME m_MireSizeCtrl = new EDA_VALUE_CTRL( this, _( "Size" ), m_Target->GetSize(), g_UserUnit, LeftBoxSizer, - m_Parent->m_InternalUnits ); + m_Parent->GetInternalUnits() ); // Width: m_MireWidthCtrl = new EDA_VALUE_CTRL( this, _( "Width" ), m_Target->GetWidth(), g_UserUnit, LeftBoxSizer, - m_Parent->m_InternalUnits ); + m_Parent->GetInternalUnits() ); // Shape wxString shape_list[2] = { _( "shape +" ), _( "shape X" ) }; diff --git a/pcbnew/modeditoptions.cpp b/pcbnew/modeditoptions.cpp index 19fa4fa1c2..fb813396a6 100644 --- a/pcbnew/modeditoptions.cpp +++ b/pcbnew/modeditoptions.cpp @@ -1,3 +1,28 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com + * Copyright (C) 2011 Wayne Stambaugh + * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + /** * @file modeditoptions.cpp * @brief Pcbnew footprint (module) editor options. @@ -23,24 +48,22 @@ void FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) switch( id ) { case ID_TB_OPTIONS_SHOW_PADS_SKETCH: - m_DisplayPadFill = !m_optionsToolBar->GetToolState( id ); + m_DisplayPadFill = !m_optionsToolBar->GetToolToggled( id ); DrawPanel->Refresh( ); break; case ID_TB_OPTIONS_SHOW_VIAS_SKETCH: - m_DisplayViaFill = !m_optionsToolBar->GetToolState( id ); + m_DisplayViaFill = !m_optionsToolBar->GetToolToggled( id ); DrawPanel->Refresh( ); break; case ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH: - m_DisplayModText = - m_optionsToolBar->GetToolState( id ) ? SKETCH : FILLED; + m_DisplayModText = m_optionsToolBar->GetToolToggled( id ) ? SKETCH : FILLED; DrawPanel->Refresh( ); break; case ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH: - m_DisplayModEdge = - m_optionsToolBar->GetToolState( id ) ? SKETCH : FILLED; + m_DisplayModEdge = m_optionsToolBar->GetToolToggled( id ) ? SKETCH : FILLED; DrawPanel->Refresh( ); break; diff --git a/pcbnew/moduleframe.cpp b/pcbnew/moduleframe.cpp index 294828e0db..afdd2f30cf 100644 --- a/pcbnew/moduleframe.cpp +++ b/pcbnew/moduleframe.cpp @@ -191,8 +191,8 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( wxWindow* father, EDA_PANEINFO mesg_pane; mesg_pane.MessageToolbarPane(); - m_auimgr.AddPane( m_HToolBar, - wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top(). Row( 0 ) ); + m_auimgr.AddPane( m_mainToolBar, + wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top(). Row( 0 ) ); m_auimgr.AddPane( m_auxiliaryToolBar, wxAuiPaneInfo( horiz ).Name( wxT( "m_auxiliaryToolBar" ) ).Top().Row( 1 ) ); diff --git a/pcbnew/onrightclick.cpp b/pcbnew/onrightclick.cpp index 0a400c586f..fbc68bf9e8 100644 --- a/pcbnew/onrightclick.cpp +++ b/pcbnew/onrightclick.cpp @@ -1,3 +1,28 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com + * Copyright (C) 2007-2011 Wayne Stambaugh + * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + /** * @file pcbnew/onrightclick.cpp * @brief Right mouse button functions. @@ -52,7 +77,8 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) { if( item && item->m_Flags ) { - AddMenuItem( aPopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel" ), KiBitmap( cancel_xpm ) ); + AddMenuItem( aPopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel" ), + KiBitmap( cancel_xpm ) ); } else { @@ -118,7 +144,7 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) case PCB_MODULE_T: createPopUpMenuForFootprints( (MODULE*) item, aPopMenu ); - if( m_HTOOL_current_state == ID_TOOLBARH_PCB_MODE_MODULE ) + if( m_mainToolBar->GetToolToggled( ID_TOOLBARH_PCB_MODE_MODULE ) ) { aPopMenu->AppendSeparator(); @@ -142,7 +168,7 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) _( "Auto Place Module" ) ); } - if( m_HTOOL_current_state == ID_TOOLBARH_PCB_MODE_TRACKS ) + if( m_mainToolBar->GetToolToggled( ID_TOOLBARH_PCB_MODE_TRACKS ) ) { if( !flags ) aPopMenu->Append( ID_POPUP_PCB_AUTOROUTE_MODULE, _( "Autoroute Module" ) ); @@ -226,7 +252,8 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) HK_MOVE_ITEM ); AddMenuItem( aPopMenu, ID_POPUP_PCB_MOVE_TEXT_DIMENSION_REQUEST, msg, KiBitmap( move_text_xpm ) ); - msg = AddHotkeyName( _( "Delete Dimension" ), g_Board_Editor_Hokeys_Descr, HK_DELETE ); + msg = AddHotkeyName( _( "Delete Dimension" ), g_Board_Editor_Hokeys_Descr, + HK_DELETE ); AddMenuItem( aPopMenu, ID_POPUP_PCB_DELETE_DIMENSION, msg, KiBitmap( delete_xpm ) ); } @@ -303,7 +330,8 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) case ID_TRACK_BUTT: if ( ! locate_track ) // This menu is already added when a track is located AddMenuItem( aPopMenu, Append_Track_Width_List( GetBoard() ), - ID_POPUP_PCB_SELECT_WIDTH, _( "Select Track Width" ), KiBitmap( width_track_xpm ) ); + ID_POPUP_PCB_SELECT_WIDTH, _( "Select Track Width" ), + KiBitmap( width_track_xpm ) ); AddMenuItem( aPopMenu, ID_POPUP_PCB_SELECT_CU_LAYER, _( "Select Working Layer" ), KiBitmap( select_w_layer_xpm ) ); @@ -329,7 +357,7 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) break; case ID_NO_TOOL_SELECTED: - if( m_HTOOL_current_state == ID_TOOLBARH_PCB_MODE_MODULE ) + if( m_mainToolBar->GetToolToggled( ID_TOOLBARH_PCB_MODE_MODULE ) ) { wxMenu* commands = new wxMenu; AddMenuItem( aPopMenu, commands, ID_POPUP_PCB_AUTOPLACE_COMMANDS, @@ -352,7 +380,7 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) aPopMenu->AppendSeparator(); } - if( m_HTOOL_current_state == ID_TOOLBARH_PCB_MODE_TRACKS ) + if( m_mainToolBar->GetToolToggled( ID_TOOLBARH_PCB_MODE_TRACKS ) ) { wxMenu* commands = new wxMenu; aPopMenu->Append( ID_POPUP_PCB_AUTOROUTE_COMMANDS, _( "Autoroute" ), commands ); @@ -385,7 +413,8 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) */ void PCB_EDIT_FRAME::createPopUpBlockMenu( wxMenu* menu ) { - AddMenuItem( menu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel Block" ), KiBitmap( cancel_xpm ) ); + AddMenuItem( menu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel Block" ), + KiBitmap( cancel_xpm ) ); AddMenuItem( menu, ID_POPUP_ZOOM_BLOCK, _( "Zoom Block" ), KiBitmap( zoom_area_xpm ) ); menu->AppendSeparator(); AddMenuItem( menu, ID_POPUP_PLACE_BLOCK, _( "Place Block" ), KiBitmap( apply_xpm ) ); @@ -414,7 +443,8 @@ void PCB_EDIT_FRAME::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu ) { if( Track->Type() == PCB_VIA_T ) { - AddMenuItem( PopMenu, ID_POPUP_PCB_MOVE_TRACK_NODE, _( "Drag Via" ), KiBitmap( move_xpm ) ); + AddMenuItem( PopMenu, ID_POPUP_PCB_MOVE_TRACK_NODE, _( "Drag Via" ), + KiBitmap( move_xpm ) ); } else { @@ -523,7 +553,8 @@ void PCB_EDIT_FRAME::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu ) // Add lock/unlock flags menu: track_mnu = new wxMenu; - AddMenuItem( PopMenu, track_mnu, ID_POPUP_PCB_SETFLAGS_TRACK_MNU, _( "Set Flags" ), KiBitmap( flag_xpm ) ); + AddMenuItem( PopMenu, track_mnu, ID_POPUP_PCB_SETFLAGS_TRACK_MNU, _( "Set Flags" ), + KiBitmap( flag_xpm ) ); track_mnu->Append( ID_POPUP_PCB_LOCK_ON_TRACKSEG, _( "Locked: Yes" ), wxEmptyString, true ); track_mnu->Append( ID_POPUP_PCB_LOCK_OFF_TRACKSEG, _( "Locked: No" ), wxEmptyString, true ); @@ -594,7 +625,8 @@ void PCB_EDIT_FRAME::createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu* _( "Add Cutout Area" ), KiBitmap( add_zone_cutout_xpm ) ); zones_menu->AppendSeparator(); - AddMenuItem( zones_menu, ID_POPUP_PCB_FILL_ZONE, _( "Fill Zone" ), KiBitmap( fill_zone_xpm ) ); + AddMenuItem( zones_menu, ID_POPUP_PCB_FILL_ZONE, _( "Fill Zone" ), + KiBitmap( fill_zone_xpm ) ); if( edge_zone->m_FilledPolysList.size() > 0 ) { @@ -657,7 +689,8 @@ void PCB_EDIT_FRAME::createPopUpMenuForFootprints( MODULE* aModule, wxMenu* menu if( !flags ) { msg = AddHotkeyName( _( "Edit" ), g_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM ); - AddMenuItem( sub_menu_footprint, ID_POPUP_PCB_EDIT_MODULE, msg, KiBitmap( edit_module_xpm ) ); + AddMenuItem( sub_menu_footprint, ID_POPUP_PCB_EDIT_MODULE, msg, + KiBitmap( edit_module_xpm ) ); sub_menu_footprint->AppendSeparator(); msg = AddHotkeyName( _( "Delete Module" ), g_Board_Editor_Hokeys_Descr, HK_DELETE ); AddMenuItem( sub_menu_footprint, ID_POPUP_PCB_DELETE_MODULE, @@ -741,8 +774,10 @@ void PCB_EDIT_FRAME::createPopUpMenuForFpPads( D_PAD* Pad, wxMenu* menu ) sub_menu_Pad = new wxMenu; AddMenuItem( menu, sub_menu_Pad, -1, msg, KiBitmap( pad_xpm ) ); - AddMenuItem( sub_menu_Pad, ID_POPUP_PCB_MOVE_PAD_REQUEST, _( "Move" ), KiBitmap( move_pad_xpm ) ); - AddMenuItem( sub_menu_Pad, ID_POPUP_PCB_DRAG_PAD_REQUEST, _( "Drag" ), KiBitmap( drag_pad_xpm ) ); + AddMenuItem( sub_menu_Pad, ID_POPUP_PCB_MOVE_PAD_REQUEST, _( "Move" ), + KiBitmap( move_pad_xpm ) ); + AddMenuItem( sub_menu_Pad, ID_POPUP_PCB_DRAG_PAD_REQUEST, _( "Drag" ), + KiBitmap( drag_pad_xpm ) ); AddMenuItem( sub_menu_Pad, ID_POPUP_PCB_EDIT_PAD, _( "Edit" ), KiBitmap( options_pad_xpm ) ); sub_menu_Pad->AppendSeparator(); @@ -764,7 +799,7 @@ void PCB_EDIT_FRAME::createPopUpMenuForFpPads( D_PAD* Pad, wxMenu* menu ) AddMenuItem( sub_menu_Pad, ID_POPUP_PCB_DELETE_PAD, _( "Delete" ), KiBitmap( delete_pad_xpm ) ); - if( m_HTOOL_current_state == ID_TOOLBARH_PCB_MODE_TRACKS ) + if( m_mainToolBar->GetToolToggled( ID_TOOLBARH_PCB_MODE_TRACKS ) ) { menu->Append( ID_POPUP_PCB_AUTOROUTE_PAD, _( "Autoroute Pad" ) ); menu->Append( ID_POPUP_PCB_AUTOROUTE_NET, _( "Autoroute Net" ) ); @@ -798,6 +833,7 @@ void PCB_EDIT_FRAME::createPopUpMenuForTexts( TEXTE_PCB* Text, wxMenu* menu ) AddMenuItem( sub_menu_Text, ID_POPUP_PCB_MOVE_TEXTEPCB_REQUEST, msg, KiBitmap( move_text_xpm ) ); } + msg = AddHotkeyName( _( "Rotate" ), g_Board_Editor_Hokeys_Descr, HK_ROTATE_ITEM ); AddMenuItem( sub_menu_Text, ID_POPUP_PCB_ROTATE_TEXTEPCB, msg, KiBitmap( rotate_ccw_xpm ) ); msg = AddHotkeyName( _( "Edit" ), g_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM ); @@ -813,8 +849,10 @@ void PCB_EDIT_FRAME::createPopUpMenuForTexts( TEXTE_PCB* Text, wxMenu* menu ) void PCB_EDIT_FRAME::createPopUpMenuForMarkers( MARKER_PCB* aMarker, wxMenu* aPopMenu ) { - AddMenuItem( aPopMenu, ID_POPUP_PCB_DELETE_MARKER, _( "Delete Marker" ), KiBitmap( delete_xpm ) ); - AddMenuItem( aPopMenu, ID_POPUP_PCB_GETINFO_MARKER, _( "Marker Error Info" ), KiBitmap( info_xpm ) ); + AddMenuItem( aPopMenu, ID_POPUP_PCB_DELETE_MARKER, _( "Delete Marker" ), + KiBitmap( delete_xpm ) ); + AddMenuItem( aPopMenu, ID_POPUP_PCB_GETINFO_MARKER, _( "Marker Error Info" ), + KiBitmap( info_xpm ) ); } diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index 4e7ff0befc..85b0f7b3b1 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -171,8 +171,8 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME ) EVT_COMBOBOX( ID_TOOLBARH_PCB_SELECT_LAYER, PCB_EDIT_FRAME::Process_Special_Functions ) EVT_COMBOBOX( ID_AUX_TOOLBAR_PCB_TRACK_WIDTH, PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event ) EVT_COMBOBOX( ID_AUX_TOOLBAR_PCB_VIA_SIZE, PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event ) - EVT_TOOL( ID_TOOLBARH_PCB_MODE_MODULE, PCB_EDIT_FRAME::AutoPlace ) - EVT_TOOL( ID_TOOLBARH_PCB_MODE_TRACKS, PCB_EDIT_FRAME::AutoPlace ) + EVT_TOOL( ID_TOOLBARH_PCB_MODE_MODULE, PCB_EDIT_FRAME::OnSelectAutoPlaceMode ) + EVT_TOOL( ID_TOOLBARH_PCB_MODE_TRACKS, PCB_EDIT_FRAME::OnSelectAutoPlaceMode ) EVT_TOOL( ID_TOOLBARH_PCB_FREEROUTE_ACCESS, PCB_EDIT_FRAME::Access_to_External_Tool ) // Option toolbar @@ -247,6 +247,8 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME ) PCB_EDIT_FRAME::OnUpdateSelectAutoTrackWidth ) EVT_UPDATE_UI( ID_POPUP_PCB_SELECT_AUTO_WIDTH, PCB_EDIT_FRAME::OnUpdateSelectAutoTrackWidth ) EVT_UPDATE_UI( ID_AUX_TOOLBAR_PCB_VIA_SIZE, PCB_EDIT_FRAME::OnUpdateSelectViaSize ) + EVT_UPDATE_UI( ID_TOOLBARH_PCB_MODE_MODULE, PCB_EDIT_FRAME::OnUpdateAutoPlaceModulesMode ) + EVT_UPDATE_UI( ID_TOOLBARH_PCB_MODE_TRACKS, PCB_EDIT_FRAME::OnUpdateAutoPlaceTracksMode ) EVT_UPDATE_UI_RANGE( ID_POPUP_PCB_SELECT_WIDTH1, ID_POPUP_PCB_SELECT_WIDTH8, PCB_EDIT_FRAME::OnUpdateSelectTrackWidth ) EVT_UPDATE_UI_RANGE( ID_POPUP_PCB_SELECT_VIASIZE1, ID_POPUP_PCB_SELECT_VIASIZE8, @@ -280,6 +282,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title, m_hasAutoSave = true; m_RecordingMacros = -1; m_microWaveToolBar = NULL; + m_autoPlaceModeId = 0; for ( int i = 0; i < 10; i++ ) m_Macros[i].m_Record.clear(); @@ -313,7 +316,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title, icon.CopyFromBitmap( KiBitmap( icon_pcbnew_xpm ) ); SetIcon( icon ); - m_InternalUnits = PCB_INTERNAL_UNIT; // Unites internes = 1/10000 inch + m_internalUnits = PCB_INTERNAL_UNIT; // Unites internes = 1/10000 inch SetScreen( new PCB_SCREEN() ); GetScreen()->m_Center = false; // PCB drawings start in the upper left corner. @@ -356,10 +359,10 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title, lyrs.Caption( _( "Visibles" ) ); - if( m_HToolBar ) // The main horizontal toolbar + if( m_mainToolBar ) // The main horizontal toolbar { - m_auimgr.AddPane( m_HToolBar, - wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().Row( 0 ) ); + m_auimgr.AddPane( m_mainToolBar, + wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top().Row( 0 ) ); } if( m_auxiliaryToolBar ) // the auxiliary horizontal toolbar, that shows track and via sizes, zoom ...) @@ -751,3 +754,17 @@ void PCB_EDIT_FRAME::UpdateTitle() SetTitle( title ); } + + +void PCB_EDIT_FRAME::OnSelectAutoPlaceMode( wxCommandEvent& aEvent ) +{ + if( aEvent.IsChecked() ) + { + m_autoPlaceModeId = aEvent.GetId(); + } + else + { + m_autoPlaceModeId = 0; + } +} + diff --git a/pcbnew/pcbplot.cpp b/pcbnew/pcbplot.cpp index 0742906735..0f2daad8ec 100644 --- a/pcbnew/pcbplot.cpp +++ b/pcbnew/pcbplot.cpp @@ -182,7 +182,7 @@ void DIALOG_PLOT::Init_Dialog() m_subtractMaskFromSilk->SetValue( g_PcbPlotOptions.GetSubtractMaskFromSilk() ); // Option to plot page references: - if( m_Parent->m_Print_Sheet_Ref ) + if( m_Parent->GetPrintBorderAndTitleBlock() ) { m_plotSheetRef->SetValue( g_PcbPlotOptions.m_PlotFrameRef ); } diff --git a/pcbnew/print_board_functions.cpp b/pcbnew/print_board_functions.cpp index 15f045dde0..1aa50f43b1 100644 --- a/pcbnew/print_board_functions.cpp +++ b/pcbnew/print_board_functions.cpp @@ -81,8 +81,8 @@ void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC, offset.x = GetScreen()->m_CurrentSheetDesc->m_Size.x / 2; offset.y = GetScreen()->m_CurrentSheetDesc->m_Size.y / 2; // offset is in mils, converts in internal units - offset.x *= m_InternalUnits / 1000; - offset.y *= m_InternalUnits / 1000; + offset.x *= m_internalUnits / 1000; + offset.y *= m_internalUnits / 1000; for( ; Module != NULL; Module = Module->Next() ) { diff --git a/pcbnew/printout_controler.cpp b/pcbnew/printout_controler.cpp index 2b769d2d4e..7be410bd6e 100644 --- a/pcbnew/printout_controler.cpp +++ b/pcbnew/printout_controler.cpp @@ -163,8 +163,8 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage() screen->m_StartVisu.x = screen->m_StartVisu.y = 0; SheetSize = screen->m_CurrentSheetDesc->m_Size; // size in 1/1000 inch - SheetSize.x *= m_Parent->m_InternalUnits / 1000; - SheetSize.y *= m_Parent->m_InternalUnits / 1000; // size in internal units + SheetSize.x *= m_Parent->GetInternalUnits() / 1000; + SheetSize.y *= m_Parent->GetInternalUnits() / 1000; // size in internal units PCB_BASE_FRAME* pcbframe = (PCB_BASE_FRAME*) m_Parent; diff --git a/pcbnew/set_grid.cpp b/pcbnew/set_grid.cpp index fb427d7d67..cb2bb28e5e 100644 --- a/pcbnew/set_grid.cpp +++ b/pcbnew/set_grid.cpp @@ -40,7 +40,7 @@ void PCB_BASE_FRAME::InstallGridFrame( const wxPoint& pos ) { DIALOG_SET_GRID dlg( this, pos ); - dlg.m_internalUnits = m_InternalUnits; + dlg.m_internalUnits = m_internalUnits; dlg.SetGridUnits( m_UserGridUnit ); dlg.SetGridSize( m_UserGridSize ); dlg.SetGridOrigin( GetScreen()->m_GridOrigin ); diff --git a/pcbnew/tool_modedit.cpp b/pcbnew/tool_modedit.cpp index cf3598a3e5..7575108286 100644 --- a/pcbnew/tool_modedit.cpp +++ b/pcbnew/tool_modedit.cpp @@ -1,6 +1,32 @@ -/***********************************************/ -/* tool_modeit.cpp: footprint editor toolbars. */ -/***********************************************/ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2005 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com + * Copyright (C) 2011 Wayne Stambaugh + * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +/** + * @file tool_modedit.cpp + * @brief Footprint editor tool bars + */ #include "fctsys.h" @@ -20,97 +46,99 @@ void FOOTPRINT_EDIT_FRAME::ReCreateHToolbar() { - if( m_HToolBar != NULL ) + if( m_mainToolBar != NULL ) return; wxString msg; - m_HToolBar = new EDA_TOOLBAR( TOOLBAR_MAIN, this, ID_H_TOOLBAR, true ); + m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize, + wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_HORZ_LAYOUT ); // Set up toolbar - m_HToolBar->AddTool( ID_MODEDIT_SELECT_CURRENT_LIB, wxEmptyString, - KiBitmap( open_library_xpm ), - _( "Select active library" ) ); + m_mainToolBar->AddTool( ID_MODEDIT_SELECT_CURRENT_LIB, wxEmptyString, + KiBitmap( open_library_xpm ), + _( "Select active library" ) ); - m_HToolBar->AddTool( ID_MODEDIT_SAVE_LIBMODULE, wxEmptyString, KiBitmap( save_library_xpm ), - _( "Save module in active library" ) ); + m_mainToolBar->AddTool( ID_MODEDIT_SAVE_LIBMODULE, wxEmptyString, KiBitmap( save_library_xpm ), + _( "Save module in active library" ) ); - m_HToolBar->AddTool( ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART, wxEmptyString, - KiBitmap( new_library_xpm ), - _( "Create new library and save current module" ) ); + m_mainToolBar->AddTool( ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART, wxEmptyString, + KiBitmap( new_library_xpm ), + _( "Create new library and save current module" ) ); - m_HToolBar->AddSeparator(); - m_HToolBar->AddTool( ID_MODEDIT_DELETE_PART, wxEmptyString, KiBitmap( delete_xpm ), - _( "Delete part from active library" ) ); + m_mainToolBar->AddSeparator(); + m_mainToolBar->AddTool( ID_MODEDIT_DELETE_PART, wxEmptyString, KiBitmap( delete_xpm ), + _( "Delete part from active library" ) ); - m_HToolBar->AddSeparator(); - m_HToolBar->AddTool( ID_MODEDIT_NEW_MODULE, wxEmptyString, KiBitmap( new_footprint_xpm ), - _( "New module" ) ); + m_mainToolBar->AddSeparator(); + m_mainToolBar->AddTool( ID_MODEDIT_NEW_MODULE, wxEmptyString, KiBitmap( new_footprint_xpm ), + _( "New module" ) ); - m_HToolBar->AddTool( ID_MODEDIT_LOAD_MODULE, wxEmptyString, - KiBitmap( load_module_lib_xpm ), - _( "Load module from library" ) ); + m_mainToolBar->AddTool( ID_MODEDIT_LOAD_MODULE, wxEmptyString, + KiBitmap( load_module_lib_xpm ), + _( "Load module from library" ) ); - m_HToolBar->AddSeparator(); - m_HToolBar->AddTool( ID_MODEDIT_LOAD_MODULE_FROM_BOARD, wxEmptyString, - KiBitmap( load_module_board_xpm ), - _( "Load module from current board" ) ); + m_mainToolBar->AddSeparator(); + m_mainToolBar->AddTool( ID_MODEDIT_LOAD_MODULE_FROM_BOARD, wxEmptyString, + KiBitmap( load_module_board_xpm ), + _( "Load module from current board" ) ); - m_HToolBar->AddTool( ID_MODEDIT_UPDATE_MODULE_IN_BOARD, wxEmptyString, - KiBitmap( update_module_board_xpm ), - _( "Update module in current board" ) ); + m_mainToolBar->AddTool( ID_MODEDIT_UPDATE_MODULE_IN_BOARD, wxEmptyString, + KiBitmap( update_module_board_xpm ), + _( "Update module in current board" ) ); - m_HToolBar->AddTool( ID_MODEDIT_INSERT_MODULE_IN_BOARD, wxEmptyString, - KiBitmap( insert_module_board_xpm ), - _( "Insert module into current board" ) ); + m_mainToolBar->AddTool( ID_MODEDIT_INSERT_MODULE_IN_BOARD, wxEmptyString, + KiBitmap( insert_module_board_xpm ), + _( "Insert module into current board" ) ); - m_HToolBar->AddSeparator(); - m_HToolBar->AddTool( ID_MODEDIT_IMPORT_PART, wxEmptyString, KiBitmap( import_module_xpm ), - _( "Import module" ) ); + m_mainToolBar->AddSeparator(); + m_mainToolBar->AddTool( ID_MODEDIT_IMPORT_PART, wxEmptyString, KiBitmap( import_module_xpm ), + _( "Import module" ) ); - m_HToolBar->AddTool( ID_MODEDIT_EXPORT_PART, wxEmptyString, KiBitmap( export_module_xpm ), - _( "Export module" ) ); + m_mainToolBar->AddTool( ID_MODEDIT_EXPORT_PART, wxEmptyString, KiBitmap( export_module_xpm ), + _( "Export module" ) ); - m_HToolBar->AddSeparator(); - m_HToolBar->AddTool( wxID_UNDO, wxEmptyString, KiBitmap( undo_xpm ), - _( "Undo last edition" ) ); - m_HToolBar->AddTool( wxID_REDO, wxEmptyString, KiBitmap( redo_xpm ), - _( "Redo the last undo command" ) ); + m_mainToolBar->AddSeparator(); + m_mainToolBar->AddTool( wxID_UNDO, wxEmptyString, KiBitmap( undo_xpm ), + _( "Undo last edition" ) ); + m_mainToolBar->AddTool( wxID_REDO, wxEmptyString, KiBitmap( redo_xpm ), + _( "Redo the last undo command" ) ); - m_HToolBar->AddSeparator(); - m_HToolBar->AddTool( ID_MODEDIT_EDIT_MODULE_PROPERTIES, wxEmptyString, - KiBitmap( module_options_xpm ), - _( "Module properties" ) ); + m_mainToolBar->AddSeparator(); + m_mainToolBar->AddTool( ID_MODEDIT_EDIT_MODULE_PROPERTIES, wxEmptyString, + KiBitmap( module_options_xpm ), + _( "Module properties" ) ); - m_HToolBar->AddSeparator(); - m_HToolBar->AddTool( wxID_PRINT, wxEmptyString, KiBitmap( print_button_xpm ), - _( "Print module" ) ); + m_mainToolBar->AddSeparator(); + m_mainToolBar->AddTool( wxID_PRINT, wxEmptyString, KiBitmap( print_button_xpm ), + _( "Print module" ) ); - m_HToolBar->AddSeparator(); + m_mainToolBar->AddSeparator(); msg = AddHotkeyName( _( "Zoom in" ), g_Module_Editor_Hokeys_Descr, HK_ZOOM_IN, IS_COMMENT ); - m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiBitmap( zoom_in_xpm ), msg ); + m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiBitmap( zoom_in_xpm ), msg ); msg = AddHotkeyName( _( "Zoom out" ), g_Module_Editor_Hokeys_Descr, HK_ZOOM_OUT, IS_COMMENT ); - m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiBitmap( zoom_out_xpm ), msg ); + m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiBitmap( zoom_out_xpm ), msg ); - msg = AddHotkeyName( _( "Redraw view" ), g_Module_Editor_Hokeys_Descr, HK_ZOOM_REDRAW, IS_COMMENT ); - m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, KiBitmap( zoom_redraw_xpm ), msg ); + msg = AddHotkeyName( _( "Redraw view" ), g_Module_Editor_Hokeys_Descr, HK_ZOOM_REDRAW, + IS_COMMENT ); + m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, KiBitmap( zoom_redraw_xpm ), msg ); msg = AddHotkeyName( _( "Zoom auto" ), g_Module_Editor_Hokeys_Descr, HK_ZOOM_AUTO, IS_COMMENT ); - m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, KiBitmap( zoom_fit_in_page_xpm ), msg ); + m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, KiBitmap( zoom_fit_in_page_xpm ), msg ); - m_HToolBar->AddSeparator(); - m_HToolBar->AddTool( ID_MODEDIT_PAD_SETTINGS, wxEmptyString, KiBitmap( options_pad_xpm ), - _( "Pad settings" ) ); + m_mainToolBar->AddSeparator(); + m_mainToolBar->AddTool( ID_MODEDIT_PAD_SETTINGS, wxEmptyString, KiBitmap( options_pad_xpm ), + _( "Pad settings" ) ); - m_HToolBar->AddSeparator(); - m_HToolBar->AddTool( ID_MODEDIT_CHECK, wxEmptyString, - KiBitmap( module_check_xpm ), - _( "Check module" ) ); + m_mainToolBar->AddSeparator(); + m_mainToolBar->AddTool( ID_MODEDIT_CHECK, wxEmptyString, + KiBitmap( module_check_xpm ), + _( "Check module" ) ); // after adding the buttons to the toolbar, must call Realize() to reflect the changes - m_HToolBar->Realize(); + m_mainToolBar->Realize(); } @@ -119,7 +147,8 @@ void FOOTPRINT_EDIT_FRAME::ReCreateVToolbar() if( m_drawToolBar ) return; - m_drawToolBar = new EDA_TOOLBAR( TOOLBAR_TOOL, this, ID_V_TOOLBAR, false ); + m_drawToolBar = new wxAuiToolBar( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize, + wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_VERTICAL ); // Set up toolbar m_drawToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, KiBitmap( cursor_xpm ), @@ -166,7 +195,8 @@ void FOOTPRINT_EDIT_FRAME::ReCreateOptToolbar() return; // Create options tool bar. - m_optionsToolBar = new EDA_TOOLBAR( TOOLBAR_OPTION, this, ID_OPT_TOOLBAR, false ); + m_optionsToolBar = new wxAuiToolBar( this, ID_OPT_TOOLBAR, wxDefaultPosition, wxDefaultSize, + wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_VERTICAL ); m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString, KiBitmap( grid_xpm ), _( "Hide grid" ), wxITEM_CHECK ); @@ -210,7 +240,8 @@ void FOOTPRINT_EDIT_FRAME::ReCreateAuxiliaryToolbar() if( m_auxiliaryToolBar ) return; - m_auxiliaryToolBar = new EDA_TOOLBAR( TOOLBAR_AUX, this, ID_AUX_TOOLBAR, true ); + m_auxiliaryToolBar = new wxAuiToolBar( this, ID_AUX_TOOLBAR, wxDefaultPosition, wxDefaultSize, + wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_HORZ_LAYOUT ); // Set up toolbar m_auxiliaryToolBar->AddSeparator(); diff --git a/pcbnew/tool_pcb.cpp b/pcbnew/tool_pcb.cpp index be5013ef98..0a38dd6bc0 100644 --- a/pcbnew/tool_pcb.cpp +++ b/pcbnew/tool_pcb.cpp @@ -1,3 +1,28 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2005 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com + * Copyright (C) 2011 Wayne Stambaugh + * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + /** * @file tool_pcb.cpp * @brief PCB editor tool bars @@ -166,10 +191,10 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator() * in order to delete the MemoryDC safely without deleting the bitmap */ iconDC.SelectObject( wxNullBitmap ); - if( m_HToolBar && ! first_call ) + if( m_mainToolBar && ! first_call ) { - m_HToolBar->SetToolBitmap( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, *LayerPairBitmap ); - m_HToolBar->Refresh(); + m_mainToolBar->SetToolBitmap( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, *LayerPairBitmap ); + m_mainToolBar->Refresh(); } } @@ -180,108 +205,109 @@ void PCB_EDIT_FRAME::ReCreateHToolbar() { wxString msg; - if( m_HToolBar ) + if( m_mainToolBar ) return; wxWindowUpdateLocker dummy( this ); - m_HToolBar = new EDA_TOOLBAR( TOOLBAR_MAIN, this, ID_H_TOOLBAR, true ); - m_HToolBar->SetRows( 1 ); + m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize, + wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_HORZ_LAYOUT ); // Set up toolbar - m_HToolBar->AddTool( ID_NEW_BOARD, wxEmptyString, KiBitmap( new_pcb_xpm ), - _( "New board" ) ); - m_HToolBar->AddTool( ID_LOAD_FILE, wxEmptyString, KiBitmap( open_brd_file_xpm ), - _( "Open existing board" ) ); - m_HToolBar->AddTool( ID_SAVE_BOARD, wxEmptyString, KiBitmap( save_xpm ), - _( "Save board" ) ); + m_mainToolBar->AddTool( ID_NEW_BOARD, wxEmptyString, KiBitmap( new_pcb_xpm ), + _( "New board" ) ); + m_mainToolBar->AddTool( ID_LOAD_FILE, wxEmptyString, KiBitmap( open_brd_file_xpm ), + _( "Open existing board" ) ); + m_mainToolBar->AddTool( ID_SAVE_BOARD, wxEmptyString, KiBitmap( save_xpm ), + _( "Save board" ) ); - m_HToolBar->AddSeparator(); - m_HToolBar->AddTool( ID_SHEET_SET, wxEmptyString, KiBitmap( sheetset_xpm ), - _( "Page settings for paper size and texts" ) ); + m_mainToolBar->AddSeparator(); + m_mainToolBar->AddTool( ID_SHEET_SET, wxEmptyString, KiBitmap( sheetset_xpm ), + _( "Page settings for paper size and texts" ) ); - m_HToolBar->AddSeparator(); - m_HToolBar->AddTool( ID_OPEN_MODULE_EDITOR, wxEmptyString, KiBitmap( modedit_xpm ), - _( "Open module editor" ) ); + m_mainToolBar->AddSeparator(); + m_mainToolBar->AddTool( ID_OPEN_MODULE_EDITOR, wxEmptyString, KiBitmap( modedit_xpm ), + _( "Open module editor" ) ); #if 0 // Not yet existing commands - m_HToolBar->AddSeparator(); - m_HToolBar->AddTool( wxID_CUT, wxEmptyString, KiBitmap( cut_button_xpm ), - _( "Cut selected item" ) ); + m_mainToolBar->AddSeparator(); + m_mainToolBar->AddTool( wxID_CUT, wxEmptyString, KiBitmap( cut_button_xpm ), + _( "Cut selected item" ) ); - m_HToolBar->AddTool( wxID_COPY, wxEmptyString, KiBitmap( copy_button_xpm ), - _( "Copy selected item" ) ); + m_mainToolBar->AddTool( wxID_COPY, wxEmptyString, KiBitmap( copy_button_xpm ), + _( "Copy selected item" ) ); - m_HToolBar->AddTool( wxID_PASTE, wxEmptyString, KiBitmap( paste_xpm ), - _( "Paste" ) ); + m_mainToolBar->AddTool( wxID_PASTE, wxEmptyString, KiBitmap( paste_xpm ), + _( "Paste" ) ); #endif - m_HToolBar->AddSeparator(); + m_mainToolBar->AddSeparator(); msg = AddHotkeyName( HELP_UNDO, g_Board_Editor_Hokeys_Descr, HK_UNDO, IS_COMMENT ); - m_HToolBar->AddTool( wxID_UNDO, wxEmptyString, KiBitmap( undo_xpm ), HELP_UNDO ); + m_mainToolBar->AddTool( wxID_UNDO, wxEmptyString, KiBitmap( undo_xpm ), HELP_UNDO ); msg = AddHotkeyName( HELP_REDO, g_Board_Editor_Hokeys_Descr, HK_REDO, IS_COMMENT ); - m_HToolBar->AddTool( wxID_REDO, wxEmptyString, KiBitmap( redo_xpm ), HELP_REDO ); + m_mainToolBar->AddTool( wxID_REDO, wxEmptyString, KiBitmap( redo_xpm ), HELP_REDO ); - m_HToolBar->AddSeparator(); - m_HToolBar->AddTool( wxID_PRINT, wxEmptyString, KiBitmap( print_button_xpm ), - _( "Print board" ) ); - m_HToolBar->AddTool( ID_GEN_PLOT, wxEmptyString, KiBitmap( plot_xpm ), - _( "Plot (HPGL, PostScript, or GERBER format)" ) ); + m_mainToolBar->AddSeparator(); + m_mainToolBar->AddTool( wxID_PRINT, wxEmptyString, KiBitmap( print_button_xpm ), + _( "Print board" ) ); + m_mainToolBar->AddTool( ID_GEN_PLOT, wxEmptyString, KiBitmap( plot_xpm ), + _( "Plot (HPGL, PostScript, or GERBER format)" ) ); - m_HToolBar->AddSeparator(); + m_mainToolBar->AddSeparator(); msg = AddHotkeyName( HELP_ZOOM_IN, g_Board_Editor_Hokeys_Descr, HK_ZOOM_IN, IS_COMMENT ); - m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiBitmap( zoom_in_xpm ), msg ); + m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiBitmap( zoom_in_xpm ), msg ); msg = AddHotkeyName( HELP_ZOOM_OUT, g_Board_Editor_Hokeys_Descr, HK_ZOOM_OUT, IS_COMMENT ); - m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiBitmap( zoom_out_xpm ), msg ); + m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiBitmap( zoom_out_xpm ), msg ); - msg = AddHotkeyName( HELP_ZOOM_REDRAW, g_Board_Editor_Hokeys_Descr, HK_ZOOM_REDRAW, IS_COMMENT ); - m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, KiBitmap( zoom_redraw_xpm ), msg ); + msg = AddHotkeyName( HELP_ZOOM_REDRAW, g_Board_Editor_Hokeys_Descr, HK_ZOOM_REDRAW, + IS_COMMENT ); + m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, KiBitmap( zoom_redraw_xpm ), msg ); msg = AddHotkeyName( HELP_ZOOM_FIT, g_Board_Editor_Hokeys_Descr, HK_ZOOM_AUTO, IS_COMMENT ); - m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, KiBitmap( zoom_fit_in_page_xpm ), msg ); + m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, KiBitmap( zoom_fit_in_page_xpm ), msg ); - m_HToolBar->AddSeparator(); + m_mainToolBar->AddSeparator(); msg = AddHotkeyName( HELP_FIND, g_Board_Editor_Hokeys_Descr, HK_FIND_ITEM, IS_COMMENT ); - m_HToolBar->AddTool( ID_FIND_ITEMS, wxEmptyString, KiBitmap( find_xpm ), msg ); + m_mainToolBar->AddTool( ID_FIND_ITEMS, wxEmptyString, KiBitmap( find_xpm ), msg ); - m_HToolBar->AddSeparator(); - m_HToolBar->AddTool( ID_GET_NETLIST, wxEmptyString, KiBitmap( netlist_xpm ), - _( "Read netlist" ) ); - m_HToolBar->AddTool( ID_DRC_CONTROL, wxEmptyString, KiBitmap( erc_xpm ), - _( "Perform design rules check" ) ); + m_mainToolBar->AddSeparator(); + m_mainToolBar->AddTool( ID_GET_NETLIST, wxEmptyString, KiBitmap( netlist_xpm ), + _( "Read netlist" ) ); + m_mainToolBar->AddTool( ID_DRC_CONTROL, wxEmptyString, KiBitmap( erc_xpm ), + _( "Perform design rules check" ) ); - m_HToolBar->AddSeparator(); + m_mainToolBar->AddSeparator(); if( m_SelLayerBox == NULL ) - m_SelLayerBox = new LAYER_BOX_SELECTOR( m_HToolBar, ID_TOOLBARH_PCB_SELECT_LAYER ); + m_SelLayerBox = new LAYER_BOX_SELECTOR( m_mainToolBar, ID_TOOLBARH_PCB_SELECT_LAYER ); - ReCreateLayerBox( m_HToolBar ); - m_HToolBar->AddControl( m_SelLayerBox ); + ReCreateLayerBox( m_mainToolBar ); + m_mainToolBar->AddControl( m_SelLayerBox ); PrepareLayerIndicator(); // Initialize the bitmap with current // active layer colors for the next tool - m_HToolBar->AddTool( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, wxEmptyString, - *LayerPairBitmap, SEL_LAYER_HELP ); + m_mainToolBar->AddTool( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, wxEmptyString, + *LayerPairBitmap, SEL_LAYER_HELP ); - m_HToolBar->AddSeparator(); - m_HToolBar->AddTool( ID_TOOLBARH_PCB_MODE_MODULE, wxEmptyString, KiBitmap( mode_module_xpm ), - _( "Mode footprint: manual and automatic move and place modules" ), - wxITEM_CHECK ); - m_HToolBar->AddTool( ID_TOOLBARH_PCB_MODE_TRACKS, wxEmptyString, KiBitmap( mode_track_xpm ), - _( "Mode track: autorouting" ), wxITEM_CHECK ); + m_mainToolBar->AddSeparator(); + m_mainToolBar->AddTool( ID_TOOLBARH_PCB_MODE_MODULE, wxEmptyString, KiBitmap( mode_module_xpm ), + _( "Mode footprint: manual and automatic move and place modules" ), + wxITEM_CHECK ); + m_mainToolBar->AddTool( ID_TOOLBARH_PCB_MODE_TRACKS, wxEmptyString, KiBitmap( mode_track_xpm ), + _( "Mode track: autorouting" ), wxITEM_CHECK ); // Fast call to FreeROUTE Web Bases router - m_HToolBar->AddSeparator(); - m_HToolBar->AddTool( ID_TOOLBARH_PCB_FREEROUTE_ACCESS, wxEmptyString, - KiBitmap( web_support_xpm ), - _( "Fast access to the Web Based FreeROUTE advanced router" ) ); + m_mainToolBar->AddSeparator(); + m_mainToolBar->AddTool( ID_TOOLBARH_PCB_FREEROUTE_ACCESS, wxEmptyString, + KiBitmap( web_support_xpm ), + _( "Fast access to the Web Based FreeROUTE advanced router" ) ); - m_HToolBar->AddSeparator(); + m_mainToolBar->AddSeparator(); // after adding the buttons to the toolbar, must call Realize() to reflect the changes - m_HToolBar->Realize(); + m_mainToolBar->Realize(); } @@ -292,7 +318,8 @@ void PCB_EDIT_FRAME::ReCreateOptToolbar() wxWindowUpdateLocker dummy( this ); - m_optionsToolBar = new EDA_TOOLBAR( TOOLBAR_OPTION, this, ID_OPT_TOOLBAR, false ); + m_optionsToolBar = new wxAuiToolBar( this, ID_OPT_TOOLBAR, wxDefaultPosition, wxDefaultSize, + wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_VERTICAL ); m_optionsToolBar->AddTool( ID_TB_OPTIONS_DRC_OFF, wxEmptyString, KiBitmap( drc_off_xpm ), _( "Enable design rule checking" ), wxITEM_CHECK ); @@ -327,15 +354,14 @@ void PCB_EDIT_FRAME::ReCreateOptToolbar() wxITEM_CHECK ); m_optionsToolBar->AddSeparator(); - m_optionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES, wxEmptyString, - KiBitmap( show_zone_xpm ), wxNullBitmap, - _( "Show filled areas in zones" ) ); - m_optionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES_DISABLE, wxEmptyString, - KiBitmap( show_zone_disable_xpm ), - wxNullBitmap, _( "Do not show filled areas in zones" )); - m_optionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY, wxEmptyString, - KiBitmap( show_zone_outline_only_xpm ), wxNullBitmap, - _( "Show outlines of filled areas only in zones" ) ); + m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_ZONES, wxEmptyString, KiBitmap( show_zone_xpm ), + _( "Show filled areas in zones" ), wxITEM_CHECK ); + m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_ZONES_DISABLE, wxEmptyString, + KiBitmap( show_zone_disable_xpm ), + _( "Do not show filled areas in zones" ) , wxITEM_CHECK ); + m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY, wxEmptyString, + KiBitmap( show_zone_outline_only_xpm ), + _( "Show outlines of filled areas only in zones" ), wxITEM_CHECK ); m_optionsToolBar->AddSeparator(); m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH, wxEmptyString, @@ -384,7 +410,8 @@ void PCB_EDIT_FRAME::ReCreateVToolbar() wxWindowUpdateLocker dummy( this ); - m_drawToolBar = new EDA_TOOLBAR( TOOLBAR_TOOL, this, ID_V_TOOLBAR, false ); + m_drawToolBar = new wxAuiToolBar( this, ID_V_TOOLBAR, wxDefaultPosition, wxDefaultSize, + wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_VERTICAL ); // Set up toolbar m_drawToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, KiBitmap( cursor_xpm ), @@ -456,7 +483,9 @@ void PCB_EDIT_FRAME::ReCreateMicrowaveVToolbar() wxWindowUpdateLocker dummy(this); - m_microWaveToolBar = new EDA_TOOLBAR( TOOLBAR_TOOL, this, ID_MICROWAVE_V_TOOLBAR, false ); + m_microWaveToolBar = new wxAuiToolBar( this, ID_MICROWAVE_V_TOOLBAR, wxDefaultPosition, + wxDefaultSize, + wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_VERTICAL ); // Set up toolbar m_microWaveToolBar->AddTool( ID_PCB_MUWAVE_TOOL_SELF_CMD, wxEmptyString, @@ -503,7 +532,8 @@ void PCB_EDIT_FRAME::ReCreateAuxiliaryToolbar() if( m_auxiliaryToolBar ) return; - m_auxiliaryToolBar = new EDA_TOOLBAR( TOOLBAR_AUX, this, ID_AUX_TOOLBAR, true ); + m_auxiliaryToolBar = new wxAuiToolBar( this, ID_AUX_TOOLBAR, wxDefaultPosition, wxDefaultSize, + wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_HORZ_LAYOUT ); /* Set up toolbar items */ @@ -617,11 +647,12 @@ void PCB_EDIT_FRAME::updateViaSizeSelectBox() if( GetBoard()->m_ViaSizeSelector >= GetBoard()->m_ViasDimensionsList.size() ) GetBoard()->m_ViaSizeSelector = 0; + m_SelViaSizeBox->SetSelection( GetBoard()->m_ViaSizeSelector ); } -LAYER_BOX_SELECTOR* PCB_EDIT_FRAME::ReCreateLayerBox( EDA_TOOLBAR* parent ) +LAYER_BOX_SELECTOR* PCB_EDIT_FRAME::ReCreateLayerBox( wxAuiToolBar* parent ) { if( m_SelLayerBox == NULL ) return NULL; diff --git a/pcbnew/toolbars_update_user_interface.cpp b/pcbnew/toolbars_update_user_interface.cpp index 4129943d63..5928e095bb 100644 --- a/pcbnew/toolbars_update_user_interface.cpp +++ b/pcbnew/toolbars_update_user_interface.cpp @@ -1,3 +1,28 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com + * Copyright (C) 2007-2011 Wayne Stambaugh + * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html + * or you may search the http://www.gnu.org website for the version 2 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + /** * @file toolbars_update_user_interface.cpp * @brief Function to update toolbars UI after changing parameters. @@ -175,3 +200,19 @@ void PCB_EDIT_FRAME::OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent ) if( aEvent.GetEventObject() == m_drawToolBar ) aEvent.Check( GetToolId() == aEvent.GetId() ); } + + +void PCB_EDIT_FRAME::OnUpdateAutoPlaceTracksMode( wxUpdateUIEvent& aEvent ) +{ + // Automatic placement of modules and tracks is a mutually exclusive operation so + // clear the other tool if one of the two is selected. + aEvent.Check( m_autoPlaceModeId == ID_TOOLBARH_PCB_MODE_TRACKS ); +} + + +void PCB_EDIT_FRAME::OnUpdateAutoPlaceModulesMode( wxUpdateUIEvent& aEvent ) +{ + // Automatic placement of modules and tracks is a mutually exclusive operation so + // clear the other tool if one of the two is selected. + aEvent.Check( m_autoPlaceModeId == ID_TOOLBARH_PCB_MODE_MODULE ); +} diff --git a/pcbnew/zones_non_copper_type_functions.cpp b/pcbnew/zones_non_copper_type_functions.cpp index 4d2c284f9d..54d71ae7a2 100644 --- a/pcbnew/zones_non_copper_type_functions.cpp +++ b/pcbnew/zones_non_copper_type_functions.cpp @@ -78,7 +78,7 @@ void DialogNonCopperZonesEditor::Init() AddUnitSymbol( *m_MinThicknessValueTitle, g_UserUnit ); wxString msg = ReturnStringFromValue( g_UserUnit, m_Zone_Setting->m_ZoneMinThickness, - m_Parent->m_InternalUnits ); + m_Parent->GetInternalUnits() ); m_ZoneMinThicknessCtrl->SetValue( msg ); if( g_Zone_45_Only ) @@ -126,7 +126,7 @@ void DialogNonCopperZonesEditor::OnOkClick( wxCommandEvent& event ) { wxString txtvalue = m_ZoneMinThicknessCtrl->GetValue(); m_Zone_Setting->m_ZoneMinThickness = - ReturnValueFromString( g_UserUnit, txtvalue, m_Parent->m_InternalUnits ); + ReturnValueFromString( g_UserUnit, txtvalue, m_Parent->GetInternalUnits() ); if( m_Zone_Setting->m_ZoneMinThickness < 10 ) {