2009-11-20 14:55:20 +00:00
|
|
|
/***************************************/
|
|
|
|
/* tool_pcb.cpp: PCB editor tool bars */
|
|
|
|
/***************************************/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#include "fctsys.h"
|
2010-07-27 12:47:08 +00:00
|
|
|
#include "wx/wupdlock.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
#include "pcbnew.h"
|
2009-07-30 11:04:07 +00:00
|
|
|
#include "wxPcbStruct.h"
|
2009-10-28 11:48:47 +00:00
|
|
|
#include "class_board_design_settings.h"
|
2010-01-29 20:36:12 +00:00
|
|
|
#include "colors_selection.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#include "bitmaps.h"
|
|
|
|
|
2009-09-22 12:27:57 +00:00
|
|
|
#include "pcbnew_id.h"
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#ifdef __UNIX__
|
2009-10-30 17:58:15 +00:00
|
|
|
#define LISTBOX_WIDTH 150
|
2007-06-05 12:10:51 +00:00
|
|
|
#else
|
2009-10-30 17:58:15 +00:00
|
|
|
#define LISTBOX_WIDTH 130
|
2007-06-05 12:10:51 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "wx/ownerdrw.h"
|
|
|
|
#include "wx/menuitem.h"
|
|
|
|
|
2007-08-30 08:15:05 +00:00
|
|
|
#include "hotkeys.h"
|
|
|
|
|
2010-06-30 11:15:34 +00:00
|
|
|
#include "help_common_strings.h"
|
|
|
|
|
2007-08-04 01:08:43 +00:00
|
|
|
#define SEL_LAYER_HELP _( \
|
|
|
|
"Show active layer selections\nand select layer pair for route and place via" )
|
2007-06-13 15:35:40 +00:00
|
|
|
|
|
|
|
/* Data to build the layer pair indicator button */
|
2007-08-30 08:15:05 +00:00
|
|
|
static wxBitmap* LayerPairBitmap = NULL;
|
2007-09-11 04:17:46 +00:00
|
|
|
|
2010-01-21 20:53:01 +00:00
|
|
|
static const char s_BitmapLayerIcon[16][16] = {
|
2007-08-04 01:08:43 +00:00
|
|
|
// 0 = draw pixel with active layer color
|
2009-11-20 14:55:20 +00:00
|
|
|
// 1 = draw pixel with top layer color (top/bottom layer used in
|
|
|
|
// autoroute and place via)
|
2007-08-04 01:08:43 +00:00
|
|
|
// 2 = draw pixel with bottom layer color
|
|
|
|
// 3 = draw pixel with via color
|
|
|
|
{ 0, 0, 0, 0, 0, 0, 0, 3, 3, 3, 1, 1, 1, 1, 0, 0 },
|
|
|
|
{ 0, 0, 0, 0, 0, 0, 3, 3, 3, 3, 3, 1, 1, 0, 0, 0 },
|
|
|
|
{ 0, 0, 0, 0, 0, 3, 3, 0, 1, 1, 3, 3, 0, 0, 0, 0 },
|
|
|
|
{ 2, 2, 2, 2, 3, 3, 0, 1, 1, 1, 1, 3, 3, 2, 2, 2 },
|
|
|
|
{ 2, 2, 2, 2, 3, 3, 1, 1, 1, 0, 0, 3, 3, 2, 2, 2 },
|
|
|
|
{ 2, 2, 2, 2, 3, 3, 1, 1, 1, 1, 0, 3, 3, 2, 2, 2 },
|
|
|
|
{ 0, 0, 0, 0, 0, 3, 3, 1, 1, 0, 3, 3, 0, 0, 0, 0 },
|
|
|
|
{ 0, 0, 0, 0, 0, 1, 3, 3, 3, 3, 3, 0, 0, 0, 0, 0 },
|
|
|
|
{ 0, 0, 0, 0, 0, 1, 1, 3, 3, 3, 0, 0, 0, 0, 0, 0 },
|
|
|
|
{ 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 },
|
|
|
|
{ 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 },
|
|
|
|
{ 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 },
|
|
|
|
{ 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 },
|
|
|
|
{ 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 },
|
|
|
|
{ 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 },
|
|
|
|
{ 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 }
|
2007-06-13 15:35:40 +00:00
|
|
|
};
|
2007-08-04 01:08:43 +00:00
|
|
|
|
|
|
|
|
2009-10-14 19:43:31 +00:00
|
|
|
/* Draw the icon for the "Select layer pair" bitmap tool
|
2007-08-04 01:08:43 +00:00
|
|
|
*/
|
2009-11-20 14:55:20 +00:00
|
|
|
void WinEDA_PcbFrame::PrepareLayerIndicator()
|
2007-06-13 15:35:40 +00:00
|
|
|
{
|
2007-08-04 01:08:43 +00:00
|
|
|
int ii, jj;
|
|
|
|
int active_layer_color, Route_Layer_TOP_color,
|
|
|
|
Route_Layer_BOTTOM_color, via_color;
|
|
|
|
bool change = false;
|
|
|
|
|
|
|
|
static int previous_active_layer_color, previous_Route_Layer_TOP_color,
|
|
|
|
previous_Route_Layer_BOTTOM_color, previous_via_color;
|
|
|
|
|
|
|
|
/* get colors, and redraw bitmap button only on changes */
|
2010-01-31 20:01:46 +00:00
|
|
|
active_layer_color = GetBoard()->GetLayerColor(getActiveLayer());
|
2007-08-04 01:08:43 +00:00
|
|
|
if( previous_active_layer_color != active_layer_color )
|
|
|
|
{
|
|
|
|
previous_active_layer_color = active_layer_color;
|
2009-10-01 16:46:13 +00:00
|
|
|
change = true;
|
2007-08-04 01:08:43 +00:00
|
|
|
}
|
2010-01-29 20:36:12 +00:00
|
|
|
Route_Layer_TOP_color = g_ColorsSettings.GetLayerColor(((PCB_SCREEN*)GetScreen())->m_Route_Layer_TOP);
|
2007-08-04 01:08:43 +00:00
|
|
|
if( previous_Route_Layer_TOP_color != Route_Layer_TOP_color )
|
|
|
|
{
|
|
|
|
previous_Route_Layer_TOP_color = Route_Layer_TOP_color;
|
2009-10-01 16:46:13 +00:00
|
|
|
change = true;
|
2007-08-04 01:08:43 +00:00
|
|
|
}
|
2010-01-29 20:36:12 +00:00
|
|
|
Route_Layer_BOTTOM_color = g_ColorsSettings.GetLayerColor(((PCB_SCREEN*)GetScreen())->m_Route_Layer_BOTTOM);
|
2007-08-04 01:08:43 +00:00
|
|
|
if( previous_Route_Layer_BOTTOM_color != Route_Layer_BOTTOM_color )
|
|
|
|
{
|
|
|
|
previous_Route_Layer_BOTTOM_color = Route_Layer_BOTTOM_color;
|
2009-10-01 16:46:13 +00:00
|
|
|
change = true;
|
2007-08-04 01:08:43 +00:00
|
|
|
}
|
2010-01-31 20:01:46 +00:00
|
|
|
|
|
|
|
int via_type = GetBoard()->GetBoardDesignSettings()->m_CurrentViaType;
|
|
|
|
via_color = GetBoard()->GetVisibleElementColor(VIAS_VISIBLE+via_type);
|
2007-08-04 01:08:43 +00:00
|
|
|
if( previous_via_color != via_color )
|
|
|
|
{
|
|
|
|
previous_via_color = via_color;
|
2009-10-01 16:46:13 +00:00
|
|
|
change = true;
|
2007-08-04 01:08:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if( !change && (LayerPairBitmap != NULL) )
|
|
|
|
return;
|
|
|
|
|
2009-10-14 19:43:31 +00:00
|
|
|
/* Create the bitmap too and its Memory DC, if not already made */
|
2007-08-04 01:08:43 +00:00
|
|
|
if( LayerPairBitmap == NULL )
|
|
|
|
{
|
|
|
|
LayerPairBitmap = new wxBitmap( 16, 16 );
|
|
|
|
}
|
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
/* Draw the icon, with colors according to the active layer and layer
|
|
|
|
* pairs for via command (change layer)
|
2007-08-04 01:08:43 +00:00
|
|
|
*/
|
|
|
|
wxMemoryDC iconDC;
|
|
|
|
iconDC.SelectObject( *LayerPairBitmap );
|
|
|
|
int buttcolor = -1;
|
|
|
|
wxPen pen;
|
|
|
|
for( ii = 0; ii < 16; ii++ )
|
|
|
|
{
|
|
|
|
for( jj = 0; jj < 16; jj++ )
|
|
|
|
{
|
|
|
|
if( s_BitmapLayerIcon[ii][jj] != buttcolor )
|
|
|
|
{
|
|
|
|
buttcolor = s_BitmapLayerIcon[ii][jj];
|
|
|
|
int color;
|
|
|
|
|
|
|
|
switch( buttcolor )
|
|
|
|
{
|
|
|
|
default:
|
|
|
|
case 0:
|
|
|
|
color = active_layer_color;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
color = Route_Layer_TOP_color;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
color = Route_Layer_BOTTOM_color;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 3:
|
|
|
|
color = via_color;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
color &= MASKCOLOR;
|
|
|
|
pen.SetColour(
|
|
|
|
ColorRefs[color].m_Red,
|
|
|
|
ColorRefs[color].m_Green,
|
|
|
|
ColorRefs[color].m_Blue
|
2007-08-30 08:15:05 +00:00
|
|
|
);
|
2007-08-04 01:08:43 +00:00
|
|
|
iconDC.SetPen( pen );
|
|
|
|
}
|
|
|
|
iconDC.DrawPoint( jj, ii );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Deselect the Tool Bitmap from DC,
|
|
|
|
* in order to delete the MemoryDC safely without deleting the bitmap */
|
|
|
|
iconDC.SelectObject( wxNullBitmap );
|
|
|
|
|
|
|
|
if( m_HToolBar )
|
|
|
|
{
|
2010-04-13 16:38:20 +00:00
|
|
|
m_HToolBar->SetToolBitmap( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR,
|
2008-12-05 16:03:05 +00:00
|
|
|
*LayerPairBitmap );
|
2010-04-13 16:38:20 +00:00
|
|
|
m_HToolBar->Realize();
|
2007-08-04 01:08:43 +00:00
|
|
|
}
|
2007-06-13 15:35:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-09-17 17:48:40 +00:00
|
|
|
/* Creates or updates the main horizontal toolbar for the board editor
|
2010-01-21 20:53:01 +00:00
|
|
|
*/
|
2009-11-20 14:55:20 +00:00
|
|
|
void WinEDA_PcbFrame::ReCreateHToolbar()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-08-30 08:15:05 +00:00
|
|
|
wxString msg;
|
2007-08-04 01:08:43 +00:00
|
|
|
|
|
|
|
if( m_HToolBar != NULL )
|
2008-04-29 03:18:02 +00:00
|
|
|
{
|
2007-08-04 01:08:43 +00:00
|
|
|
SetToolbars();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-07-27 12:47:08 +00:00
|
|
|
wxWindowUpdateLocker dummy(this);
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2009-10-01 16:46:13 +00:00
|
|
|
m_HToolBar = new WinEDA_Toolbar( TOOLBAR_MAIN, this, ID_H_TOOLBAR, true );
|
2007-08-04 01:08:43 +00:00
|
|
|
m_HToolBar->SetRows( 1 );
|
2010-02-08 18:15:42 +00:00
|
|
|
|
2007-08-04 01:08:43 +00:00
|
|
|
// Set up toolbar
|
2008-12-05 16:03:05 +00:00
|
|
|
m_HToolBar->AddTool( ID_NEW_BOARD, wxEmptyString, wxBitmap( new_xpm ),
|
2010-01-21 20:53:01 +00:00
|
|
|
_( "New board" ) );
|
2008-12-05 16:03:05 +00:00
|
|
|
m_HToolBar->AddTool( ID_LOAD_FILE, wxEmptyString, wxBitmap( open_xpm ),
|
2010-01-21 20:53:01 +00:00
|
|
|
_( "Open existing board" ) );
|
2008-12-05 16:03:05 +00:00
|
|
|
m_HToolBar->AddTool( ID_SAVE_BOARD, wxEmptyString, wxBitmap( save_xpm ),
|
2010-01-21 20:53:01 +00:00
|
|
|
_( "Save board" ) );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
|
|
|
m_HToolBar->AddSeparator();
|
2008-12-05 16:03:05 +00:00
|
|
|
m_HToolBar->AddTool( ID_SHEET_SET, wxEmptyString, wxBitmap( sheetset_xpm ),
|
2010-01-21 20:53:01 +00:00
|
|
|
_( "Page settings (size, texts)" ) );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
|
|
|
m_HToolBar->AddSeparator();
|
2008-12-05 16:03:05 +00:00
|
|
|
m_HToolBar->AddTool( ID_OPEN_MODULE_EDITOR, wxEmptyString,
|
2010-01-21 20:53:01 +00:00
|
|
|
wxBitmap( modedit_xpm ),
|
|
|
|
_( "Open module editor" ) );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
|
|
|
m_HToolBar->AddSeparator();
|
2008-12-05 16:03:05 +00:00
|
|
|
m_HToolBar->AddTool( wxID_CUT, wxEmptyString, wxBitmap( cut_button ),
|
2010-01-21 20:53:01 +00:00
|
|
|
_( "Cut selected item" ) );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
#if 0
|
2008-12-05 16:03:05 +00:00
|
|
|
m_HToolBar->AddTool( wxID_COPY, wxEmptyString, wxBitmap( copy_button ),
|
2010-01-21 20:53:01 +00:00
|
|
|
_( "Copy selected item" ) );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-12-05 16:03:05 +00:00
|
|
|
m_HToolBar->AddTool( wxID_PASTE, wxEmptyString, wxBitmap( paste_xpm ),
|
2010-01-21 20:53:01 +00:00
|
|
|
_( "Paste" ) );
|
2007-06-05 12:10:51 +00:00
|
|
|
#endif
|
|
|
|
|
2009-07-29 13:10:36 +00:00
|
|
|
m_HToolBar->AddSeparator();
|
2010-08-11 18:17:12 +00:00
|
|
|
msg = AddHotkeyName( HELP_UNDO, s_Board_Editor_Hokeys_Descr,
|
|
|
|
HK_UNDO, false );
|
2010-01-19 20:43:44 +00:00
|
|
|
m_HToolBar->AddTool( wxID_UNDO, wxEmptyString, wxBitmap( undo_xpm ),
|
2010-06-30 11:15:34 +00:00
|
|
|
HELP_UNDO );
|
2010-08-11 18:17:12 +00:00
|
|
|
msg = AddHotkeyName( HELP_REDO, s_Board_Editor_Hokeys_Descr,
|
|
|
|
HK_REDO, false );
|
2010-01-19 20:43:44 +00:00
|
|
|
m_HToolBar->AddTool( wxID_REDO, wxEmptyString, wxBitmap( redo_xpm ),
|
2010-06-30 11:15:34 +00:00
|
|
|
HELP_REDO );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
|
|
|
m_HToolBar->AddSeparator();
|
2010-07-29 20:00:24 +00:00
|
|
|
m_HToolBar->AddTool( wxID_PRINT, wxEmptyString, wxBitmap( print_button ),
|
2010-01-21 20:53:01 +00:00
|
|
|
_( "Print board" ) );
|
2008-12-05 16:03:05 +00:00
|
|
|
m_HToolBar->AddTool( ID_GEN_PLOT, wxEmptyString, wxBitmap( plot_xpm ),
|
2010-01-21 20:53:01 +00:00
|
|
|
_( "Plot (HPGL, PostScript, or GERBER format)" ) );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
|
|
|
m_HToolBar->AddSeparator();
|
2010-06-30 11:15:34 +00:00
|
|
|
msg = AddHotkeyName( HELP_ZOOM_IN, s_Board_Editor_Hokeys_Descr,
|
2010-02-16 10:42:57 +00:00
|
|
|
HK_ZOOM_IN, false );
|
2009-01-07 15:59:49 +00:00
|
|
|
m_HToolBar->AddTool( ID_ZOOM_IN, wxEmptyString, wxBitmap( zoom_in_xpm ),
|
2007-08-30 08:15:05 +00:00
|
|
|
msg );
|
|
|
|
|
2010-06-30 11:15:34 +00:00
|
|
|
msg = AddHotkeyName( HELP_ZOOM_OUT, s_Board_Editor_Hokeys_Descr,
|
2010-02-16 10:42:57 +00:00
|
|
|
HK_ZOOM_OUT, false );
|
2009-01-07 15:59:49 +00:00
|
|
|
m_HToolBar->AddTool( ID_ZOOM_OUT, wxEmptyString,
|
2008-12-05 16:03:05 +00:00
|
|
|
wxBitmap( zoom_out_xpm ), msg );
|
2007-08-30 08:15:05 +00:00
|
|
|
|
2010-06-30 11:15:34 +00:00
|
|
|
msg = AddHotkeyName( HELP_ZOOM_REDRAW, s_Board_Editor_Hokeys_Descr,
|
2010-02-16 10:42:57 +00:00
|
|
|
HK_ZOOM_REDRAW, false );
|
2009-01-07 15:59:49 +00:00
|
|
|
m_HToolBar->AddTool( ID_ZOOM_REDRAW, wxEmptyString,
|
2008-12-05 16:03:05 +00:00
|
|
|
wxBitmap( zoom_redraw_xpm ), msg );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2010-06-30 11:15:34 +00:00
|
|
|
msg = AddHotkeyName( HELP_ZOOM_FIT, s_Board_Editor_Hokeys_Descr,
|
2010-02-16 10:42:57 +00:00
|
|
|
HK_ZOOM_AUTO, false );
|
2009-01-07 15:59:49 +00:00
|
|
|
m_HToolBar->AddTool( ID_ZOOM_PAGE, wxEmptyString,
|
2009-09-27 14:09:26 +00:00
|
|
|
wxBitmap( zoom_auto_xpm ), msg );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
|
|
|
m_HToolBar->AddSeparator();
|
2010-06-30 11:15:34 +00:00
|
|
|
msg = AddHotkeyName( HELP_FIND, // Find components and texts
|
2008-12-05 16:03:05 +00:00
|
|
|
s_Board_Editor_Hokeys_Descr,
|
2010-02-16 10:42:57 +00:00
|
|
|
HK_FIND_ITEM, false );
|
2008-12-05 16:03:05 +00:00
|
|
|
m_HToolBar->AddTool( ID_FIND_ITEMS, wxEmptyString, wxBitmap( find_xpm ),
|
2007-08-30 08:15:05 +00:00
|
|
|
msg );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
|
|
|
m_HToolBar->AddSeparator();
|
2008-12-05 16:03:05 +00:00
|
|
|
m_HToolBar->AddTool( ID_GET_NETLIST, wxEmptyString, wxBitmap( netlist_xpm ),
|
2010-01-21 20:53:01 +00:00
|
|
|
_( "Read netlist" ) );
|
2008-12-05 16:03:05 +00:00
|
|
|
m_HToolBar->AddTool( ID_DRC_CONTROL, wxEmptyString, wxBitmap( erc_xpm ),
|
2010-01-21 20:53:01 +00:00
|
|
|
_( "Perform design rules check" ) );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
|
|
|
m_HToolBar->AddSeparator();
|
2008-04-29 13:35:26 +00:00
|
|
|
|
2007-08-04 01:08:43 +00:00
|
|
|
ReCreateLayerBox( m_HToolBar );
|
2009-11-20 14:55:20 +00:00
|
|
|
PrepareLayerIndicator(); // Initialize the bitmap with current
|
|
|
|
// active layer colors for the next tool
|
2008-12-05 16:03:05 +00:00
|
|
|
m_HToolBar->AddTool( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, wxEmptyString,
|
|
|
|
*LayerPairBitmap, SEL_LAYER_HELP );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
|
|
|
m_HToolBar->AddSeparator();
|
2010-08-17 10:41:44 +00:00
|
|
|
m_HToolBar->AddTool( ID_TOOLBARH_PCB_MODE_MODULE, wxEmptyString,
|
2008-12-05 16:03:05 +00:00
|
|
|
wxBitmap( mode_module_xpm ),
|
2010-08-11 18:17:12 +00:00
|
|
|
_( "Mode footprint: manual and automatic move and place modules" ),
|
2007-08-04 01:08:43 +00:00
|
|
|
wxITEM_CHECK );
|
2010-08-17 10:41:44 +00:00
|
|
|
m_HToolBar->AddTool( ID_TOOLBARH_PCB_MODE_TRACKS, wxEmptyString,
|
2008-12-05 16:03:05 +00:00
|
|
|
wxBitmap( mode_track_xpm ),
|
2010-08-11 18:17:12 +00:00
|
|
|
_( "Mode track: autorouting" ), wxITEM_CHECK );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2008-04-29 03:18:02 +00:00
|
|
|
// Fast call to FreeROUTE Web Bases router
|
2008-03-14 10:09:39 +00:00
|
|
|
m_HToolBar->AddSeparator();
|
2008-12-05 16:03:05 +00:00
|
|
|
m_HToolBar->AddTool( ID_TOOLBARH_PCB_FREEROUTE_ACCESS, wxEmptyString,
|
2010-01-21 20:53:01 +00:00
|
|
|
wxBitmap( web_support_xpm ),
|
2010-06-30 11:15:34 +00:00
|
|
|
_( "Fast access to the Web Based FreeROUTE advanced router" ) );
|
2008-04-29 03:18:02 +00:00
|
|
|
|
2010-10-19 19:18:30 +00:00
|
|
|
m_HToolBar->AddSeparator();
|
2008-04-29 03:18:02 +00:00
|
|
|
// after adding the buttons to the toolbar, must call Realize() to reflect
|
2007-08-04 01:08:43 +00:00
|
|
|
// the changes
|
|
|
|
|
|
|
|
m_HToolBar->Realize();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
void WinEDA_PcbFrame::ReCreateOptToolbar()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-08-04 01:08:43 +00:00
|
|
|
if( m_OptionsToolBar )
|
|
|
|
return;
|
|
|
|
|
2010-07-27 12:47:08 +00:00
|
|
|
wxWindowUpdateLocker dummy(this);
|
|
|
|
|
2008-12-05 16:03:05 +00:00
|
|
|
m_OptionsToolBar = new WinEDA_Toolbar( TOOLBAR_OPTION, this,
|
|
|
|
ID_OPT_TOOLBAR, FALSE );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2008-12-05 16:03:05 +00:00
|
|
|
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_DRC_OFF, wxEmptyString,
|
|
|
|
wxBitmap( drc_off_xpm ),
|
2009-11-20 14:55:20 +00:00
|
|
|
_( "Enable design rule checking" ),
|
|
|
|
wxITEM_CHECK );
|
2008-12-05 16:03:05 +00:00
|
|
|
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString,
|
|
|
|
wxBitmap( grid_xpm ),
|
2009-11-20 14:55:20 +00:00
|
|
|
_( "Hide grid" ), wxITEM_CHECK );
|
2007-08-04 01:08:43 +00:00
|
|
|
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString,
|
2008-12-05 16:03:05 +00:00
|
|
|
wxBitmap( polar_coord_xpm ),
|
2009-11-20 14:55:20 +00:00
|
|
|
_( "Display polar coordinates" ), wxITEM_CHECK );
|
2007-08-04 01:08:43 +00:00
|
|
|
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, wxEmptyString,
|
2008-12-05 16:03:05 +00:00
|
|
|
wxBitmap( unit_inch_xpm ),
|
|
|
|
_( "Units in inches" ), wxITEM_CHECK );
|
2007-08-04 01:08:43 +00:00
|
|
|
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_MM, wxEmptyString,
|
2008-12-05 16:03:05 +00:00
|
|
|
wxBitmap( unit_mm_xpm ),
|
|
|
|
_( "Units in millimeters" ), wxITEM_CHECK );
|
2007-08-04 01:08:43 +00:00
|
|
|
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString,
|
2008-12-05 16:03:05 +00:00
|
|
|
wxBitmap( cursor_shape_xpm ),
|
2009-11-20 14:55:20 +00:00
|
|
|
_( "Change cursor shape" ), wxITEM_CHECK );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
|
|
|
m_OptionsToolBar->AddSeparator();
|
|
|
|
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_RATSNEST, wxEmptyString,
|
2008-12-05 16:03:05 +00:00
|
|
|
wxBitmap( general_ratsnet_xpm ),
|
2009-11-20 14:55:20 +00:00
|
|
|
_( "Show board ratsnest" ), wxITEM_CHECK );
|
2007-08-04 01:08:43 +00:00
|
|
|
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MODULE_RATSNEST, wxEmptyString,
|
2008-12-05 16:03:05 +00:00
|
|
|
wxBitmap( local_ratsnet_xpm ),
|
2009-11-20 14:55:20 +00:00
|
|
|
_( "Show module ratsnest when moving" ),
|
2008-12-05 16:03:05 +00:00
|
|
|
wxITEM_CHECK );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
|
|
|
m_OptionsToolBar->AddSeparator();
|
|
|
|
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_AUTO_DEL_TRACK, wxEmptyString,
|
2008-12-05 16:03:05 +00:00
|
|
|
wxBitmap( auto_delete_track_xpm ),
|
2009-11-20 14:55:20 +00:00
|
|
|
_( "Enable automatic track deletion" ),
|
|
|
|
wxITEM_CHECK );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
|
|
|
m_OptionsToolBar->AddSeparator();
|
2008-12-12 21:30:07 +00:00
|
|
|
m_OptionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES, wxEmptyString,
|
2010-01-21 20:53:01 +00:00
|
|
|
wxBitmap( show_zone_xpm ), wxNullBitmap,
|
|
|
|
_( "Show filled areas in zones" ) );
|
2009-11-20 14:55:20 +00:00
|
|
|
m_OptionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES_DISABLE,
|
2010-01-21 20:53:01 +00:00
|
|
|
wxEmptyString,
|
|
|
|
wxBitmap( show_zone_disable_xpm ),
|
|
|
|
wxNullBitmap,
|
|
|
|
_( "Do not show filled areas in zones" ));
|
2009-11-20 14:55:20 +00:00
|
|
|
m_OptionsToolBar->AddRadioTool( ID_TB_OPTIONS_SHOW_ZONES_OUTLINES_ONLY,
|
2010-01-21 20:53:01 +00:00
|
|
|
wxEmptyString,
|
|
|
|
wxBitmap( show_zone_outline_only_xpm ),
|
|
|
|
wxNullBitmap,
|
|
|
|
_( "Show outlines of filled areas only in zones" ) );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
|
|
|
m_OptionsToolBar->AddSeparator();
|
|
|
|
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_PADS_SKETCH, wxEmptyString,
|
2008-12-05 16:03:05 +00:00
|
|
|
wxBitmap( pad_sketch_xpm ),
|
2009-11-20 14:55:20 +00:00
|
|
|
_( "Show pads in outline mode" ), wxITEM_CHECK );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2009-09-29 04:44:35 +00:00
|
|
|
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_VIAS_SKETCH, wxEmptyString,
|
|
|
|
wxBitmap( via_sketch_xpm ),
|
2009-11-20 14:55:20 +00:00
|
|
|
_( "Show vias in outline mode" ), wxITEM_CHECK );
|
2009-09-29 04:44:35 +00:00
|
|
|
|
2007-08-04 01:08:43 +00:00
|
|
|
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_TRACKS_SKETCH, wxEmptyString,
|
2008-12-05 16:03:05 +00:00
|
|
|
wxBitmap( showtrack_xpm ),
|
2009-11-20 14:55:20 +00:00
|
|
|
_( "Show tracks in outline mode" ),
|
|
|
|
wxITEM_CHECK );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2009-06-19 20:13:22 +00:00
|
|
|
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
|
2008-12-05 16:03:05 +00:00
|
|
|
wxEmptyString,
|
|
|
|
wxBitmap( palette_xpm ),
|
2009-11-20 14:55:20 +00:00
|
|
|
_( "Enable high contrast display mode" ),
|
2008-12-05 16:03:05 +00:00
|
|
|
wxITEM_CHECK );
|
2009-06-19 20:13:22 +00:00
|
|
|
m_OptionsToolBar->ToggleTool( ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE,
|
2007-08-04 01:08:43 +00:00
|
|
|
DisplayOpt.ContrastModeDisplay );
|
2009-06-19 20:13:22 +00:00
|
|
|
|
2010-01-24 13:46:01 +00:00
|
|
|
// Tools to show/hide toolbars:
|
2007-08-04 01:08:43 +00:00
|
|
|
m_OptionsToolBar->AddSeparator();
|
2010-01-24 02:05:07 +00:00
|
|
|
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR,
|
|
|
|
wxEmptyString,
|
|
|
|
wxBitmap( layers_manager_xpm ),
|
2010-06-30 11:15:34 +00:00
|
|
|
HELP_SHOW_HIDE_LAYERMANAGER,
|
2010-01-24 02:05:07 +00:00
|
|
|
wxITEM_CHECK );
|
|
|
|
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1,
|
2008-12-05 16:03:05 +00:00
|
|
|
wxEmptyString,
|
|
|
|
wxBitmap( mw_toolbar_xpm ),
|
2010-01-22 12:55:29 +00:00
|
|
|
_( "Show/hide the toolbar for microwaves tools\n This is a experimental feature (under development)" ),
|
2007-08-04 01:08:43 +00:00
|
|
|
wxITEM_CHECK );
|
2010-01-22 12:55:29 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-10-19 19:18:30 +00:00
|
|
|
m_OptionsToolBar->AddSeparator();
|
2007-08-04 01:08:43 +00:00
|
|
|
m_OptionsToolBar->Realize();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Create the main vertical right toolbar, showing usual tools
|
2007-08-04 01:08:43 +00:00
|
|
|
*/
|
2009-11-20 14:55:20 +00:00
|
|
|
void WinEDA_PcbFrame::ReCreateVToolbar()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-08-04 01:08:43 +00:00
|
|
|
if( m_VToolBar )
|
|
|
|
return;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-07-27 12:47:08 +00:00
|
|
|
wxWindowUpdateLocker dummy(this);
|
|
|
|
|
2007-08-04 01:08:43 +00:00
|
|
|
m_VToolBar = new WinEDA_Toolbar( TOOLBAR_TOOL, this, ID_V_TOOLBAR, FALSE );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-04 01:08:43 +00:00
|
|
|
// Set up toolbar
|
|
|
|
m_VToolBar->AddTool( ID_NO_SELECT_BUTT, wxEmptyString,
|
2008-12-05 16:03:05 +00:00
|
|
|
wxBitmap( cursor_xpm ), wxEmptyString, wxITEM_CHECK );
|
2009-10-01 16:46:13 +00:00
|
|
|
m_VToolBar->ToggleTool( ID_NO_SELECT_BUTT, true );
|
2007-08-04 01:08:43 +00:00
|
|
|
m_VToolBar->AddSeparator();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-04 01:08:43 +00:00
|
|
|
m_VToolBar->AddTool( ID_PCB_HIGHLIGHT_BUTT, wxEmptyString,
|
2010-01-24 13:46:01 +00:00
|
|
|
wxBitmap( net_highlight_xpm ), _( "Highlight net" ),
|
2008-12-05 16:03:05 +00:00
|
|
|
wxITEM_CHECK );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-04 01:08:43 +00:00
|
|
|
m_VToolBar->AddTool( ID_PCB_SHOW_1_RATSNEST_BUTT, wxEmptyString,
|
2008-12-05 16:03:05 +00:00
|
|
|
wxBitmap( tool_ratsnet_xpm ),
|
2009-10-27 13:48:24 +00:00
|
|
|
_( "Display local ratsnest" ),
|
2008-12-05 16:03:05 +00:00
|
|
|
wxITEM_CHECK );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-04 01:08:43 +00:00
|
|
|
m_VToolBar->AddSeparator();
|
|
|
|
m_VToolBar->AddTool( ID_COMPONENT_BUTT, wxEmptyString,
|
2008-12-05 16:03:05 +00:00
|
|
|
wxBitmap( module_xpm ),
|
2007-08-04 01:08:43 +00:00
|
|
|
_( "Add modules" ), wxITEM_CHECK );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-04 01:08:43 +00:00
|
|
|
m_VToolBar->AddTool( ID_TRACK_BUTT, wxEmptyString,
|
2008-12-05 16:03:05 +00:00
|
|
|
wxBitmap( add_tracks_xpm ),
|
2007-10-12 03:24:46 +00:00
|
|
|
_( "Add tracks and vias" ), wxITEM_CHECK );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-04 01:08:43 +00:00
|
|
|
m_VToolBar->AddTool( ID_PCB_ZONES_BUTT, wxEmptyString,
|
2008-12-05 16:03:05 +00:00
|
|
|
wxBitmap( add_zone_xpm ),
|
2007-10-12 03:24:46 +00:00
|
|
|
_( "Add zones" ), wxITEM_CHECK );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-04 01:08:43 +00:00
|
|
|
m_VToolBar->AddSeparator();
|
2009-09-22 12:27:57 +00:00
|
|
|
m_VToolBar->AddTool( ID_PCB_ADD_LINE_BUTT, wxEmptyString,
|
2008-12-05 16:03:05 +00:00
|
|
|
wxBitmap( add_dashed_line_xpm ),
|
2007-08-04 01:08:43 +00:00
|
|
|
_( "Add graphic line or polygon" ), wxITEM_CHECK );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-04 01:08:43 +00:00
|
|
|
m_VToolBar->AddTool( ID_PCB_CIRCLE_BUTT, wxEmptyString,
|
2008-12-05 16:03:05 +00:00
|
|
|
wxBitmap( add_circle_xpm ),
|
2007-08-04 01:08:43 +00:00
|
|
|
_( "Add graphic circle" ), wxITEM_CHECK );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-04 01:08:43 +00:00
|
|
|
m_VToolBar->AddTool( ID_PCB_ARC_BUTT, wxEmptyString,
|
2008-12-05 16:03:05 +00:00
|
|
|
wxBitmap( add_arc_xpm ),
|
2007-08-04 01:08:43 +00:00
|
|
|
_( "Add graphic arc" ), wxITEM_CHECK );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2009-09-22 12:27:57 +00:00
|
|
|
m_VToolBar->AddTool( ID_PCB_ADD_TEXT_BUTT, wxEmptyString,
|
2008-12-05 16:03:05 +00:00
|
|
|
wxBitmap( add_text_xpm ),
|
2007-10-12 03:24:46 +00:00
|
|
|
_( "Add text" ), wxITEM_CHECK );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-04 01:08:43 +00:00
|
|
|
m_VToolBar->AddSeparator();
|
2010-04-23 09:54:40 +00:00
|
|
|
m_VToolBar->AddTool( ID_PCB_DIMENSION_BUTT, wxEmptyString,
|
2010-01-18 12:37:53 +00:00
|
|
|
wxBitmap( add_dimension_xpm ),
|
2007-10-12 03:24:46 +00:00
|
|
|
_( "Add dimension" ), wxITEM_CHECK );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-04 01:08:43 +00:00
|
|
|
m_VToolBar->AddTool( ID_PCB_MIRE_BUTT, wxEmptyString,
|
2008-12-05 16:03:05 +00:00
|
|
|
wxBitmap( add_mires_xpm ),
|
2007-10-10 14:08:26 +00:00
|
|
|
_( "Add layer alignment target" ), wxITEM_CHECK );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-04 01:08:43 +00:00
|
|
|
m_VToolBar->AddSeparator();
|
|
|
|
m_VToolBar->AddTool( ID_PCB_DELETE_ITEM_BUTT, wxEmptyString,
|
2008-12-05 16:03:05 +00:00
|
|
|
wxBitmap( delete_body_xpm ),
|
2007-08-04 01:08:43 +00:00
|
|
|
_( "Delete items" ), wxITEM_CHECK );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2007-08-04 01:08:43 +00:00
|
|
|
m_VToolBar->AddSeparator();
|
|
|
|
m_VToolBar->AddTool( ID_PCB_PLACE_OFFSET_COORD_BUTT, wxEmptyString,
|
2008-12-05 16:03:05 +00:00
|
|
|
wxBitmap( pcb_offset_xpm ),
|
|
|
|
_( "Offset adjust for drill and place files" ),
|
|
|
|
wxITEM_CHECK );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-07-13 10:42:32 +00:00
|
|
|
m_VToolBar->AddTool( ID_PCB_PLACE_GRID_COORD_BUTT, wxEmptyString,
|
|
|
|
wxBitmap( grid_select_axis_xpm ),
|
|
|
|
_( "Set the origin point for the grid" ),
|
|
|
|
wxITEM_CHECK );
|
|
|
|
|
2007-08-04 01:08:43 +00:00
|
|
|
m_VToolBar->Realize();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
/* Create the auxiliary vertical right toolbar, showing tools for
|
|
|
|
* microwave applications
|
2007-08-04 01:08:43 +00:00
|
|
|
*/
|
2010-07-17 11:14:57 +00:00
|
|
|
void WinEDA_PcbFrame::ReCreateMicrowaveVToolbar()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-08-04 01:08:43 +00:00
|
|
|
if( m_AuxVToolBar )
|
|
|
|
return;
|
|
|
|
|
2010-07-27 12:47:08 +00:00
|
|
|
wxWindowUpdateLocker dummy(this);
|
|
|
|
|
2008-12-05 16:03:05 +00:00
|
|
|
m_AuxVToolBar = new WinEDA_Toolbar( TOOLBAR_TOOL, this,
|
2010-07-17 11:14:57 +00:00
|
|
|
ID_MICROWAVE_V_TOOLBAR, FALSE );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
|
|
|
// Set up toolbar
|
2009-05-02 07:35:04 +00:00
|
|
|
m_AuxVToolBar->AddTool( ID_PCB_MUWAVE_TOOL_SELF_CMD, wxEmptyString,
|
2010-01-21 20:53:01 +00:00
|
|
|
wxBitmap( mw_Add_Line_xpm ),
|
|
|
|
_( "Create line of specified length for microwave applications" ) );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2009-05-02 07:35:04 +00:00
|
|
|
m_AuxVToolBar->AddTool( ID_PCB_MUWAVE_TOOL_GAP_CMD, wxEmptyString,
|
2010-01-21 20:53:01 +00:00
|
|
|
wxBitmap( mw_Add_Gap_xpm ),
|
|
|
|
_( "Create gap of specified length for microwave applications" ) );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
|
|
|
m_AuxVToolBar->AddSeparator();
|
|
|
|
|
2009-05-02 07:35:04 +00:00
|
|
|
m_AuxVToolBar->AddTool( ID_PCB_MUWAVE_TOOL_STUB_CMD, wxEmptyString,
|
2010-01-21 20:53:01 +00:00
|
|
|
wxBitmap( mw_Add_Stub_xpm ),
|
|
|
|
_( "Create stub of specified length for microwave applications" ) );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2009-05-02 07:35:04 +00:00
|
|
|
m_AuxVToolBar->AddTool( ID_PCB_MUWAVE_TOOL_STUB_ARC_CMD, wxEmptyString,
|
2008-12-05 16:03:05 +00:00
|
|
|
wxBitmap( mw_Add_stub_arc_xpm ),
|
2007-08-04 01:08:43 +00:00
|
|
|
_( "Create stub (arc) of specified length for microwave applications" )
|
2007-08-30 08:15:05 +00:00
|
|
|
);
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2009-05-02 07:35:04 +00:00
|
|
|
m_AuxVToolBar->AddTool( ID_PCB_MUWAVE_TOOL_FUNCTION_SHAPE_CMD, wxEmptyString,
|
2010-01-21 20:53:01 +00:00
|
|
|
wxBitmap( mw_Add_Shape_xpm ),
|
|
|
|
_( "Create a polynomial shape for microwave applications" ) );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
|
|
|
m_AuxVToolBar->Realize();
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2009-10-03 17:18:08 +00:00
|
|
|
/* Creates auxiliary horizontal toolbar
|
2008-01-28 18:44:14 +00:00
|
|
|
* displays:
|
|
|
|
* existing track width choice
|
|
|
|
* selection for auto track width
|
|
|
|
* existing via size choice
|
2009-10-03 17:18:08 +00:00
|
|
|
* Current strategy (to choose the track and via sizes)
|
2008-01-28 18:44:14 +00:00
|
|
|
* grid size choice
|
|
|
|
* zoom level choice
|
2007-08-04 01:08:43 +00:00
|
|
|
*/
|
2009-11-20 14:55:20 +00:00
|
|
|
void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar()
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2008-12-05 16:03:05 +00:00
|
|
|
size_t i;
|
2007-08-04 01:08:43 +00:00
|
|
|
wxString msg;
|
|
|
|
|
2010-07-27 12:47:08 +00:00
|
|
|
wxWindowUpdateLocker dummy(this);
|
|
|
|
|
2007-08-04 01:08:43 +00:00
|
|
|
if( m_AuxiliaryToolBar == NULL )
|
|
|
|
{
|
2008-12-05 16:03:05 +00:00
|
|
|
m_AuxiliaryToolBar = new WinEDA_Toolbar( TOOLBAR_AUX, this,
|
2009-10-01 16:46:13 +00:00
|
|
|
ID_AUX_TOOLBAR, true );
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2009-10-03 17:18:08 +00:00
|
|
|
m_TrackAndViasSizesList_Changed = true;
|
|
|
|
|
|
|
|
/* Set up toolbar items */
|
|
|
|
|
|
|
|
// Creates box to display and choose tracks widths:
|
2007-08-04 01:08:43 +00:00
|
|
|
m_SelTrackWidthBox = new WinEDAChoiceBox( m_AuxiliaryToolBar,
|
2010-01-21 20:53:01 +00:00
|
|
|
ID_AUX_TOOLBAR_PCB_TRACK_WIDTH,
|
|
|
|
wxPoint( -1, -1 ),
|
|
|
|
wxSize( LISTBOX_WIDTH, -1 ) );
|
2007-08-04 01:08:43 +00:00
|
|
|
m_AuxiliaryToolBar->AddControl( m_SelTrackWidthBox );
|
2009-10-14 19:43:31 +00:00
|
|
|
m_AuxiliaryToolBar->AddSeparator();
|
2009-10-03 17:18:08 +00:00
|
|
|
|
|
|
|
// Creates box to display and choose vias diameters:
|
|
|
|
m_SelViaSizeBox = new WinEDAChoiceBox( m_AuxiliaryToolBar,
|
2010-01-21 20:53:01 +00:00
|
|
|
ID_AUX_TOOLBAR_PCB_VIA_SIZE,
|
|
|
|
wxPoint( -1, -1 ),
|
|
|
|
wxSize( (LISTBOX_WIDTH*12)/10, -1 ) );
|
2009-10-03 17:18:08 +00:00
|
|
|
m_AuxiliaryToolBar->AddControl( m_SelViaSizeBox );
|
2009-10-14 19:43:31 +00:00
|
|
|
m_AuxiliaryToolBar->AddSeparator();
|
2009-10-03 17:18:08 +00:00
|
|
|
|
|
|
|
// Creates box to display tracks and vias clearance:
|
2009-10-14 19:43:31 +00:00
|
|
|
m_ClearanceBox = new wxTextCtrl( m_AuxiliaryToolBar, -1,
|
|
|
|
wxEmptyString, wxPoint( -1, -1 ),
|
2009-10-30 17:58:15 +00:00
|
|
|
wxSize( LISTBOX_WIDTH + 10, -1 ),
|
2009-10-14 19:43:31 +00:00
|
|
|
wxTE_READONLY );
|
2010-01-21 20:53:01 +00:00
|
|
|
m_ClearanceBox->SetToolTip(_("Current NetClass clearance value") );
|
2009-10-18 23:22:26 +00:00
|
|
|
m_AuxiliaryToolBar->AddControl( m_ClearanceBox );
|
2009-10-14 19:43:31 +00:00
|
|
|
m_AuxiliaryToolBar->AddSeparator();
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2009-10-03 17:18:08 +00:00
|
|
|
// Creates box to display the current NetClass:
|
2009-10-14 19:43:31 +00:00
|
|
|
m_NetClassSelectedBox = new wxTextCtrl( m_AuxiliaryToolBar, -1,
|
|
|
|
wxEmptyString, wxPoint( -1, -1 ),
|
|
|
|
wxSize( LISTBOX_WIDTH, -1 ),
|
|
|
|
wxTE_READONLY );
|
2010-01-21 20:53:01 +00:00
|
|
|
m_NetClassSelectedBox->SetToolTip(_("Name of the current NetClass") );
|
2009-10-18 23:22:26 +00:00
|
|
|
m_AuxiliaryToolBar->AddControl( m_NetClassSelectedBox );
|
2009-10-14 19:43:31 +00:00
|
|
|
m_AuxiliaryToolBar->AddSeparator();
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2009-10-14 19:43:31 +00:00
|
|
|
// Creates box to display and choose strategy to handle tracks an
|
|
|
|
// vias sizes:
|
2009-10-03 17:18:08 +00:00
|
|
|
m_AuxiliaryToolBar->AddTool( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH,
|
|
|
|
wxEmptyString,
|
|
|
|
wxBitmap( auto_track_width_xpm ),
|
2010-01-21 20:53:01 +00:00
|
|
|
_( "Auto track width: when starting on \
|
|
|
|
an existing track use its width\notherwise, use current width setting" ),
|
2009-10-03 17:18:08 +00:00
|
|
|
wxITEM_CHECK );
|
|
|
|
|
|
|
|
// Add the box to display and select the current grid size:
|
2009-09-27 11:00:21 +00:00
|
|
|
m_AuxiliaryToolBar->AddSeparator();
|
2007-08-04 01:08:43 +00:00
|
|
|
m_SelGridBox = new WinEDAChoiceBox( m_AuxiliaryToolBar,
|
2010-01-21 20:53:01 +00:00
|
|
|
ID_ON_GRID_SELECT,
|
|
|
|
wxPoint( -1, -1 ),
|
|
|
|
wxSize( LISTBOX_WIDTH, -1 ) );
|
2007-08-04 01:08:43 +00:00
|
|
|
m_AuxiliaryToolBar->AddControl( m_SelGridBox );
|
|
|
|
|
2009-10-03 17:18:08 +00:00
|
|
|
// Add the box to display and select the current Zoom
|
2007-08-04 01:08:43 +00:00
|
|
|
m_AuxiliaryToolBar->AddSeparator();
|
|
|
|
m_SelZoomBox = new WinEDAChoiceBox( m_AuxiliaryToolBar,
|
2010-01-21 20:53:01 +00:00
|
|
|
ID_ON_ZOOM_SELECT,
|
|
|
|
wxPoint( -1, -1 ),
|
|
|
|
wxSize( LISTBOX_WIDTH, -1 ) );
|
2007-08-04 01:08:43 +00:00
|
|
|
msg = _( "Auto" );
|
|
|
|
m_SelZoomBox->Append( msg );
|
2010-01-21 20:53:01 +00:00
|
|
|
for( int i = 0; i < (int)GetScreen()->m_ZoomList.GetCount(); i++ )
|
2007-08-04 01:08:43 +00:00
|
|
|
{
|
2009-01-29 14:26:20 +00:00
|
|
|
msg = _( "Zoom " );
|
2010-01-21 20:53:01 +00:00
|
|
|
if ( (GetScreen()->m_ZoomList[i] % GetScreen()->m_ZoomScalar) == 0 )
|
2009-01-31 10:05:16 +00:00
|
|
|
msg << GetScreen()->m_ZoomList[i] / GetScreen()->m_ZoomScalar;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
wxString value;
|
2009-10-14 19:43:31 +00:00
|
|
|
value.Printf( wxT( "%.1f" ),
|
2010-01-21 20:53:01 +00:00
|
|
|
(float)GetScreen()->m_ZoomList[i] /
|
2009-10-14 19:43:31 +00:00
|
|
|
GetScreen()->m_ZoomScalar );
|
2009-01-31 10:05:16 +00:00
|
|
|
msg += value;
|
|
|
|
}
|
2007-08-04 01:08:43 +00:00
|
|
|
m_SelZoomBox->Append( msg );
|
|
|
|
}
|
|
|
|
|
|
|
|
m_AuxiliaryToolBar->AddControl( m_SelZoomBox );
|
|
|
|
|
|
|
|
// after adding the buttons to the toolbar, must call Realize()
|
|
|
|
m_AuxiliaryToolBar->Realize();
|
|
|
|
}
|
|
|
|
|
2009-10-03 17:18:08 +00:00
|
|
|
// Update displayed values
|
2007-08-04 01:08:43 +00:00
|
|
|
m_SelGridBox->Clear();
|
2010-01-21 20:53:01 +00:00
|
|
|
wxString format = _( "Grid");
|
2010-07-12 14:07:09 +00:00
|
|
|
switch( g_UserUnit )
|
|
|
|
{
|
|
|
|
case INCHES:
|
2007-08-04 01:08:43 +00:00
|
|
|
format += wxT( " %.1f" );
|
2010-07-12 14:07:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case MILLIMETRES:
|
2007-08-04 01:08:43 +00:00
|
|
|
format += wxT( " %.3f" );
|
2010-07-12 14:07:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case UNSCALED_UNITS:
|
|
|
|
format += wxT( " %f" );
|
|
|
|
break;
|
|
|
|
}
|
2007-08-04 01:08:43 +00:00
|
|
|
|
2008-12-05 16:03:05 +00:00
|
|
|
for( i = 0; i < GetScreen()->m_GridList.GetCount(); i++ )
|
2007-08-04 01:08:43 +00:00
|
|
|
{
|
2010-01-21 20:53:01 +00:00
|
|
|
GRID_TYPE grid = GetScreen()->m_GridList[i];
|
2010-07-12 14:07:09 +00:00
|
|
|
double value = To_User_Unit( g_UserUnit, grid.m_Size.x,
|
2010-01-21 20:53:01 +00:00
|
|
|
m_InternalUnits );
|
2008-12-05 16:03:05 +00:00
|
|
|
if( grid.m_Id != ID_POPUP_GRID_USER )
|
|
|
|
{
|
2010-07-13 10:42:32 +00:00
|
|
|
switch( g_UserUnit )
|
2010-07-12 14:07:09 +00:00
|
|
|
{
|
|
|
|
case INCHES:
|
2008-12-05 16:03:05 +00:00
|
|
|
msg.Printf( format.GetData(), value * 1000 );
|
2010-07-12 14:07:09 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case MILLIMETRES:
|
|
|
|
case UNSCALED_UNITS:
|
2008-12-05 16:03:05 +00:00
|
|
|
msg.Printf( format.GetData(), value );
|
2010-07-12 14:07:09 +00:00
|
|
|
break;
|
|
|
|
}
|
2008-12-05 16:03:05 +00:00
|
|
|
}
|
2007-08-04 01:08:43 +00:00
|
|
|
else
|
2008-12-05 16:03:05 +00:00
|
|
|
msg = _( "User Grid" );
|
|
|
|
|
2009-10-14 19:43:31 +00:00
|
|
|
m_SelGridBox->Append( msg, (void*) &GetScreen()->m_GridList[i].m_Id );
|
|
|
|
|
2009-11-07 14:36:54 +00:00
|
|
|
if( m_LastGridSizeId == GetScreen()->m_GridList[i].m_Id )
|
2009-10-14 19:43:31 +00:00
|
|
|
m_SelGridBox->SetSelection( i );
|
2007-08-04 01:08:43 +00:00
|
|
|
}
|
|
|
|
|
2010-01-21 20:53:01 +00:00
|
|
|
m_TrackAndViasSizesList_Changed = true;
|
2010-10-19 19:18:30 +00:00
|
|
|
m_AuxiliaryToolBar->AddSeparator();
|
2008-04-29 15:43:28 +00:00
|
|
|
ReCreateLayerBox( NULL );
|
2007-06-05 12:10:51 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-01-24 02:05:07 +00:00
|
|
|
void WinEDA_PcbFrame::syncLayerBox()
|
2008-04-29 13:35:26 +00:00
|
|
|
{
|
|
|
|
wxASSERT( m_SelLayerBox );
|
|
|
|
|
2009-11-20 14:55:20 +00:00
|
|
|
// Enable the display on the correct layer
|
|
|
|
// To avoid reentrancy ( Bug wxGTK Linux version? ), the selection is
|
2010-01-24 02:05:07 +00:00
|
|
|
// made only if it needs changing ( corrected on wxGTK 2.6.0 )
|
|
|
|
int count = m_SelLayerBox->GetCount();
|
2010-01-21 20:53:01 +00:00
|
|
|
int choice = m_SelLayerBox->GetChoice();
|
2010-01-24 02:05:07 +00:00
|
|
|
int layer = getActiveLayer();
|
2008-04-29 13:35:26 +00:00
|
|
|
|
2010-01-21 20:53:01 +00:00
|
|
|
for( int listNdx=0; listNdx<count; ++listNdx )
|
2008-04-29 13:35:26 +00:00
|
|
|
{
|
2010-02-12 23:12:00 +00:00
|
|
|
int clientData = (int) (size_t) m_SelLayerBox->wxItemContainer::GetClientData( listNdx );
|
2010-01-24 02:05:07 +00:00
|
|
|
|
|
|
|
if( clientData == layer )
|
2008-04-29 13:35:26 +00:00
|
|
|
{
|
|
|
|
if( listNdx != choice )
|
|
|
|
m_SelLayerBox->SetSelection( listNdx );
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2007-08-04 01:08:43 +00:00
|
|
|
WinEDAChoiceBox* WinEDA_PcbFrame::ReCreateLayerBox( WinEDA_Toolbar* parent )
|
2007-06-05 12:10:51 +00:00
|
|
|
{
|
2007-08-04 01:08:43 +00:00
|
|
|
if( m_SelLayerBox == NULL )
|
|
|
|
{
|
|
|
|
if( parent == NULL )
|
|
|
|
return NULL;
|
2008-01-28 18:44:14 +00:00
|
|
|
|
2008-12-05 16:03:05 +00:00
|
|
|
m_SelLayerBox = new WinEDAChoiceBox( parent,
|
|
|
|
ID_TOOLBARH_PCB_SELECT_LAYER,
|
2008-01-28 18:44:14 +00:00
|
|
|
wxPoint( -1, -1 ),
|
2010-01-21 20:53:01 +00:00
|
|
|
#if defined (__UNIX__)
|
2008-01-28 18:44:14 +00:00
|
|
|
|
2010-01-21 20:53:01 +00:00
|
|
|
// Width enough for the longest
|
|
|
|
// string: "Component (Page Down)"
|
|
|
|
// Maybe that string is too long?
|
2008-01-28 18:44:14 +00:00
|
|
|
wxSize( 230, -1 )
|
2008-01-18 07:22:19 +00:00
|
|
|
#else
|
2009-10-30 17:58:15 +00:00
|
|
|
wxSize( LISTBOX_WIDTH + 30, -1 )
|
2008-01-18 07:22:19 +00:00
|
|
|
#endif
|
2008-01-28 18:44:14 +00:00
|
|
|
);
|
|
|
|
|
2007-08-04 01:08:43 +00:00
|
|
|
parent->AddControl( m_SelLayerBox );
|
|
|
|
}
|
2010-01-31 20:01:46 +00:00
|
|
|
int layer_mask = GetBoard()->GetEnabledLayers();
|
2010-01-21 20:53:01 +00:00
|
|
|
unsigned length = 0;
|
2008-04-29 03:18:02 +00:00
|
|
|
|
2008-04-29 13:35:26 +00:00
|
|
|
m_SelLayerBox->Clear();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2010-01-25 14:01:46 +00:00
|
|
|
static DECLARE_LAYERS_ORDER_LIST(layerOrder_for_display);
|
|
|
|
|
2010-01-24 13:46:01 +00:00
|
|
|
for( int idx=0, listNdx=0; idx <= EDGE_N; idx++ )
|
2007-08-04 01:08:43 +00:00
|
|
|
{
|
2010-01-24 13:46:01 +00:00
|
|
|
int layer = layerOrder_for_display[idx];
|
2008-04-29 13:35:26 +00:00
|
|
|
// List to append hotkeys in layer box selection
|
2010-01-21 20:53:01 +00:00
|
|
|
static const int HK_SwitchLayer[EDGE_N + 1] = {
|
2008-04-29 13:35:26 +00:00
|
|
|
HK_SWITCH_LAYER_TO_COPPER,
|
|
|
|
HK_SWITCH_LAYER_TO_INNER1,
|
|
|
|
HK_SWITCH_LAYER_TO_INNER2,
|
|
|
|
HK_SWITCH_LAYER_TO_INNER3,
|
|
|
|
HK_SWITCH_LAYER_TO_INNER4,
|
|
|
|
HK_SWITCH_LAYER_TO_INNER5,
|
|
|
|
HK_SWITCH_LAYER_TO_INNER6,
|
|
|
|
HK_SWITCH_LAYER_TO_INNER7,
|
|
|
|
HK_SWITCH_LAYER_TO_INNER8,
|
|
|
|
HK_SWITCH_LAYER_TO_INNER9,
|
|
|
|
HK_SWITCH_LAYER_TO_INNER10,
|
|
|
|
HK_SWITCH_LAYER_TO_INNER11,
|
|
|
|
HK_SWITCH_LAYER_TO_INNER12,
|
|
|
|
HK_SWITCH_LAYER_TO_INNER13,
|
|
|
|
HK_SWITCH_LAYER_TO_INNER14,
|
|
|
|
HK_SWITCH_LAYER_TO_COMPONENT
|
|
|
|
};
|
|
|
|
|
2008-05-05 19:55:09 +00:00
|
|
|
if( g_TabOneLayerMask[layer] & layer_mask )
|
2007-08-04 01:08:43 +00:00
|
|
|
{
|
2009-01-05 05:21:35 +00:00
|
|
|
wxString msg = GetBoard()->GetLayerName( layer );
|
2010-02-16 10:42:57 +00:00
|
|
|
msg << wxT(" ");
|
2008-12-05 16:03:05 +00:00
|
|
|
msg = AddHotkeyName( msg, s_Board_Editor_Hokeys_Descr,
|
2010-02-16 10:42:57 +00:00
|
|
|
HK_SwitchLayer[layer], false );
|
2010-01-24 02:05:07 +00:00
|
|
|
|
2010-01-21 20:36:48 +00:00
|
|
|
m_SelLayerBox->Append( msg );
|
2010-01-21 20:53:01 +00:00
|
|
|
|
|
|
|
//D(printf("appending layername=%s, ndx=%d, layer=%d\n", CONV_TO_UTF8(msg), listNdx, layer );)
|
|
|
|
|
2010-02-12 23:12:00 +00:00
|
|
|
m_SelLayerBox->wxItemContainer::SetClientData( listNdx, (void*) layer );
|
2008-04-29 13:35:26 +00:00
|
|
|
length = MAX( length, msg.Len() );
|
2008-05-01 06:21:07 +00:00
|
|
|
listNdx++;
|
2007-08-04 01:08:43 +00:00
|
|
|
}
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
2008-04-29 13:35:26 +00:00
|
|
|
m_SelLayerBox->SetToolTip( _( "+/- to switch" ) );
|
|
|
|
|
2010-01-24 02:05:07 +00:00
|
|
|
syncLayerBox();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
return m_SelLayerBox;
|
|
|
|
}
|