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.
This commit is contained in:
Wayne Stambaugh 2011-12-16 08:32:23 -05:00
parent c9269232cf
commit fac288cffa
76 changed files with 1056 additions and 845 deletions

View File

@ -41,7 +41,8 @@ void EDA_3D_FRAME::ReCreateHToolbar()
return; 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 // Set up toolbar
m_HToolBar->AddTool( ID_RELOAD3D_BOARD, wxEmptyString, m_HToolBar->AddTool( ID_RELOAD3D_BOARD, wxEmptyString,

View File

@ -268,8 +268,8 @@ public:
private: private:
wxString m_FrameName; // name used for writing and reading setup. It is "Frame3D" wxString m_FrameName; // name used for writing and reading setup. It is "Frame3D"
EDA_3D_CANVAS* m_Canvas; EDA_3D_CANVAS* m_Canvas;
EDA_TOOLBAR* m_HToolBar; wxAuiToolBar* m_HToolBar;
EDA_TOOLBAR* m_VToolBar; wxAuiToolBar* m_VToolBar;
int m_InternalUnits; int m_InternalUnits;
wxPoint m_FramePos; wxPoint m_FramePos;
wxSize m_FrameSize; wxSize m_FrameSize;

View File

@ -65,7 +65,6 @@ set(COMMON_SRCS
richio.cpp richio.cpp
selcolor.cpp selcolor.cpp
string.cpp string.cpp
wineda_toolbar.cpp
trigo.cpp trigo.cpp
worksheet.cpp worksheet.cpp
wxwineda.cpp wxwineda.cpp

View File

@ -66,7 +66,7 @@ EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* father,
wxSize minsize; wxSize minsize;
m_Ident = idtype; m_Ident = idtype;
m_HToolBar = NULL; m_mainToolBar = NULL;
m_FrameIsActive = true; m_FrameIsActive = true;
m_hasAutoSave = false; m_hasAutoSave = false;
m_autoSaveState = false; m_autoSaveState = false;

View File

@ -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, const wxPoint& pos, const wxSize& size,
int n, const wxString choices[] ) : int n, const wxString choices[] ) :
wxBitmapComboBox( parent, id, wxEmptyString, pos, size, n, choices, wxCB_READONLY ) 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 wxPoint& pos, const wxSize& size,
const wxArrayString& choices ) : const wxArrayString& choices ) :
wxBitmapComboBox( parent, id, wxEmptyString, pos, size, choices, wxCB_READONLY ) wxBitmapComboBox( parent, id, wxEmptyString, pos, size, choices, wxCB_READONLY )

View File

@ -51,7 +51,7 @@ bool DrawPageOnClipboard( EDA_DRAW_FRAME* aFrame )
BASE_SCREEN* screen = aFrame->DrawPanel->GetScreen(); BASE_SCREEN* screen = aFrame->DrawPanel->GetScreen();
/* scale is the ratio resolution/internal units */ /* scale is the ratio resolution/internal units */
float scale = 82.0 / aFrame->m_InternalUnits; float scale = 82.0 / aFrame->GetInternalUnits();
if( screen->IsBlockActive() ) if( screen->IsBlockActive() )
{ {

View File

@ -99,10 +99,8 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* father, int idtype, const wxString& ti
m_currentScreen = NULL; m_currentScreen = NULL;
m_toolId = ID_NO_TOOL_SELECTED; m_toolId = ID_NO_TOOL_SELECTED;
m_lastDrawToolId = ID_NO_TOOL_SELECTED; m_lastDrawToolId = ID_NO_TOOL_SELECTED;
m_HTOOL_current_state = 0;
m_showAxis = false; // true to draw axis. m_showAxis = false; // true to draw axis.
m_showBorderAndTitleBlock = false; // true to display reference sheet. 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_showGridAxis = false; // true to draw the grid axis
m_cursorShape = 0; m_cursorShape = 0;
m_LastGridSizeId = 0; m_LastGridSizeId = 0;
@ -111,7 +109,7 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* father, int idtype, const wxString& ti
m_snapToGrid = true; m_snapToGrid = true;
// Internal units per inch: = 1000 for schema, = 10000 for PCB // Internal units per inch: = 1000 for schema, = 10000 for PCB
m_InternalUnits = EESCHEMA_INTERNAL_UNIT; m_internalUnits = EESCHEMA_INTERNAL_UNIT;
minsize.x = 470; minsize.x = 470;
minsize.y = 350 + m_MsgFrameHeight; minsize.y = 350 + m_MsgFrameHeight;
@ -757,8 +755,8 @@ void EDA_DRAW_FRAME::UpdateStatusBar()
SetStatusText( Line, 1 ); SetStatusText( Line, 1 );
/* Display absolute coordinates: */ /* Display absolute coordinates: */
double dXpos = To_User_Unit( g_UserUnit, screen->GetCrossHairPosition().x, 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 ); double dYpos = To_User_Unit( g_UserUnit, screen->GetCrossHairPosition().y, m_internalUnits );
/* /*
* Converting from inches to mm can give some coordinates due to * Converting from inches to mm can give some coordinates due to
@ -767,8 +765,8 @@ void EDA_DRAW_FRAME::UpdateStatusBar()
*/ */
if ( g_UserUnit == MILLIMETRES ) if ( g_UserUnit == MILLIMETRES )
{ {
dXpos = RoundTo0( dXpos, (double)( m_InternalUnits / 10 ) ); dXpos = RoundTo0( dXpos, (double)( m_internalUnits / 10 ) );
dYpos = RoundTo0( dYpos, (double)( m_InternalUnits / 10 ) ); dYpos = RoundTo0( dYpos, (double)( m_internalUnits / 10 ) );
} }
/* The following sadly is an if Eeschema/if Pcbnew */ /* The following sadly is an if Eeschema/if Pcbnew */
@ -777,7 +775,7 @@ void EDA_DRAW_FRAME::UpdateStatusBar()
switch( g_UserUnit ) switch( g_UserUnit )
{ {
case INCHES: case INCHES:
if( m_InternalUnits == EESCHEMA_INTERNAL_UNIT ) if( m_internalUnits == EESCHEMA_INTERNAL_UNIT )
{ {
absformatter = wxT( "X %.3f Y %.3f" ); absformatter = wxT( "X %.3f Y %.3f" );
locformatter = wxT( "dx %.3f dy %.3f" ); locformatter = wxT( "dx %.3f dy %.3f" );
@ -790,7 +788,7 @@ void EDA_DRAW_FRAME::UpdateStatusBar()
break; break;
case MILLIMETRES: case MILLIMETRES:
if( m_InternalUnits == EESCHEMA_INTERNAL_UNIT ) if( m_internalUnits == EESCHEMA_INTERNAL_UNIT )
{ {
absformatter = wxT( "X %.2f Y %.2f" ); absformatter = wxT( "X %.2f Y %.2f" );
locformatter = wxT( "dx %.2f dy %.2f" ); locformatter = wxT( "dx %.2f dy %.2f" );
@ -814,13 +812,13 @@ void EDA_DRAW_FRAME::UpdateStatusBar()
/* Display relative coordinates: */ /* Display relative coordinates: */
dx = screen->GetCrossHairPosition().x - screen->m_O_Curseur.x; dx = screen->GetCrossHairPosition().x - screen->m_O_Curseur.x;
dy = screen->GetCrossHairPosition().y - screen->m_O_Curseur.y; dy = screen->GetCrossHairPosition().y - screen->m_O_Curseur.y;
dXpos = To_User_Unit( g_UserUnit, dx, m_InternalUnits ); dXpos = To_User_Unit( g_UserUnit, dx, m_internalUnits );
dYpos = To_User_Unit( g_UserUnit, dy, m_InternalUnits ); dYpos = To_User_Unit( g_UserUnit, dy, m_internalUnits );
if( g_UserUnit == MILLIMETRES ) if( g_UserUnit == MILLIMETRES )
{ {
dXpos = RoundTo0( dXpos, (double) ( m_InternalUnits / 10 ) ); dXpos = RoundTo0( dXpos, (double) ( m_internalUnits / 10 ) );
dYpos = RoundTo0( dYpos, (double) ( m_InternalUnits / 10 ) ); dYpos = RoundTo0( dYpos, (double) ( m_internalUnits / 10 ) );
} }
/* We already decided the formatter above */ /* 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 ) wxString EDA_DRAW_FRAME::CoordinateToString( int aValue, bool aConvertToMils )
{ {
return ::CoordinateToString( aValue, m_InternalUnits, aConvertToMils ); return ::CoordinateToString( aValue, m_internalUnits, aConvertToMils );
} }

View File

@ -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 <stambaughw@verizon.net>
* 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__ #ifdef __GNUG__
#pragma implementation #pragma implementation
@ -21,7 +42,6 @@ EDA_MSG_PANEL::EDA_MSG_PANEL( EDA_DRAW_FRAME* parent, int id,
const wxPoint& pos, const wxSize& size ) : const wxPoint& pos, const wxSize& size ) :
wxPanel( parent, id, pos, size ) wxPanel( parent, id, pos, size )
{ {
m_Parent = parent;
SetFont( wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ) ); SetFont( wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ) );
SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) ); SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
m_last_x = 0; m_last_x = 0;

View File

@ -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;
}

View File

@ -1003,7 +1003,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_wid
EDA_Colors Color; EDA_Colors Color;
wxString Line; wxString Line;
Ki_WorkSheetData* WsItem; Ki_WorkSheetData* WsItem;
int scale = m_InternalUnits / 1000; int scale = m_internalUnits / 1000;
wxSize size( SIZETEXT * scale, SIZETEXT * scale ); wxSize size( SIZETEXT * scale, SIZETEXT * scale );
#if defined(KICAD_GOST) #if defined(KICAD_GOST)
wxSize size2( SIZETEXT * scale * 2, SIZETEXT * scale * 2); wxSize size2( SIZETEXT * scale * 2, SIZETEXT * scale * 2);

View File

@ -197,8 +197,8 @@ void EDA_DRAW_FRAME::AddMenuZoomAndGrid( wxMenu* MasterMenu )
for( size_t i = 0; i < screen->GetGridCount(); i++ ) for( size_t i = 0; i < screen->GetGridCount(); i++ )
{ {
tmp = screen->GetGrid( i ); tmp = screen->GetGrid( i );
double gridValueInch = To_User_Unit( INCHES, 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 ); double gridValue_mm = To_User_Unit( MILLIMETRES, tmp.m_Size.x, m_internalUnits );
if( tmp.m_Id == ID_POPUP_GRID_USER ) if( tmp.m_Id == ID_POPUP_GRID_USER )
{ {

View File

@ -121,8 +121,8 @@ DISPLAY_FOOTPRINTS_FRAME::DISPLAY_FOOTPRINTS_FRAME( CVPCB_MAINFRAME* father,
m_auimgr.AddPane( m_HToolBar, m_auimgr.AddPane( m_mainToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top(). Row( 0 ) ); wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top(). Row( 0 ) );
if( m_drawToolBar ) // Currently, no vertical right toolbar. if( m_drawToolBar ) // Currently, no vertical right toolbar.
m_auimgr.AddPane( m_drawToolBar, m_auimgr.AddPane( m_drawToolBar,
@ -178,7 +178,8 @@ void DISPLAY_FOOTPRINTS_FRAME::ReCreateOptToolbar()
return; return;
// Create options tool bar. // 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 ), m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString, KiBitmap( grid_xpm ),
_( "Hide grid" ), wxITEM_CHECK ); _( "Hide grid" ), wxITEM_CHECK );
@ -218,35 +219,36 @@ void DISPLAY_FOOTPRINTS_FRAME::ReCreateOptToolbar()
void DISPLAY_FOOTPRINTS_FRAME::ReCreateHToolbar() void DISPLAY_FOOTPRINTS_FRAME::ReCreateHToolbar()
{ {
if( m_HToolBar != NULL ) if( m_mainToolBar != NULL )
return; 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 ), m_mainToolBar->AddTool( ID_OPTIONS_SETUP, wxEmptyString, KiBitmap( display_options_xpm ),
_( "Display options" ) ); _( "Display options" ) );
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiBitmap( zoom_in_xpm ), m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, KiBitmap( zoom_in_xpm ),
_( "Zoom in (F1)" ) ); _( "Zoom in (F1)" ) );
m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiBitmap( zoom_out_xpm ), m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, KiBitmap( zoom_out_xpm ),
_( "Zoom out (F2)" ) ); _( "Zoom out (F2)" ) );
m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, KiBitmap( zoom_redraw_xpm ), m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, KiBitmap( zoom_redraw_xpm ),
_( "Redraw view (F3)" ) ); _( "Redraw view (F3)" ) );
m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, KiBitmap( zoom_fit_in_page_xpm ), m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, KiBitmap( zoom_fit_in_page_xpm ),
_( "Zoom auto (Home)" ) ); _( "Zoom auto (Home)" ) );
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_HToolBar->AddTool( ID_CVPCB_SHOW3D_FRAME, wxEmptyString, KiBitmap( three_d_xpm ), m_mainToolBar->AddTool( ID_CVPCB_SHOW3D_FRAME, wxEmptyString, KiBitmap( three_d_xpm ),
_( "3D Display" ) ); _( "3D Display" ) );
// after adding the buttons to the toolbar, must call Realize() to reflect // after adding the buttons to the toolbar, must call Realize() to reflect
// the changes // the changes
m_HToolBar->Realize(); m_mainToolBar->Realize();
} }

View File

@ -109,7 +109,7 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( const wxString& title, long style ) :
m_ListCmp = NULL; m_ListCmp = NULL;
m_FootprintList = NULL; m_FootprintList = NULL;
m_DisplayFootprintFrame = NULL; m_DisplayFootprintFrame = NULL;
m_HToolBar = NULL; m_mainToolBar = NULL;
m_modified = false; m_modified = false;
m_isEESchemaNetlist = false; m_isEESchemaNetlist = false;
m_KeepCvpcbOpen = false; m_KeepCvpcbOpen = false;
@ -166,9 +166,9 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( const wxString& title, long style ) :
info.InfoToolbarPane(); info.InfoToolbarPane();
if( m_HToolBar ) if( m_mainToolBar )
m_auimgr.AddPane( m_HToolBar, m_auimgr.AddPane( m_mainToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top() ); wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top() );
if( m_ListCmp ) if( m_ListCmp )
m_auimgr.AddPane( m_ListCmp, m_auimgr.AddPane( m_ListCmp,
@ -189,7 +189,7 @@ CVPCB_MAINFRAME::~CVPCB_MAINFRAME()
if( config ) 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 ); config->Write( wxT( FILTERFOOTPRINTKEY ), state );
} }
@ -504,7 +504,7 @@ void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
{ {
int selection; 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 ); m_FootprintList->SetActiveFootprintList( true, true );
return; return;
@ -554,11 +554,11 @@ void CVPCB_MAINFRAME::OnSelectFilteringFootprint( wxCommandEvent& event )
switch( event.GetId() ) switch( event.GetId() )
{ {
case ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST: 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; break;
case ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST: 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; break;
default: default:

View File

@ -15,7 +15,7 @@
/* Forward declarations of all top-level window classes. */ /* Forward declarations of all top-level window classes. */
class EDA_TOOLBAR; class wxAuiToolBar;
class FOOTPRINTS_LISTBOX; class FOOTPRINTS_LISTBOX;
class COMPONENTS_LISTBOX; class COMPONENTS_LISTBOX;
class DISPLAY_FOOTPRINTS_FRAME; class DISPLAY_FOOTPRINTS_FRAME;
@ -32,7 +32,7 @@ public:
FOOTPRINTS_LISTBOX* m_FootprintList; FOOTPRINTS_LISTBOX* m_FootprintList;
COMPONENTS_LISTBOX* m_ListCmp; COMPONENTS_LISTBOX* m_ListCmp;
DISPLAY_FOOTPRINTS_FRAME* m_DisplayFootprintFrame; DISPLAY_FOOTPRINTS_FRAME* m_DisplayFootprintFrame;
EDA_TOOLBAR* m_HToolBar; wxAuiToolBar* m_mainToolBar;
wxFileName m_NetlistFileName; wxFileName m_NetlistFileName;
wxArrayString m_ModuleLibNames; wxArrayString m_ModuleLibNames;
wxArrayString m_AliasLibNames; wxArrayString m_AliasLibNames;

View File

@ -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 <stambaughw@verizon.net>
* 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 "fctsys.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
@ -16,78 +41,81 @@ void CVPCB_MAINFRAME::ReCreateHToolbar()
{ {
wxConfig* config = wxGetApp().m_EDA_Config; wxConfig* config = wxGetApp().m_EDA_Config;
if( m_HToolBar != NULL ) if( m_mainToolBar != NULL )
return; 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, m_mainToolBar->AddTool( ID_CVPCB_READ_INPUT_NETLIST, wxEmptyString,
KiBitmap( open_document_xpm ), KiBitmap( open_document_xpm ),
_( "Open a net list file" ) ); _( "Open a net list file" ) );
m_HToolBar->AddTool( wxID_SAVE, wxEmptyString, KiBitmap( save_xpm ), m_mainToolBar->AddTool( wxID_SAVE, wxEmptyString, KiBitmap( save_xpm ),
_( "Save net list and footprint files" ) ); _( "Save net list and footprint files" ) );
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_HToolBar->AddTool( ID_CVPCB_CREATE_CONFIGWINDOW, wxEmptyString, m_mainToolBar->AddTool( ID_CVPCB_CREATE_CONFIGWINDOW, wxEmptyString,
KiBitmap( config_xpm ), KiBitmap( config_xpm ),
_( "Configuration" ) ); _( "Configuration" ) );
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_HToolBar->AddTool( ID_CVPCB_CREATE_SCREENCMP, wxEmptyString, m_mainToolBar->AddTool( ID_CVPCB_CREATE_SCREENCMP, wxEmptyString,
KiBitmap( show_footprint_xpm ), KiBitmap( show_footprint_xpm ),
_( "View selected footprint" ) ); _( "View selected footprint" ) );
m_HToolBar->AddTool( ID_CVPCB_AUTO_ASSOCIE, wxEmptyString, m_mainToolBar->AddTool( ID_CVPCB_AUTO_ASSOCIE, wxEmptyString,
KiBitmap( auto_associe_xpm ), KiBitmap( auto_associe_xpm ),
_( "Perform automatic footprint association" ) ); _( "Perform automatic footprint association" ) );
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_HToolBar->AddTool( ID_CVPCB_GOTO_PREVIOUSNA, wxEmptyString, m_mainToolBar->AddTool( ID_CVPCB_GOTO_PREVIOUSNA, wxEmptyString,
KiBitmap( left_xpm ), KiBitmap( left_xpm ),
_( "Select previous free component" ) ); _( "Select previous free component" ) );
m_HToolBar->AddTool( ID_CVPCB_GOTO_FIRSTNA, wxEmptyString, m_mainToolBar->AddTool( ID_CVPCB_GOTO_FIRSTNA, wxEmptyString,
KiBitmap( right_xpm ), KiBitmap( right_xpm ),
_( "Select next free component" ) ); _( "Select next free component" ) );
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_HToolBar->AddTool( ID_CVPCB_DEL_ASSOCIATIONS, wxEmptyString, m_mainToolBar->AddTool( ID_CVPCB_DEL_ASSOCIATIONS, wxEmptyString,
KiBitmap( delete_association_xpm ), KiBitmap( delete_association_xpm ),
_( "Delete all associations" ) ); _( "Delete all associations" ) );
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_HToolBar->AddTool( ID_CVPCB_CREATE_STUFF_FILE, wxEmptyString, m_mainToolBar->AddTool( ID_CVPCB_CREATE_STUFF_FILE, wxEmptyString,
KiBitmap( export_footprint_names_xpm ), KiBitmap( export_footprint_names_xpm ),
_( "Create export file (component/footprint list, \ _( "Create export file (component/footprint list, \
used by Eeschema to fill the footprint field of components)" ) ); used by Eeschema to fill the footprint field of components)" ) );
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_HToolBar->AddTool( ID_PCB_DISPLAY_FOOTPRINT_DOC, wxEmptyString, m_mainToolBar->AddTool( ID_PCB_DISPLAY_FOOTPRINT_DOC, wxEmptyString,
KiBitmap( datasheet_xpm ), KiBitmap( datasheet_xpm ),
_( "Display footprints list documentation" ) ); _( "Display footprints list documentation" ) );
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_HToolBar->AddRadioTool( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, m_mainToolBar->AddTool( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST,
wxEmptyString, KiBitmap( module_filtered_list_xpm ),
KiBitmap( module_filtered_list_xpm ), wxNullBitmap,
wxNullBitmap, true, NULL,
_( "Display the filtered footprint list for the current component" ) ); _( "Display the filtered footprint list for the current component" ),
wxEmptyString );
m_HToolBar->AddRadioTool( ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST, m_mainToolBar->AddTool( ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST,
wxEmptyString, KiBitmap( module_full_list_xpm ), KiBitmap( module_full_list_xpm ),
wxNullBitmap, wxNullBitmap, true, NULL,
_( "Display the full footprint list (without filtering)" ) ); _( "Display the full footprint list (without filtering)" ),
wxEmptyString );
if( config ) if( config )
{ {
wxString key = wxT( FILTERFOOTPRINTKEY ); wxString key = wxT( FILTERFOOTPRINTKEY );
int opt = config->Read( key, (long) 1 ); int opt = config->Read( key, (long) 1 );
m_HToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, opt ); m_mainToolBar->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_FULL_LIST, !opt );
} }
// after adding the buttons to the toolbar, must call Realize() to reflect the changes // after adding the buttons to the toolbar, must call Realize() to reflect the changes
m_HToolBar->Realize(); m_mainToolBar->Realize();
} }

View File

@ -79,7 +79,7 @@ void DIALOG_SVG_PRINT::OnInitDialog( wxInitDialogEvent& event )
AddUnitSymbol( *m_TextPenWidth, g_UserUnit ); AddUnitSymbol( *m_TextPenWidth, g_UserUnit );
m_DialogPenWidth->SetValue( m_DialogPenWidth->SetValue(
ReturnStringFromValue( g_UserUnit, g_DrawDefaultLineThickness, ReturnStringFromValue( g_UserUnit, g_DrawDefaultLineThickness,
m_Parent->m_InternalUnits ) ); m_Parent->GetInternalUnits() ) );
m_Print_Sheet_Ref->SetValue( s_Print_Frame_Ref ); m_Print_Sheet_Ref->SetValue( s_Print_Frame_Ref );
if( GetSizer() ) if( GetSizer() )
@ -92,7 +92,7 @@ void DIALOG_SVG_PRINT::OnInitDialog( wxInitDialogEvent& event )
void DIALOG_SVG_PRINT::SetPenWidth() void DIALOG_SVG_PRINT::SetPenWidth()
{ {
g_DrawDefaultLineThickness = g_DrawDefaultLineThickness =
ReturnValueFromTextCtrl( *m_DialogPenWidth, m_Parent->m_InternalUnits ); ReturnValueFromTextCtrl( *m_DialogPenWidth, m_Parent->GetInternalUnits() );
if( g_DrawDefaultLineThickness > WIDTH_MAX_VALUE ) if( g_DrawDefaultLineThickness > WIDTH_MAX_VALUE )
{ {
@ -106,7 +106,7 @@ void DIALOG_SVG_PRINT::SetPenWidth()
m_DialogPenWidth->SetValue( m_DialogPenWidth->SetValue(
ReturnStringFromValue( g_UserUnit, g_DrawDefaultLineThickness, 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(); SetPenWidth();
g_DrawDefaultLineThickness = g_DrawDefaultLineThickness =
ReturnValueFromTextCtrl( *m_DialogPenWidth, m_Parent->m_InternalUnits ); ReturnValueFromTextCtrl( *m_DialogPenWidth, m_Parent->GetInternalUnits() );
SCH_SCREEN* screen = (SCH_SCREEN*) m_Parent->GetScreen(); 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 SetLocaleTo_C_standard(); // Switch the locale to standard C (needed
// to print floating point numbers like 1.3) // 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 ); wxSVGFileDC dc( FullFileName, SheetSize.x, SheetSize.y, dpi );
EDA_RECT tmp = panel->m_ClipBox; EDA_RECT tmp = panel->m_ClipBox;

View File

@ -175,7 +175,7 @@ void DialogLabelEditor::InitDialog()
m_staticSizeUnits->SetLabel( msg ); m_staticSizeUnits->SetLabel( msg );
msg = ReturnStringFromValue( g_UserUnit, m_CurrentText->m_Size.x, msg = ReturnStringFromValue( g_UserUnit, m_CurrentText->m_Size.x,
m_Parent->m_InternalUnits ); m_Parent->GetInternalUnits() );
m_TextSize->SetValue( msg ); m_TextSize->SetValue( msg );
if( m_CurrentText->Type() != SCH_GLOBAL_LABEL_T if( m_CurrentText->Type() != SCH_GLOBAL_LABEL_T
@ -239,7 +239,7 @@ void DialogLabelEditor::TextPropertiesAccept( wxCommandEvent& aEvent )
m_CurrentText->SetOrientation( m_TextOrient->GetSelection() ); m_CurrentText->SetOrientation( m_TextOrient->GetSelection() );
text = m_TextSize->GetValue(); 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; m_CurrentText->m_Size.x = m_CurrentText->m_Size.y = value;
if( m_TextShape ) if( m_TextShape )

View File

@ -119,7 +119,7 @@ void DIALOG_LIB_EDIT_PIN::OnPropertiesChange( wxCommandEvent& event )
{ {
if( ! IsShown() ) // do nothing at init time if( ! IsShown() ) // do nothing at init time
return; return;
int units = ((LIB_EDIT_FRAME*)GetParent())->m_InternalUnits; int units = ((LIB_EDIT_FRAME*)GetParent())->GetInternalUnits();
int pinNameSize = ReturnValueFromString( g_UserUnit, GetNameTextSize(), units ); int pinNameSize = ReturnValueFromString( g_UserUnit, GetNameTextSize(), units );
int pinNumSize = ReturnValueFromString( g_UserUnit, GetPadNameTextSize(), units); int pinNumSize = ReturnValueFromString( g_UserUnit, GetPadNameTextSize(), units);
int pinOrient = LIB_PIN::GetOrientationCode( GetOrientation() ); int pinOrient = LIB_PIN::GetOrientationCode( GetOrientation() );

View File

@ -61,7 +61,7 @@ void DIALOG_LIB_EDIT_TEXT::initDlg( )
if ( m_GraphicText ) if ( m_GraphicText )
{ {
msg = ReturnStringFromValue( g_UserUnit, m_GraphicText->m_Size.x, msg = ReturnStringFromValue( g_UserUnit, m_GraphicText->m_Size.x,
m_Parent->m_InternalUnits ); m_Parent->GetInternalUnits() );
m_TextSize->SetValue( msg ); m_TextSize->SetValue( msg );
m_TextValue->SetValue( m_GraphicText->m_Text ); m_TextValue->SetValue( m_GraphicText->m_Text );
@ -114,7 +114,7 @@ void DIALOG_LIB_EDIT_TEXT::initDlg( )
else else
{ {
msg = ReturnStringFromValue( g_UserUnit, m_Parent->m_textSize, msg = ReturnStringFromValue( g_UserUnit, m_Parent->m_textSize,
m_Parent->m_InternalUnits ); m_Parent->GetInternalUnits() );
m_TextSize->SetValue( msg ); m_TextSize->SetValue( msg );
if ( ! m_Parent->m_drawSpecificUnit ) if ( ! m_Parent->m_drawSpecificUnit )
@ -146,7 +146,7 @@ void DIALOG_LIB_EDIT_TEXT::OnOkClick( wxCommandEvent& event )
Line = m_TextValue->GetValue(); Line = m_TextValue->GetValue();
m_Parent->m_textOrientation = m_Orient->GetValue() ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ; m_Parent->m_textOrientation = m_Orient->GetValue() ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ;
wxString msg = m_TextSize->GetValue(); 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_drawSpecificConvert = m_CommonConvert->GetValue() ? false : true;
m_Parent->m_drawSpecificUnit = m_CommonUnit->GetValue() ? false : true; m_Parent->m_drawSpecificUnit = m_CommonUnit->GetValue() ? false : true;

View File

@ -96,9 +96,9 @@ void SCH_EDIT_FRAME::OnFindDrcMarker( wxFindDialogEvent& event )
wxString path = sheetFoundIn->Path(); wxString path = sheetFoundIn->Path();
wxString units = GetAbbreviatedUnitsLabel(); wxString units = GetAbbreviatedUnitsLabel();
double x = To_User_Unit( g_UserUnit, (double) lastMarker->GetPosition().x, 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, 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" ), 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) ); GetChars( path ), x, GetChars( units ), y, GetChars( units) );
SetStatusText( msg ); SetStatusText( msg );

View File

@ -635,7 +635,7 @@ lost!\n\nClear the current component from the screen?" ) ) )
GetScreen()->ClearUndoRedoList(); GetScreen()->ClearUndoRedoList();
OnModify(); OnModify();
DrawPanel->Refresh(); DrawPanel->Refresh();
m_HToolBar->Refresh(); m_mainToolBar->Refresh();
} }

View File

@ -247,8 +247,8 @@ LIB_EDIT_FRAME::LIB_EDIT_FRAME( SCH_EDIT_FRAME* aParent,
EDA_PANEINFO mesg; EDA_PANEINFO mesg;
mesg.MessageToolbarPane(); mesg.MessageToolbarPane();
m_auimgr.AddPane( m_HToolBar, m_auimgr.AddPane( m_mainToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().Row( 0 ) ); wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top().Row( 0 ) );
m_auimgr.AddPane( m_drawToolBar, m_auimgr.AddPane( m_drawToolBar,
wxAuiPaneInfo( vert ).Name( wxT( "m_VToolBar" ) ).Right() ); 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 ) void LIB_EDIT_FRAME::OnUpdateDeMorganNormal( wxUpdateUIEvent& event )
{ {
if( m_HToolBar == NULL ) if( m_mainToolBar == NULL )
return; return;
event.Enable( GetShowDeMorgan() || ( m_component && m_component->HasConversion() ) ); 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 ) void LIB_EDIT_FRAME::OnUpdateDeMorganConvert( wxUpdateUIEvent& event )
{ {
if( m_HToolBar == NULL ) if( m_mainToolBar == NULL )
return; return;
event.Enable( GetShowDeMorgan() || ( m_component && m_component->HasConversion() ) ); event.Enable( GetShowDeMorgan() || ( m_component && m_component->HasConversion() ) );
@ -674,7 +674,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_LIBEDIT_EDIT_PIN_BY_PIN: 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; break;
case ID_POPUP_LIBEDIT_END_CREATE_ITEM: case ID_POPUP_LIBEDIT_END_CREATE_ITEM:

View File

@ -86,15 +86,15 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event )
dlg.SetName( pin->GetName() ); dlg.SetName( pin->GetName() );
dlg.SetNameTextSize( ReturnStringFromValue( g_UserUnit, dlg.SetNameTextSize( ReturnStringFromValue( g_UserUnit,
pin->GetNameTextSize(), pin->GetNameTextSize(),
m_InternalUnits ) ); m_internalUnits ) );
dlg.SetNameTextSizeUnits( units ); dlg.SetNameTextSizeUnits( units );
dlg.SetPadName( pin->GetNumberString() ); dlg.SetPadName( pin->GetNumberString() );
dlg.SetPadNameTextSize( ReturnStringFromValue( g_UserUnit, dlg.SetPadNameTextSize( ReturnStringFromValue( g_UserUnit,
pin->GetNumberTextSize(), pin->GetNumberTextSize(),
m_InternalUnits ) ); m_internalUnits ) );
dlg.SetPadNameTextSizeUnits( units ); 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.SetLengthUnits( units );
dlg.SetAddToAllParts( pin->GetUnit() == 0 ); dlg.SetAddToAllParts( pin->GetUnit() == 0 );
dlg.SetAddToAllBodyStyles( pin->GetConvert() == 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. */ /* Save the pin properties to use for the next new pin. */
LastPinNameSize = ReturnValueFromString( g_UserUnit, dlg.GetNameTextSize(), m_InternalUnits ); LastPinNameSize = ReturnValueFromString( g_UserUnit, dlg.GetNameTextSize(), m_internalUnits );
LastPinNumSize = ReturnValueFromString( g_UserUnit, dlg.GetPadNameTextSize(), m_InternalUnits ); LastPinNumSize = ReturnValueFromString( g_UserUnit, dlg.GetPadNameTextSize(), m_internalUnits );
LastPinOrient = LIB_PIN::GetOrientationCode( dlg.GetOrientation() ); 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() ); LastPinShape = LIB_PIN::GetStyleCode( dlg.GetStyle() );
LastPinType = dlg.GetElectricalType(); LastPinType = dlg.GetElectricalType();
LastPinCommonConvert = dlg.GetAddToAllBodyStyles(); LastPinCommonConvert = dlg.GetAddToAllBodyStyles();

View File

@ -249,9 +249,9 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( wxWindow* father,
if( m_HToolBar ) if( m_mainToolBar )
m_auimgr.AddPane( m_HToolBar, m_auimgr.AddPane( m_mainToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().Row( 0 ) ); wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top().Row( 0 ) );
if( m_drawToolBar ) if( m_drawToolBar )
m_auimgr.AddPane( m_drawToolBar, wxAuiPaneInfo( vert ).Name( wxT( "m_drawToolBar" ) ).Right() ); m_auimgr.AddPane( m_drawToolBar, wxAuiPaneInfo( vert ).Name( wxT( "m_drawToolBar" ) ).Right() );

View File

@ -51,12 +51,12 @@ bool SCH_EDIT_FRAME::EditSheet( SCH_SHEET* aSheet, wxDC* aDC )
dlg.SetFileName( aSheet->GetFileName() ); dlg.SetFileName( aSheet->GetFileName() );
dlg.SetFileNameTextSize( ReturnStringFromValue( g_UserUnit, dlg.SetFileNameTextSize( ReturnStringFromValue( g_UserUnit,
aSheet->GetFileNameSize(), aSheet->GetFileNameSize(),
m_InternalUnits ) ); m_internalUnits ) );
dlg.SetFileNameTextSizeUnits( units ); dlg.SetFileNameTextSizeUnits( units );
dlg.SetSheetName( aSheet->GetName() ); dlg.SetSheetName( aSheet->GetName() );
dlg.SetSheetNameTextSize( ReturnStringFromValue( g_UserUnit, dlg.SetSheetNameTextSize( ReturnStringFromValue( g_UserUnit,
aSheet->GetSheetNameSize(), aSheet->GetSheetNameSize(),
m_InternalUnits ) ); m_internalUnits ) );
dlg.SetSheetNameTextSizeUnits( units ); dlg.SetSheetNameTextSizeUnits( units );
/* This ugly hack fixes a bug in wxWidgets 2.8.7 and likely earlier /* 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, aSheet->SetFileNameSize( ReturnValueFromString( g_UserUnit,
dlg.GetFileNameTextSize(), dlg.GetFileNameTextSize(),
m_InternalUnits ) ); m_internalUnits ) );
aSheet->SetName( dlg.GetSheetName() ); aSheet->SetName( dlg.GetSheetName() );
aSheet->SetSheetNameSize( ReturnValueFromString( g_UserUnit, aSheet->SetSheetNameSize( ReturnValueFromString( g_UserUnit,
dlg.GetSheetNameTextSize(), dlg.GetSheetNameTextSize(),
m_InternalUnits ) ); m_internalUnits ) );
if( aSheet->GetName().IsEmpty() ) if( aSheet->GetName().IsEmpty() )
aSheet->SetName( wxString::Format( wxT( "Sheet%8.8lX" ), aSheet->GetTimeStamp() ) ); aSheet->SetName( wxString::Format( wxT( "Sheet%8.8lX" ), aSheet->GetTimeStamp() ) );

View File

@ -56,9 +56,9 @@ int SCH_EDIT_FRAME::EditSheetPin( SCH_SHEET_PIN* aSheetPin, wxDC* aDC )
DIALOG_SCH_EDIT_SHEET_PIN dlg( this ); DIALOG_SCH_EDIT_SHEET_PIN dlg( this );
dlg.SetLabelName( aSheetPin->m_Text ); 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.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.SetTextWidthUnits( GetUnitsLabel( g_UserUnit ) );
dlg.SetConnectionType( aSheetPin->GetShape() ); 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_Text = dlg.GetLabelName();
aSheetPin->m_Size.y = ReturnValueFromString( g_UserUnit, dlg.GetTextHeight(), 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->m_Size.x = ReturnValueFromString( g_UserUnit, dlg.GetTextWidth(), m_internalUnits );
aSheetPin->SetShape( dlg.GetConnectionType() ); aSheetPin->SetShape( dlg.GetConnectionType() );
if( aDC ) if( aDC )

View File

@ -42,7 +42,7 @@ void LIB_EDIT_FRAME::EditGraphicSymbol( wxDC* DC, LIB_ITEM* DrawItem )
dialog.SetWidthUnits( ReturnUnitSymbol( g_UserUnit ) ); 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.SetWidth( val );
dialog.SetApplyToAllUnits( !m_drawSpecificUnit ); dialog.SetApplyToAllUnits( !m_drawSpecificUnit );
dialog.EnableApplyToAllUnits( component && component->GetPartCount() > 1 ); dialog.EnableApplyToAllUnits( component && component->GetPartCount() > 1 );
@ -56,7 +56,7 @@ void LIB_EDIT_FRAME::EditGraphicSymbol( wxDC* DC, LIB_ITEM* DrawItem )
return; return;
val = dialog.GetWidth(); val = dialog.GetWidth();
m_drawLineWidth = ReturnValueFromString( g_UserUnit, val, m_InternalUnits ); m_drawLineWidth = ReturnValueFromString( g_UserUnit, val, m_internalUnits );
m_drawSpecificConvert = !dialog.GetApplyToAllConversions(); m_drawSpecificConvert = !dialog.GetApplyToAllConversions();
m_drawSpecificUnit = !dialog.GetApplyToAllUnits(); m_drawSpecificUnit = !dialog.GetApplyToAllUnits();

View File

@ -55,7 +55,8 @@ void LIB_EDIT_FRAME::ReCreateVToolbar()
if( m_drawToolBar != NULL ) if( m_drawToolBar != NULL )
return; 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 // Set up toolbar
m_drawToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, KiBitmap( cursor_xpm ), m_drawToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, KiBitmap( cursor_xpm ),
@ -100,111 +101,114 @@ void LIB_EDIT_FRAME::ReCreateHToolbar()
wxString msg; wxString msg;
// Create the toolbar if not exists // Create the toolbar if not exists
if( m_HToolBar != NULL ) if( m_mainToolBar != NULL )
return; 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 // Set up toolbar
m_HToolBar->AddTool( ID_LIBEDIT_SAVE_CURRENT_LIB, wxEmptyString, KiBitmap( save_library_xpm ), m_mainToolBar->AddTool( ID_LIBEDIT_SAVE_CURRENT_LIB, wxEmptyString,
_( "Save current library to disk" ) ); KiBitmap( save_library_xpm ),
_( "Save current library to disk" ) );
m_HToolBar->AddTool( ID_LIBEDIT_SELECT_CURRENT_LIB, wxEmptyString, KiBitmap( library_xpm ), m_mainToolBar->AddTool( ID_LIBEDIT_SELECT_CURRENT_LIB, wxEmptyString, KiBitmap( library_xpm ),
_( "Select working library" ) ); _( "Select working library" ) );
m_HToolBar->AddTool( ID_LIBEDIT_DELETE_PART, wxEmptyString, KiBitmap( delete_xpm ), m_mainToolBar->AddTool( ID_LIBEDIT_DELETE_PART, wxEmptyString, KiBitmap( delete_xpm ),
_( "Delete component in current library" ) ); _( "Delete component in current library" ) );
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_HToolBar->AddTool( ID_LIBEDIT_NEW_PART, wxEmptyString, KiBitmap( new_component_xpm ), m_mainToolBar->AddTool( ID_LIBEDIT_NEW_PART, wxEmptyString, KiBitmap( new_component_xpm ),
_( "Create a new component" ) ); _( "Create a new component" ) );
m_HToolBar->AddTool( ID_LIBEDIT_SELECT_PART, wxEmptyString, m_mainToolBar->AddTool( ID_LIBEDIT_SELECT_PART, wxEmptyString,
KiBitmap( import_cmp_from_lib_xpm ), KiBitmap( import_cmp_from_lib_xpm ),
_( "Load component to edit from the current library" ) ); _( "Load component to edit from the current library" ) );
m_HToolBar->AddTool( ID_LIBEDIT_NEW_PART_FROM_EXISTING, wxEmptyString, m_mainToolBar->AddTool( ID_LIBEDIT_NEW_PART_FROM_EXISTING, wxEmptyString,
KiBitmap( copycomponent_xpm ), KiBitmap( copycomponent_xpm ),
_( "Create a new component from the current one" ) ); _( "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 ), 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 ), m_mainToolBar->AddTool( ImportPartId, wxEmptyString, KiBitmap( import_xpm ),
_( "Import component" ) ); _( "Import component" ) );
m_HToolBar->AddTool( ExportPartId, wxEmptyString, KiBitmap( export_xpm ), m_mainToolBar->AddTool( ExportPartId, wxEmptyString, KiBitmap( export_xpm ),
_( "Export component" ) ); _( "Export component" ) );
m_HToolBar->AddTool( CreateNewLibAndSavePartId, wxEmptyString, KiBitmap( new_library_xpm ), m_mainToolBar->AddTool( CreateNewLibAndSavePartId, wxEmptyString, KiBitmap( new_library_xpm ),
_( "Save current component to new library" ) ); _( "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 ); 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, msg = AddHotkeyName( _( "Redo the last command" ), s_Schematic_Hokeys_Descr, HK_REDO,
IS_COMMENT ); 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();
m_HToolBar->AddTool( ID_LIBEDIT_GET_FRAME_EDIT_PART, wxEmptyString, m_mainToolBar->AddTool( ID_LIBEDIT_GET_FRAME_EDIT_PART, wxEmptyString,
KiBitmap( part_properties_xpm ), _( "Edit component properties" ) ); KiBitmap( part_properties_xpm ), _( "Edit component properties" ) );
m_HToolBar->AddTool( ID_LIBEDIT_GET_FRAME_EDIT_FIELDS, wxEmptyString, KiBitmap( add_text_xpm ), m_mainToolBar->AddTool( ID_LIBEDIT_GET_FRAME_EDIT_FIELDS, wxEmptyString,
_( "Add and remove fields and edit field properties" ) ); KiBitmap( add_text_xpm ),
_( "Add and remove fields and edit field properties" ) );
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_HToolBar->AddTool( ID_LIBEDIT_CHECK_PART, wxEmptyString, KiBitmap( erc_xpm ), m_mainToolBar->AddTool( ID_LIBEDIT_CHECK_PART, wxEmptyString, KiBitmap( erc_xpm ),
_( "Test for duplicate and off grid pins" ) ); _( "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 ); 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 ); 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 ); 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 ); 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_mainToolBar->AddSeparator();
m_HToolBar->AddTool( ID_DE_MORGAN_NORMAL_BUTT, wxEmptyString, KiBitmap( morgan1_xpm ), m_mainToolBar->AddTool( ID_DE_MORGAN_NORMAL_BUTT, wxEmptyString, KiBitmap( morgan1_xpm ),
_( "Show as \"De Morgan\" normal part" ), wxITEM_CHECK ); _( "Show as \"De Morgan\" normal part" ), wxITEM_CHECK );
m_HToolBar->AddTool( ID_DE_MORGAN_CONVERT_BUTT, wxEmptyString, KiBitmap( morgan2_xpm ), m_mainToolBar->AddTool( ID_DE_MORGAN_CONVERT_BUTT, wxEmptyString, KiBitmap( morgan2_xpm ),
_( "Show as \"De Morgan\" convert part" ), wxITEM_CHECK ); _( "Show as \"De Morgan\" convert part" ), wxITEM_CHECK );
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_HToolBar->AddTool( ID_LIBEDIT_VIEW_DOC, wxEmptyString, KiBitmap( datasheet_xpm ), m_mainToolBar->AddTool( ID_LIBEDIT_VIEW_DOC, wxEmptyString, KiBitmap( datasheet_xpm ),
_( "Edit document file" ) ); _( "Edit document file" ) );
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_partSelectBox = new wxComboBox( m_HToolBar, m_partSelectBox = new wxComboBox( m_mainToolBar,
ID_LIBEDIT_SELECT_PART_NUMBER, ID_LIBEDIT_SELECT_PART_NUMBER,
wxEmptyString, wxEmptyString,
wxDefaultPosition, wxDefaultPosition,
wxSize( LISTBOX_WIDTH, -1 ), wxSize( LISTBOX_WIDTH, -1 ),
0, NULL, wxCB_READONLY ); 0, 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, ID_LIBEDIT_SELECT_ALIAS,
wxEmptyString, wxEmptyString,
wxDefaultPosition, wxDefaultPosition,
wxSize( LISTBOX_WIDTH, -1 ), wxSize( LISTBOX_WIDTH, -1 ),
0, NULL, wxCB_READONLY ); 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!)" ); msg = _( "Edit pins per part or body style (Use carefully!)" );
m_HToolBar->AddTool( ID_LIBEDIT_EDIT_PIN_BY_PIN, wxEmptyString, KiBitmap( pin2pin_xpm ), m_mainToolBar->AddTool( ID_LIBEDIT_EDIT_PIN_BY_PIN, wxEmptyString, KiBitmap( pin2pin_xpm ),
msg, wxITEM_CHECK ); msg, wxITEM_CHECK );
// after adding the buttons to the toolbar, must call Realize() to reflect the changes // after adding the buttons to the toolbar, must call Realize() to reflect the changes
m_HToolBar->Realize(); m_mainToolBar->Realize();
} }
@ -213,7 +217,8 @@ void LIB_EDIT_FRAME::CreateOptionToolbar()
if( m_optionsToolBar ) if( m_optionsToolBar )
return; 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 ), m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString, KiBitmap( grid_xpm ),
_( "Turn grid off" ), wxITEM_CHECK ); _( "Turn grid off" ), wxITEM_CHECK );

View File

@ -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 <stambaughw@verizon.net>
* 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 * @file tool_sch.cpp
*/ */
@ -17,138 +42,140 @@
*/ */
void SCH_EDIT_FRAME::ReCreateHToolbar() void SCH_EDIT_FRAME::ReCreateHToolbar()
{ {
if( m_HToolBar != NULL ) if( m_mainToolBar != NULL )
return; return;
wxString msg; 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 // Set up toolbar
m_HToolBar->AddTool( ID_NEW_PROJECT, wxEmptyString, KiBitmap( new_xpm ), m_mainToolBar->AddTool( ID_NEW_PROJECT, wxEmptyString, KiBitmap( new_xpm ),
_( "New schematic project" ) ); _( "New schematic project" ) );
m_HToolBar->AddTool( ID_LOAD_PROJECT, wxEmptyString, KiBitmap( open_document_xpm ), m_mainToolBar->AddTool( ID_LOAD_PROJECT, wxEmptyString, KiBitmap( open_document_xpm ),
_( "Open schematic project" ) ); _( "Open schematic project" ) );
m_HToolBar->AddTool( ID_SAVE_PROJECT, wxEmptyString, KiBitmap( save_project_xpm ), m_mainToolBar->AddTool( ID_SAVE_PROJECT, wxEmptyString, KiBitmap( save_project_xpm ),
_( "Save schematic project" ) ); _( "Save schematic project" ) );
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_HToolBar->AddTool( ID_SHEET_SET, wxEmptyString, KiBitmap( sheetset_xpm ), m_mainToolBar->AddTool( ID_SHEET_SET, wxEmptyString, KiBitmap( sheetset_xpm ),
_( "Page settings" ) ); _( "Page settings" ) );
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_HToolBar->AddTool( wxID_PRINT, wxEmptyString, KiBitmap( print_button_xpm ), m_mainToolBar->AddTool( wxID_PRINT, wxEmptyString, KiBitmap( print_button_xpm ),
_( "Print schematic" ) ); _( "Print schematic" ) );
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_HToolBar->AddTool( wxID_CUT, wxEmptyString, KiBitmap( cut_button_xpm ), m_mainToolBar->AddTool( wxID_CUT, wxEmptyString, KiBitmap( cut_button_xpm ),
_( "Cut selected item" ) ); _( "Cut selected item" ) );
m_HToolBar->AddTool( wxID_COPY, wxEmptyString, KiBitmap( copy_button_xpm ), m_mainToolBar->AddTool( wxID_COPY, wxEmptyString, KiBitmap( copy_button_xpm ),
_( "Copy selected item" ) ); _( "Copy selected item" ) );
m_HToolBar->AddTool( wxID_PASTE, wxEmptyString, KiBitmap( paste_xpm ), m_mainToolBar->AddTool( wxID_PASTE, wxEmptyString, KiBitmap( paste_xpm ),
_( "Paste" ) ); _( "Paste" ) );
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
msg = AddHotkeyName( HELP_UNDO, s_Schematic_Hokeys_Descr, HK_UNDO, IS_COMMENT ); 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 ); 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 ); 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 ), m_mainToolBar->AddTool( wxID_REPLACE, wxEmptyString, KiBitmap( find_replace_xpm ),
wxNullBitmap, wxITEM_NORMAL, _( "Find and replace text" ), wxNullBitmap, wxITEM_NORMAL, _( "Find and replace text" ),
HELP_REPLACE, NULL ); HELP_REPLACE, NULL );
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
msg = AddHotkeyName( HELP_ZOOM_IN, s_Schematic_Hokeys_Descr, HK_ZOOM_IN, IS_COMMENT ); 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 ); 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 ); 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 ); 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 ), m_mainToolBar->AddTool( ID_HIERARCHY, wxEmptyString, KiBitmap( hierarchy_nav_xpm ),
_( "Navigate schematic hierarchy" ) ); _( "Navigate schematic hierarchy" ) );
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_HToolBar->AddTool( ID_TO_LIBRARY, wxEmptyString, KiBitmap( libedit_xpm ), m_mainToolBar->AddTool( ID_TO_LIBRARY, wxEmptyString, KiBitmap( libedit_xpm ),
_( "Library editor - Create and edit components" ) ); _( "Library editor - Create and edit components" ) );
m_HToolBar->AddTool( ID_TO_LIBVIEW, wxEmptyString, KiBitmap( library_browse_xpm ), m_mainToolBar->AddTool( ID_TO_LIBVIEW, wxEmptyString, KiBitmap( library_browse_xpm ),
_( "Library browser - Browse components" ) ); _( "Library browser - Browse components" ) );
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_HToolBar->AddTool( ID_GET_ANNOTATE, wxEmptyString, KiBitmap( annotate_xpm ), m_mainToolBar->AddTool( ID_GET_ANNOTATE, wxEmptyString, KiBitmap( annotate_xpm ),
_( "Annotate schematic" ) ); _( "Annotate schematic" ) );
m_HToolBar->AddTool( ID_GET_ERC, wxEmptyString, KiBitmap( erc_xpm ), m_mainToolBar->AddTool( ID_GET_ERC, wxEmptyString, KiBitmap( erc_xpm ),
_( "Perform electric rules check" ) ); _( "Perform electric rules check" ) );
m_HToolBar->AddTool( ID_GET_NETLIST, wxEmptyString, KiBitmap( netlist_xpm ), m_mainToolBar->AddTool( ID_GET_NETLIST, wxEmptyString, KiBitmap( netlist_xpm ),
_( "Generate netlist" ) ); _( "Generate netlist" ) );
m_HToolBar->AddTool( ID_GET_TOOLS, wxEmptyString, KiBitmap( bom_xpm ), m_mainToolBar->AddTool( ID_GET_TOOLS, wxEmptyString, KiBitmap( bom_xpm ),
_( "Generate bill of materials and/or cross references" ) ); _( "Generate bill of materials and/or cross references" ) );
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_HToolBar->AddTool( ID_TO_CVPCB, wxEmptyString, KiBitmap( cvpcb_xpm ), m_mainToolBar->AddTool( ID_TO_CVPCB, wxEmptyString, KiBitmap( cvpcb_xpm ),
_( "Run CvPcb to associate components and footprints" ) ); _( "Run CvPcb to associate components and footprints" ) );
m_HToolBar->AddTool( ID_TO_PCB, wxEmptyString, KiBitmap( pcbnew_xpm ), m_mainToolBar->AddTool( ID_TO_PCB, wxEmptyString, KiBitmap( pcbnew_xpm ),
_( "Run Pcbnew to layout printed circuit board" ) ); _( "Run Pcbnew to layout printed circuit board" ) );
m_HToolBar->AddTool( ID_BACKANNO_ITEMS, wxEmptyString, KiBitmap( import_footprint_names_xpm ), m_mainToolBar->AddTool( ID_BACKANNO_ITEMS, wxEmptyString,
_( "Back annotate component foot prints" ) ); KiBitmap( import_footprint_names_xpm ),
_( "Back annotate component foot prints" ) );
// set icon paddings // set icon paddings
m_HToolBar->SetToolBorderPadding(3); // padding m_mainToolBar->SetToolBorderPadding(3); // padding
m_HToolBar->SetToolSeparation(0); m_mainToolBar->SetToolSeparation(0);
//m_HToolBar->SetMargins(0,1); // margins width and height //m_mainToolBar->SetMargins(0,1); // margins width and height
// after adding the tools to the toolbar, must call Realize() to reflect the changes // after adding the tools to the toolbar, must call Realize() to reflect the changes
m_HToolBar->Realize(); m_mainToolBar->Realize();
} }
@ -159,7 +186,8 @@ void SCH_EDIT_FRAME::ReCreateVToolbar()
if( m_drawToolBar ) if( m_drawToolBar )
return; 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 // Set up toolbar
m_drawToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, KiBitmap( cursor_xpm ), m_drawToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, KiBitmap( cursor_xpm ),
@ -245,7 +273,8 @@ void SCH_EDIT_FRAME::ReCreateOptToolbar()
if( m_optionsToolBar ) if( m_optionsToolBar )
return; 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, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString,
KiBitmap( grid_xpm ), KiBitmap( grid_xpm ),
@ -292,12 +321,12 @@ void SCH_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
switch( id ) switch( id )
{ {
case ID_TB_OPTIONS_HIDDEN_PINS: case ID_TB_OPTIONS_HIDDEN_PINS:
m_showAllPins = m_optionsToolBar->GetToolState( id ); m_showAllPins = m_optionsToolBar->GetToolToggled( id );
DrawPanel->Refresh( ); DrawPanel->Refresh( );
break; break;
case ID_TB_OPTIONS_BUS_WIRES_ORIENT: case ID_TB_OPTIONS_BUS_WIRES_ORIENT:
g_HVLines = m_optionsToolBar->GetToolState( id ); g_HVLines = m_optionsToolBar->GetToolToggled( id );
break; break;
default: default:

View File

@ -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 <stambaughw@verizon.net>
* 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 "fctsys.h"
#include "macros.h" #include "macros.h"
@ -23,85 +49,86 @@ void LIB_VIEW_FRAME::ReCreateHToolbar()
LIB_ALIAS* entry = NULL; LIB_ALIAS* entry = NULL;
bool asdeMorgan = false; 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 // Set up toolbar
m_HToolBar->AddTool( ID_LIBVIEW_SELECT_LIB, wxEmptyString, m_mainToolBar->AddTool( ID_LIBVIEW_SELECT_LIB, wxEmptyString,
KiBitmap( library_xpm ), KiBitmap( library_xpm ),
_( "Select library to browse" ) ); _( "Select library to browse" ) );
m_HToolBar->AddTool( ID_LIBVIEW_SELECT_PART, wxEmptyString, m_mainToolBar->AddTool( ID_LIBVIEW_SELECT_PART, wxEmptyString,
KiBitmap( add_component_xpm ), KiBitmap( add_component_xpm ),
_( "Select part to browse" ) ); _( "Select part to browse" ) );
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_HToolBar->AddTool( ID_LIBVIEW_PREVIOUS, wxEmptyString, m_mainToolBar->AddTool( ID_LIBVIEW_PREVIOUS, wxEmptyString,
KiBitmap( lib_previous_xpm ), KiBitmap( lib_previous_xpm ),
_( "Display previous part" ) ); _( "Display previous part" ) );
m_HToolBar->AddTool( ID_LIBVIEW_NEXT, wxEmptyString, m_mainToolBar->AddTool( ID_LIBVIEW_NEXT, wxEmptyString,
KiBitmap( lib_next_xpm ), KiBitmap( lib_next_xpm ),
_( "Display next part" ) ); _( "Display next part" ) );
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
msg = AddHotkeyName( _( "Zoom in" ), s_Viewlib_Hokeys_Descr, msg = AddHotkeyName( _( "Zoom in" ), s_Viewlib_Hokeys_Descr,
HK_ZOOM_IN, IS_COMMENT ); HK_ZOOM_IN, IS_COMMENT );
m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, m_mainToolBar->AddTool( ID_ZOOM_IN, wxEmptyString,
KiBitmap( zoom_in_xpm ), msg ); KiBitmap( zoom_in_xpm ), msg );
msg = AddHotkeyName( _( "Zoom out" ), s_Viewlib_Hokeys_Descr, msg = AddHotkeyName( _( "Zoom out" ), s_Viewlib_Hokeys_Descr,
HK_ZOOM_OUT, IS_COMMENT ); HK_ZOOM_OUT, IS_COMMENT );
m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString, m_mainToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString,
KiBitmap( zoom_out_xpm ), msg ); KiBitmap( zoom_out_xpm ), msg );
msg = AddHotkeyName( _( "Redraw view" ), s_Viewlib_Hokeys_Descr, msg = AddHotkeyName( _( "Redraw view" ), s_Viewlib_Hokeys_Descr,
HK_ZOOM_REDRAW, IS_COMMENT ); HK_ZOOM_REDRAW, IS_COMMENT );
m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, m_mainToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
KiBitmap( zoom_redraw_xpm ), msg ); KiBitmap( zoom_redraw_xpm ), msg );
msg = AddHotkeyName( _( "Zoom auto" ), s_Viewlib_Hokeys_Descr, msg = AddHotkeyName( _( "Zoom auto" ), s_Viewlib_Hokeys_Descr,
HK_ZOOM_AUTO, IS_COMMENT ); HK_ZOOM_AUTO, IS_COMMENT );
m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString, m_mainToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
KiBitmap( zoom_fit_in_page_xpm ), msg ); KiBitmap( zoom_fit_in_page_xpm ), msg );
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_HToolBar->AddTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, wxEmptyString, m_mainToolBar->AddTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, wxEmptyString,
KiBitmap( morgan1_xpm ), KiBitmap( morgan1_xpm ),
_( "Show as \"De Morgan\" normal part" ), _( "Show as \"De Morgan\" normal part" ),
wxITEM_CHECK ); wxITEM_CHECK );
m_HToolBar->AddTool( ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, wxEmptyString, m_mainToolBar->AddTool( ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, wxEmptyString,
KiBitmap( morgan2_xpm ), KiBitmap( morgan2_xpm ),
_( "Show as \"De Morgan\" convert part" ), _( "Show as \"De Morgan\" convert part" ),
wxITEM_CHECK ); 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, wxEmptyString, wxDefaultPosition,
wxSize( 150, -1 ), 0, NULL, wxCB_READONLY ); wxSize( 150, -1 ), 0, NULL, wxCB_READONLY );
m_HToolBar->AddControl( SelpartBox ); m_mainToolBar->AddControl( SelpartBox );
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_HToolBar->AddTool( ID_LIBVIEW_VIEWDOC, wxEmptyString, m_mainToolBar->AddTool( ID_LIBVIEW_VIEWDOC, wxEmptyString,
KiBitmap( datasheet_xpm ), KiBitmap( datasheet_xpm ),
_( "View component documents" ) ); _( "View component documents" ) );
m_HToolBar->EnableTool( ID_LIBVIEW_VIEWDOC, false ); m_mainToolBar->EnableTool( ID_LIBVIEW_VIEWDOC, false );
if( m_Semaphore ) if( m_Semaphore )
{ {
// The library browser is called from a "load component" command // The library browser is called from a "load component" command
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_HToolBar->AddTool( ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC, m_mainToolBar->AddTool( ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC,
wxEmptyString, KiBitmap( export_xpm ), wxEmptyString, KiBitmap( export_xpm ),
_( "Insert component in schematic" ) ); _( "Insert component in schematic" ) );
} }
// after adding the buttons to the toolbar, must call Realize() to // after adding the buttons to the toolbar, must call Realize() to
// reflect the changes // reflect the changes
m_HToolBar->Realize(); m_mainToolBar->Realize();
} }
if( (m_libraryName != wxEmptyString) && (m_entryName != wxEmptyString) ) if( (m_libraryName != wxEmptyString) && (m_entryName != wxEmptyString) )
@ -120,25 +147,29 @@ void LIB_VIEW_FRAME::ReCreateHToolbar()
} }
// Must be AFTER Realize(): // Must be AFTER Realize():
m_HToolBar->EnableTool( ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT, asdeMorgan ); m_mainToolBar->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_NORMAL_BUTT, asdeMorgan );
if( asdeMorgan ) if( asdeMorgan )
{ {
bool normal = m_convert <= 1; bool normal = m_convert <= 1;
m_HToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT,normal ); m_mainToolBar->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_CONVERT_BUTT, !normal );
} }
else else
{ {
m_HToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, true ); m_mainToolBar->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_CONVERT_BUTT, false );
} }
int parts_count = 1; int parts_count = 1;
if( component ) if( component )
parts_count = MAX( component->GetPartCount(), 1 ); parts_count = MAX( component->GetPartCount(), 1 );
SelpartBox->Clear(); SelpartBox->Clear();
for( ii = 0; ii < parts_count; ii++ ) for( ii = 0; ii < parts_count; ii++ )
{ {
wxString msg; wxString msg;
@ -149,10 +180,10 @@ void LIB_VIEW_FRAME::ReCreateHToolbar()
SelpartBox->SetSelection( (m_unit > 0 ) ? m_unit - 1 : 0 ); SelpartBox->SetSelection( (m_unit > 0 ) ? m_unit - 1 : 0 );
SelpartBox->Enable( parts_count > 1 ); SelpartBox->Enable( parts_count > 1 );
m_HToolBar->EnableTool( ID_LIBVIEW_VIEWDOC, m_mainToolBar->EnableTool( ID_LIBVIEW_VIEWDOC,
entry && ( entry->GetDocFileName() != wxEmptyString ) ); entry && ( entry->GetDocFileName() != wxEmptyString ) );
m_HToolBar->Refresh(); m_mainToolBar->Refresh();
} }

View File

@ -211,8 +211,8 @@ LIB_VIEW_FRAME::LIB_VIEW_FRAME( wxWindow* father, CMP_LIBRARY* Library, wxSemaph
// Manage main toolbal // Manage main toolbal
m_auimgr.AddPane( m_HToolBar, m_auimgr.AddPane( m_mainToolBar,
wxAuiPaneInfo( horiz ).Name( wxT ("m_HToolBar" ) ).Top().Row( 0 ) ); wxAuiPaneInfo( horiz ).Name( wxT ("m_mainToolBar" ) ).Top().Row( 0 ) );
wxSize minsize( 60, -1 ); wxSize minsize( 60, -1 );

View File

@ -56,15 +56,15 @@ void LIB_VIEW_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
case ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT: case ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT:
m_HToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, true ); m_mainToolBar->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_CONVERT_BUTT, FALSE );
m_convert = 1; m_convert = 1;
DrawPanel->Refresh(); DrawPanel->Refresh();
break; break;
case ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT: case ID_LIBVIEW_DE_MORGAN_CONVERT_BUTT:
m_HToolBar->ToggleTool( ID_LIBVIEW_DE_MORGAN_NORMAL_BUTT, FALSE ); m_mainToolBar->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_CONVERT_BUTT, true );
m_convert = 2; m_convert = 2;
DrawPanel->Refresh(); DrawPanel->Refresh();
break; break;

View File

@ -14,7 +14,7 @@
/* Helper class for displaying DCodes list */ /* 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 wxPoint& aLocation, const wxSize& aSize,
const wxArrayString& aChoices ) : const wxArrayString& aChoices ) :
wxComboBox( aParent, aId, wxEmptyString, aLocation, aSize, 0, NULL, wxCB_READONLY ) wxComboBox( aParent, aId, wxEmptyString, aLocation, aSize, 0, NULL, wxCB_READONLY )

View File

@ -14,7 +14,7 @@ class DCODE_SELECTION_BOX : public wxComboBox
private: private:
const wxArrayString* m_dcodeList; 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 wxPoint& aLocation, const wxSize& aSize,
const wxArrayString& aChoices); const wxArrayString& aChoices);
~DCODE_SELECTION_BOX(); ~DCODE_SELECTION_BOX();

View File

@ -128,9 +128,9 @@ GERBVIEW_FRAME::GERBVIEW_FRAME( wxWindow* father,
lyrs.Caption( _( "Visibles" ) ); lyrs.Caption( _( "Visibles" ) );
if( m_HToolBar ) if( m_mainToolBar )
m_auimgr.AddPane( m_HToolBar, m_auimgr.AddPane( m_mainToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().Row( 0 ) ); wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top().Row( 0 ) );
if( m_drawToolBar ) if( m_drawToolBar )
m_auimgr.AddPane( m_drawToolBar, m_auimgr.AddPane( m_drawToolBar,

View File

@ -28,7 +28,7 @@ void GERBVIEW_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
break; break;
default: default:
state = m_optionsToolBar->GetToolState( id ); state = m_optionsToolBar->GetToolToggled( id );
break; break;
} }

View File

@ -46,45 +46,46 @@ void GERBVIEW_FRAME::ReCreateHToolbar( void )
int ii; int ii;
wxString msg; wxString msg;
if( m_HToolBar != NULL ) if( m_mainToolBar != NULL )
return; 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 // Set up toolbar
m_HToolBar->AddTool( ID_GERBVIEW_ERASE_ALL, wxEmptyString, m_mainToolBar->AddTool( ID_GERBVIEW_ERASE_ALL, wxEmptyString,
KiBitmap( gerbview_clear_layers_xpm ), KiBitmap( gerbview_clear_layers_xpm ),
_( "Erase all layers" ) ); _( "Erase all layers" ) );
m_HToolBar->AddTool( wxID_FILE, wxEmptyString, KiBitmap( gerber_file_xpm ), m_mainToolBar->AddTool( wxID_FILE, wxEmptyString, KiBitmap( gerber_file_xpm ),
_( "Load a new Gerber file on the current layer. Previous data will be deleted" ) ); _( "Load a new Gerber file on the current layer. Previous data will be deleted" ) );
m_HToolBar->AddTool( ID_GERBVIEW_LOAD_DRILL_FILE, wxEmptyString, m_mainToolBar->AddTool( ID_GERBVIEW_LOAD_DRILL_FILE, wxEmptyString,
KiBitmap( gerbview_drill_file_xpm ), KiBitmap( gerbview_drill_file_xpm ),
_( "Load an excellon drill file on the current layer. Previous data will be deleted" ) ); _( "Load an excellon drill file on the current layer. Previous data will be deleted" ) );
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_HToolBar->AddTool( ID_GERBVIEW_SET_PAGE_BORDER, wxEmptyString, KiBitmap( sheetset_xpm ), m_mainToolBar->AddTool( ID_GERBVIEW_SET_PAGE_BORDER, wxEmptyString, KiBitmap( sheetset_xpm ),
_( "Show/hide frame reference and select paper size for printing" ) ); _( "Show/hide frame reference and select paper size for printing" ) );
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_HToolBar->AddTool( wxID_PRINT, wxEmptyString, KiBitmap( print_button_xpm ), m_mainToolBar->AddTool( wxID_PRINT, wxEmptyString, KiBitmap( print_button_xpm ),
_( "Print layers" ) ); _( "Print layers" ) );
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
msg = AddHotkeyName( _( "Zoom in" ), s_Gerbview_Hokeys_Descr, HK_ZOOM_IN, IS_COMMENT ); 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 ); 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 ); 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 ); 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; wxArrayString choices;
@ -94,11 +95,11 @@ void GERBVIEW_FRAME::ReCreateHToolbar( void )
choices.Add( msg ); 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 ); 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.Alloc(TOOLS_MAX_COUNT+1);
m_DCodesList.Add( _( "No tool" ) ); m_DCodesList.Add( _( "No tool" ) );
@ -110,17 +111,18 @@ void GERBVIEW_FRAME::ReCreateHToolbar( void )
m_DCodesList.Add( msg ); 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 ), wxDefaultPosition, wxSize( 150, -1 ),
m_DCodesList ); 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 ); 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 // 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 ) if( m_drawToolBar )
return; 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 // Set up toolbar
m_drawToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, KiBitmap( cursor_xpm ) ); m_drawToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, KiBitmap( cursor_xpm ) );
@ -145,7 +148,8 @@ void GERBVIEW_FRAME::ReCreateOptToolbar( void )
return; return;
// creation of tool bar options // 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 ), m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString, KiBitmap( grid_xpm ),
_( "Turn grid off" ), wxITEM_CHECK ); _( "Turn grid off" ), wxITEM_CHECK );

View File

@ -5,7 +5,7 @@
#include <wx/bmpcbox.h> #include <wx/bmpcbox.h>
class EDA_TOOLBAR; class wxAuiToolBar;
/* class to display a layer list. /* class to display a layer list.
@ -18,12 +18,12 @@ private:
bool m_layerhotkeys; bool m_layerhotkeys;
bool m_layerorder; bool m_layerorder;
public: public:
LAYER_BOX_SELECTOR( EDA_TOOLBAR* parent, wxWindowID id, LAYER_BOX_SELECTOR( wxAuiToolBar* parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = NULL ); 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 wxPoint& pos, const wxSize& size,
const wxArrayString& choices ); const wxArrayString& choices );

View File

@ -86,7 +86,10 @@ protected:
/// Auxiliary tool bar typically shown below the main tool bar at the top of the /// Auxiliary tool bar typically shown below the main tool bar at the top of the
/// main window. /// 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 updateGridSelectBox();
void updateZoomSelectBox(); void updateZoomSelectBox();
@ -99,6 +102,8 @@ public:
~PCB_BASE_FRAME(); ~PCB_BASE_FRAME();
bool GetPrintBorderAndTitleBlock() const { return m_printBorderAndTitleBlock; }
/** /**
* Function GetBoardBoundingBox * Function GetBoardBoundingBox
* calculates the bounding box containing all board items (or board edge segments). * calculates the bounding box containing all board items (or board edge segments).

View File

@ -82,8 +82,12 @@ class PCB_EDIT_FRAME : public PCB_BASE_FRAME
int m_RecordingMacros; int m_RecordingMacros;
MACROS_RECORDED m_Macros[10]; 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. /// The auxiliary right vertical tool bar used to access the microwave tools.
EDA_TOOLBAR* m_microWaveToolBar; wxAuiToolBar* m_microWaveToolBar;
protected: protected:
@ -236,6 +240,8 @@ public:
void OnUpdateZoneDisplayStyle( wxUpdateUIEvent& aEvent ); void OnUpdateZoneDisplayStyle( wxUpdateUIEvent& aEvent );
void OnUpdateSelectTrackWidth( wxUpdateUIEvent& aEvent ); void OnUpdateSelectTrackWidth( wxUpdateUIEvent& aEvent );
void OnUpdateSelectAutoTrackWidth( wxUpdateUIEvent& aEvent ); void OnUpdateSelectAutoTrackWidth( wxUpdateUIEvent& aEvent );
void OnUpdateAutoPlaceModulesMode( wxUpdateUIEvent& aEvent );
void OnUpdateAutoPlaceTracksMode( wxUpdateUIEvent& aEvent );
/** /**
* Function RecordMacros. * Function RecordMacros.
@ -474,7 +480,7 @@ public:
void ReCreateMicrowaveVToolbar(); void ReCreateMicrowaveVToolbar();
void ReCreateOptToolbar(); void ReCreateOptToolbar();
void ReCreateMenuBar(); void ReCreateMenuBar();
LAYER_BOX_SELECTOR* ReCreateLayerBox( EDA_TOOLBAR* parent ); LAYER_BOX_SELECTOR* ReCreateLayerBox( wxAuiToolBar* parent );
/** /**
* Function OnModify * Function OnModify
@ -1321,6 +1327,8 @@ public:
// Autoplacement: // Autoplacement:
void AutoPlace( wxCommandEvent& event ); void AutoPlace( wxCommandEvent& event );
void OnSelectAutoPlaceMode( wxCommandEvent& aEvent );
/** /**
* Function OnOrientFootprints * Function OnOrientFootprints
* install the dialog box for the common Orient Footprints * install the dialog box for the common Orient Footprints

View File

@ -71,7 +71,6 @@ class EDA_RECT;
class EDA_DRAW_PANEL; class EDA_DRAW_PANEL;
class EDA_MSG_PANEL; class EDA_MSG_PANEL;
class BASE_SCREEN; class BASE_SCREEN;
class EDA_TOOLBAR;
class PARAM_CFG_BASE; class PARAM_CFG_BASE;
class Ki_PageDescr; class Ki_PageDescr;
class PLOTTER; class PLOTTER;
@ -98,13 +97,6 @@ enum id_drawframe {
KICAD_MAIN_FRAME 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. /// Custom trace mask to enable and disable auto save tracing.
extern const wxChar* traceAutoSave; extern const wxChar* traceAutoSave;
@ -123,7 +115,7 @@ protected:
wxSize m_FrameSize; wxSize m_FrameSize;
int m_MsgFrameHeight; int m_MsgFrameHeight;
EDA_TOOLBAR* m_HToolBar; // Standard horizontal Toolbar wxAuiToolBar* m_mainToolBar; // Standard horizontal Toolbar
bool m_FrameIsActive; bool m_FrameIsActive;
wxString m_FrameName; // name used for writing and reading setup wxString m_FrameName; // name used for writing and reading setup
// It is "SchematicFrame", "PcbFrame" .... // It is "SchematicFrame", "PcbFrame" ....
@ -376,14 +368,6 @@ class EDA_DRAW_FRAME : public EDA_BASE_FRAME
public: public:
EDA_DRAW_PANEL* DrawPanel; // Draw area 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: protected:
EDA_HOTKEY_CONFIG* m_HotkeysZoomAndGridList; EDA_HOTKEY_CONFIG* m_HotkeysZoomAndGridList;
@ -391,6 +375,10 @@ protected:
bool m_DrawGrid; // hide/Show grid bool m_DrawGrid; // hide/Show grid
int m_GridColor; // Grid color 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. /// Tool ID of previously active draw tool bar button.
int m_lastDrawToolId; int m_lastDrawToolId;
// on the vertical toolbar // on the vertical toolbar
@ -423,10 +411,10 @@ protected:
/// The tool bar that contains the buttons for quick access to the application draw /// 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. /// 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. /// 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. /// Panel used to display information at the bottom of the main window.
EDA_MSG_PANEL* m_messagePanel; EDA_MSG_PANEL* m_messagePanel;
@ -473,6 +461,8 @@ public:
void SetShowBorderAndTitleBlock( bool aShow ) { m_showBorderAndTitleBlock = aShow; } void SetShowBorderAndTitleBlock( bool aShow ) { m_showBorderAndTitleBlock = aShow; }
int GetInternalUnits() const { return m_internalUnits; }
virtual wxString GetScreenDesc(); virtual wxString GetScreenDesc();
/** /**
@ -876,10 +866,6 @@ protected:
*/ */
wxSize computeTextSize( const wxString& text ); wxSize computeTextSize( const wxString& text );
public:
EDA_DRAW_FRAME* m_Parent;
int m_BgColor;
public: public:
EDA_MSG_PANEL( EDA_DRAW_FRAME* parent, int id, const wxPoint& pos, const wxSize& size ); EDA_MSG_PANEL( EDA_DRAW_FRAME* parent, int id, const wxPoint& pos, const wxSize& size );
~EDA_MSG_PANEL(); ~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 * Function AddMenuItem
* is an inline helper function to create and insert a menu item with an image * is an inline helper function to create and insert a menu item with an image

View File

@ -63,7 +63,7 @@ class KICAD_MANAGER_FRAME : public EDA_BASE_FRAME
public: public:
TREE_PROJECT_FRAME* m_LeftWin; TREE_PROJECT_FRAME* m_LeftWin;
RIGHT_KM_FRAME* m_RightWin; 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_BoardFileName;
wxString m_SchematicRootFileName; wxString m_SchematicRootFileName;
wxFileName m_ProjectFileName; wxFileName m_ProjectFileName;

View File

@ -75,9 +75,9 @@ KICAD_MANAGER_FRAME::KICAD_MANAGER_FRAME( wxWindow* parent,
EDA_PANEINFO info; EDA_PANEINFO info;
info.InfoToolbarPane(); info.InfoToolbarPane();
if( m_HToolBar ) if( m_mainToolBar )
m_auimgr.AddPane( m_HToolBar, m_auimgr.AddPane( m_mainToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().Layer( 1 ) ); wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top().Layer( 1 ) );
if( m_RightWin ) if( m_RightWin )
m_auimgr.AddPane( m_RightWin, m_auimgr.AddPane( m_RightWin,

View File

@ -296,43 +296,44 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar()
void KICAD_MANAGER_FRAME::RecreateBaseHToolbar() void KICAD_MANAGER_FRAME::RecreateBaseHToolbar()
{ {
// Check if toolbar is not already created // Check if toolbar is not already created
if( m_HToolBar != NULL ) if( m_mainToolBar != NULL )
return; return;
// Allocate memory for m_HToolBar // Allocate memory for m_mainToolBar
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 );
// New // New
m_HToolBar->AddTool( ID_NEW_PROJECT, wxEmptyString, m_mainToolBar->AddTool( ID_NEW_PROJECT, wxEmptyString,
KiBitmap( new_project_xpm ), KiBitmap( new_project_xpm ),
_( "Start a new project" ) ); _( "Start a new project" ) );
// Load // Load
m_HToolBar->AddTool( ID_LOAD_PROJECT, wxEmptyString, m_mainToolBar->AddTool( ID_LOAD_PROJECT, wxEmptyString,
KiBitmap( open_project_xpm ), KiBitmap( open_project_xpm ),
_( "Load existing project" ) ); _( "Load existing project" ) );
// Save // Save
m_HToolBar->AddTool( ID_SAVE_PROJECT, wxEmptyString, m_mainToolBar->AddTool( ID_SAVE_PROJECT, wxEmptyString,
KiBitmap( save_project_xpm ), KiBitmap( save_project_xpm ),
_( "Save current project" ) ); _( "Save current project" ) );
// Separator // Separator
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
// Archive // Archive
m_HToolBar->AddTool( ID_SAVE_AND_ZIP_FILES, wxEmptyString, m_mainToolBar->AddTool( ID_SAVE_AND_ZIP_FILES, wxEmptyString,
KiBitmap( zip_xpm ), KiBitmap( zip_xpm ),
_( "Archive all project files" ) ); _( "Archive all project files" ) );
// Separator // Separator
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
// Refresh project tree // Refresh project tree
m_HToolBar->AddTool( ID_PROJECT_TREE_REFRESH, wxEmptyString, m_mainToolBar->AddTool( ID_PROJECT_TREE_REFRESH, wxEmptyString,
KiBitmap( reload_xpm ), KiBitmap( reload_xpm ),
_( "Refresh project tree" ) ); _( "Refresh project tree" ) );
// Create m_HToolBar // Create m_mainToolBar
m_HToolBar->Realize(); m_mainToolBar->Realize();
} }

View File

@ -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 <stambaughw@verizon.net>
* 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 <algorithm> #include <algorithm>
@ -39,46 +65,14 @@ wxString ModulesMaskSelection = wxT( "*" );
void PCB_EDIT_FRAME::AutoPlace( wxCommandEvent& event ) void PCB_EDIT_FRAME::AutoPlace( wxCommandEvent& event )
{ {
int id = event.GetId(); int id = event.GetId();
bool on_state;
if( m_HToolBar == NULL ) if( m_mainToolBar == NULL )
return; return;
INSTALL_UNBUFFERED_DC( dc, DrawPanel ); INSTALL_UNBUFFERED_DC( dc, DrawPanel );
switch( id ) 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: case ID_POPUP_PCB_AUTOROUTE_SELECT_LAYERS:
return; return;

View File

@ -85,7 +85,7 @@ PCB_BASE_FRAME::PCB_BASE_FRAME( wxWindow* father,
long style) : long style) :
EDA_DRAW_FRAME( father, idtype, title, pos, size, 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_Pcb = NULL;
m_DisplayPadFill = true; // How to draw pads m_DisplayPadFill = true; // How to draw pads
@ -504,7 +504,7 @@ void PCB_BASE_FRAME::UpdateStatusBar()
break; 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 // overwrite the absolute cartesian coordinates
SetStatusText( Line, 2 ); SetStatusText( Line, 2 );
@ -624,7 +624,7 @@ void PCB_BASE_FRAME::updateGridSelectBox()
for( size_t i = 0; i < GetScreen()->GetGridCount(); i++ ) for( size_t i = 0; i < GetScreen()->GetGridCount(); i++ )
{ {
GRID_TYPE& grid = GetScreen()->GetGrid( 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 ) if( grid.m_Id != ID_POPUP_GRID_USER )
{ {

View File

@ -107,18 +107,12 @@ BOARD_ITEM* PCB_BASE_FRAME::PcbGeneralLocateAndDisplay( int aHotKeyCode )
} }
else if( GetToolId() == ID_NO_TOOL_SELECTED ) else if( GetToolId() == ID_NO_TOOL_SELECTED )
{ {
switch( m_HTOOL_current_state ) if( m_mainToolBar->GetToolToggled( ID_TOOLBARH_PCB_MODE_MODULE ) )
{
case ID_TOOLBARH_PCB_MODE_MODULE:
scanList = GENERAL_COLLECTOR::ModuleItems; scanList = GENERAL_COLLECTOR::ModuleItems;
break; else
scanList = (DisplayOpt.DisplayZonesMode == 0) ?
default:
scanList = DisplayOpt.DisplayZonesMode == 0 ?
GENERAL_COLLECTOR::AllBoardItems : GENERAL_COLLECTOR::AllBoardItems :
GENERAL_COLLECTOR::AllButZones; GENERAL_COLLECTOR::AllButZones;
break;
}
} }
else else
{ {

View File

@ -73,7 +73,7 @@ void DIALOG_SVG_PRINT::initDialog( )
AddUnitSymbol( *m_TextPenWidth, g_UserUnit ); AddUnitSymbol( *m_TextPenWidth, g_UserUnit );
m_DialogPenWidth->SetValue( m_DialogPenWidth->SetValue(
ReturnStringFromValue( g_UserUnit, s_Parameters.m_PenDefaultSize, 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 ); 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() void DIALOG_SVG_PRINT::SetPenWidth()
{ {
s_Parameters.m_PenDefaultSize = ReturnValueFromTextCtrl( *m_DialogPenWidth, s_Parameters.m_PenDefaultSize = ReturnValueFromTextCtrl( *m_DialogPenWidth,
m_Parent->m_InternalUnits ); m_Parent->GetInternalUnits() );
if( s_Parameters.m_PenDefaultSize > WIDTH_MAX_VALUE ) if( s_Parameters.m_PenDefaultSize > WIDTH_MAX_VALUE )
{ {
@ -153,7 +153,7 @@ void DIALOG_SVG_PRINT::SetPenWidth()
g_DrawDefaultLineThickness = s_Parameters.m_PenDefaultSize; g_DrawDefaultLineThickness = s_Parameters.m_PenDefaultSize;
m_DialogPenWidth->SetValue( m_DialogPenWidth->SetValue(
ReturnStringFromValue( g_UserUnit, s_Parameters.m_PenDefaultSize, 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_DrawOrg.x = screen->m_DrawOrg.y = 0;
screen->m_StartVisu.x = screen->m_StartVisu.y = 0; screen->m_StartVisu.x = screen->m_StartVisu.y = 0;
SheetSize = screen->m_CurrentSheetDesc->m_Size; // size in 1/1000 inch SheetSize = screen->m_CurrentSheetDesc->m_Size; // size in 1/1000 inch
SheetSize.x *= m_Parent->m_InternalUnits / 1000; SheetSize.x *= m_Parent->GetInternalUnits() / 1000;
SheetSize.y *= m_Parent->m_InternalUnits / 1000; // size in pixels SheetSize.y *= m_Parent->GetInternalUnits() / 1000; // size in pixels
screen->SetScalingFactor( 1.0 ); screen->SetScalingFactor( 1.0 );
float dpi = (float)m_Parent->m_InternalUnits; float dpi = (float)m_Parent->GetInternalUnits();
EDA_DRAW_PANEL* panel = m_Parent->DrawPanel; EDA_DRAW_PANEL* panel = m_Parent->DrawPanel;

View File

@ -84,13 +84,13 @@ void DIALOG_COPPER_ZONE::initDialog()
AddUnitSymbol( *m_ClearanceValueTitle, g_UserUnit ); AddUnitSymbol( *m_ClearanceValueTitle, g_UserUnit );
msg = ReturnStringFromValue( g_UserUnit, msg = ReturnStringFromValue( g_UserUnit,
m_Zone_Setting->m_ZoneClearance, m_Zone_Setting->m_ZoneClearance,
m_Parent->m_InternalUnits ); m_Parent->GetInternalUnits() );
m_ZoneClearanceCtrl->SetValue( msg ); m_ZoneClearanceCtrl->SetValue( msg );
AddUnitSymbol( *m_MinThicknessValueTitle, g_UserUnit ); AddUnitSymbol( *m_MinThicknessValueTitle, g_UserUnit );
msg = ReturnStringFromValue( g_UserUnit, msg = ReturnStringFromValue( g_UserUnit,
m_Zone_Setting->m_ZoneMinThickness, m_Zone_Setting->m_ZoneMinThickness,
m_Parent->m_InternalUnits ); m_Parent->GetInternalUnits() );
m_ZoneMinThicknessCtrl->SetValue( msg ); m_ZoneMinThicknessCtrl->SetValue( msg );
switch( m_Zone_Setting->m_Zone_Pad_Options ) 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(); wxString txtvalue = m_ZoneClearanceCtrl->GetValue();
m_Zone_Setting->m_ZoneClearance = 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 // Test if this is a reasonnable value for this parameter
// A too large value can hang Pcbnew // A too large value can hang Pcbnew
@ -311,7 +311,7 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aPromptForErrors, bool aUseExportab
txtvalue = m_ZoneMinThicknessCtrl->GetValue(); txtvalue = m_ZoneMinThicknessCtrl->GetValue();
m_Zone_Setting->m_ZoneMinThickness = 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 ) if( m_Zone_Setting->m_ZoneMinThickness < 10 )
{ {
DisplayError( this, DisplayError( this,
@ -321,7 +321,7 @@ bool DIALOG_COPPER_ZONE::AcceptOptions( bool aPromptForErrors, bool aUseExportab
m_Zone_Setting->SetCornerSmoothingType( m_cornerSmoothingChoice->GetSelection() ); m_Zone_Setting->SetCornerSmoothingType( m_cornerSmoothingChoice->GetSelection() );
txtvalue = m_cornerSmoothingCtrl->GetValue(); 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 ) if( m_OrientEdgesOpt->GetSelection() == 0 )
g_Zone_45_Only = FALSE; g_Zone_45_Only = FALSE;

View File

@ -207,7 +207,7 @@ DIALOG_DESIGN_RULES::DIALOG_DESIGN_RULES( PCB_EDIT_FRAME* parent ) :
void DIALOG_DESIGN_RULES::PrintCurrentSettings() void DIALOG_DESIGN_RULES::PrintCurrentSettings()
{ {
wxString msg, value; wxString msg, value;
int internal_units = m_Parent->m_InternalUnits; int internal_units = m_Parent->GetInternalUnits();
m_MessagesList->AppendToPage( _( "<b>Current general settings:</b><br>" ) ); m_MessagesList->AppendToPage( _( "<b>Current general settings:</b><br>" ) );
@ -290,7 +290,7 @@ void DIALOG_DESIGN_RULES::InitGlobalRules()
AddUnitSymbol( *m_MicroViaMinDrillTitle ); AddUnitSymbol( *m_MicroViaMinDrillTitle );
AddUnitSymbol( *m_TrackMinWidthTitle ); 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_SetViasMinSizeCtrl, m_BrdSettings.m_ViasMinSize, Internal_Unit );
PutValueInLocalUnits( *m_SetViasMinDrillCtrl, m_BrdSettings.m_ViasMinDrill, Internal_Unit ); PutValueInLocalUnits( *m_SetViasMinDrillCtrl, m_BrdSettings.m_ViasMinDrill, Internal_Unit );
@ -326,7 +326,7 @@ void DIALOG_DESIGN_RULES::InitDimensionsLists()
*/ */
{ {
wxString msg; wxString msg;
int Internal_Unit = m_Parent->m_InternalUnits; int Internal_Unit = m_Parent->GetInternalUnits();
// Compute the column widths here, after setting texts // Compute the column widths here, after setting texts
msg = wxT("000000.000000"); // This is a very long text to display values. 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. // 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 // enter others netclasses
int row = 1; int row = 1;
@ -538,7 +538,7 @@ void DIALOG_DESIGN_RULES::InitRulesList()
{ {
NETCLASS* netclass = i->second; 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(); netclasses.Clear();
// Copy the default NetClass: // 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 : // Copy other NetClasses :
for( int row = 1; row < m_grid->GetNumberRows(); ++row ) for( int row = 1; row < m_grid->GetNumberRows(); ++row )
@ -586,7 +586,7 @@ void DIALOG_DESIGN_RULES::CopyRulesListToBoard()
continue; 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 // 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 // Update vias minimum values for DRC
m_BrdSettings.m_ViasMinSize = m_BrdSettings.m_ViasMinSize =
ReturnValueFromTextCtrl( *m_SetViasMinSizeCtrl, m_Parent->m_InternalUnits ); ReturnValueFromTextCtrl( *m_SetViasMinSizeCtrl, m_Parent->GetInternalUnits() );
m_BrdSettings.m_ViasMinDrill = 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; m_BrdSettings.m_MicroViasAllowed = m_AllowMicroViaCtrl->GetSelection() == 1;
// Update microvias minimum values for DRC // Update microvias minimum values for DRC
m_BrdSettings.m_MicroViasMinSize = m_BrdSettings.m_MicroViasMinSize =
ReturnValueFromTextCtrl( *m_SetMicroViasMinSizeCtrl, m_Parent->m_InternalUnits ); ReturnValueFromTextCtrl( *m_SetMicroViasMinSizeCtrl, m_Parent->GetInternalUnits() );
m_BrdSettings.m_MicroViasMinDrill = m_BrdSettings.m_MicroViasMinDrill =
ReturnValueFromTextCtrl( *m_SetMicroViasMinDrillCtrl, m_Parent->m_InternalUnits ); ReturnValueFromTextCtrl( *m_SetMicroViasMinDrillCtrl, m_Parent->GetInternalUnits() );
// Update tracks minimum values for DRC // Update tracks minimum values for DRC
m_BrdSettings.m_TrackMinWidth = 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 ); msg = m_gridTrackWidthList->GetCellValue( row, 0 );
if( msg.IsEmpty() ) if( msg.IsEmpty() )
continue; 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 ); m_TracksWidthList.push_back( value );
} }
@ -656,13 +656,13 @@ void DIALOG_DESIGN_RULES::CopyDimensionsListsToBoard()
msg = m_gridViaSizeList->GetCellValue( row, 0 ); msg = m_gridViaSizeList->GetCellValue( row, 0 );
if( msg.IsEmpty() ) if( msg.IsEmpty() )
continue; 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_DIMENSION via_dim;
via_dim.m_Diameter = value; via_dim.m_Diameter = value;
msg = m_gridViaSizeList->GetCellValue( row, 1 ); msg = m_gridViaSizeList->GetCellValue( row, 1 );
if( !msg.IsEmpty() ) 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; via_dim.m_Drill = value;
} }
m_ViasDimensionsList.push_back( via_dim ); m_ViasDimensionsList.push_back( via_dim );
@ -995,22 +995,22 @@ bool DIALOG_DESIGN_RULES::TestDataValidity()
wxString msg; wxString msg;
int minViaDia = ReturnValueFromTextCtrl( *m_SetViasMinSizeCtrl, int minViaDia = ReturnValueFromTextCtrl( *m_SetViasMinSizeCtrl,
m_Parent->m_InternalUnits ); m_Parent->GetInternalUnits() );
int minViaDrill = ReturnValueFromTextCtrl( *m_SetViasMinDrillCtrl, int minViaDrill = ReturnValueFromTextCtrl( *m_SetViasMinDrillCtrl,
m_Parent->m_InternalUnits ); m_Parent->GetInternalUnits() );
int minUViaDia = ReturnValueFromTextCtrl( *m_SetMicroViasMinSizeCtrl, int minUViaDia = ReturnValueFromTextCtrl( *m_SetMicroViasMinSizeCtrl,
m_Parent->m_InternalUnits ); m_Parent->GetInternalUnits() );
int minUViaDrill = ReturnValueFromTextCtrl( *m_SetMicroViasMinDrillCtrl, int minUViaDrill = ReturnValueFromTextCtrl( *m_SetMicroViasMinDrillCtrl,
m_Parent->m_InternalUnits ); m_Parent->GetInternalUnits() );
int minTrackWidth = ReturnValueFromTextCtrl( *m_SetTrackMinWidthCtrl, int minTrackWidth = ReturnValueFromTextCtrl( *m_SetTrackMinWidthCtrl,
m_Parent->m_InternalUnits ); m_Parent->GetInternalUnits() );
for( int row = 0; row < m_grid->GetNumberRows(); row++ ) for( int row = 0; row < m_grid->GetNumberRows(); row++ )
{ {
int tracksize = ReturnValueFromString( g_UserUnit, int tracksize = ReturnValueFromString( g_UserUnit,
m_grid->GetCellValue( row, GRID_TRACKSIZE ), m_grid->GetCellValue( row, GRID_TRACKSIZE ),
m_Parent->m_InternalUnits ); m_Parent->GetInternalUnits() );
if( tracksize < minTrackWidth ) if( tracksize < minTrackWidth )
{ {
result = false; result = false;
@ -1023,7 +1023,7 @@ bool DIALOG_DESIGN_RULES::TestDataValidity()
// Test vias // Test vias
int viadia = ReturnValueFromString( g_UserUnit, int viadia = ReturnValueFromString( g_UserUnit,
m_grid->GetCellValue( row, GRID_VIASIZE ), m_grid->GetCellValue( row, GRID_VIASIZE ),
m_Parent->m_InternalUnits ); m_Parent->GetInternalUnits() );
if( viadia < minViaDia ) if( viadia < minViaDia )
{ {
@ -1036,7 +1036,7 @@ bool DIALOG_DESIGN_RULES::TestDataValidity()
int viadrill = ReturnValueFromString( g_UserUnit, int viadrill = ReturnValueFromString( g_UserUnit,
m_grid->GetCellValue( row, GRID_VIADRILL ), m_grid->GetCellValue( row, GRID_VIADRILL ),
m_Parent->m_InternalUnits ); m_Parent->GetInternalUnits() );
if( viadrill >= viadia ) if( viadrill >= viadia )
{ {
result = false; result = false;
@ -1058,7 +1058,7 @@ bool DIALOG_DESIGN_RULES::TestDataValidity()
// Test Micro vias // Test Micro vias
int muviadia = ReturnValueFromString( g_UserUnit, int muviadia = ReturnValueFromString( g_UserUnit,
m_grid->GetCellValue( row, GRID_uVIASIZE ), m_grid->GetCellValue( row, GRID_uVIASIZE ),
m_Parent->m_InternalUnits ); m_Parent->GetInternalUnits() );
if( muviadia < minUViaDia ) if( muviadia < minUViaDia )
{ {
@ -1071,7 +1071,7 @@ bool DIALOG_DESIGN_RULES::TestDataValidity()
int muviadrill = ReturnValueFromString( g_UserUnit, int muviadrill = ReturnValueFromString( g_UserUnit,
m_grid->GetCellValue( row, GRID_uVIADRILL ), m_grid->GetCellValue( row, GRID_uVIADRILL ),
m_Parent->m_InternalUnits ); m_Parent->GetInternalUnits() );
if( muviadrill >= muviadia ) if( muviadrill >= muviadia )
{ {
result = false; result = false;
@ -1101,7 +1101,7 @@ bool DIALOG_DESIGN_RULES::TestDataValidity()
int tracksize = ReturnValueFromString( g_UserUnit, int tracksize = ReturnValueFromString( g_UserUnit,
tvalue, tvalue,
m_Parent->m_InternalUnits ); m_Parent->GetInternalUnits() );
if( tracksize < minTrackWidth ) if( tracksize < minTrackWidth )
{ {
result = false; result = false;
@ -1128,12 +1128,12 @@ bool DIALOG_DESIGN_RULES::TestDataValidity()
continue; continue;
int viadia = ReturnValueFromString( g_UserUnit, tvalue, int viadia = ReturnValueFromString( g_UserUnit, tvalue,
m_Parent->m_InternalUnits ); m_Parent->GetInternalUnits() );
int viadrill = 0; int viadrill = 0;
wxString drlvalue = m_gridViaSizeList->GetCellValue( row, 1 ); wxString drlvalue = m_gridViaSizeList->GetCellValue( row, 1 );
if( !drlvalue.IsEmpty() ) if( !drlvalue.IsEmpty() )
viadrill = ReturnValueFromString( g_UserUnit, drlvalue, viadrill = ReturnValueFromString( g_UserUnit, drlvalue,
m_Parent->m_InternalUnits ); m_Parent->GetInternalUnits() );
if( viadia < minViaDia ) if( viadia < minViaDia )
{ {
result = false; result = false;

View File

@ -131,11 +131,11 @@ void DIALOG_DRC_CONTROL::InitValues()
void DIALOG_DRC_CONTROL::SetDrcParmeters( ) void DIALOG_DRC_CONTROL::SetDrcParmeters( )
{ {
m_BrdSettings.m_TrackMinWidth = m_BrdSettings.m_TrackMinWidth =
ReturnValueFromTextCtrl( *m_SetTrackMinWidthCtrl, m_Parent->m_InternalUnits ); ReturnValueFromTextCtrl( *m_SetTrackMinWidthCtrl, m_Parent->GetInternalUnits() );
m_BrdSettings.m_ViasMinSize = m_BrdSettings.m_ViasMinSize =
ReturnValueFromTextCtrl( *m_SetViaMinSizeCtrl, m_Parent->m_InternalUnits ); ReturnValueFromTextCtrl( *m_SetViaMinSizeCtrl, m_Parent->GetInternalUnits() );
m_BrdSettings.m_MicroViasMinSize = m_BrdSettings.m_MicroViasMinSize =
ReturnValueFromTextCtrl( *m_SetMicroViakMinSizeCtrl, m_Parent->m_InternalUnits ); ReturnValueFromTextCtrl( *m_SetMicroViakMinSizeCtrl, m_Parent->GetInternalUnits() );
m_Parent->GetBoard()->SetDesignSettings( m_BrdSettings ); m_Parent->GetBoard()->SetDesignSettings( m_BrdSettings );
} }

View File

@ -110,7 +110,7 @@ void DIALOG_MODULE_BOARD_EDITOR::InitBoardProperties()
m_SolderMaskMarginUnits->SetLabel( GetUnitsLabel( g_UserUnit ) ); m_SolderMaskMarginUnits->SetLabel( GetUnitsLabel( g_UserUnit ) );
m_SolderPasteMarginUnits->SetLabel( GetUnitsLabel( g_UserUnit ) ); m_SolderPasteMarginUnits->SetLabel( GetUnitsLabel( g_UserUnit ) );
int internalUnit = m_Parent->m_InternalUnits; int internalUnit = m_Parent->GetInternalUnits();
PutValueInLocalUnits( *m_NetClearanceValueCtrl, PutValueInLocalUnits( *m_NetClearanceValueCtrl,
m_CurrentModule->m_LocalClearance, internalUnit ); m_CurrentModule->m_LocalClearance, internalUnit );
PutValueInLocalUnits( *m_SolderMaskMarginCtrl, PutValueInLocalUnits( *m_SolderMaskMarginCtrl,
@ -463,11 +463,11 @@ void DIALOG_MODULE_BOARD_EDITOR::OnOkClick( wxCommandEvent& event )
// Initialize masks clearances // Initialize masks clearances
m_CurrentModule->m_LocalClearance = m_CurrentModule->m_LocalClearance =
ReturnValueFromTextCtrl( *m_NetClearanceValueCtrl, m_Parent->m_InternalUnits ); ReturnValueFromTextCtrl( *m_NetClearanceValueCtrl, m_Parent->GetInternalUnits() );
m_CurrentModule->m_LocalSolderMaskMargin = m_CurrentModule->m_LocalSolderMaskMargin =
ReturnValueFromTextCtrl( *m_SolderMaskMarginCtrl, m_Parent->m_InternalUnits ); ReturnValueFromTextCtrl( *m_SolderMaskMarginCtrl, m_Parent->GetInternalUnits() );
m_CurrentModule->m_LocalSolderPasteMargin = m_CurrentModule->m_LocalSolderPasteMargin =
ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl, m_Parent->m_InternalUnits ); ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl, m_Parent->GetInternalUnits() );
double dtmp = 0.0; double dtmp = 0.0;
msg = m_SolderPasteMarginRatioCtrl->GetValue(); msg = m_SolderPasteMarginRatioCtrl->GetValue();
msg.ToDouble( &dtmp ); msg.ToDouble( &dtmp );

View File

@ -147,7 +147,7 @@ void DIALOG_MODULE_MODULE_EDITOR::InitModeditProperties()
m_SolderPasteMarginUnits->SetLabel( GetUnitsLabel( g_UserUnit ) ); m_SolderPasteMarginUnits->SetLabel( GetUnitsLabel( g_UserUnit ) );
wxString msg; wxString msg;
int internalUnit = m_Parent->m_InternalUnits; int internalUnit = m_Parent->GetInternalUnits();
PutValueInLocalUnits( *m_NetClearanceValueCtrl, PutValueInLocalUnits( *m_NetClearanceValueCtrl,
m_CurrentModule->m_LocalClearance, internalUnit ); m_CurrentModule->m_LocalClearance, internalUnit );
PutValueInLocalUnits( *m_SolderMaskMarginCtrl, PutValueInLocalUnits( *m_SolderMaskMarginCtrl,
@ -368,7 +368,7 @@ void DIALOG_MODULE_MODULE_EDITOR::OnOkClick( wxCommandEvent& event )
m_CurrentModule->m_Value->Copy(m_ValueCopy ); m_CurrentModule->m_Value->Copy(m_ValueCopy );
// Initialize masks clearances // Initialize masks clearances
int internalUnit = m_Parent->m_InternalUnits; int internalUnit = m_Parent->GetInternalUnits();
m_CurrentModule->m_LocalClearance = m_CurrentModule->m_LocalClearance =
ReturnValueFromTextCtrl( *m_NetClearanceValueCtrl, internalUnit ); ReturnValueFromTextCtrl( *m_NetClearanceValueCtrl, internalUnit );
m_CurrentModule->m_LocalSolderMaskMargin = m_CurrentModule->m_LocalSolderMaskMargin =

View File

@ -121,23 +121,23 @@ void DialogEditModuleText::initDlg( )
AddUnitSymbol( *m_SizeXTitle ); AddUnitSymbol( *m_SizeXTitle );
PutValueInLocalUnits( *m_TxtSizeCtrlX, m_currentText->m_Size.x, PutValueInLocalUnits( *m_TxtSizeCtrlX, m_currentText->m_Size.x,
m_parent->m_InternalUnits ); m_parent->GetInternalUnits() );
AddUnitSymbol( *m_SizeYTitle ); AddUnitSymbol( *m_SizeYTitle );
PutValueInLocalUnits( *m_TxtSizeCtrlY, m_currentText->m_Size.y, PutValueInLocalUnits( *m_TxtSizeCtrlY, m_currentText->m_Size.y,
m_parent->m_InternalUnits ); m_parent->GetInternalUnits() );
AddUnitSymbol( *m_PosXTitle ); AddUnitSymbol( *m_PosXTitle );
PutValueInLocalUnits( *m_TxtPosCtrlX, m_currentText->GetPos0().x, PutValueInLocalUnits( *m_TxtPosCtrlX, m_currentText->GetPos0().x,
m_parent->m_InternalUnits ); m_parent->GetInternalUnits() );
AddUnitSymbol( *m_PosYTitle ); AddUnitSymbol( *m_PosYTitle );
PutValueInLocalUnits( *m_TxtPosCtrlY, m_currentText->GetPos0().y, PutValueInLocalUnits( *m_TxtPosCtrlY, m_currentText->GetPos0().y,
m_parent->m_InternalUnits ); m_parent->GetInternalUnits() );
AddUnitSymbol( *m_WidthTitle ); AddUnitSymbol( *m_WidthTitle );
PutValueInLocalUnits( *m_TxtWidthCtlr, m_currentText->m_Thickness, PutValueInLocalUnits( *m_TxtWidthCtlr, m_currentText->m_Thickness,
m_parent->m_InternalUnits ); m_parent->GetInternalUnits() );
int text_orient = m_currentText->m_Orient; int text_orient = m_currentText->m_Orient;
NORMALIZE_ANGLE_90(text_orient) NORMALIZE_ANGLE_90(text_orient)
@ -169,19 +169,19 @@ void DialogEditModuleText::OnOkClick( wxCommandEvent& event )
wxPoint tmp; wxPoint tmp;
msg = m_TxtPosCtrlX->GetValue(); 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(); 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 ); m_currentText->SetPos0( tmp );
msg = m_TxtSizeCtrlX->GetValue(); msg = m_TxtSizeCtrlX->GetValue();
m_currentText->m_Size.x = ReturnValueFromString( g_UserUnit, msg, m_currentText->m_Size.x = ReturnValueFromString( g_UserUnit, msg,
m_parent->m_InternalUnits ); m_parent->GetInternalUnits() );
msg = m_TxtSizeCtrlY->GetValue(); msg = m_TxtSizeCtrlY->GetValue();
m_currentText->m_Size.y = ReturnValueFromString( g_UserUnit, msg, m_currentText->m_Size.y = ReturnValueFromString( g_UserUnit, msg,
m_parent->m_InternalUnits ); m_parent->GetInternalUnits() );
// Test for a reasonnable size: // Test for a reasonnable size:
if( m_currentText->m_Size.x< TEXTS_MIN_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; m_currentText->m_Size.y = TEXTS_MIN_SIZE;
msg = m_TxtWidthCtlr->GetValue(); 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: // Test for a reasonnable width:
if( width <= 1 ) if( width <= 1 )

View File

@ -149,7 +149,7 @@ void Dialog_GeneralOptions::OnOkClick( wxCommandEvent& event )
void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event ) void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
{ {
int id = event.GetId(); int id = event.GetId();
bool state = m_optionsToolBar->GetToolState( id ); bool state = m_optionsToolBar->GetToolToggled( id );
switch( id ) switch( id )
{ {

View File

@ -44,7 +44,7 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::MyInit()
wxString msg; wxString msg;
// Display current setup for tracks and vias // 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(); BOARD* board = m_Parent->GetBoard();
NETCLASSES& netclasses = board->m_NetClasses; NETCLASSES& netclasses = board->m_NetClasses;
NETINFO_ITEM* net = board->FindNet( m_Netcode ); NETINFO_ITEM* net = board->FindNet( m_Netcode );

View File

@ -119,23 +119,23 @@ void DialogGraphicItemProperties::initDlg( )
AddUnitSymbol( *m_Start_Center_XText ); AddUnitSymbol( *m_Start_Center_XText );
PutValueInLocalUnits( *m_Center_StartXCtrl, m_Item->GetStart().x, PutValueInLocalUnits( *m_Center_StartXCtrl, m_Item->GetStart().x,
m_Parent->m_InternalUnits ); m_Parent->GetInternalUnits() );
AddUnitSymbol( *m_Start_Center_YText ); AddUnitSymbol( *m_Start_Center_YText );
PutValueInLocalUnits( *m_Center_StartYCtrl, m_Item->GetStart().y, PutValueInLocalUnits( *m_Center_StartYCtrl, m_Item->GetStart().y,
m_Parent->m_InternalUnits ); m_Parent->GetInternalUnits() );
AddUnitSymbol( *m_EndX_Radius_Text ); AddUnitSymbol( *m_EndX_Radius_Text );
PutValueInLocalUnits( *m_EndX_Radius_Ctrl, m_Item->GetEnd().x, PutValueInLocalUnits( *m_EndX_Radius_Ctrl, m_Item->GetEnd().x,
m_Parent->m_InternalUnits ); m_Parent->GetInternalUnits() );
AddUnitSymbol( *m_EndY_Text ); AddUnitSymbol( *m_EndY_Text );
PutValueInLocalUnits( *m_EndY_Ctrl, m_Item->GetEnd().y, PutValueInLocalUnits( *m_EndY_Ctrl, m_Item->GetEnd().y,
m_Parent->m_InternalUnits ); m_Parent->GetInternalUnits() );
AddUnitSymbol( *m_ItemThicknessText ); AddUnitSymbol( *m_ItemThicknessText );
PutValueInLocalUnits( *m_ThicknessCtrl, m_Item->GetWidth(), PutValueInLocalUnits( *m_ThicknessCtrl, m_Item->GetWidth(),
m_Parent->m_InternalUnits ); m_Parent->GetInternalUnits() );
AddUnitSymbol( *m_DefaultThicknessText ); AddUnitSymbol( *m_DefaultThicknessText );
@ -147,7 +147,7 @@ void DialogGraphicItemProperties::initDlg( )
thickness = m_BrdSettings.m_DrawSegmentWidth; thickness = m_BrdSettings.m_DrawSegmentWidth;
PutValueInLocalUnits( *m_DefaultThicknessCtrl, thickness, PutValueInLocalUnits( *m_DefaultThicknessCtrl, thickness,
m_Parent->m_InternalUnits ); m_Parent->GetInternalUnits() );
for( int layer=FIRST_NO_COPPER_LAYER; layer <= LAST_NO_COPPER_LAYER; ++layer ) 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; thickness = m_BrdSettings.m_DrawSegmentWidth;
PutValueInLocalUnits( *m_DefaultThicknessCtrl, thickness, 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 ); m_Item->Draw( m_Parent->DrawPanel, m_DC, GR_XOR );
msg = m_Center_StartXCtrl->GetValue(); 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(); 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(); 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(); 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(); 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(); 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); m_Item->SetLayer( m_LayerSelection->GetCurrentSelection() + FIRST_NO_COPPER_LAYER);

View File

@ -42,7 +42,7 @@ void DIALOG_PADS_MASK_CLEARANCE::MyInit()
m_SolderMaskMarginUnits->SetLabel( GetUnitsLabel( g_UserUnit ) ); m_SolderMaskMarginUnits->SetLabel( GetUnitsLabel( g_UserUnit ) );
m_SolderPasteMarginUnits->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, PutValueInLocalUnits( *m_SolderMaskMarginCtrl,
m_BrdSettings.m_SolderMaskMargin, m_BrdSettings.m_SolderMaskMargin,
Internal_Unit ); Internal_Unit );
@ -70,10 +70,10 @@ void DIALOG_PADS_MASK_CLEARANCE::OnButtonOkClick( wxCommandEvent& event )
/*******************************************************************/ /*******************************************************************/
{ {
m_BrdSettings.m_SolderMaskMargin = m_BrdSettings.m_SolderMaskMargin =
ReturnValueFromTextCtrl( *m_SolderMaskMarginCtrl, m_Parent->m_InternalUnits ); ReturnValueFromTextCtrl( *m_SolderMaskMarginCtrl, m_Parent->GetInternalUnits() );
m_BrdSettings.m_SolderPasteMargin = m_BrdSettings.m_SolderPasteMargin =
ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl, m_Parent->m_InternalUnits ); ReturnValueFromTextCtrl( *m_SolderPasteMarginCtrl, m_Parent->GetInternalUnits() );
double dtmp = 0; double dtmp = 0;
wxString msg = m_SolderPasteMarginRatioCtrl->GetValue(); wxString msg = m_SolderPasteMarginRatioCtrl->GetValue();

View File

@ -190,7 +190,7 @@ void DIALOG_PAD_PROPERTIES::initValues()
{ {
SetFocus(); // Required under wxGTK if we want to demiss the dialog with the ESC key 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; wxString msg;
m_isFlipped = false; m_isFlipped = false;
if( m_CurrentPad ) if( m_CurrentPad )
@ -688,7 +688,7 @@ void DIALOG_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event )
bool DIALOG_PAD_PROPERTIES::TransfertDataToPad( D_PAD* aPad, bool aPromptOnError ) bool DIALOG_PAD_PROPERTIES::TransfertDataToPad( D_PAD* aPad, bool aPromptOnError )
{ {
long PadLayerMask; long PadLayerMask;
int internalUnits = m_Parent->m_InternalUnits; int internalUnits = m_Parent->GetInternalUnits();
wxString msg; wxString msg;
aPad->m_Attribut = CodeType[m_PadType->GetSelection()]; aPad->m_Attribut = CodeType[m_PadType->GetSelection()];

View File

@ -91,15 +91,15 @@ void DIALOG_PCB_TEXT_PROPERTIES::MyInit()
*m_TextContentCtrl << m_SelectedPCBText->m_Text; *m_TextContentCtrl << m_SelectedPCBText->m_Text;
PutValueInLocalUnits( *m_SizeXCtrl, m_SelectedPCBText->m_Size.x, PutValueInLocalUnits( *m_SizeXCtrl, m_SelectedPCBText->m_Size.x,
m_Parent->m_InternalUnits ); m_Parent->GetInternalUnits() );
PutValueInLocalUnits( *m_SizeYCtrl, m_SelectedPCBText->m_Size.y, PutValueInLocalUnits( *m_SizeYCtrl, m_SelectedPCBText->m_Size.y,
m_Parent->m_InternalUnits ); m_Parent->GetInternalUnits() );
PutValueInLocalUnits( *m_ThicknessCtrl, m_SelectedPCBText->m_Thickness, PutValueInLocalUnits( *m_ThicknessCtrl, m_SelectedPCBText->m_Thickness,
m_Parent->m_InternalUnits ); m_Parent->GetInternalUnits() );
PutValueInLocalUnits( *m_PositionXCtrl, m_SelectedPCBText->m_Pos.x, PutValueInLocalUnits( *m_PositionXCtrl, m_SelectedPCBText->m_Pos.x,
m_Parent->m_InternalUnits ); m_Parent->GetInternalUnits() );
PutValueInLocalUnits( *m_PositionYCtrl, m_SelectedPCBText->m_Pos.y, PutValueInLocalUnits( *m_PositionYCtrl, m_SelectedPCBText->m_Pos.y,
m_Parent->m_InternalUnits ); m_Parent->GetInternalUnits() );
int enabledLayers = m_Parent->GetBoard()->GetEnabledLayers(); int enabledLayers = m_Parent->GetBoard()->GetEnabledLayers();
for( int layer = 0; layer < NB_LAYERS; ++layer ) for( int layer = 0; layer < NB_LAYERS; ++layer )
@ -195,13 +195,13 @@ void DIALOG_PCB_TEXT_PROPERTIES::OnOkClick( wxCommandEvent& event )
} }
// Set PCB Text position // Set PCB Text position
newPosition.x = ReturnValueFromString( g_UserUnit, m_PositionXCtrl->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->m_InternalUnits ); newPosition.y = ReturnValueFromString( g_UserUnit, m_PositionYCtrl->GetValue(), m_Parent->GetInternalUnits() );
m_SelectedPCBText->m_Pos = newPosition; m_SelectedPCBText->m_Pos = newPosition;
// Check constraints and set PCB Text size // Check constraints and set PCB Text size
newSize.x = ReturnValueFromString( g_UserUnit, m_SizeXCtrl->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->m_InternalUnits ); newSize.y = ReturnValueFromString( g_UserUnit, m_SizeYCtrl->GetValue(), m_Parent->GetInternalUnits() );
if( newSize.x < TEXTS_MIN_SIZE ) if( newSize.x < TEXTS_MIN_SIZE )
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; m_SelectedPCBText->m_Size = newSize;
// Set the new thickness // 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 // 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 ); int maxthickness = Clamp_Text_PenSize( m_SelectedPCBText->m_Thickness, m_SelectedPCBText->m_Size );

View File

@ -266,7 +266,7 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
s_Parameters.m_PenDefaultSize = g_DrawDefaultLineThickness; s_Parameters.m_PenDefaultSize = g_DrawDefaultLineThickness;
AddUnitSymbol( *m_TextPenWidth, g_UserUnit ); AddUnitSymbol( *m_TextPenWidth, g_UserUnit );
m_DialogPenWidth->SetValue( 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 // Create scale adjust option
@ -420,7 +420,7 @@ void DIALOG_PRINT_USING_PRINTER::SetPenWidth()
* NOTE: s_Parameters.m_PenDefaultSize is in internal units * 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 ) if( s_Parameters.m_PenDefaultSize > WIDTH_MAX_VALUE )
{ {
@ -435,7 +435,7 @@ void DIALOG_PRINT_USING_PRINTER::SetPenWidth()
g_DrawDefaultLineThickness = s_Parameters.m_PenDefaultSize; g_DrawDefaultLineThickness = s_Parameters.m_PenDefaultSize;
m_DialogPenWidth->SetValue( 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 ) void DIALOG_PRINT_USING_PRINTER::OnScaleSelectionClick( wxCommandEvent& event )

View File

@ -92,23 +92,23 @@ DIALOG_DIMENSION_EDITOR::DIALOG_DIMENSION_EDITOR( PCB_EDIT_FRAME* aParent,
// Enter size value in dialog // Enter size value in dialog
PutValueInLocalUnits( *m_TxtSizeXCtrl, aDimension->m_Text.m_Size.x, PutValueInLocalUnits( *m_TxtSizeXCtrl, aDimension->m_Text.m_Size.x,
m_Parent->m_InternalUnits ); m_Parent->GetInternalUnits() );
AddUnitSymbol( *m_staticTextSizeX ); AddUnitSymbol( *m_staticTextSizeX );
PutValueInLocalUnits( *m_TxtSizeYCtrl, aDimension->m_Text.m_Size.y, PutValueInLocalUnits( *m_TxtSizeYCtrl, aDimension->m_Text.m_Size.y,
m_Parent->m_InternalUnits ); m_Parent->GetInternalUnits() );
AddUnitSymbol( *m_staticTextSizeY ); AddUnitSymbol( *m_staticTextSizeY );
// Enter lines thickness value in dialog // Enter lines thickness value in dialog
PutValueInLocalUnits( *m_TxtWidthCtrl, aDimension->m_Width, PutValueInLocalUnits( *m_TxtWidthCtrl, aDimension->m_Width,
m_Parent->m_InternalUnits ); m_Parent->GetInternalUnits() );
AddUnitSymbol( *m_staticTextWidth ); AddUnitSymbol( *m_staticTextWidth );
// Enter position value in dialog // Enter position value in dialog
PutValueInLocalUnits( *m_textCtrlPosX, aDimension->m_Text.m_Pos.x, PutValueInLocalUnits( *m_textCtrlPosX, aDimension->m_Text.m_Pos.x,
m_Parent->m_InternalUnits ); m_Parent->GetInternalUnits() );
AddUnitSymbol( *m_staticTextPosX ); AddUnitSymbol( *m_staticTextPosX );
PutValueInLocalUnits( *m_textCtrlPosY, aDimension->m_Text.m_Pos.y, PutValueInLocalUnits( *m_textCtrlPosY, aDimension->m_Text.m_Pos.y,
m_Parent->m_InternalUnits ); m_Parent->GetInternalUnits() );
AddUnitSymbol( *m_staticTextPosY ); AddUnitSymbol( *m_staticTextPosY );
for( int layer = FIRST_NO_COPPER_LAYER; layer<NB_LAYERS; layer++ ) for( int layer = FIRST_NO_COPPER_LAYER; layer<NB_LAYERS; layer++ )
@ -149,24 +149,24 @@ void DIALOG_DIMENSION_EDITOR::OnOKClick( wxCommandEvent& event )
// Get new size value: // Get new size value:
msg = m_TxtSizeXCtrl->GetValue(); msg = m_TxtSizeXCtrl->GetValue();
CurrentDimension->m_Text.m_Size.x = ReturnValueFromString( g_UserUnit, msg, CurrentDimension->m_Text.m_Size.x = ReturnValueFromString( g_UserUnit, msg,
m_Parent->m_InternalUnits ); m_Parent->GetInternalUnits() );
msg = m_TxtSizeYCtrl->GetValue(); msg = m_TxtSizeYCtrl->GetValue();
CurrentDimension->m_Text.m_Size.y = ReturnValueFromString( g_UserUnit, msg, CurrentDimension->m_Text.m_Size.y = ReturnValueFromString( g_UserUnit, msg,
m_Parent->m_InternalUnits ); m_Parent->GetInternalUnits() );
// Get new position value: // Get new position value:
// It will be copied later in dimension, because // It will be copied later in dimension, because
msg = m_textCtrlPosX->GetValue(); msg = m_textCtrlPosX->GetValue();
CurrentDimension->m_Text.m_Pos.x = ReturnValueFromString( g_UserUnit, msg, CurrentDimension->m_Text.m_Pos.x = ReturnValueFromString( g_UserUnit, msg,
m_Parent->m_InternalUnits ); m_Parent->GetInternalUnits() );
msg = m_textCtrlPosY->GetValue(); msg = m_textCtrlPosY->GetValue();
CurrentDimension->m_Text.m_Pos.y = ReturnValueFromString( g_UserUnit, msg, CurrentDimension->m_Text.m_Pos.y = ReturnValueFromString( g_UserUnit, msg,
m_Parent->m_InternalUnits ); m_Parent->GetInternalUnits() );
// Get new line thickness value: // Get new line thickness value:
msg = m_TxtWidthCtrl->GetValue(); msg = m_TxtWidthCtrl->GetValue();
int width = ReturnValueFromString( g_UserUnit, msg, int width = ReturnValueFromString( g_UserUnit, msg,
m_Parent->m_InternalUnits ); m_Parent->GetInternalUnits() );
int maxthickness = Clamp_Text_PenSize( width, CurrentDimension->m_Text.m_Size ); int maxthickness = Clamp_Text_PenSize( width, CurrentDimension->m_Text.m_Size );
if( width > maxthickness ) if( width > maxthickness )

View File

@ -56,13 +56,13 @@ void DRC::ShowDialog()
PutValueInLocalUnits( *m_ui->m_SetTrackMinWidthCtrl, PutValueInLocalUnits( *m_ui->m_SetTrackMinWidthCtrl,
m_pcb->GetDesignSettings().m_TrackMinWidth, m_pcb->GetDesignSettings().m_TrackMinWidth,
m_mainWindow->m_InternalUnits ); m_mainWindow->GetInternalUnits() );
PutValueInLocalUnits( *m_ui->m_SetViaMinSizeCtrl, PutValueInLocalUnits( *m_ui->m_SetViaMinSizeCtrl,
m_pcb->GetDesignSettings().m_ViasMinSize, m_pcb->GetDesignSettings().m_ViasMinSize,
m_mainWindow->m_InternalUnits ); m_mainWindow->GetInternalUnits() );
PutValueInLocalUnits( *m_ui->m_SetMicroViakMinSizeCtrl, PutValueInLocalUnits( *m_ui->m_SetMicroViakMinSizeCtrl,
m_pcb->GetDesignSettings().m_MicroViasMinSize, m_pcb->GetDesignSettings().m_MicroViasMinSize,
m_mainWindow->m_InternalUnits ); m_mainWindow->GetInternalUnits() );
m_ui->m_CreateRptCtrl->SetValue( m_doCreateRptFile ); m_ui->m_CreateRptCtrl->SetValue( m_doCreateRptFile );
m_ui->m_RptFilenameCtrl->SetValue( m_rptFilename ); m_ui->m_RptFilenameCtrl->SetValue( m_rptFilename );

View File

@ -104,13 +104,13 @@ TARGET_PROPERTIES_DIALOG_EDITOR::TARGET_PROPERTIES_DIALOG_EDITOR( PCB_EDIT_FRAME
m_MireSizeCtrl = new EDA_VALUE_CTRL( this, _( "Size" ), m_MireSizeCtrl = new EDA_VALUE_CTRL( this, _( "Size" ),
m_Target->GetSize(), m_Target->GetSize(),
g_UserUnit, LeftBoxSizer, g_UserUnit, LeftBoxSizer,
m_Parent->m_InternalUnits ); m_Parent->GetInternalUnits() );
// Width: // Width:
m_MireWidthCtrl = new EDA_VALUE_CTRL( this, _( "Width" ), m_MireWidthCtrl = new EDA_VALUE_CTRL( this, _( "Width" ),
m_Target->GetWidth(), m_Target->GetWidth(),
g_UserUnit, LeftBoxSizer, g_UserUnit, LeftBoxSizer,
m_Parent->m_InternalUnits ); m_Parent->GetInternalUnits() );
// Shape // Shape
wxString shape_list[2] = { _( "shape +" ), _( "shape X" ) }; wxString shape_list[2] = { _( "shape +" ), _( "shape X" ) };

View File

@ -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 <stambaughw@verizon.net>
* 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 * @file modeditoptions.cpp
* @brief Pcbnew footprint (module) editor options. * @brief Pcbnew footprint (module) editor options.
@ -23,24 +48,22 @@ void FOOTPRINT_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
switch( id ) switch( id )
{ {
case ID_TB_OPTIONS_SHOW_PADS_SKETCH: case ID_TB_OPTIONS_SHOW_PADS_SKETCH:
m_DisplayPadFill = !m_optionsToolBar->GetToolState( id ); m_DisplayPadFill = !m_optionsToolBar->GetToolToggled( id );
DrawPanel->Refresh( ); DrawPanel->Refresh( );
break; break;
case ID_TB_OPTIONS_SHOW_VIAS_SKETCH: case ID_TB_OPTIONS_SHOW_VIAS_SKETCH:
m_DisplayViaFill = !m_optionsToolBar->GetToolState( id ); m_DisplayViaFill = !m_optionsToolBar->GetToolToggled( id );
DrawPanel->Refresh( ); DrawPanel->Refresh( );
break; break;
case ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH: case ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH:
m_DisplayModText = m_DisplayModText = m_optionsToolBar->GetToolToggled( id ) ? SKETCH : FILLED;
m_optionsToolBar->GetToolState( id ) ? SKETCH : FILLED;
DrawPanel->Refresh( ); DrawPanel->Refresh( );
break; break;
case ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH: case ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH:
m_DisplayModEdge = m_DisplayModEdge = m_optionsToolBar->GetToolToggled( id ) ? SKETCH : FILLED;
m_optionsToolBar->GetToolState( id ) ? SKETCH : FILLED;
DrawPanel->Refresh( ); DrawPanel->Refresh( );
break; break;

View File

@ -191,8 +191,8 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( wxWindow* father,
EDA_PANEINFO mesg_pane; EDA_PANEINFO mesg_pane;
mesg_pane.MessageToolbarPane(); mesg_pane.MessageToolbarPane();
m_auimgr.AddPane( m_HToolBar, m_auimgr.AddPane( m_mainToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top(). Row( 0 ) ); wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top(). Row( 0 ) );
m_auimgr.AddPane( m_auxiliaryToolBar, m_auimgr.AddPane( m_auxiliaryToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_auxiliaryToolBar" ) ).Top().Row( 1 ) ); wxAuiPaneInfo( horiz ).Name( wxT( "m_auxiliaryToolBar" ) ).Top().Row( 1 ) );

View File

@ -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 <stambaughw@verizon.net>
* 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 * @file pcbnew/onrightclick.cpp
* @brief Right mouse button functions. * @brief Right mouse button functions.
@ -52,7 +77,8 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
{ {
if( item && item->m_Flags ) 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 else
{ {
@ -118,7 +144,7 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
case PCB_MODULE_T: case PCB_MODULE_T:
createPopUpMenuForFootprints( (MODULE*) item, aPopMenu ); 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(); aPopMenu->AppendSeparator();
@ -142,7 +168,7 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
_( "Auto Place Module" ) ); _( "Auto Place Module" ) );
} }
if( m_HTOOL_current_state == ID_TOOLBARH_PCB_MODE_TRACKS ) if( m_mainToolBar->GetToolToggled( ID_TOOLBARH_PCB_MODE_TRACKS ) )
{ {
if( !flags ) if( !flags )
aPopMenu->Append( ID_POPUP_PCB_AUTOROUTE_MODULE, _( "Autoroute Module" ) ); 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 ); HK_MOVE_ITEM );
AddMenuItem( aPopMenu, ID_POPUP_PCB_MOVE_TEXT_DIMENSION_REQUEST, AddMenuItem( aPopMenu, ID_POPUP_PCB_MOVE_TEXT_DIMENSION_REQUEST,
msg, KiBitmap( move_text_xpm ) ); 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, AddMenuItem( aPopMenu, ID_POPUP_PCB_DELETE_DIMENSION,
msg, KiBitmap( delete_xpm ) ); msg, KiBitmap( delete_xpm ) );
} }
@ -303,7 +330,8 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
case ID_TRACK_BUTT: case ID_TRACK_BUTT:
if ( ! locate_track ) // This menu is already added when a track is located if ( ! locate_track ) // This menu is already added when a track is located
AddMenuItem( aPopMenu, Append_Track_Width_List( GetBoard() ), 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, AddMenuItem( aPopMenu, ID_POPUP_PCB_SELECT_CU_LAYER,
_( "Select Working Layer" ), KiBitmap( select_w_layer_xpm ) ); _( "Select Working Layer" ), KiBitmap( select_w_layer_xpm ) );
@ -329,7 +357,7 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
break; break;
case ID_NO_TOOL_SELECTED: 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; wxMenu* commands = new wxMenu;
AddMenuItem( aPopMenu, commands, ID_POPUP_PCB_AUTOPLACE_COMMANDS, AddMenuItem( aPopMenu, commands, ID_POPUP_PCB_AUTOPLACE_COMMANDS,
@ -352,7 +380,7 @@ bool PCB_EDIT_FRAME::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
aPopMenu->AppendSeparator(); 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; wxMenu* commands = new wxMenu;
aPopMenu->Append( ID_POPUP_PCB_AUTOROUTE_COMMANDS, _( "Autoroute" ), commands ); 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 ) 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 ) ); AddMenuItem( menu, ID_POPUP_ZOOM_BLOCK, _( "Zoom Block" ), KiBitmap( zoom_area_xpm ) );
menu->AppendSeparator(); menu->AppendSeparator();
AddMenuItem( menu, ID_POPUP_PLACE_BLOCK, _( "Place Block" ), KiBitmap( apply_xpm ) ); 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 ) 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 else
{ {
@ -523,7 +553,8 @@ void PCB_EDIT_FRAME::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
// Add lock/unlock flags menu: // Add lock/unlock flags menu:
track_mnu = new wxMenu; 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_ON_TRACKSEG, _( "Locked: Yes" ), wxEmptyString, true );
track_mnu->Append( ID_POPUP_PCB_LOCK_OFF_TRACKSEG, _( "Locked: No" ), 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 ) ); _( "Add Cutout Area" ), KiBitmap( add_zone_cutout_xpm ) );
zones_menu->AppendSeparator(); 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 ) if( edge_zone->m_FilledPolysList.size() > 0 )
{ {
@ -657,7 +689,8 @@ void PCB_EDIT_FRAME::createPopUpMenuForFootprints( MODULE* aModule, wxMenu* menu
if( !flags ) if( !flags )
{ {
msg = AddHotkeyName( _( "Edit" ), g_Board_Editor_Hokeys_Descr, HK_EDIT_ITEM ); 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(); sub_menu_footprint->AppendSeparator();
msg = AddHotkeyName( _( "Delete Module" ), g_Board_Editor_Hokeys_Descr, HK_DELETE ); msg = AddHotkeyName( _( "Delete Module" ), g_Board_Editor_Hokeys_Descr, HK_DELETE );
AddMenuItem( sub_menu_footprint, ID_POPUP_PCB_DELETE_MODULE, 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; sub_menu_Pad = new wxMenu;
AddMenuItem( menu, sub_menu_Pad, -1, msg, KiBitmap( pad_xpm ) ); 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_MOVE_PAD_REQUEST, _( "Move" ),
AddMenuItem( sub_menu_Pad, ID_POPUP_PCB_DRAG_PAD_REQUEST, _( "Drag" ), KiBitmap( drag_pad_xpm ) ); 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 ) ); AddMenuItem( sub_menu_Pad, ID_POPUP_PCB_EDIT_PAD, _( "Edit" ), KiBitmap( options_pad_xpm ) );
sub_menu_Pad->AppendSeparator(); 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 ) ); 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_PAD, _( "Autoroute Pad" ) );
menu->Append( ID_POPUP_PCB_AUTOROUTE_NET, _( "Autoroute Net" ) ); 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, AddMenuItem( sub_menu_Text, ID_POPUP_PCB_MOVE_TEXTEPCB_REQUEST,
msg, KiBitmap( move_text_xpm ) ); msg, KiBitmap( move_text_xpm ) );
} }
msg = AddHotkeyName( _( "Rotate" ), g_Board_Editor_Hokeys_Descr, HK_ROTATE_ITEM ); 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 ) ); 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 ); 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 ) 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_DELETE_MARKER, _( "Delete Marker" ),
AddMenuItem( aPopMenu, ID_POPUP_PCB_GETINFO_MARKER, _( "Marker Error Info" ), KiBitmap( info_xpm ) ); KiBitmap( delete_xpm ) );
AddMenuItem( aPopMenu, ID_POPUP_PCB_GETINFO_MARKER, _( "Marker Error Info" ),
KiBitmap( info_xpm ) );
} }

View File

@ -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_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_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_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_MODULE, PCB_EDIT_FRAME::OnSelectAutoPlaceMode )
EVT_TOOL( ID_TOOLBARH_PCB_MODE_TRACKS, PCB_EDIT_FRAME::AutoPlace ) 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 ) EVT_TOOL( ID_TOOLBARH_PCB_FREEROUTE_ACCESS, PCB_EDIT_FRAME::Access_to_External_Tool )
// Option toolbar // Option toolbar
@ -247,6 +247,8 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
PCB_EDIT_FRAME::OnUpdateSelectAutoTrackWidth ) PCB_EDIT_FRAME::OnUpdateSelectAutoTrackWidth )
EVT_UPDATE_UI( ID_POPUP_PCB_SELECT_AUTO_WIDTH, 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_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, EVT_UPDATE_UI_RANGE( ID_POPUP_PCB_SELECT_WIDTH1, ID_POPUP_PCB_SELECT_WIDTH8,
PCB_EDIT_FRAME::OnUpdateSelectTrackWidth ) PCB_EDIT_FRAME::OnUpdateSelectTrackWidth )
EVT_UPDATE_UI_RANGE( ID_POPUP_PCB_SELECT_VIASIZE1, ID_POPUP_PCB_SELECT_VIASIZE8, 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_hasAutoSave = true;
m_RecordingMacros = -1; m_RecordingMacros = -1;
m_microWaveToolBar = NULL; m_microWaveToolBar = NULL;
m_autoPlaceModeId = 0;
for ( int i = 0; i < 10; i++ ) for ( int i = 0; i < 10; i++ )
m_Macros[i].m_Record.clear(); 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 ) ); icon.CopyFromBitmap( KiBitmap( icon_pcbnew_xpm ) );
SetIcon( icon ); 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() ); SetScreen( new PCB_SCREEN() );
GetScreen()->m_Center = false; // PCB drawings start in the upper left corner. 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" ) ); lyrs.Caption( _( "Visibles" ) );
if( m_HToolBar ) // The main horizontal toolbar if( m_mainToolBar ) // The main horizontal toolbar
{ {
m_auimgr.AddPane( m_HToolBar, m_auimgr.AddPane( m_mainToolBar,
wxAuiPaneInfo( horiz ).Name( wxT( "m_HToolBar" ) ).Top().Row( 0 ) ); wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top().Row( 0 ) );
} }
if( m_auxiliaryToolBar ) // the auxiliary horizontal toolbar, that shows track and via sizes, zoom ...) 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 ); SetTitle( title );
} }
void PCB_EDIT_FRAME::OnSelectAutoPlaceMode( wxCommandEvent& aEvent )
{
if( aEvent.IsChecked() )
{
m_autoPlaceModeId = aEvent.GetId();
}
else
{
m_autoPlaceModeId = 0;
}
}

View File

@ -182,7 +182,7 @@ void DIALOG_PLOT::Init_Dialog()
m_subtractMaskFromSilk->SetValue( g_PcbPlotOptions.GetSubtractMaskFromSilk() ); m_subtractMaskFromSilk->SetValue( g_PcbPlotOptions.GetSubtractMaskFromSilk() );
// Option to plot page references: // Option to plot page references:
if( m_Parent->m_Print_Sheet_Ref ) if( m_Parent->GetPrintBorderAndTitleBlock() )
{ {
m_plotSheetRef->SetValue( g_PcbPlotOptions.m_PlotFrameRef ); m_plotSheetRef->SetValue( g_PcbPlotOptions.m_PlotFrameRef );
} }

View File

@ -81,8 +81,8 @@ void FOOTPRINT_EDIT_FRAME::PrintPage( wxDC* aDC,
offset.x = GetScreen()->m_CurrentSheetDesc->m_Size.x / 2; offset.x = GetScreen()->m_CurrentSheetDesc->m_Size.x / 2;
offset.y = GetScreen()->m_CurrentSheetDesc->m_Size.y / 2; offset.y = GetScreen()->m_CurrentSheetDesc->m_Size.y / 2;
// offset is in mils, converts in internal units // offset is in mils, converts in internal units
offset.x *= m_InternalUnits / 1000; offset.x *= m_internalUnits / 1000;
offset.y *= m_InternalUnits / 1000; offset.y *= m_internalUnits / 1000;
for( ; Module != NULL; Module = Module->Next() ) for( ; Module != NULL; Module = Module->Next() )
{ {

View File

@ -163,8 +163,8 @@ void BOARD_PRINTOUT_CONTROLER::DrawPage()
screen->m_StartVisu.x = screen->m_StartVisu.y = 0; screen->m_StartVisu.x = screen->m_StartVisu.y = 0;
SheetSize = screen->m_CurrentSheetDesc->m_Size; // size in 1/1000 inch SheetSize = screen->m_CurrentSheetDesc->m_Size; // size in 1/1000 inch
SheetSize.x *= m_Parent->m_InternalUnits / 1000; SheetSize.x *= m_Parent->GetInternalUnits() / 1000;
SheetSize.y *= m_Parent->m_InternalUnits / 1000; // size in internal units SheetSize.y *= m_Parent->GetInternalUnits() / 1000; // size in internal units
PCB_BASE_FRAME* pcbframe = (PCB_BASE_FRAME*) m_Parent; PCB_BASE_FRAME* pcbframe = (PCB_BASE_FRAME*) m_Parent;

View File

@ -40,7 +40,7 @@ void PCB_BASE_FRAME::InstallGridFrame( const wxPoint& pos )
{ {
DIALOG_SET_GRID dlg( this, pos ); DIALOG_SET_GRID dlg( this, pos );
dlg.m_internalUnits = m_InternalUnits; dlg.m_internalUnits = m_internalUnits;
dlg.SetGridUnits( m_UserGridUnit ); dlg.SetGridUnits( m_UserGridUnit );
dlg.SetGridSize( m_UserGridSize ); dlg.SetGridSize( m_UserGridSize );
dlg.SetGridOrigin( GetScreen()->m_GridOrigin ); dlg.SetGridOrigin( GetScreen()->m_GridOrigin );

View File

@ -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 <stambaughw@verizon.net>
* 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" #include "fctsys.h"
@ -20,97 +46,99 @@
void FOOTPRINT_EDIT_FRAME::ReCreateHToolbar() void FOOTPRINT_EDIT_FRAME::ReCreateHToolbar()
{ {
if( m_HToolBar != NULL ) if( m_mainToolBar != NULL )
return; return;
wxString msg; 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 // Set up toolbar
m_HToolBar->AddTool( ID_MODEDIT_SELECT_CURRENT_LIB, wxEmptyString, m_mainToolBar->AddTool( ID_MODEDIT_SELECT_CURRENT_LIB, wxEmptyString,
KiBitmap( open_library_xpm ), KiBitmap( open_library_xpm ),
_( "Select active library" ) ); _( "Select active library" ) );
m_HToolBar->AddTool( ID_MODEDIT_SAVE_LIBMODULE, wxEmptyString, KiBitmap( save_library_xpm ), m_mainToolBar->AddTool( ID_MODEDIT_SAVE_LIBMODULE, wxEmptyString, KiBitmap( save_library_xpm ),
_( "Save module in active library" ) ); _( "Save module in active library" ) );
m_HToolBar->AddTool( ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART, wxEmptyString, m_mainToolBar->AddTool( ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART, wxEmptyString,
KiBitmap( new_library_xpm ), KiBitmap( new_library_xpm ),
_( "Create new library and save current module" ) ); _( "Create new library and save current module" ) );
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_HToolBar->AddTool( ID_MODEDIT_DELETE_PART, wxEmptyString, KiBitmap( delete_xpm ), m_mainToolBar->AddTool( ID_MODEDIT_DELETE_PART, wxEmptyString, KiBitmap( delete_xpm ),
_( "Delete part from active library" ) ); _( "Delete part from active library" ) );
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_HToolBar->AddTool( ID_MODEDIT_NEW_MODULE, wxEmptyString, KiBitmap( new_footprint_xpm ), m_mainToolBar->AddTool( ID_MODEDIT_NEW_MODULE, wxEmptyString, KiBitmap( new_footprint_xpm ),
_( "New module" ) ); _( "New module" ) );
m_HToolBar->AddTool( ID_MODEDIT_LOAD_MODULE, wxEmptyString, m_mainToolBar->AddTool( ID_MODEDIT_LOAD_MODULE, wxEmptyString,
KiBitmap( load_module_lib_xpm ), KiBitmap( load_module_lib_xpm ),
_( "Load module from library" ) ); _( "Load module from library" ) );
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_HToolBar->AddTool( ID_MODEDIT_LOAD_MODULE_FROM_BOARD, wxEmptyString, m_mainToolBar->AddTool( ID_MODEDIT_LOAD_MODULE_FROM_BOARD, wxEmptyString,
KiBitmap( load_module_board_xpm ), KiBitmap( load_module_board_xpm ),
_( "Load module from current board" ) ); _( "Load module from current board" ) );
m_HToolBar->AddTool( ID_MODEDIT_UPDATE_MODULE_IN_BOARD, wxEmptyString, m_mainToolBar->AddTool( ID_MODEDIT_UPDATE_MODULE_IN_BOARD, wxEmptyString,
KiBitmap( update_module_board_xpm ), KiBitmap( update_module_board_xpm ),
_( "Update module in current board" ) ); _( "Update module in current board" ) );
m_HToolBar->AddTool( ID_MODEDIT_INSERT_MODULE_IN_BOARD, wxEmptyString, m_mainToolBar->AddTool( ID_MODEDIT_INSERT_MODULE_IN_BOARD, wxEmptyString,
KiBitmap( insert_module_board_xpm ), KiBitmap( insert_module_board_xpm ),
_( "Insert module into current board" ) ); _( "Insert module into current board" ) );
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_HToolBar->AddTool( ID_MODEDIT_IMPORT_PART, wxEmptyString, KiBitmap( import_module_xpm ), m_mainToolBar->AddTool( ID_MODEDIT_IMPORT_PART, wxEmptyString, KiBitmap( import_module_xpm ),
_( "Import module" ) ); _( "Import module" ) );
m_HToolBar->AddTool( ID_MODEDIT_EXPORT_PART, wxEmptyString, KiBitmap( export_module_xpm ), m_mainToolBar->AddTool( ID_MODEDIT_EXPORT_PART, wxEmptyString, KiBitmap( export_module_xpm ),
_( "Export module" ) ); _( "Export module" ) );
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_HToolBar->AddTool( wxID_UNDO, wxEmptyString, KiBitmap( undo_xpm ), m_mainToolBar->AddTool( wxID_UNDO, wxEmptyString, KiBitmap( undo_xpm ),
_( "Undo last edition" ) ); _( "Undo last edition" ) );
m_HToolBar->AddTool( wxID_REDO, wxEmptyString, KiBitmap( redo_xpm ), m_mainToolBar->AddTool( wxID_REDO, wxEmptyString, KiBitmap( redo_xpm ),
_( "Redo the last undo command" ) ); _( "Redo the last undo command" ) );
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_HToolBar->AddTool( ID_MODEDIT_EDIT_MODULE_PROPERTIES, wxEmptyString, m_mainToolBar->AddTool( ID_MODEDIT_EDIT_MODULE_PROPERTIES, wxEmptyString,
KiBitmap( module_options_xpm ), KiBitmap( module_options_xpm ),
_( "Module properties" ) ); _( "Module properties" ) );
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_HToolBar->AddTool( wxID_PRINT, wxEmptyString, KiBitmap( print_button_xpm ), m_mainToolBar->AddTool( wxID_PRINT, wxEmptyString, KiBitmap( print_button_xpm ),
_( "Print module" ) ); _( "Print module" ) );
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
msg = AddHotkeyName( _( "Zoom in" ), g_Module_Editor_Hokeys_Descr, HK_ZOOM_IN, IS_COMMENT ); msg = AddHotkeyName( _( "Zoom in" ), g_Module_Editor_Hokeys_Descr, HK_ZOOM_IN, IS_COMMENT );
m_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 ); 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 ); msg = AddHotkeyName( _( "Redraw view" ), g_Module_Editor_Hokeys_Descr, HK_ZOOM_REDRAW,
m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, KiBitmap( zoom_redraw_xpm ), msg ); 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 ); 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_mainToolBar->AddSeparator();
m_HToolBar->AddTool( ID_MODEDIT_PAD_SETTINGS, wxEmptyString, KiBitmap( options_pad_xpm ), m_mainToolBar->AddTool( ID_MODEDIT_PAD_SETTINGS, wxEmptyString, KiBitmap( options_pad_xpm ),
_( "Pad settings" ) ); _( "Pad settings" ) );
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_HToolBar->AddTool( ID_MODEDIT_CHECK, wxEmptyString, m_mainToolBar->AddTool( ID_MODEDIT_CHECK, wxEmptyString,
KiBitmap( module_check_xpm ), KiBitmap( module_check_xpm ),
_( "Check module" ) ); _( "Check module" ) );
// after adding the buttons to the toolbar, must call Realize() to reflect the changes // after adding the buttons to the toolbar, must call Realize() to reflect the changes
m_HToolBar->Realize(); m_mainToolBar->Realize();
} }
@ -119,7 +147,8 @@ void FOOTPRINT_EDIT_FRAME::ReCreateVToolbar()
if( m_drawToolBar ) if( m_drawToolBar )
return; 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 // Set up toolbar
m_drawToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, KiBitmap( cursor_xpm ), m_drawToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, KiBitmap( cursor_xpm ),
@ -166,7 +195,8 @@ void FOOTPRINT_EDIT_FRAME::ReCreateOptToolbar()
return; return;
// Create options tool bar. // 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 ), m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString, KiBitmap( grid_xpm ),
_( "Hide grid" ), wxITEM_CHECK ); _( "Hide grid" ), wxITEM_CHECK );
@ -210,7 +240,8 @@ void FOOTPRINT_EDIT_FRAME::ReCreateAuxiliaryToolbar()
if( m_auxiliaryToolBar ) if( m_auxiliaryToolBar )
return; 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 // Set up toolbar
m_auxiliaryToolBar->AddSeparator(); m_auxiliaryToolBar->AddSeparator();

View File

@ -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 <stambaughw@verizon.net>
* 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 * @file tool_pcb.cpp
* @brief PCB editor tool bars * @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 */ * in order to delete the MemoryDC safely without deleting the bitmap */
iconDC.SelectObject( wxNullBitmap ); 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_mainToolBar->SetToolBitmap( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, *LayerPairBitmap );
m_HToolBar->Refresh(); m_mainToolBar->Refresh();
} }
} }
@ -180,108 +205,109 @@ void PCB_EDIT_FRAME::ReCreateHToolbar()
{ {
wxString msg; wxString msg;
if( m_HToolBar ) if( m_mainToolBar )
return; return;
wxWindowUpdateLocker dummy( this ); wxWindowUpdateLocker dummy( this );
m_HToolBar = new EDA_TOOLBAR( TOOLBAR_MAIN, this, ID_H_TOOLBAR, true ); m_mainToolBar = new wxAuiToolBar( this, ID_H_TOOLBAR, wxDefaultPosition, wxDefaultSize,
m_HToolBar->SetRows( 1 ); wxAUI_TB_DEFAULT_STYLE | wxAUI_TB_HORZ_LAYOUT );
// Set up toolbar // Set up toolbar
m_HToolBar->AddTool( ID_NEW_BOARD, wxEmptyString, KiBitmap( new_pcb_xpm ), m_mainToolBar->AddTool( ID_NEW_BOARD, wxEmptyString, KiBitmap( new_pcb_xpm ),
_( "New board" ) ); _( "New board" ) );
m_HToolBar->AddTool( ID_LOAD_FILE, wxEmptyString, KiBitmap( open_brd_file_xpm ), m_mainToolBar->AddTool( ID_LOAD_FILE, wxEmptyString, KiBitmap( open_brd_file_xpm ),
_( "Open existing board" ) ); _( "Open existing board" ) );
m_HToolBar->AddTool( ID_SAVE_BOARD, wxEmptyString, KiBitmap( save_xpm ), m_mainToolBar->AddTool( ID_SAVE_BOARD, wxEmptyString, KiBitmap( save_xpm ),
_( "Save board" ) ); _( "Save board" ) );
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_HToolBar->AddTool( ID_SHEET_SET, wxEmptyString, KiBitmap( sheetset_xpm ), m_mainToolBar->AddTool( ID_SHEET_SET, wxEmptyString, KiBitmap( sheetset_xpm ),
_( "Page settings for paper size and texts" ) ); _( "Page settings for paper size and texts" ) );
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_HToolBar->AddTool( ID_OPEN_MODULE_EDITOR, wxEmptyString, KiBitmap( modedit_xpm ), m_mainToolBar->AddTool( ID_OPEN_MODULE_EDITOR, wxEmptyString, KiBitmap( modedit_xpm ),
_( "Open module editor" ) ); _( "Open module editor" ) );
#if 0 #if 0
// Not yet existing commands // Not yet existing commands
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_HToolBar->AddTool( wxID_CUT, wxEmptyString, KiBitmap( cut_button_xpm ), m_mainToolBar->AddTool( wxID_CUT, wxEmptyString, KiBitmap( cut_button_xpm ),
_( "Cut selected item" ) ); _( "Cut selected item" ) );
m_HToolBar->AddTool( wxID_COPY, wxEmptyString, KiBitmap( copy_button_xpm ), m_mainToolBar->AddTool( wxID_COPY, wxEmptyString, KiBitmap( copy_button_xpm ),
_( "Copy selected item" ) ); _( "Copy selected item" ) );
m_HToolBar->AddTool( wxID_PASTE, wxEmptyString, KiBitmap( paste_xpm ), m_mainToolBar->AddTool( wxID_PASTE, wxEmptyString, KiBitmap( paste_xpm ),
_( "Paste" ) ); _( "Paste" ) );
#endif #endif
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
msg = AddHotkeyName( HELP_UNDO, g_Board_Editor_Hokeys_Descr, HK_UNDO, IS_COMMENT ); msg = AddHotkeyName( HELP_UNDO, g_Board_Editor_Hokeys_Descr, HK_UNDO, IS_COMMENT );
m_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 ); 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_mainToolBar->AddSeparator();
m_HToolBar->AddTool( wxID_PRINT, wxEmptyString, KiBitmap( print_button_xpm ), m_mainToolBar->AddTool( wxID_PRINT, wxEmptyString, KiBitmap( print_button_xpm ),
_( "Print board" ) ); _( "Print board" ) );
m_HToolBar->AddTool( ID_GEN_PLOT, wxEmptyString, KiBitmap( plot_xpm ), m_mainToolBar->AddTool( ID_GEN_PLOT, wxEmptyString, KiBitmap( plot_xpm ),
_( "Plot (HPGL, PostScript, or GERBER format)" ) ); _( "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 ); 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 ); 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 ); msg = AddHotkeyName( HELP_ZOOM_REDRAW, g_Board_Editor_Hokeys_Descr, HK_ZOOM_REDRAW,
m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString, KiBitmap( zoom_redraw_xpm ), msg ); 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 ); 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 ); 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_mainToolBar->AddSeparator();
m_HToolBar->AddTool( ID_GET_NETLIST, wxEmptyString, KiBitmap( netlist_xpm ), m_mainToolBar->AddTool( ID_GET_NETLIST, wxEmptyString, KiBitmap( netlist_xpm ),
_( "Read netlist" ) ); _( "Read netlist" ) );
m_HToolBar->AddTool( ID_DRC_CONTROL, wxEmptyString, KiBitmap( erc_xpm ), m_mainToolBar->AddTool( ID_DRC_CONTROL, wxEmptyString, KiBitmap( erc_xpm ),
_( "Perform design rules check" ) ); _( "Perform design rules check" ) );
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
if( m_SelLayerBox == NULL ) 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 ); ReCreateLayerBox( m_mainToolBar );
m_HToolBar->AddControl( m_SelLayerBox ); m_mainToolBar->AddControl( m_SelLayerBox );
PrepareLayerIndicator(); // Initialize the bitmap with current PrepareLayerIndicator(); // Initialize the bitmap with current
// active layer colors for the next tool // active layer colors for the next tool
m_HToolBar->AddTool( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, wxEmptyString, m_mainToolBar->AddTool( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, wxEmptyString,
*LayerPairBitmap, SEL_LAYER_HELP ); *LayerPairBitmap, SEL_LAYER_HELP );
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_HToolBar->AddTool( ID_TOOLBARH_PCB_MODE_MODULE, wxEmptyString, KiBitmap( mode_module_xpm ), m_mainToolBar->AddTool( ID_TOOLBARH_PCB_MODE_MODULE, wxEmptyString, KiBitmap( mode_module_xpm ),
_( "Mode footprint: manual and automatic move and place modules" ), _( "Mode footprint: manual and automatic move and place modules" ),
wxITEM_CHECK ); wxITEM_CHECK );
m_HToolBar->AddTool( ID_TOOLBARH_PCB_MODE_TRACKS, wxEmptyString, KiBitmap( mode_track_xpm ), m_mainToolBar->AddTool( ID_TOOLBARH_PCB_MODE_TRACKS, wxEmptyString, KiBitmap( mode_track_xpm ),
_( "Mode track: autorouting" ), wxITEM_CHECK ); _( "Mode track: autorouting" ), wxITEM_CHECK );
// Fast call to FreeROUTE Web Bases router // Fast call to FreeROUTE Web Bases router
m_HToolBar->AddSeparator(); m_mainToolBar->AddSeparator();
m_HToolBar->AddTool( ID_TOOLBARH_PCB_FREEROUTE_ACCESS, wxEmptyString, m_mainToolBar->AddTool( ID_TOOLBARH_PCB_FREEROUTE_ACCESS, wxEmptyString,
KiBitmap( web_support_xpm ), KiBitmap( web_support_xpm ),
_( "Fast access to the Web Based FreeROUTE advanced router" ) ); _( "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 // 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 ); 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 ), m_optionsToolBar->AddTool( ID_TB_OPTIONS_DRC_OFF, wxEmptyString, KiBitmap( drc_off_xpm ),
_( "Enable design rule checking" ), wxITEM_CHECK ); _( "Enable design rule checking" ), wxITEM_CHECK );
@ -327,15 +354,14 @@ void PCB_EDIT_FRAME::ReCreateOptToolbar()
wxITEM_CHECK ); wxITEM_CHECK );
m_optionsToolBar->AddSeparator(); m_optionsToolBar->AddSeparator();
m_optionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_ZONES, wxEmptyString, KiBitmap( show_zone_xpm ),
KiBitmap( show_zone_xpm ), wxNullBitmap, _( "Show filled areas in zones" ), wxITEM_CHECK );
_( "Show filled areas in zones" ) ); m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_ZONES_DISABLE, wxEmptyString,
m_optionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES_DISABLE, wxEmptyString, KiBitmap( show_zone_disable_xpm ),
KiBitmap( show_zone_disable_xpm ), _( "Do not show filled areas in zones" ) , wxITEM_CHECK );
wxNullBitmap, _( "Do not show filled areas in zones" )); m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY, wxEmptyString,
m_optionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY, wxEmptyString, KiBitmap( show_zone_outline_only_xpm ),
KiBitmap( show_zone_outline_only_xpm ), wxNullBitmap, _( "Show outlines of filled areas only in zones" ), wxITEM_CHECK );
_( "Show outlines of filled areas only in zones" ) );
m_optionsToolBar->AddSeparator(); m_optionsToolBar->AddSeparator();
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH, wxEmptyString, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH, wxEmptyString,
@ -384,7 +410,8 @@ void PCB_EDIT_FRAME::ReCreateVToolbar()
wxWindowUpdateLocker dummy( this ); 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 // Set up toolbar
m_drawToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, KiBitmap( cursor_xpm ), m_drawToolBar->AddTool( ID_NO_TOOL_SELECTED, wxEmptyString, KiBitmap( cursor_xpm ),
@ -456,7 +483,9 @@ void PCB_EDIT_FRAME::ReCreateMicrowaveVToolbar()
wxWindowUpdateLocker dummy(this); 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 // Set up toolbar
m_microWaveToolBar->AddTool( ID_PCB_MUWAVE_TOOL_SELF_CMD, wxEmptyString, m_microWaveToolBar->AddTool( ID_PCB_MUWAVE_TOOL_SELF_CMD, wxEmptyString,
@ -503,7 +532,8 @@ void PCB_EDIT_FRAME::ReCreateAuxiliaryToolbar()
if( m_auxiliaryToolBar ) if( m_auxiliaryToolBar )
return; 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 */ /* Set up toolbar items */
@ -617,11 +647,12 @@ void PCB_EDIT_FRAME::updateViaSizeSelectBox()
if( GetBoard()->m_ViaSizeSelector >= GetBoard()->m_ViasDimensionsList.size() ) if( GetBoard()->m_ViaSizeSelector >= GetBoard()->m_ViasDimensionsList.size() )
GetBoard()->m_ViaSizeSelector = 0; GetBoard()->m_ViaSizeSelector = 0;
m_SelViaSizeBox->SetSelection( GetBoard()->m_ViaSizeSelector ); 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 ) if( m_SelLayerBox == NULL )
return NULL; return NULL;

View File

@ -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 <stambaughw@verizon.net>
* 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 * @file toolbars_update_user_interface.cpp
* @brief Function to update toolbars UI after changing parameters. * @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 ) if( aEvent.GetEventObject() == m_drawToolBar )
aEvent.Check( GetToolId() == aEvent.GetId() ); 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 );
}

View File

@ -78,7 +78,7 @@ void DialogNonCopperZonesEditor::Init()
AddUnitSymbol( *m_MinThicknessValueTitle, g_UserUnit ); AddUnitSymbol( *m_MinThicknessValueTitle, g_UserUnit );
wxString msg = ReturnStringFromValue( g_UserUnit, wxString msg = ReturnStringFromValue( g_UserUnit,
m_Zone_Setting->m_ZoneMinThickness, m_Zone_Setting->m_ZoneMinThickness,
m_Parent->m_InternalUnits ); m_Parent->GetInternalUnits() );
m_ZoneMinThicknessCtrl->SetValue( msg ); m_ZoneMinThicknessCtrl->SetValue( msg );
if( g_Zone_45_Only ) if( g_Zone_45_Only )
@ -126,7 +126,7 @@ void DialogNonCopperZonesEditor::OnOkClick( wxCommandEvent& event )
{ {
wxString txtvalue = m_ZoneMinThicknessCtrl->GetValue(); wxString txtvalue = m_ZoneMinThicknessCtrl->GetValue();
m_Zone_Setting->m_ZoneMinThickness = 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 ) if( m_Zone_Setting->m_ZoneMinThickness < 10 )
{ {