Commit c25e5c31 authored by dickelbeck's avatar dickelbeck

bug fixes

parent 3237ea13
...@@ -5,6 +5,23 @@ Started 2007-June-11 ...@@ -5,6 +5,23 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2008-Apr-28 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
+pcbnew
* Layer names were not being set into the htoolbar listbox properly if the
BOARD was loaded via the command line as happens when kicad chain loads
pcbnew. Also, layer names were not being set if a second board was loaded
that had the same number of layers as the previous board. The solution was
to comment out the listbox rebuild test in WinEDAChoiceBox*
WinEDA_PcbFrame::ReCreateLayerBox( WinEDA_Toolbar* parent )
* files.cpp: added Clear_Pcb( false ) to LoadOnePcbFile() and call it if
not appending. This way a user can get into the file selection dialog and
still abort (change his mind) without losing the current board. Removed calls to
Clear_Pcb() where LoadOnePcbFile() would now do that.
* edtxtmod.cpp: fixed the drawing relics when moving and rotating module texts.
2008-Apr-21 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> 2008-Apr-21 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================ ================================================================================
+pcbnew +pcbnew
......
...@@ -522,6 +522,7 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) ...@@ -522,6 +522,7 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
if( delta.x <= 0 ) if( delta.x <= 0 )
delta.x = 1; delta.x = 1;
if( delta.y <= 0 ) if( delta.y <= 0 )
delta.y = 1; delta.y = 1;
......
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
#include "dialog_edit_mod_text.h" #include "dialog_edit_mod_text.h"
extern wxPoint MoveVector; // Move vector for move edge, imported from dialog_edit mod_text.cpp extern wxPoint MoveVector; // Move vector for move edge, imported from edtxtmod.cpp
////@begin XPM images ////@begin XPM images
////@end XPM images ////@end XPM images
......
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: dialog_general_options.cpp // Name: dialog_general_options.cpp
// Purpose: // Purpose:
// Author: jean-pierre Charras // Author: jean-pierre Charras
// Modified by: // Modified by:
// Created: 21/01/2006 18:28:47 // Created: 21/01/2006 18:28:47
// RCS-ID: // RCS-ID:
// Copyright: License GNU // Copyright: License GNU
// Licence: // Licence:
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Generated by DialogBlocks (unregistered), 21/01/2006 18:28:47 // Generated by DialogBlocks (unregistered), 21/01/2006 18:28:47
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) #if defined (__GNUG__) && !defined (NO_GCC_PRAGMA)
#pragma implementation "dialog_general_options.h" #pragma implementation "dialog_general_options.h"
#endif #endif
...@@ -40,44 +41,46 @@ ...@@ -40,44 +41,46 @@
////@end XPM images ////@end XPM images
/*****************************************************************/ /*****************************************************************/
void WinEDA_PcbFrame::OnSelectOptionToolbar(wxCommandEvent& event) void WinEDA_PcbFrame::OnSelectOptionToolbar( wxCommandEvent& event )
/*****************************************************************/ /*****************************************************************/
/* Mises a jour de differentes variables de gestion d'options apres action sur /* Mises a jour de differentes variables de gestion d'options apres action sur
le toolbar d'options * le toolbar d'options
*/ */
{ {
int id = event.GetId(); int id = event.GetId();
wxClientDC dc(DrawPanel);
wxClientDC dc( DrawPanel );
DrawPanel->CursorOff(&dc); DrawPanel->CursorOff( &dc );
DrawPanel->PrepareGraphicContext(&dc); DrawPanel->PrepareGraphicContext( &dc );
switch ( id ) switch( id )
{ {
case ID_TB_OPTIONS_DRC_OFF: case ID_TB_OPTIONS_DRC_OFF:
Drc_On = m_OptionsToolBar->GetToolState(id) ? FALSE : TRUE; Drc_On = m_OptionsToolBar->GetToolState( id ) ? FALSE : TRUE;
break; break;
case ID_TB_OPTIONS_SHOW_GRID: case ID_TB_OPTIONS_SHOW_GRID:
m_Draw_Grid = g_ShowGrid = m_OptionsToolBar->GetToolState(id); m_Draw_Grid = g_ShowGrid = m_OptionsToolBar->GetToolState( id );
DrawPanel->ReDraw(&dc, TRUE); DrawPanel->ReDraw( &dc, TRUE );
break; break;
case ID_TB_OPTIONS_SHOW_RATSNEST: case ID_TB_OPTIONS_SHOW_RATSNEST:
g_Show_Ratsnest = m_OptionsToolBar->GetToolState(id); g_Show_Ratsnest = m_OptionsToolBar->GetToolState( id );
Ratsnest_On_Off(&dc); Ratsnest_On_Off( &dc );
break; break;
case ID_TB_OPTIONS_SHOW_MODULE_RATSNEST: case ID_TB_OPTIONS_SHOW_MODULE_RATSNEST:
g_Show_Module_Ratsnest = m_OptionsToolBar->GetToolState(id); g_Show_Module_Ratsnest = m_OptionsToolBar->GetToolState( id );
break; break;
case ID_TB_OPTIONS_SELECT_UNIT_MM: case ID_TB_OPTIONS_SELECT_UNIT_MM:
g_UnitMetric = MILLIMETRE; g_UnitMetric = MILLIMETRE;
case ID_TB_OPTIONS_SELECT_UNIT_INCH: case ID_TB_OPTIONS_SELECT_UNIT_INCH:
if ( id == ID_TB_OPTIONS_SELECT_UNIT_INCH ) if( id == ID_TB_OPTIONS_SELECT_UNIT_INCH )
g_UnitMetric = INCHES; g_UnitMetric = INCHES;
m_SelTrackWidthBox_Changed = TRUE; m_SelTrackWidthBox_Changed = TRUE;
Affiche_Status_Box(); /* Reaffichage des coord curseur */ Affiche_Status_Box(); /* Reaffichage des coord curseur */
...@@ -86,44 +89,44 @@ wxClientDC dc(DrawPanel); ...@@ -86,44 +89,44 @@ wxClientDC dc(DrawPanel);
break; break;
case ID_TB_OPTIONS_SHOW_POLAR_COORD: case ID_TB_OPTIONS_SHOW_POLAR_COORD:
Affiche_Message(wxEmptyString); Affiche_Message( wxEmptyString );
DisplayOpt.DisplayPolarCood = m_OptionsToolBar->GetToolState(id); DisplayOpt.DisplayPolarCood = m_OptionsToolBar->GetToolState( id );
Affiche_Status_Box(); /* Reaffichage des coord curseur */ Affiche_Status_Box(); /* Reaffichage des coord curseur */
break; break;
case ID_TB_OPTIONS_SELECT_CURSOR: case ID_TB_OPTIONS_SELECT_CURSOR:
g_CursorShape = m_OptionsToolBar->GetToolState(id); g_CursorShape = m_OptionsToolBar->GetToolState( id );
break; break;
case ID_TB_OPTIONS_AUTO_DEL_TRACK: case ID_TB_OPTIONS_AUTO_DEL_TRACK:
g_AutoDeleteOldTrack = m_OptionsToolBar->GetToolState(id); g_AutoDeleteOldTrack = m_OptionsToolBar->GetToolState( id );
break; break;
case ID_TB_OPTIONS_SHOW_ZONES: case ID_TB_OPTIONS_SHOW_ZONES:
DisplayOpt.DisplayZones = m_OptionsToolBar->GetToolState(id); DisplayOpt.DisplayZones = m_OptionsToolBar->GetToolState( id );
DrawPanel->ReDraw(&dc, TRUE); DrawPanel->ReDraw( &dc, TRUE );
break; break;
case ID_TB_OPTIONS_SHOW_PADS_SKETCH: case ID_TB_OPTIONS_SHOW_PADS_SKETCH:
m_DisplayPadFill = DisplayOpt.DisplayPadFill = m_DisplayPadFill = DisplayOpt.DisplayPadFill =
! m_OptionsToolBar->GetToolState(id); !m_OptionsToolBar->GetToolState( id );
DrawPanel->ReDraw(&dc, TRUE); DrawPanel->ReDraw( &dc, TRUE );
break; break;
case ID_TB_OPTIONS_SHOW_TRACKS_SKETCH: case ID_TB_OPTIONS_SHOW_TRACKS_SKETCH:
m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill = m_DisplayPcbTrackFill = DisplayOpt.DisplayPcbTrackFill =
! m_OptionsToolBar->GetToolState(id); !m_OptionsToolBar->GetToolState( id );
DrawPanel->ReDraw(&dc, TRUE); DrawPanel->ReDraw( &dc, TRUE );
break; break;
case ID_TB_OPTIONS_SHOW_HIGHT_CONTRAST_MODE: case ID_TB_OPTIONS_SHOW_HIGHT_CONTRAST_MODE:
DisplayOpt.ContrastModeDisplay = DisplayOpt.ContrastModeDisplay =
m_OptionsToolBar->GetToolState(id); m_OptionsToolBar->GetToolState( id );
DrawPanel->ReDraw(&dc, TRUE); DrawPanel->ReDraw( &dc, TRUE );
break; break;
case ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1: case ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR1:
if ( m_OptionsToolBar->GetToolState(id) ) // show aux V toolbar (Microwave tool) if( m_OptionsToolBar->GetToolState( id ) ) // show aux V toolbar (Microwave tool)
ReCreateAuxVToolbar(); ReCreateAuxVToolbar();
else else
{ {
...@@ -131,18 +134,20 @@ wxClientDC dc(DrawPanel); ...@@ -131,18 +134,20 @@ wxClientDC dc(DrawPanel);
m_AuxVToolBar = NULL; m_AuxVToolBar = NULL;
} }
{ {
wxSizeEvent SizeEv(GetSize()); wxSizeEvent SizeEv( GetSize() );
OnSize(SizeEv);
OnSize( SizeEv );
} }
break; break;
default: default:
DisplayError(this, wxT("WinEDA_PcbFrame::OnSelectOptionToolbar error \n (event not handled!)")); DisplayError( this,
wxT( "WinEDA_PcbFrame::OnSelectOptionToolbar error \n (event not handled!)" ) );
break; break;
} }
SetToolbars(); SetToolbars();
DrawPanel->CursorOn(&dc); DrawPanel->CursorOn( &dc );
} }
...@@ -159,9 +164,9 @@ IMPLEMENT_DYNAMIC_CLASS( WinEDA_PcbGeneralOptionsFrame, wxDialog ) ...@@ -159,9 +164,9 @@ IMPLEMENT_DYNAMIC_CLASS( WinEDA_PcbGeneralOptionsFrame, wxDialog )
BEGIN_EVENT_TABLE( WinEDA_PcbGeneralOptionsFrame, wxDialog ) BEGIN_EVENT_TABLE( WinEDA_PcbGeneralOptionsFrame, wxDialog )
////@begin WinEDA_PcbGeneralOptionsFrame event table entries ////@begin WinEDA_PcbGeneralOptionsFrame event table entries
EVT_BUTTON( wxID_OK, WinEDA_PcbGeneralOptionsFrame::OnOkClick ) EVT_BUTTON( wxID_OK, WinEDA_PcbGeneralOptionsFrame::OnOkClick )
EVT_BUTTON( wxID_CANCEL, WinEDA_PcbGeneralOptionsFrame::OnCancelClick ) EVT_BUTTON( wxID_CANCEL, WinEDA_PcbGeneralOptionsFrame::OnCancelClick )
////@end WinEDA_PcbGeneralOptionsFrame event table entries ////@end WinEDA_PcbGeneralOptionsFrame event table entries
...@@ -171,221 +176,325 @@ END_EVENT_TABLE() ...@@ -171,221 +176,325 @@ END_EVENT_TABLE()
* WinEDA_PcbGeneralOptionsFrame constructors * WinEDA_PcbGeneralOptionsFrame constructors
*/ */
WinEDA_PcbGeneralOptionsFrame::WinEDA_PcbGeneralOptionsFrame( ) WinEDA_PcbGeneralOptionsFrame::WinEDA_PcbGeneralOptionsFrame()
{ {
} }
WinEDA_PcbGeneralOptionsFrame::WinEDA_PcbGeneralOptionsFrame( WinEDA_PcbFrame* parent, wxDC * DC,
wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) WinEDA_PcbGeneralOptionsFrame::WinEDA_PcbGeneralOptionsFrame( WinEDA_PcbFrame* parent,
wxDC* DC,
wxWindowID id,
const wxString& caption,
const wxPoint& pos,
const wxSize& size,
long style )
{ {
m_Parent = parent; m_Parent = parent;
m_DC = DC; m_DC = DC;
Create(parent, id, caption, pos, size, style); Create( parent, id, caption, pos, size, style );
/* Set display options */ /* Set display options */
m_PolarDisplay->SetSelection(DisplayOpt.DisplayPolarCood ? 1 : 0); m_PolarDisplay->SetSelection( DisplayOpt.DisplayPolarCood ? 1 : 0 );
m_BoxUnits->SetSelection( g_UnitMetric ? 1 : 0); m_BoxUnits->SetSelection( g_UnitMetric ? 1 : 0 );
m_CursorShape->SetSelection( g_CursorShape ? 1 : 0); m_CursorShape->SetSelection( g_CursorShape ? 1 : 0 );
wxString timevalue; wxString timevalue;
timevalue << g_TimeOut / 60; timevalue << g_TimeOut / 60;
m_SaveTime->SetValue(timevalue); m_SaveTime->SetValue( timevalue );
m_LayerNumber->SetValue(g_DesignSettings.m_CopperLayerCount); m_LayerNumber->SetValue( g_DesignSettings.m_CopperLayerCount );
m_MaxShowLinks->SetValue(g_MaxLinksShowed); m_MaxShowLinks->SetValue( g_MaxLinksShowed );
m_DrcOn->SetValue(Drc_On ); m_DrcOn->SetValue( Drc_On );
m_ShowModuleRatsnest->SetValue(g_Show_Module_Ratsnest); m_ShowModuleRatsnest->SetValue( g_Show_Module_Ratsnest );
m_ShowGlobalRatsnest->SetValue(g_Show_Ratsnest); m_ShowGlobalRatsnest->SetValue( g_Show_Ratsnest );
m_TrackAutodel->SetValue(g_AutoDeleteOldTrack); m_TrackAutodel->SetValue( g_AutoDeleteOldTrack );
m_Track_45_Only_Ctrl->SetValue(Track_45_Only); m_Track_45_Only_Ctrl->SetValue( Track_45_Only );
m_Segments_45_Only_Ctrl->SetValue(Segments_45_Only); m_Segments_45_Only_Ctrl->SetValue( Segments_45_Only );
m_AutoPANOpt->SetValue(m_Parent->DrawPanel-> m_AutoPAN_Enable); m_AutoPANOpt->SetValue( m_Parent->DrawPanel->m_AutoPAN_Enable );
m_Segments_45_Only_Ctrl->SetValue(Segments_45_Only); m_Segments_45_Only_Ctrl->SetValue( Segments_45_Only );
m_Track_DoubleSegm_Ctrl->SetValue(g_TwoSegmentTrackBuild); m_Track_DoubleSegm_Ctrl->SetValue( g_TwoSegmentTrackBuild );
} }
/*! /*!
* WinEDA_PcbGeneralOptionsFrame creator * WinEDA_PcbGeneralOptionsFrame creator
*/ */
bool WinEDA_PcbGeneralOptionsFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) bool WinEDA_PcbGeneralOptionsFrame::Create( wxWindow* parent,
wxWindowID id,
const wxString& caption,
const wxPoint& pos,
const wxSize& size,
long style )
{ {
////@begin WinEDA_PcbGeneralOptionsFrame member initialisation ////@begin WinEDA_PcbGeneralOptionsFrame member initialisation
m_PolarDisplay = NULL; m_PolarDisplay = NULL;
m_BoxUnits = NULL; m_BoxUnits = NULL;
m_CursorShape = NULL; m_CursorShape = NULL;
m_LayerNumber = NULL; m_LayerNumber = NULL;
m_MaxShowLinks = NULL; m_MaxShowLinks = NULL;
m_SaveTime = NULL; m_SaveTime = NULL;
m_DrcOn = NULL; m_DrcOn = NULL;
m_ShowGlobalRatsnest = NULL; m_ShowGlobalRatsnest = NULL;
m_ShowModuleRatsnest = NULL; m_ShowModuleRatsnest = NULL;
m_TrackAutodel = NULL; m_TrackAutodel = NULL;
m_Track_45_Only_Ctrl = NULL; m_Track_45_Only_Ctrl = NULL;
m_Segments_45_Only_Ctrl = NULL; m_Segments_45_Only_Ctrl = NULL;
m_AutoPANOpt = NULL; m_AutoPANOpt = NULL;
m_Track_DoubleSegm_Ctrl = NULL; m_Track_DoubleSegm_Ctrl = NULL;
m_MagneticPadOptCtrl = NULL; m_MagneticPadOptCtrl = NULL;
m_MagneticTrackOptCtrl = NULL; m_MagneticTrackOptCtrl = NULL;
////@end WinEDA_PcbGeneralOptionsFrame member initialisation ////@end WinEDA_PcbGeneralOptionsFrame member initialisation
////@begin WinEDA_PcbGeneralOptionsFrame creation ////@begin WinEDA_PcbGeneralOptionsFrame creation
SetExtraStyle(wxWS_EX_BLOCK_EVENTS); SetExtraStyle( wxWS_EX_BLOCK_EVENTS );
wxDialog::Create( parent, id, caption, pos, size, style ); wxDialog::Create( parent, id, caption, pos, size, style );
CreateControls(); CreateControls();
if (GetSizer()) if( GetSizer() )
{ {
GetSizer()->SetSizeHints(this); GetSizer()->SetSizeHints( this );
} }
Centre(); Centre();
////@end WinEDA_PcbGeneralOptionsFrame creation ////@end WinEDA_PcbGeneralOptionsFrame creation
SetFont(*g_DialogFont); SetFont( *g_DialogFont );
return true; return true;
} }
/*! /*!
* Control creation for WinEDA_PcbGeneralOptionsFrame * Control creation for WinEDA_PcbGeneralOptionsFrame
*/ */
void WinEDA_PcbGeneralOptionsFrame::CreateControls() void WinEDA_PcbGeneralOptionsFrame::CreateControls()
{ {
////@begin WinEDA_PcbGeneralOptionsFrame content construction ////@begin WinEDA_PcbGeneralOptionsFrame content construction
// Generated by DialogBlocks, Mon 03 Mar 2008 04:27:22 PM EST (unregistered) // Generated by DialogBlocks, Mon 03 Mar 2008 04:27:22 PM EST (unregistered)
WinEDA_PcbGeneralOptionsFrame* itemDialog1 = this; WinEDA_PcbGeneralOptionsFrame* itemDialog1 = this;
wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxHORIZONTAL); wxBoxSizer* itemBoxSizer2 = new wxBoxSizer( wxHORIZONTAL );
itemDialog1->SetSizer(itemBoxSizer2);
itemDialog1->SetSizer( itemBoxSizer2 );
wxBoxSizer* itemBoxSizer3 = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxVERTICAL); itemBoxSizer2->Add( itemBoxSizer3, 0, wxGROW | wxALL, 5 );
itemBoxSizer2->Add(itemBoxSizer3, 0, wxGROW|wxALL, 5);
wxArrayString m_PolarDisplayStrings; wxArrayString m_PolarDisplayStrings;
m_PolarDisplayStrings.Add(_("No Display")); m_PolarDisplayStrings.Add( _( "No Display" ) );
m_PolarDisplayStrings.Add(_("Display")); m_PolarDisplayStrings.Add( _( "Display" ) );
m_PolarDisplay = new wxRadioBox( itemDialog1, ID_RADIOBOX, _("Display Polar Coord"), wxDefaultPosition, wxDefaultSize, m_PolarDisplayStrings, 1, wxRA_SPECIFY_COLS ); m_PolarDisplay = new wxRadioBox( itemDialog1, ID_RADIOBOX, _(
m_PolarDisplay->SetSelection(0); "Display Polar Coord" ), wxDefaultPosition, wxDefaultSize,
itemBoxSizer3->Add(m_PolarDisplay, 0, wxALIGN_LEFT|wxALL, 5); m_PolarDisplayStrings, 1,
wxRA_SPECIFY_COLS );
m_PolarDisplay->SetSelection( 0 );
itemBoxSizer3->Add( m_PolarDisplay, 0, wxALIGN_LEFT | wxALL, 5 );
wxArrayString m_BoxUnitsStrings; wxArrayString m_BoxUnitsStrings;
m_BoxUnitsStrings.Add(_("Inches")); m_BoxUnitsStrings.Add( _( "Inches" ) );
m_BoxUnitsStrings.Add(_("millimeters")); m_BoxUnitsStrings.Add( _( "millimeters" ) );
m_BoxUnits = new wxRadioBox( itemDialog1, ID_RADIOBOX1, _("Units"), wxDefaultPosition, wxDefaultSize, m_BoxUnitsStrings, 1, wxRA_SPECIFY_COLS ); m_BoxUnits = new wxRadioBox( itemDialog1, ID_RADIOBOX1, _(
m_BoxUnits->SetSelection(0); "Units" ), wxDefaultPosition, wxDefaultSize,
itemBoxSizer3->Add(m_BoxUnits, 0, wxALIGN_LEFT|wxALL, 5); m_BoxUnitsStrings, 1, wxRA_SPECIFY_COLS );
m_BoxUnits->SetSelection( 0 );
itemBoxSizer3->Add( m_BoxUnits, 0, wxALIGN_LEFT | wxALL, 5 );
wxArrayString m_CursorShapeStrings; wxArrayString m_CursorShapeStrings;
m_CursorShapeStrings.Add(_("Small")); m_CursorShapeStrings.Add( _( "Small" ) );
m_CursorShapeStrings.Add(_("Big")); m_CursorShapeStrings.Add( _( "Big" ) );
m_CursorShape = new wxRadioBox( itemDialog1, ID_RADIOBOX2, _("Cursor"), wxDefaultPosition, wxDefaultSize, m_CursorShapeStrings, 1, wxRA_SPECIFY_COLS ); m_CursorShape = new wxRadioBox( itemDialog1, ID_RADIOBOX2, _(
m_CursorShape->SetSelection(0); "Cursor" ),
itemBoxSizer3->Add(m_CursorShape, 0, wxALIGN_LEFT|wxALL, 5); wxDefaultPosition,
wxDefaultSize, m_CursorShapeStrings, 1, wxRA_SPECIFY_COLS );
m_CursorShape->SetSelection( 0 );
itemBoxSizer3->Add( m_CursorShape, 0, wxALIGN_LEFT | wxALL, 5 );
wxBoxSizer* itemBoxSizer7 = new wxBoxSizer( wxVERTICAL );
itemBoxSizer2->Add( itemBoxSizer7, 0, wxGROW | wxALL, 5 );
wxStaticBox* itemStaticBoxSizer8Static = new wxStaticBox( itemDialog1, wxID_ANY, _(
"Number of Layers:" ) );
wxStaticBoxSizer* itemStaticBoxSizer8 = new wxStaticBoxSizer(
itemStaticBoxSizer8Static,
wxVERTICAL );
itemBoxSizer7->Add( itemStaticBoxSizer8, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
m_LayerNumber = new wxSpinCtrl( itemDialog1, ID_SPINCTRL1, _T(
"1" ), wxDefaultPosition,
wxDefaultSize, wxSP_ARROW_KEYS,
1, 16, 1 );
itemStaticBoxSizer8->Add( m_LayerNumber, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
wxStaticBox* itemStaticBoxSizer10Static = new wxStaticBox( itemDialog1, wxID_ANY, _(
"Max Links:" ) );
wxStaticBoxSizer* itemStaticBoxSizer10 = new wxStaticBoxSizer(
itemStaticBoxSizer10Static,
wxVERTICAL );
itemBoxSizer7->Add( itemStaticBoxSizer10, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
m_MaxShowLinks = new wxSpinCtrl( itemDialog1, ID_SPINCTRL2, _T(
"1" ), wxDefaultPosition,
wxDefaultSize, wxSP_ARROW_KEYS,
1, 5, 1 );
itemStaticBoxSizer10->Add( m_MaxShowLinks, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
wxStaticBox* itemStaticBoxSizer12Static = new wxStaticBox( itemDialog1, wxID_ANY, _(
"Auto Save (minuts):" ) );
wxStaticBoxSizer* itemStaticBoxSizer12 = new wxStaticBoxSizer(
itemStaticBoxSizer12Static,
wxVERTICAL );
wxBoxSizer* itemBoxSizer7 = new wxBoxSizer(wxVERTICAL); itemBoxSizer7->Add( itemStaticBoxSizer12, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
itemBoxSizer2->Add(itemBoxSizer7, 0, wxGROW|wxALL, 5);
wxStaticBox* itemStaticBoxSizer8Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Number of Layers:")); m_SaveTime = new wxSpinCtrl( itemDialog1, ID_SPINCTRL3, _T(
wxStaticBoxSizer* itemStaticBoxSizer8 = new wxStaticBoxSizer(itemStaticBoxSizer8Static, wxVERTICAL); "0" ), wxDefaultPosition,
itemBoxSizer7->Add(itemStaticBoxSizer8, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); wxDefaultSize, wxSP_ARROW_KEYS,
0, 60, 0 );
m_LayerNumber = new wxSpinCtrl( itemDialog1, ID_SPINCTRL1, _T("1"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 16, 1 ); itemStaticBoxSizer12->Add( m_SaveTime, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
itemStaticBoxSizer8->Add(m_LayerNumber, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
wxStaticBox* itemStaticBoxSizer10Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Max Links:")); wxBoxSizer* itemBoxSizer14 = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* itemStaticBoxSizer10 = new wxStaticBoxSizer(itemStaticBoxSizer10Static, wxVERTICAL);
itemBoxSizer7->Add(itemStaticBoxSizer10, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
m_MaxShowLinks = new wxSpinCtrl( itemDialog1, ID_SPINCTRL2, _T("1"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 1, 5, 1 ); itemBoxSizer2->Add( itemBoxSizer14, 0, wxGROW | wxALL, 5 );
itemStaticBoxSizer10->Add(m_MaxShowLinks, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
wxStaticBox* itemStaticBoxSizer12Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Auto Save (minuts):")); wxStaticBox* itemStaticBoxSizer15Static = new wxStaticBox( itemDialog1, wxID_ANY, _(
wxStaticBoxSizer* itemStaticBoxSizer12 = new wxStaticBoxSizer(itemStaticBoxSizer12Static, wxVERTICAL); "Options:" ) );
itemBoxSizer7->Add(itemStaticBoxSizer12, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
m_SaveTime = new wxSpinCtrl( itemDialog1, ID_SPINCTRL3, _T("0"), wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 60, 0 ); wxStaticBoxSizer* itemStaticBoxSizer15 = new wxStaticBoxSizer(
itemStaticBoxSizer12->Add(m_SaveTime, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); itemStaticBoxSizer15Static,
wxVERTICAL );
wxBoxSizer* itemBoxSizer14 = new wxBoxSizer(wxVERTICAL); itemBoxSizer14->Add( itemStaticBoxSizer15, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5 );
itemBoxSizer2->Add(itemBoxSizer14, 0, wxGROW|wxALL, 5);
wxStaticBox* itemStaticBoxSizer15Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Options:")); m_DrcOn = new wxCheckBox( itemDialog1, ID_CHECKBOX, _(
wxStaticBoxSizer* itemStaticBoxSizer15 = new wxStaticBoxSizer(itemStaticBoxSizer15Static, wxVERTICAL); "Drc ON" ),
itemBoxSizer14->Add(itemStaticBoxSizer15, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); wxDefaultPosition,
wxDefaultSize, wxCHK_2STATE );
m_DrcOn = new wxCheckBox( itemDialog1, ID_CHECKBOX, _("Drc ON"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_DrcOn->SetValue( false );
m_DrcOn->SetValue(false); m_DrcOn->SetForegroundColour( wxColour( 198, 0, 0 ) );
m_DrcOn->SetForegroundColour(wxColour(198, 0, 0)); itemStaticBoxSizer15->Add( m_DrcOn, 0, wxALIGN_LEFT | wxALL, 5 );
itemStaticBoxSizer15->Add(m_DrcOn, 0, wxALIGN_LEFT|wxALL, 5);
m_ShowGlobalRatsnest = new wxCheckBox( itemDialog1, ID_CHECKBOX1, _("Show Ratsnest"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_ShowGlobalRatsnest = new wxCheckBox( itemDialog1, ID_CHECKBOX1, _(
m_ShowGlobalRatsnest->SetValue(false); "Show Ratsnest" ), wxDefaultPosition,
itemStaticBoxSizer15->Add(m_ShowGlobalRatsnest, 0, wxALIGN_LEFT|wxALL, 5); wxDefaultSize, wxCHK_2STATE );
m_ShowModuleRatsnest = new wxCheckBox( itemDialog1, ID_CHECKBOX2, _("Show Mod Ratsnest"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_ShowGlobalRatsnest->SetValue( false );
m_ShowModuleRatsnest->SetValue(false); itemStaticBoxSizer15->Add( m_ShowGlobalRatsnest, 0, wxALIGN_LEFT | wxALL, 5 );
itemStaticBoxSizer15->Add(m_ShowModuleRatsnest, 0, wxALIGN_LEFT|wxALL, 5);
m_TrackAutodel = new wxCheckBox( itemDialog1, ID_CHECKBOX3, _("Tracks Auto Del"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_ShowModuleRatsnest = new wxCheckBox( itemDialog1, ID_CHECKBOX2, _(
m_TrackAutodel->SetValue(false); "Show Mod Ratsnest" ), wxDefaultPosition,
itemStaticBoxSizer15->Add(m_TrackAutodel, 0, wxALIGN_LEFT|wxALL, 5); wxDefaultSize, wxCHK_2STATE );
m_Track_45_Only_Ctrl = new wxCheckBox( itemDialog1, ID_CHECKBOX4, _("Track 45 Only"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_ShowModuleRatsnest->SetValue( false );
m_Track_45_Only_Ctrl->SetValue(false); itemStaticBoxSizer15->Add( m_ShowModuleRatsnest, 0, wxALIGN_LEFT | wxALL, 5 );
itemStaticBoxSizer15->Add(m_Track_45_Only_Ctrl, 0, wxALIGN_LEFT|wxALL, 5);
m_Segments_45_Only_Ctrl = new wxCheckBox( itemDialog1, ID_CHECKBOX5, _("Segments 45 Only"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_TrackAutodel = new wxCheckBox( itemDialog1, ID_CHECKBOX3, _(
m_Segments_45_Only_Ctrl->SetValue(false); "Tracks Auto Del" ), wxDefaultPosition,
itemStaticBoxSizer15->Add(m_Segments_45_Only_Ctrl, 0, wxALIGN_LEFT|wxALL, 5); wxDefaultSize, wxCHK_2STATE );
m_AutoPANOpt = new wxCheckBox( itemDialog1, ID_CHECKBOX6, _("Auto PAN"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_TrackAutodel->SetValue( false );
m_AutoPANOpt->SetValue(false); itemStaticBoxSizer15->Add( m_TrackAutodel, 0, wxALIGN_LEFT | wxALL, 5 );
m_AutoPANOpt->SetForegroundColour(wxColour(0, 0, 255));
itemStaticBoxSizer15->Add(m_AutoPANOpt, 0, wxALIGN_LEFT|wxALL, 5);
m_Track_DoubleSegm_Ctrl = new wxCheckBox( itemDialog1, ID_CHECKBOX7, _("Double Segm Track"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_Track_45_Only_Ctrl = new wxCheckBox( itemDialog1, ID_CHECKBOX4, _(
m_Track_DoubleSegm_Ctrl->SetValue(false); "Track 45 Only" ), wxDefaultPosition,
m_Track_DoubleSegm_Ctrl->SetForegroundColour(wxColour(0, 144, 0)); wxDefaultSize, wxCHK_2STATE );
itemStaticBoxSizer15->Add(m_Track_DoubleSegm_Ctrl, 0, wxALIGN_LEFT|wxALL, 5);
wxBoxSizer* itemBoxSizer24 = new wxBoxSizer(wxVERTICAL); m_Track_45_Only_Ctrl->SetValue( false );
itemBoxSizer2->Add(itemBoxSizer24, 0, wxALIGN_TOP|wxALL, 5); itemStaticBoxSizer15->Add( m_Track_45_Only_Ctrl, 0, wxALIGN_LEFT | wxALL, 5 );
m_Segments_45_Only_Ctrl = new wxCheckBox( itemDialog1, ID_CHECKBOX5, _(
"Segments 45 Only" ), wxDefaultPosition,
wxDefaultSize, wxCHK_2STATE );
m_Segments_45_Only_Ctrl->SetValue( false );
itemStaticBoxSizer15->Add( m_Segments_45_Only_Ctrl, 0, wxALIGN_LEFT | wxALL, 5 );
m_AutoPANOpt = new wxCheckBox( itemDialog1, ID_CHECKBOX6, _(
"Auto PAN" ), wxDefaultPosition, wxDefaultSize,
wxCHK_2STATE );
m_AutoPANOpt->SetValue( false );
m_AutoPANOpt->SetForegroundColour( wxColour( 0, 0, 255 ) );
itemStaticBoxSizer15->Add( m_AutoPANOpt, 0, wxALIGN_LEFT | wxALL, 5 );
m_Track_DoubleSegm_Ctrl = new wxCheckBox( itemDialog1, ID_CHECKBOX7, _(
"Double Segm Track" ), wxDefaultPosition,
wxDefaultSize, wxCHK_2STATE );
m_Track_DoubleSegm_Ctrl->SetValue( false );
m_Track_DoubleSegm_Ctrl->SetForegroundColour( wxColour( 0, 144, 0 ) );
itemStaticBoxSizer15->Add( m_Track_DoubleSegm_Ctrl, 0, wxALIGN_LEFT | wxALL, 5 );
wxBoxSizer* itemBoxSizer24 = new wxBoxSizer( wxVERTICAL );
itemBoxSizer2->Add( itemBoxSizer24, 0, wxALIGN_TOP | wxALL, 5 );
wxArrayString m_MagneticPadOptCtrlStrings; wxArrayString m_MagneticPadOptCtrlStrings;
m_MagneticPadOptCtrlStrings.Add(_("Never")); m_MagneticPadOptCtrlStrings.Add( _( "Never" ) );
m_MagneticPadOptCtrlStrings.Add(_("When creating tracks")); m_MagneticPadOptCtrlStrings.Add( _( "When creating tracks" ) );
m_MagneticPadOptCtrlStrings.Add(_("Always")); m_MagneticPadOptCtrlStrings.Add( _( "Always" ) );
m_MagneticPadOptCtrl = new wxRadioBox( itemDialog1, ID_RADIOBOX4, _("Magnetic Pads"), wxDefaultPosition, wxDefaultSize, m_MagneticPadOptCtrlStrings, 1, wxRA_SPECIFY_COLS ); m_MagneticPadOptCtrl = new wxRadioBox( itemDialog1, ID_RADIOBOX4, _(
m_MagneticPadOptCtrl->SetSelection(0); "Magnetic Pads" ), wxDefaultPosition, wxDefaultSize,
if (WinEDA_PcbGeneralOptionsFrame::ShowToolTips()) m_MagneticPadOptCtrlStrings, 1,
m_MagneticPadOptCtrl->SetToolTip(_("control the capture of the pcb cursor when the mouse cursor enters a pad area")); wxRA_SPECIFY_COLS );
itemBoxSizer24->Add(m_MagneticPadOptCtrl, 0, wxGROW|wxALL, 5);
m_MagneticPadOptCtrl->SetSelection( 0 );
if( WinEDA_PcbGeneralOptionsFrame::ShowToolTips() )
m_MagneticPadOptCtrl->SetToolTip( _(
"control the capture of the pcb cursor when the mouse cursor enters a pad area" ) );
itemBoxSizer24->Add( m_MagneticPadOptCtrl, 0, wxGROW | wxALL, 5 );
wxArrayString m_MagneticTrackOptCtrlStrings; wxArrayString m_MagneticTrackOptCtrlStrings;
m_MagneticTrackOptCtrlStrings.Add(_("Never")); m_MagneticTrackOptCtrlStrings.Add( _( "Never" ) );
m_MagneticTrackOptCtrlStrings.Add(_("When creating tracks")); m_MagneticTrackOptCtrlStrings.Add( _( "When creating tracks" ) );
m_MagneticTrackOptCtrlStrings.Add(_("Always")); m_MagneticTrackOptCtrlStrings.Add( _( "Always" ) );
m_MagneticTrackOptCtrl = new wxRadioBox( itemDialog1, ID_RADIOBOX3, _("Magnetic Tracks"), wxDefaultPosition, wxDefaultSize, m_MagneticTrackOptCtrlStrings, 1, wxRA_SPECIFY_COLS ); m_MagneticTrackOptCtrl = new wxRadioBox( itemDialog1, ID_RADIOBOX3, _(
m_MagneticTrackOptCtrl->SetSelection(0); "Magnetic Tracks" ), wxDefaultPosition,
if (WinEDA_PcbGeneralOptionsFrame::ShowToolTips()) wxDefaultSize, m_MagneticTrackOptCtrlStrings, 1,
m_MagneticTrackOptCtrl->SetToolTip(_("control the capture of the pcb cursor when the mouse cursor enters a track")); wxRA_SPECIFY_COLS );
itemBoxSizer24->Add(m_MagneticTrackOptCtrl, 0, wxGROW|wxALL, 5);
m_MagneticTrackOptCtrl->SetSelection( 0 );
wxButton* itemButton27 = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 ); if( WinEDA_PcbGeneralOptionsFrame::ShowToolTips() )
itemButton27->SetForegroundColour(wxColour(221, 0, 0)); m_MagneticTrackOptCtrl->SetToolTip( _(
itemBoxSizer24->Add(itemButton27, 0, wxGROW|wxALL, 5); "control the capture of the pcb cursor when the mouse cursor enters a track" ) );
itemBoxSizer24->Add( m_MagneticTrackOptCtrl, 0, wxGROW | wxALL, 5 );
wxButton* itemButton28 = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
itemButton28->SetForegroundColour(wxColour(0, 0, 255)); wxButton* itemButton27 = new wxButton( itemDialog1, wxID_OK, _(
itemBoxSizer24->Add(itemButton28, 0, wxGROW|wxALL, 5); "&OK" ), wxDefaultPosition, wxDefaultSize, 0 );
itemButton27->SetForegroundColour( wxColour( 221, 0, 0 ) );
itemBoxSizer24->Add( itemButton27, 0, wxGROW | wxALL, 5 );
wxButton* itemButton28 = new wxButton( itemDialog1, wxID_CANCEL, _(
"&Cancel" ), wxDefaultPosition, wxDefaultSize, 0 );
itemButton28->SetForegroundColour( wxColour( 0, 0, 255 ) );
itemBoxSizer24->Add( itemButton28, 0, wxGROW | wxALL, 5 );
// Set validators // Set validators
m_MagneticPadOptCtrl->SetValidator( wxGenericValidator(& g_MagneticPadOption) ); m_MagneticPadOptCtrl->SetValidator( wxGenericValidator( &g_MagneticPadOption ) );
m_MagneticTrackOptCtrl->SetValidator( wxGenericValidator(& g_MagneticTrackOption) ); m_MagneticTrackOptCtrl->SetValidator( wxGenericValidator( &g_MagneticTrackOption ) );
////@end WinEDA_PcbGeneralOptionsFrame content construction ////@end WinEDA_PcbGeneralOptionsFrame content construction
} }
/*! /*!
* Should we show tooltips? * Should we show tooltips?
*/ */
...@@ -395,6 +504,7 @@ bool WinEDA_PcbGeneralOptionsFrame::ShowToolTips() ...@@ -395,6 +504,7 @@ bool WinEDA_PcbGeneralOptionsFrame::ShowToolTips()
return true; return true;
} }
/*! /*!
* Get bitmap resources * Get bitmap resources
*/ */
...@@ -403,11 +513,13 @@ wxBitmap WinEDA_PcbGeneralOptionsFrame::GetBitmapResource( const wxString& name ...@@ -403,11 +513,13 @@ wxBitmap WinEDA_PcbGeneralOptionsFrame::GetBitmapResource( const wxString& name
{ {
// Bitmap retrieval // Bitmap retrieval
////@begin WinEDA_PcbGeneralOptionsFrame bitmap retrieval ////@begin WinEDA_PcbGeneralOptionsFrame bitmap retrieval
wxUnusedVar(name); wxUnusedVar( name );
return wxNullBitmap; return wxNullBitmap;
////@end WinEDA_PcbGeneralOptionsFrame bitmap retrieval ////@end WinEDA_PcbGeneralOptionsFrame bitmap retrieval
} }
/*! /*!
* Get icon resources * Get icon resources
*/ */
...@@ -416,11 +528,13 @@ wxIcon WinEDA_PcbGeneralOptionsFrame::GetIconResource( const wxString& name ) ...@@ -416,11 +528,13 @@ wxIcon WinEDA_PcbGeneralOptionsFrame::GetIconResource( const wxString& name )
{ {
// Icon retrieval // Icon retrieval
////@begin WinEDA_PcbGeneralOptionsFrame icon retrieval ////@begin WinEDA_PcbGeneralOptionsFrame icon retrieval
wxUnusedVar(name); wxUnusedVar( name );
return wxNullIcon; return wxNullIcon;
////@end WinEDA_PcbGeneralOptionsFrame icon retrieval ////@end WinEDA_PcbGeneralOptionsFrame icon retrieval
} }
/*! /*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
*/ */
...@@ -430,62 +544,66 @@ void WinEDA_PcbGeneralOptionsFrame::OnCancelClick( wxCommandEvent& event ) ...@@ -430,62 +544,66 @@ void WinEDA_PcbGeneralOptionsFrame::OnCancelClick( wxCommandEvent& event )
////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK in WinEDA_PcbGeneralOptionsFrame. ////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK in WinEDA_PcbGeneralOptionsFrame.
// Before editing this code, remove the block markers. // Before editing this code, remove the block markers.
event.Skip(); event.Skip();
////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK in WinEDA_PcbGeneralOptionsFrame.
////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK in WinEDA_PcbGeneralOptionsFrame.
} }
/*! /*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
*/ */
void WinEDA_PcbGeneralOptionsFrame::OnOkClick( wxCommandEvent& event ) void WinEDA_PcbGeneralOptionsFrame::OnOkClick( wxCommandEvent& event )
{ {
AcceptPcbOptions(event); AcceptPcbOptions( event );
////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK in WinEDA_PcbGeneralOptionsFrame. ////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK in WinEDA_PcbGeneralOptionsFrame.
// Before editing this code, remove the block markers. // Before editing this code, remove the block markers.
event.Skip(); event.Skip();
////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK in WinEDA_PcbGeneralOptionsFrame.
}
////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK in WinEDA_PcbGeneralOptionsFrame.
}
/**************************************************************************/ /**************************************************************************/
void WinEDA_PcbGeneralOptionsFrame::AcceptPcbOptions(wxCommandEvent& event) void WinEDA_PcbGeneralOptionsFrame::AcceptPcbOptions( wxCommandEvent& event )
/**************************************************************************/ /**************************************************************************/
{ {
int ii; int ii;
DisplayOpt.DisplayPolarCood = DisplayOpt.DisplayPolarCood =
(m_PolarDisplay->GetSelection() == 0) ? FALSE : TRUE; (m_PolarDisplay->GetSelection() == 0) ? FALSE : TRUE;
ii = g_UnitMetric; ii = g_UnitMetric;
g_UnitMetric = (m_BoxUnits->GetSelection() == 0) ? 0 : 1; g_UnitMetric = (m_BoxUnits->GetSelection() == 0) ? 0 : 1;
if ( ii != g_UnitMetric ) m_Parent->ReCreateAuxiliaryToolbar(); if( ii != g_UnitMetric )
m_Parent->ReCreateAuxiliaryToolbar();
g_CursorShape = m_CursorShape->GetSelection(); g_CursorShape = m_CursorShape->GetSelection();
g_TimeOut = 60 * m_SaveTime->GetValue(); g_TimeOut = 60 * m_SaveTime->GetValue();
/* Mise a jour de la combobox d'affichage de la couche active */ /* Mise a jour de la combobox d'affichage de la couche active */
g_DesignSettings.m_CopperLayerCount = m_LayerNumber->GetValue(); g_DesignSettings.m_CopperLayerCount = m_LayerNumber->GetValue();
m_Parent->ReCreateLayerBox(NULL); m_Parent->ReCreateLayerBox( NULL );
g_MaxLinksShowed = m_MaxShowLinks->GetValue(); g_MaxLinksShowed = m_MaxShowLinks->GetValue();
Drc_On = m_DrcOn->GetValue(); Drc_On = m_DrcOn->GetValue();
if ( g_Show_Ratsnest != m_ShowGlobalRatsnest->GetValue() ) if( g_Show_Ratsnest != m_ShowGlobalRatsnest->GetValue() )
{ {
g_Show_Ratsnest = m_ShowGlobalRatsnest->GetValue(); g_Show_Ratsnest = m_ShowGlobalRatsnest->GetValue();
m_Parent->Ratsnest_On_Off(m_DC); m_Parent->Ratsnest_On_Off( m_DC );
} }
g_Show_Module_Ratsnest = m_ShowModuleRatsnest->GetValue(); g_Show_Module_Ratsnest = m_ShowModuleRatsnest->GetValue();
g_AutoDeleteOldTrack = m_TrackAutodel->GetValue(); g_AutoDeleteOldTrack = m_TrackAutodel->GetValue();
Segments_45_Only = m_Segments_45_Only_Ctrl->GetValue(); Segments_45_Only = m_Segments_45_Only_Ctrl->GetValue();
Track_45_Only = m_Track_45_Only_Ctrl->GetValue(); Track_45_Only = m_Track_45_Only_Ctrl->GetValue();
m_Parent->DrawPanel->m_AutoPAN_Enable = m_AutoPANOpt->GetValue(); m_Parent->DrawPanel->m_AutoPAN_Enable = m_AutoPANOpt->GetValue();
g_TwoSegmentTrackBuild = m_Track_DoubleSegm_Ctrl->GetValue(); g_TwoSegmentTrackBuild = m_Track_DoubleSegm_Ctrl->GetValue();
EndModal(1); EndModal( 1 );
} }
enum id_optpcb enum id_optpcb {
{
ID_ACCEPT_OPT = 1000, ID_ACCEPT_OPT = 1000,
ID_CANCEL_OPT ID_CANCEL_OPT
}; };
...@@ -495,42 +613,49 @@ enum id_optpcb ...@@ -495,42 +613,49 @@ enum id_optpcb
#include "dialog_graphic_items_options.cpp" #include "dialog_graphic_items_options.cpp"
/*****************************************************************/ /*****************************************************************/
void WinEDA_PcbFrame::InstallPcbOptionsFrame(const wxPoint & pos, void WinEDA_PcbFrame::InstallPcbOptionsFrame( const wxPoint& pos,
wxDC * DC, int id) wxDC* DC, int id )
/*****************************************************************/ /*****************************************************************/
{ {
switch( id )
switch ( id )
{ {
case ID_PCB_TRACK_SIZE_SETUP: case ID_PCB_TRACK_SIZE_SETUP:
{ {
WinEDA_PcbTracksDialog * OptionsFrame = WinEDA_PcbTracksDialog* OptionsFrame =
new WinEDA_PcbTracksDialog(this); new WinEDA_PcbTracksDialog( this );
OptionsFrame->ShowModal(); OptionsFrame->Destroy();
OptionsFrame->ShowModal();
OptionsFrame->Destroy();
} }
break; break;
case ID_PCB_DRAWINGS_WIDTHS_SETUP: case ID_PCB_DRAWINGS_WIDTHS_SETUP:
{ {
WinEDA_GraphicItemsOptionsDialog * OptionsFrame = WinEDA_GraphicItemsOptionsDialog* OptionsFrame =
new WinEDA_GraphicItemsOptionsDialog(this); new WinEDA_GraphicItemsOptionsDialog( this );
OptionsFrame->ShowModal(); OptionsFrame->Destroy();
OptionsFrame->ShowModal();
OptionsFrame->Destroy();
} }
break; break;
case ID_PCB_LOOK_SETUP: case ID_PCB_LOOK_SETUP:
{ {
WinEDA_DisplayOptionsDialog * OptionsFrame = WinEDA_DisplayOptionsDialog* OptionsFrame =
new WinEDA_DisplayOptionsDialog(this); new WinEDA_DisplayOptionsDialog( this );
OptionsFrame->ShowModal(); OptionsFrame->Destroy();
OptionsFrame->ShowModal();
OptionsFrame->Destroy();
} }
break; break;
case ID_OPTIONS_SETUP: case ID_OPTIONS_SETUP:
{ {
WinEDA_PcbGeneralOptionsFrame * OptionsFrame = WinEDA_PcbGeneralOptionsFrame* OptionsFrame =
new WinEDA_PcbGeneralOptionsFrame(this, DC); new WinEDA_PcbGeneralOptionsFrame( this, DC );
OptionsFrame->ShowModal(); OptionsFrame->Destroy();
OptionsFrame->ShowModal();
OptionsFrame->Destroy();
} }
break; break;
} }
...@@ -538,10 +663,10 @@ void WinEDA_PcbFrame::InstallPcbOptionsFrame(const wxPoint & pos, ...@@ -538,10 +663,10 @@ void WinEDA_PcbFrame::InstallPcbOptionsFrame(const wxPoint & pos,
/*******************************************************************/ /*******************************************************************/
void WinEDA_ModuleEditFrame::InstallOptionsFrame(const wxPoint & pos) void WinEDA_ModuleEditFrame::InstallOptionsFrame( const wxPoint& pos )
/*******************************************************************/ /*******************************************************************/
{ {
WinEDA_GraphicItemsOptionsDialog OptionsFrame (this); WinEDA_GraphicItemsOptionsDialog OptionsFrame( this );
OptionsFrame.ShowModal(); OptionsFrame.ShowModal();
} }
...@@ -20,7 +20,7 @@ static void Show_MoveTexte_Module( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ...@@ -20,7 +20,7 @@ static void Show_MoveTexte_Module( WinEDA_DrawPanel* panel, wxDC* DC, bool erase
static void ExitTextModule( WinEDA_DrawPanel* Panel, wxDC* DC ); static void ExitTextModule( WinEDA_DrawPanel* Panel, wxDC* DC );
/* local variables */ /* local variables */
wxPoint MoveVector; // Move vector for move edge, exported to dialog_edit mod_text.cpp wxPoint MoveVector; // Move vector for move edge, exported to dialog_edit mod_text.cpp
static wxPoint CursorInitialPosition; // Mouse cursor inital position for move command static wxPoint CursorInitialPosition; // Mouse cursor inital position for move command
...@@ -74,14 +74,15 @@ void WinEDA_BasePcbFrame::RotateTextModule( TEXTE_MODULE* Text, wxDC* DC ) ...@@ -74,14 +74,15 @@ void WinEDA_BasePcbFrame::RotateTextModule( TEXTE_MODULE* Text, wxDC* DC )
MODULE* module = (MODULE*) Text->m_Parent; MODULE* module = (MODULE*) Text->m_Parent;
Text->Draw( DrawPanel, DC, GR_XOR ); // we expect MoveVector to be (0,0) if there is no move in progress
Text->Draw( DrawPanel, DC, GR_XOR, MoveVector );
Text->m_Orient += 900; Text->m_Orient += 900;
while( Text->m_Orient >= 1800 ) while( Text->m_Orient >= 1800 )
Text->m_Orient -= 1800; Text->m_Orient -= 1800;
/* Redessin du Texte */ /* Redessin du Texte */
Text->Draw( DrawPanel, DC, GR_XOR ); Text->Draw( DrawPanel, DC, GR_XOR, MoveVector );
Text->Display_Infos( this ); Text->Display_Infos( this );
...@@ -107,10 +108,11 @@ void WinEDA_BasePcbFrame::DeleteTextModule( TEXTE_MODULE* Text, wxDC* DC ) ...@@ -107,10 +108,11 @@ void WinEDA_BasePcbFrame::DeleteTextModule( TEXTE_MODULE* Text, wxDC* DC )
if( Text->m_Type == TEXT_is_DIVERS ) if( Text->m_Type == TEXT_is_DIVERS )
{ {
Text->Draw( DrawPanel, DC, GR_XOR ); // Text->Draw( DrawPanel, DC, GR_XOR );
DrawPanel->PostDirtyRect( Text->GetBoundingBox() );
/* liberation de la memoire : */ /* liberation de la memoire : */
Text ->DeleteStructure(); Text->DeleteStructure();
GetScreen()->SetModify(); GetScreen()->SetModify();
Module->m_LastEdit_Time = time( NULL ); Module->m_LastEdit_Time = time( NULL );
} }
...@@ -137,10 +139,15 @@ static void ExitTextModule( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -137,10 +139,15 @@ static void ExitTextModule( WinEDA_DrawPanel* Panel, wxDC* DC )
return; return;
Module = (MODULE*) Text->m_Parent; Module = (MODULE*) Text->m_Parent;
Text->Draw( Panel, DC, GR_XOR, MoveVector ); Text->Draw( Panel, DC, GR_XOR, MoveVector );
/* Redessin du Texte */ /* Redessin du Texte */
Text->Draw( Panel, DC, GR_OR ); // Text->Draw( Panel, DC, GR_OR );
Panel->PostDirtyRect( Text->GetBoundingBox() );
// leave it at (0,0) so we can use it Rotate when not moving.
MoveVector.x = MoveVector.y = 0;
Text->m_Flags = 0; Text->m_Flags = 0;
Module->m_Flags = 0; Module->m_Flags = 0;
...@@ -167,6 +174,7 @@ void WinEDA_BasePcbFrame::StartMoveTexteModule( TEXTE_MODULE* Text, wxDC* DC ) ...@@ -167,6 +174,7 @@ void WinEDA_BasePcbFrame::StartMoveTexteModule( TEXTE_MODULE* Text, wxDC* DC )
Module->m_Flags |= IN_EDIT; Module->m_Flags |= IN_EDIT;
MoveVector.x = MoveVector.y = 0; MoveVector.x = MoveVector.y = 0;
CursorInitialPosition = Text->m_Pos; CursorInitialPosition = Text->m_Pos;
Text->Display_Infos( this ); Text->Display_Infos( this );
...@@ -189,6 +197,8 @@ void WinEDA_BasePcbFrame::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC ) ...@@ -189,6 +197,8 @@ void WinEDA_BasePcbFrame::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC )
{ {
if( Text != NULL ) if( Text != NULL )
{ {
DrawPanel->PostDirtyRect( Text->GetBoundingBox() );
Text->m_Pos = GetScreen()->m_Curseur; Text->m_Pos = GetScreen()->m_Curseur;
/* mise a jour des coordonnes relatives a l'ancre */ /* mise a jour des coordonnes relatives a l'ancre */
MODULE* Module = (MODULE*) Text->m_Parent; MODULE* Module = (MODULE*) Text->m_Parent;
...@@ -205,10 +215,14 @@ void WinEDA_BasePcbFrame::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC ) ...@@ -205,10 +215,14 @@ void WinEDA_BasePcbFrame::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC )
GetScreen()->SetModify(); GetScreen()->SetModify();
/* Redessin du Texte */ /* Redessin du Texte */
Text->Draw( DrawPanel, DC, GR_OR ); //Text->Draw( DrawPanel, DC, GR_OR );
DrawPanel->PostDirtyRect( Text->GetBoundingBox() );
} }
} }
// leave it at (0,0) so we can use it Rotate when not moving.
MoveVector.x = MoveVector.y = 0;
DrawPanel->ManageCurseur = NULL; DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL; DrawPanel->ForceCloseManageCurseur = NULL;
} }
......
...@@ -34,42 +34,40 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event ) ...@@ -34,42 +34,40 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event )
{ {
case ID_MENU_LOAD_FILE: case ID_MENU_LOAD_FILE:
case ID_LOAD_FILE: case ID_LOAD_FILE:
Clear_Pcb(TRUE ); LoadOnePcbFile( wxEmptyString, false );
LoadOnePcbFile( wxEmptyString,FALSE );
ReCreateAuxiliaryToolbar(); ReCreateAuxiliaryToolbar();
break; break;
case ID_MENU_READ_LAST_SAVED_VERSION_BOARD: case ID_MENU_READ_LAST_SAVED_VERSION_BOARD:
case ID_MENU_RECOVER_BOARD: case ID_MENU_RECOVER_BOARD:
{
wxString filename, oldfilename = GetScreen()->m_FileName;
if( id == ID_MENU_RECOVER_BOARD )
{
filename = g_SaveFileName + PcbExtBuffer;
}
else
{
filename = oldfilename;
ChangeFileNameExt( filename, wxT( ".000" ) );
}
if( !wxFileExists( filename ) )
{ {
msg = _( "Recovery file " ) + filename + _( " not found" ); wxString filename, oldfilename = GetScreen()->m_FileName;
DisplayInfo( this, msg ); if( id == ID_MENU_RECOVER_BOARD )
break; {
} filename = g_SaveFileName + PcbExtBuffer;
else }
{ else
msg = _( "Ok to load Recovery file " ) + filename; {
if( !IsOK( this, msg ) ) filename = oldfilename;
ChangeFileNameExt( filename, wxT( ".000" ) );
}
if( !wxFileExists( filename ) )
{
msg = _( "Recovery file " ) + filename + _( " not found" );
DisplayInfo( this, msg );
break; break;
}
else
{
msg = _( "Ok to load Recovery file " ) + filename;
if( !IsOK( this, msg ) )
break;
}
LoadOnePcbFile( filename, false );
GetScreen()->m_FileName = oldfilename;
SetTitle( GetScreen()->m_FileName );
ReCreateAuxiliaryToolbar();
} }
Clear_Pcb( TRUE );
LoadOnePcbFile( filename, FALSE );
GetScreen()->m_FileName = oldfilename;
SetTitle( GetScreen()->m_FileName );
ReCreateAuxiliaryToolbar();
}
break; break;
case ID_MENU_APPEND_FILE: case ID_MENU_APPEND_FILE:
...@@ -95,7 +93,6 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event ) ...@@ -95,7 +93,6 @@ void WinEDA_PcbFrame::Files_io( wxCommandEvent& event )
case ID_LOAD_FILE_8: case ID_LOAD_FILE_8:
case ID_LOAD_FILE_9: case ID_LOAD_FILE_9:
case ID_LOAD_FILE_10: case ID_LOAD_FILE_10:
Clear_Pcb(TRUE );
wxSetWorkingDirectory( wxPathOnly( GetLastProject( id - ID_LOAD_FILE_1 ) ) ); wxSetWorkingDirectory( wxPathOnly( GetLastProject( id - ID_LOAD_FILE_1 ) ) );
LoadOnePcbFile( GetLastProject( id - ID_LOAD_FILE_1 ).GetData(), LoadOnePcbFile( GetLastProject( id - ID_LOAD_FILE_1 ).GetData(),
false ); false );
...@@ -153,10 +150,12 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, bool Append ) ...@@ -153,10 +150,12 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, bool Append )
m_Pcb->m_Status_Pcb = 0; m_Pcb->m_Status_Pcb = 0;
} }
wxString fileName;
if( FullFileName == wxEmptyString ) if( FullFileName == wxEmptyString )
{ {
msg = wxT( "*" ) + PcbExtBuffer; msg = wxT( "*" ) + PcbExtBuffer;
wxString FileName = fileName =
EDA_FileSelector( _( "Load board files:" ), EDA_FileSelector( _( "Load board files:" ),
wxEmptyString, /* Chemin par defaut */ wxEmptyString, /* Chemin par defaut */
GetScreen()->m_FileName, /* nom fichier par defaut */ GetScreen()->m_FileName, /* nom fichier par defaut */
...@@ -166,15 +165,20 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, bool Append ) ...@@ -166,15 +165,20 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, bool Append )
wxFD_OPEN, wxFD_OPEN,
FALSE FALSE
); );
if( FileName == wxEmptyString )
if( fileName == wxEmptyString )
return FALSE; return FALSE;
GetScreen()->m_FileName = FileName;
} }
else else
GetScreen()->m_FileName = FullFileName; fileName = FullFileName;
if( !Append )
Clear_Pcb( false ); // pass false since we prompted above for a modified board
GetScreen()->m_FileName = fileName;
/* Start read PCB file /* Start read PCB file
*/ */
source = wxFopen( GetScreen()->m_FileName, wxT( "rt" ) ); source = wxFopen( GetScreen()->m_FileName, wxT( "rt" ) );
if( source == NULL ) if( source == NULL )
...@@ -202,7 +206,7 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, bool Append ) ...@@ -202,7 +206,7 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, bool Append )
} }
else if ( ver < g_CurrentVersionPCB ) else if ( ver < g_CurrentVersionPCB )
{ {
DisplayInfo( this, _( "This file was created by an older version of EESchema. It will be stored in the new file format when you save this file again.")); DisplayInfo( this, _( "This file was created by an older version of PCBnew. It will be stored in the new file format when you save this file again."));
} }
SetTitle( GetScreen()->m_FileName ); SetTitle( GetScreen()->m_FileName );
...@@ -242,7 +246,7 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, bool Append ) ...@@ -242,7 +246,7 @@ int WinEDA_PcbFrame::LoadOnePcbFile( const wxString& FullFileName, bool Append )
m_Pcb->Display_Infos( this ); m_Pcb->Display_Infos( this );
DrawPanel->Refresh( true); DrawPanel->Refresh( true);
/* reset the auto save timer */ /* reset the auto save timer */
g_SaveTime = time( NULL ); g_SaveTime = time( NULL );
...@@ -312,8 +316,8 @@ bool WinEDA_PcbFrame::SavePcbFile( const wxString& FileName ) ...@@ -312,8 +316,8 @@ bool WinEDA_PcbFrame::SavePcbFile( const wxString& FileName )
ChangeFileNameExt( BackupFileName, wxT( ".000" ) ); ChangeFileNameExt( BackupFileName, wxT( ".000" ) );
/* If an old backup file exists, delete it. /* If an old backup file exists, delete it.
if an old board file existes, rename it to the backup file name if an old board file existes, rename it to the backup file name
*/ */
if( wxFileExists( FullFileName ) ) if( wxFileExists( FullFileName ) )
{ {
/* rename the "old" file" from xxx.brd to xxx.000 */ /* rename the "old" file" from xxx.brd to xxx.000 */
......
...@@ -139,6 +139,7 @@ bool WinEDA_BasePcbFrame::Clear_Pcb( bool query ) ...@@ -139,6 +139,7 @@ bool WinEDA_BasePcbFrame::Clear_Pcb( bool query )
/* init pointeurs et variables */ /* init pointeurs et variables */
GetScreen()->m_FileName.Empty(); GetScreen()->m_FileName.Empty();
memset( buf_work, 0, BUFMEMSIZE ); memset( buf_work, 0, BUFMEMSIZE );
adr_lowmem = adr_max = buf_work; adr_lowmem = adr_max = buf_work;
......
...@@ -369,7 +369,6 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) ...@@ -369,7 +369,6 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
switch( m_ID_current_state ) switch( m_ID_current_state )
{ {
case ID_PCB_ZONES_BUTT: case ID_PCB_ZONES_BUTT:
{
if( m_Pcb->m_ZoneDescriptorList.size() > 0 ) if( m_Pcb->m_ZoneDescriptorList.size() > 0 )
{ {
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_FILL_ALL_ZONES, ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_FILL_ALL_ZONES,
...@@ -380,11 +379,9 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) ...@@ -380,11 +379,9 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_SELECT_LAYER, ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_SELECT_LAYER,
_( "Select Working Layer" ), Select_W_Layer_xpm ); _( "Select Working Layer" ), Select_W_Layer_xpm );
aPopMenu->AppendSeparator(); aPopMenu->AppendSeparator();
}
break; break;
case ID_TRACK_BUTT: case ID_TRACK_BUTT:
{
ADD_MENUITEM_WITH_SUBMENU( aPopMenu, Append_Track_Width_List(), ADD_MENUITEM_WITH_SUBMENU( aPopMenu, Append_Track_Width_List(),
ID_POPUP_PCB_SELECT_WIDTH, ID_POPUP_PCB_SELECT_WIDTH,
_( "Select Track Width" ), width_track_xpm ); _( "Select Track Width" ), width_track_xpm );
...@@ -393,7 +390,6 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) ...@@ -393,7 +390,6 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_SELECT_LAYER_PAIR, ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_SELECT_LAYER_PAIR,
_( "Select layer pair for vias" ), select_layer_pair_xpm ); _( "Select layer pair for vias" ), select_layer_pair_xpm );
aPopMenu->AppendSeparator(); aPopMenu->AppendSeparator();
}
break; break;
case ID_PCB_CIRCLE_BUTT: case ID_PCB_CIRCLE_BUTT:
......
...@@ -205,7 +205,8 @@ void WinEDA_PcbFrame::ReCreateHToolbar() ...@@ -205,7 +205,8 @@ void WinEDA_PcbFrame::ReCreateHToolbar()
wxString msg; wxString msg;
if( m_HToolBar != NULL ) if( m_HToolBar != NULL )
{ // simple mise a jour de la liste des fichiers anciens {
// simple mise a jour de la liste des fichiers anciens
wxMenuItem* item; wxMenuItem* item;
for( ii = 9; ii >=0; ii-- ) for( ii = 9; ii >=0; ii-- )
{ {
...@@ -307,12 +308,12 @@ void WinEDA_PcbFrame::ReCreateHToolbar() ...@@ -307,12 +308,12 @@ void WinEDA_PcbFrame::ReCreateHToolbar()
m_HToolBar->AddTool( ID_TOOLBARH_PCB_AUTOROUTE, wxEmptyString, BITMAP( mode_track_xpm ), m_HToolBar->AddTool( ID_TOOLBARH_PCB_AUTOROUTE, wxEmptyString, BITMAP( mode_track_xpm ),
_( "Mode Track and Autorouting" ), wxITEM_CHECK ); _( "Mode Track and Autorouting" ), wxITEM_CHECK );
// Fast call to FreeROUTE Web Bases router // Fast call to FreeROUTE Web Bases router
m_HToolBar->AddSeparator(); m_HToolBar->AddSeparator();
m_HToolBar->AddTool( ID_TOOLBARH_PCB_FREEROUTE_ACCESS, wxEmptyString, BITMAP( web_support_xpm ), m_HToolBar->AddTool( ID_TOOLBARH_PCB_FREEROUTE_ACCESS, wxEmptyString, BITMAP( web_support_xpm ),
_( "Fast access to theWeb Based FreeROUTE advanced routed" )); _( "Fast access to theWeb Based FreeROUTE advanced routed" ));
// 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_HToolBar->Realize();
...@@ -630,10 +631,7 @@ WinEDAChoiceBox* WinEDA_PcbFrame::ReCreateLayerBox( WinEDA_Toolbar* parent ) ...@@ -630,10 +631,7 @@ WinEDAChoiceBox* WinEDA_PcbFrame::ReCreateLayerBox( WinEDA_Toolbar* parent )
/**************************************************************************/ /**************************************************************************/
{ {
int ii, jj, ll; int ii, jj, ll;
unsigned lenght = 0; unsigned length = 0;
bool rebuild = FALSE;
long current_mask_layer;
if( m_SelLayerBox == NULL ) if( m_SelLayerBox == NULL )
{ {
if( parent == NULL ) if( parent == NULL )
...@@ -655,27 +653,39 @@ WinEDAChoiceBox* WinEDA_PcbFrame::ReCreateLayerBox( WinEDA_Toolbar* parent ) ...@@ -655,27 +653,39 @@ WinEDAChoiceBox* WinEDA_PcbFrame::ReCreateLayerBox( WinEDA_Toolbar* parent )
parent->AddControl( m_SelLayerBox ); parent->AddControl( m_SelLayerBox );
} }
// Test si reconstruction de la liste necessaire
current_mask_layer = 0; int layer_mask = g_TabAllCopperLayerMask[g_DesignSettings.m_CopperLayerCount - 1];
int Masque_Layer = g_TabAllCopperLayerMask[g_DesignSettings.m_CopperLayerCount - 1];
Masque_Layer |= ALL_NO_CU_LAYERS; layer_mask |= ALL_NO_CU_LAYERS;
// This is commented out because testing the number of layer is no longer
// sufficient since the layer names may also have changed. And the time
// required to test layer names is probably longer than the time required
// to simply reconstruct the list.
#if 0
// Test if reconstruction of the list is necessary
int current_layer_mask = 0;
for( ii = 0; ii < (int) m_SelLayerBox->GetCount(); ii++ ) for( ii = 0; ii < (int) m_SelLayerBox->GetCount(); ii++ )
{ {
jj = (int) ( (size_t) m_SelLayerBox->GetClientData( ii ) ); jj = (int) ( (size_t) m_SelLayerBox->GetClientData( ii ) );
current_mask_layer |= g_TabOneLayerMask[jj]; current_mask_layer |= g_TabOneLayerMask[jj];
} }
if( current_mask_layer != Masque_Layer ) bool rebuild = FALSE;
if( current_layer_mask != layer_mask )
rebuild = TRUE; rebuild = TRUE;
// Construction de la liste // Construction de la liste
if( rebuild ) if( rebuild )
#endif
{ {
m_SelLayerBox->Clear(); m_SelLayerBox->Clear();
for( ii = 0, jj = 0; ii <= EDGE_N; ii++ ) for( ii = 0, jj = 0; ii <= EDGE_N; ii++ )
{ {
// List to append hotkeys in layer box selection // List to append hotkeys in layer box selection
static int HK_SwitchLayer[EDGE_N + 1] = { static const int HK_SwitchLayer[EDGE_N + 1] = {
HK_SWITCH_LAYER_TO_COPPER, HK_SWITCH_LAYER_TO_COPPER,
HK_SWITCH_LAYER_TO_INNER1, HK_SWITCH_LAYER_TO_INNER1,
HK_SWITCH_LAYER_TO_INNER2, HK_SWITCH_LAYER_TO_INNER2,
...@@ -694,20 +704,20 @@ WinEDAChoiceBox* WinEDA_PcbFrame::ReCreateLayerBox( WinEDA_Toolbar* parent ) ...@@ -694,20 +704,20 @@ WinEDAChoiceBox* WinEDA_PcbFrame::ReCreateLayerBox( WinEDA_Toolbar* parent )
HK_SWITCH_LAYER_TO_COMPONENT HK_SWITCH_LAYER_TO_COMPONENT
}; };
if( (g_TabOneLayerMask[ii] & Masque_Layer) ) if( (g_TabOneLayerMask[ii] & layer_mask) )
{ {
wxString msg = m_Pcb->GetLayerName( ii ); wxString msg = m_Pcb->GetLayerName( ii );
msg = AddHotkeyName( msg, s_Board_Editor_Hokeys_Descr, HK_SwitchLayer[ii] ); msg = AddHotkeyName( msg, s_Board_Editor_Hokeys_Descr, HK_SwitchLayer[ii] );
m_SelLayerBox->Append( msg ); m_SelLayerBox->Append( msg );
m_SelLayerBox->SetClientData( jj, (void*) ii ); m_SelLayerBox->SetClientData( jj, (void*) ii );
lenght = max( lenght, msg.Len() ); length = MAX( length, msg.Len() );
jj++; jj++;
} }
} }
// Test me: // Test me:
// int lchar = m_SelLayerBox->GetFont().GetPointSize(); // int lchar = m_SelLayerBox->GetFont().GetPointSize();
// m_SelLayerBox->SetSize(wxSize(lenght * lchar,-1)); // m_SelLayerBox->SetSize(wxSize(length * lchar,-1));
m_SelLayerBox->SetToolTip( _( "+/- to switch" ) ); m_SelLayerBox->SetToolTip( _( "+/- to switch" ) );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment