beautified

This commit is contained in:
dickelbeck 2007-08-04 01:08:43 +00:00
parent 72f7cb164c
commit ede37ecfa7
2 changed files with 533 additions and 482 deletions

View File

@ -1,5 +1,5 @@
/********************************************************************************/
/* tool_onrightclick.cpp: fonctions appelées par le bouton droit sur un TOOL */
/* tool_onrightclick.cpp: fonctions appel<EFBFBD>s par le bouton droit sur un TOOL */
/********************************************************************************/
#include "fctsys.h"
@ -15,7 +15,6 @@
#include "protos.h"
/*****************************************************************/
void WinEDA_PcbFrame::ToolOnRightClick( wxCommandEvent& event )
/*****************************************************************/
@ -49,6 +48,7 @@ int id = event.GetSelection();
}
}
/************************************************************************/
void WinEDA_ModuleEditFrame::ToolOnRightClick( wxCommandEvent& event )
/************************************************************************/
@ -79,5 +79,3 @@ int id = event.GetSelection();
break;
}
}

View File

@ -46,7 +46,8 @@
#include "general_ratsnet.xpm"
#include "add_cotation.xpm"
#define SEL_LAYER_HELP _("Show active layer selections\nand select layer pair for route and place via")
#define SEL_LAYER_HELP _( \
"Show active layer selections\nand select layer pair for route and place via" )
/* Data to build the layer pair indicator button */
static wxBitmap* LayerPairBitmap = NULL;
@ -72,19 +73,23 @@ static char s_BitmapLayerIcon[16][16] = {
{ 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 }
};
/************************************************************/
void WinEDA_PcbFrame::PrepareLayerIndicator( void )
/************************************************************/
/* Draw the icon for the "Select layet pair" bitmap tool
*/
{
int ii, jj;
static int previous_active_layer_color, previous_Route_Layer_TOP_color,
previous_Route_Layer_BOTTOM_color, previous_via_color;
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 */
active_layer_color = g_DesignSettings.m_LayerColor[GetScreen()->m_Active_Layer];
if( previous_active_layer_color != active_layer_color )
@ -111,8 +116,8 @@ bool change = false;
change = TRUE;
}
if ( ! change && (LayerPairBitmap != NULL) ) return;
if( !change && (LayerPairBitmap != NULL) )
return;
/* Creat the bitmap too and its Memory DC, if not already made */
if( LayerPairBitmap == NULL )
@ -121,7 +126,8 @@ bool change = false;
}
/* Draw the icon, with colors according to the active layer and layer pairs for
via command (change layer) */
* via command (change layer)
*/
wxMemoryDC iconDC;
iconDC.SelectObject( *LayerPairBitmap );
int buttcolor = -1;
@ -134,22 +140,27 @@ wxMemoryDC iconDC;
{
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,
@ -161,16 +172,19 @@ wxMemoryDC iconDC;
iconDC.DrawPoint( jj, ii );
}
}
/* Deselect the Tool Bitmap from DC,
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 );
if (m_HToolBar) {
if( m_HToolBar )
{
#if wxCHECK_VERSION( 2, 8, 3 )
m_HToolBar->SetToolNormalBitmap( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, *LayerPairBitmap );
#else
int pos = m_HToolBar->GetToolPos( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR );
if (pos != wxNOT_FOUND) {
if( pos != wxNOT_FOUND )
{
m_HToolBar->DeleteTool( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR );
m_HToolBar->InsertTool( pos, ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, *LayerPairBitmap,
wxNullBitmap, false, NULL, SEL_LAYER_HELP );
@ -178,13 +192,13 @@ wxMemoryDC iconDC;
}
#endif
}
}
/******************************************/
void WinEDA_PcbFrame::ReCreateHToolbar( void )
/******************************************/
// Create the main horizontal toolbar
{
int ii;
@ -197,12 +211,15 @@ int ii;
if( m_FilesMenu->FindItem( ID_LOAD_FILE_1 + ii ) )
{
item = m_FilesMenu->Remove( ID_LOAD_FILE_1 + ii );
if ( item ) delete item;
if( item )
delete item;
}
}
for( ii = 0; ii < 10; ii++ )
{
if ( GetLastProject(ii).IsEmpty() ) break;
if( GetLastProject( ii ).IsEmpty() )
break;
m_FilesMenu->Append( ID_LOAD_FILE_1 + ii, GetLastProject( ii ) );
}
@ -217,11 +234,13 @@ int ii;
// Set up toolbar
m_HToolBar->AddTool( ID_NEW_BOARD, wxEmptyString, BITMAP( new_xpm ), _( "New Board" ) );
m_HToolBar->AddTool(ID_LOAD_FILE, wxEmptyString, BITMAP(open_xpm), _("Open existing Board"));
m_HToolBar->AddTool( ID_LOAD_FILE, wxEmptyString, BITMAP( open_xpm ),
_( "Open existing Board" ) );
m_HToolBar->AddTool( ID_SAVE_BOARD, wxEmptyString, BITMAP( save_xpm ), _( "Save Board" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool(ID_SHEET_SET, wxEmptyString, BITMAP(sheetset_xpm), _("page settings (size, texts)") );
m_HToolBar->AddTool( ID_SHEET_SET, wxEmptyString, BITMAP( sheetset_xpm ),
_( "page settings (size, texts)" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_OPEN_MODULE_EDITOR, wxEmptyString, BITMAP( modedit_xpm ),
@ -231,7 +250,8 @@ int ii;
m_HToolBar->AddTool( wxID_CUT, wxEmptyString, BITMAP( cut_button ), _( "Cut selected item" ) );
#if 0
m_HToolBar->AddTool(wxID_COPY, wxEmptyString, BITMAP(copy_button), _("Copy selected item"));
m_HToolBar->AddTool( wxID_COPY, wxEmptyString, BITMAP( copy_button ),
_( "Copy selected item" ) );
m_HToolBar->AddTool( wxID_PASTE, wxEmptyString, BITMAP( paste_xpm ), _( "Paste" ) );
#endif
@ -240,21 +260,29 @@ int ii;
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_GEN_PRINT, wxEmptyString, BITMAP( print_button ), _( "Print Board" ) );
m_HToolBar->AddTool(ID_GEN_PLOT, wxEmptyString, BITMAP(plot_xpm), _("Plot (HPGL, PostScript, or GERBER format)"));
m_HToolBar->AddTool( ID_GEN_PLOT, wxEmptyString, BITMAP( plot_xpm ),
_( "Plot (HPGL, PostScript, or GERBER format)" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool(ID_ZOOM_PLUS_BUTT, wxEmptyString, BITMAP(zoom_in_xpm), _("zoom + (F1)"));
m_HToolBar->AddTool(ID_ZOOM_MOINS_BUTT, wxEmptyString, BITMAP(zoom_out_xpm), _("zoom - (F2)"));
m_HToolBar->AddTool(ID_ZOOM_REDRAW_BUTT, wxEmptyString, BITMAP(repaint_xpm), _("redraw (F3)"));
m_HToolBar->AddTool( ID_ZOOM_PLUS_BUTT, wxEmptyString, BITMAP( zoom_in_xpm ),
_( "zoom + (F1)" ) );
m_HToolBar->AddTool( ID_ZOOM_MOINS_BUTT, wxEmptyString, BITMAP( zoom_out_xpm ),
_( "zoom - (F2)" ) );
m_HToolBar->AddTool( ID_ZOOM_REDRAW_BUTT, wxEmptyString, BITMAP( repaint_xpm ),
_( "redraw (F3)" ) );
m_HToolBar->AddTool(ID_ZOOM_PAGE_BUTT, wxEmptyString, BITMAP(zoom_optimal_xpm), _("auto zoom"));
m_HToolBar->AddTool( ID_ZOOM_PAGE_BUTT, wxEmptyString, BITMAP( zoom_optimal_xpm ),
_( "auto zoom" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool(ID_FIND_ITEMS, wxEmptyString, BITMAP(find_xpm), _("Find components and texts (Ctrl-F)"));
m_HToolBar->AddTool( ID_FIND_ITEMS, wxEmptyString, BITMAP( find_xpm ),
_( "Find components and texts (Ctrl-F)" ) );
m_HToolBar->AddSeparator();
m_HToolBar->AddTool(ID_GET_NETLIST, wxEmptyString, BITMAP(netlist_xpm), _("Read Netlist"));
m_HToolBar->AddTool(ID_DRC_CONTROL, wxEmptyString, BITMAP(erc_xpm), _("Pcb Design Rules Check"));
m_HToolBar->AddTool( ID_GET_NETLIST, wxEmptyString, BITMAP( netlist_xpm ),
_( "Read Netlist" ) );
m_HToolBar->AddTool( ID_DRC_CONTROL, wxEmptyString, BITMAP( erc_xpm ),
_( "Pcb Design Rules Check" ) );
m_HToolBar->AddSeparator();
ReCreateLayerBox( m_HToolBar );
@ -264,11 +292,12 @@ int ii;
m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_TOOLBARH_PCB_AUTOPLACE, wxEmptyString, BITMAP( mode_module_xpm ),
_("Mode Module: Manual and Automatic Move or Place for modules"), wxITEM_CHECK );
_(
"Mode Module: Manual and Automatic Move or Place for modules" ),
wxITEM_CHECK );
m_HToolBar->AddTool( ID_TOOLBARH_PCB_AUTOROUTE, wxEmptyString, BITMAP( mode_track_xpm ),
_( "Mode Track and Autorouting" ), wxITEM_CHECK );
// after adding the buttons to the toolbar, must call Realize() to reflect
// the changes
@ -277,12 +306,15 @@ int ii;
SetToolbars();
}
/*********************************************/
void WinEDA_PcbFrame::ReCreateOptToolbar( void )
/*********************************************/
// Create the left vertical toolbar (option selections)
{
if ( m_OptionsToolBar ) return;
if( m_OptionsToolBar )
return;
// creation du tool bar options
m_OptionsToolBar = new WinEDA_Toolbar( TOOLBAR_OPTION, this, ID_OPT_TOOLBAR, FALSE );
@ -292,12 +324,14 @@ void WinEDA_PcbFrame::ReCreateOptToolbar(void)
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_GRID, wxEmptyString, BITMAP( grid_xpm ),
_( "Display Grid OFF" ), wxITEM_CHECK );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_POLAR_COORD, wxEmptyString,
BITMAP(polar_coord_xpm), _("Display Polar Coord ON"), wxITEM_CHECK);
BITMAP( polar_coord_xpm ), _(
"Display Polar Coord ON" ), wxITEM_CHECK );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_INCH, wxEmptyString,
BITMAP( unit_inch_xpm ), _( "Units = Inch" ), wxITEM_CHECK );
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_UNIT_MM, wxEmptyString,
BITMAP( unit_mm_xpm ), _( "Units = mm" ), wxITEM_CHECK );
m_OptionsToolBar->AddTool(ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString, BITMAP(cursor_shape_xpm),
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SELECT_CURSOR, wxEmptyString,
BITMAP( cursor_shape_xpm ),
_( "Change Cursor Shape" ), wxITEM_CHECK );
m_OptionsToolBar->AddSeparator();
@ -309,7 +343,8 @@ void WinEDA_PcbFrame::ReCreateOptToolbar(void)
_( "Show Module Ratsnest when moving" ), wxITEM_CHECK );
m_OptionsToolBar->AddSeparator();
m_OptionsToolBar->AddTool(ID_TB_OPTIONS_AUTO_DEL_TRACK, wxEmptyString, BITMAP(auto_delete_track_xpm),
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_AUTO_DEL_TRACK, wxEmptyString,
BITMAP( auto_delete_track_xpm ),
_( "Enable Auto Del Track" ), wxITEM_CHECK );
m_OptionsToolBar->AddSeparator();
@ -335,7 +370,9 @@ void WinEDA_PcbFrame::ReCreateOptToolbar(void)
m_OptionsToolBar->AddSeparator();
m_OptionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1, wxEmptyString,
BITMAP( mw_toolbar_xpm ),
_("Display auxiliary vertical toolbar (tools for micro wave applications)\n This is a very experimental feature (under development)"), wxITEM_CHECK);
_(
"Display auxiliary vertical toolbar (tools for micro wave applications)\n This is a very experimental feature (under development)" ),
wxITEM_CHECK );
#endif
m_OptionsToolBar->Realize();
@ -347,10 +384,12 @@ void WinEDA_PcbFrame::ReCreateOptToolbar(void)
/********************************************/
void WinEDA_PcbFrame::ReCreateVToolbar( void )
/********************************************/
/* Create the main vertical right toolbar, showing usual tools
*/
{
if( m_VToolBar ) return;
if( m_VToolBar )
return;
m_VToolBar = new WinEDA_Toolbar( TOOLBAR_TOOL, this, ID_V_TOOLBAR, FALSE );
@ -425,10 +464,12 @@ void WinEDA_PcbFrame::ReCreateVToolbar(void)
/*********************************************/
void WinEDA_PcbFrame::ReCreateAuxVToolbar( void )
/*********************************************/
/* Create the auxiliary vertical right toolbar, showing tools fo microwave applications
*/
{
if( m_AuxVToolBar ) return;
if( m_AuxVToolBar )
return;
m_AuxVToolBar = new WinEDA_Toolbar( TOOLBAR_TOOL, this, ID_AUX_V_TOOLBAR, FALSE );
@ -457,7 +498,8 @@ void WinEDA_PcbFrame::ReCreateAuxVToolbar(void)
BITMAP( mw_Add_stub_arc_xpm ),
wxNullBitmap, TRUE,
-1, -1, (wxObject*) NULL,
_("Create stub (arc) of specified length for microwave applications") );
_( "Create stub (arc) of specified length for microwave applications" )
);
m_AuxVToolBar->AddTool( ID_PCB_MUWAVE_TOOL_FUNCTION_SHAPE_CMD,
BITMAP( mw_Add_Shape_xpm ),
@ -470,9 +512,11 @@ void WinEDA_PcbFrame::ReCreateAuxVToolbar(void)
SetToolbars();
}
/****************************************************/
void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar( void )
/****************************************************/
/* Create auxiliary horizontal toolbar
*/
{
@ -487,7 +531,8 @@ wxString msg;
m_AuxiliaryToolBar->AddSeparator();
m_SelTrackWidthBox = new WinEDAChoiceBox( m_AuxiliaryToolBar,
ID_AUX_TOOLBAR_PCB_TRACK_WIDTH,
wxPoint(-1,-1), wxSize(LISTBOX_WIDTH+20, -1));
wxPoint( -1,
-1 ), wxSize( LISTBOX_WIDTH + 20, -1 ) );
m_AuxiliaryToolBar->AddControl( m_SelTrackWidthBox );
m_SelTrackWidthBox_Changed = TRUE;
@ -498,6 +543,7 @@ wxString msg;
m_AuxiliaryToolBar->AddControl( m_SelViaSizeBox );
m_AuxiliaryToolBar->AddSeparator();
// Boite de selection du pas de grille
m_SelGridBox = new WinEDAChoiceBox( m_AuxiliaryToolBar,
ID_ON_GRID_SELECT,
@ -516,6 +562,7 @@ wxString msg;
msg = _( "Zoom " ); msg << ii;
m_SelZoomBox->Append( msg );
}
m_SelZoomBox->Append( wxT( "" ) );
m_AuxiliaryToolBar->AddControl( m_SelZoomBox );
@ -527,8 +574,10 @@ wxString msg;
// mise a jour des affichages
m_SelGridBox->Clear();
wxString format = _( "Grid" );
if ( g_UnitMetric == INCHES ) format += wxT(" %.1f");
else format += wxT(" %.3f");
if( g_UnitMetric == INCHES )
format += wxT( " %.1f" );
else
format += wxT( " %.3f" );
for( ii = 0; g_GridList[ii].x > 0; ii++ )
{
@ -539,6 +588,7 @@ wxString msg;
msg.Printf( format.GetData(), value );
m_SelGridBox->Append( msg );
}
m_SelGridBox->Append( _( "User Grid" ) );
m_SelViaSizeBox_Changed = TRUE;
@ -558,7 +608,8 @@ long current_mask_layer;
if( m_SelLayerBox == NULL )
{
if ( parent == NULL ) return NULL;
if( parent == NULL )
return NULL;
m_SelLayerBox = new WinEDAChoiceBox( parent, ID_TOOLBARH_PCB_SELECT_LAYER,
wxPoint( -1, -1 ), wxSize( LISTBOX_WIDTH, -1 ) );
parent->AddControl( m_SelLayerBox );
@ -573,7 +624,9 @@ long current_mask_layer;
jj = (int) ( (size_t) m_SelLayerBox->GetClientData( ii ) );
current_mask_layer |= g_TabOneLayerMask[jj];
}
if ( current_mask_layer != Masque_Layer) rebuild = TRUE;
if( current_mask_layer != Masque_Layer )
rebuild = TRUE;
// Construction de la liste
if( rebuild )
@ -588,6 +641,7 @@ long current_mask_layer;
jj++;
}
}
m_SelLayerBox->SetToolTip( _( "+/- to switch" ) );
}
@ -600,12 +654,11 @@ long current_mask_layer;
{
if( (int) ( (size_t) m_SelLayerBox->GetClientData( ii ) ) == GetScreen()->m_Active_Layer )
{
if ( ii != ll ) m_SelLayerBox->SetSelection( ii );
if( ii != ll )
m_SelLayerBox->SetSelection( ii );
break;
}
}
return m_SelLayerBox;
}