Commit 24ce9409 authored by charras's avatar charras

more about Netclasses work

parent 9b4d215b
......@@ -51,11 +51,11 @@ class GENERAL_COLLECTORS_GUIDE;
class WinEDA_PcbFrame: public WinEDA_BasePcbFrame
{
public:
WinEDAChoiceBox* m_SelLayerBox;
WinEDAChoiceBox* m_SelTrackWidthBox;
wxTextCtrl* m_ClearanceBox;
wxTextCtrl* m_NetClassSelectedBox;
WinEDAChoiceBox* m_SelViaSizeBox;
WinEDAChoiceBox* m_SelLayerBox; // a combo box to display and select active layer
WinEDAChoiceBox* m_SelTrackWidthBox; // a combo box to display and select current track width
WinEDAChoiceBox* m_SelViaSizeBox; // a combo box to display and select current via diameter
wxTextCtrl* m_ClearanceBox; // a text ctrl to display the current tracks and vias clearance
wxTextCtrl* m_NetClassSelectedBox; // a text ctrl to display the current NetClass
private:
bool m_TrackAndViasSizesList_Changed;
......@@ -90,6 +90,7 @@ public:
void OnCloseWindow( wxCloseEvent& Event );
void Process_Special_Functions( wxCommandEvent& event );
void Tracks_and_Vias_Size_Event( wxCommandEvent& event );
void ProcessMuWaveFunctions( wxCommandEvent& event );
void MuWaveCommand( wxDC* DC, const wxPoint& MousePos );
......@@ -388,7 +389,6 @@ public:
// Track and via edition:
void Via_Edit_Control( wxCommandEvent& event );
void DisplayTrackSettings();
/**
* Function Other_Layer_Route
......
No preview for this file type
This diff is collapsed.
......@@ -79,6 +79,7 @@ set(PCBNEW_SRCS
edit_pcb_text.cpp
edit_track_width.cpp
edtxtmod.cpp
event_handlers_tracks_vias_sizes.cpp
export_gencad.cpp
files.cpp
find.cpp
......
......@@ -81,10 +81,13 @@ BOARD::~BOARD()
* Must be called after a netclass selection (or after a netclass parameter change
* Initialise vias and tracks values displayed in comb boxs of the auxiliary toolbar
* and some others parametres (netclass name ....)
* @param aNetClassName = the new netclass name
* @return true if lists of tracks and vias sizes are modified
*/
void BOARD::SetCurrentNetClass( const wxString & aNetClassName)
bool BOARD::SetCurrentNetClass( const wxString & aNetClassName)
{
NETCLASS * netClass = m_NetClasses.Find(aNetClassName);
bool lists_sizes_modified = false;
// if not found (should not happen) use the default
if ( netClass == NULL )
......@@ -94,12 +97,34 @@ BOARD::~BOARD()
// Initialize others values:
if( m_ViaSizeHistory.size() == 0 )
{
lists_sizes_modified = true;
m_ViaSizeHistory.push_back(0);
}
if( m_TrackWidthHistory.size() == 0 )
{
lists_sizes_modified = true;
m_TrackWidthHistory.push_back(0);
}
if( m_ViaSizeHistory[0] != netClass->GetViaDiameter() )
lists_sizes_modified = true;
m_ViaSizeHistory[0] = netClass->GetViaDiameter();
if( m_TrackWidthHistory[0] != netClass->GetTrackWidth() )
lists_sizes_modified = true;
m_TrackWidthHistory[0] = netClass->GetTrackWidth();
if( m_ViaSizeSelector >= m_ViaSizeHistory.size() )
m_ViaSizeSelector = m_ViaSizeHistory.size();
if( m_TrackWidthSelector >= m_TrackWidthHistory.size() )
m_TrackWidthSelector = m_TrackWidthHistory.size();
//Initialize track and via current size:
g_DesignSettings.m_CurrentViaSize = m_ViaSizeHistory[m_ViaSizeSelector];
g_DesignSettings.m_CurrentTrackWidth = m_TrackWidthHistory[m_TrackWidthSelector];
return lists_sizes_modified;
}
wxString BOARD::GetLayerName( int aLayerIndex ) const
......
......@@ -110,9 +110,9 @@ public:
// The others values are extra values
std::vector <int> m_ViaSizeHistory; // Last used via sizes (max count = HISTORY_MAX_COUNT)
std::vector <int> m_TrackWidthHistory; // Last used track widths (max count = HISTORY_MAX_COUNT)
int m_ViaSizeSelector; // index for m_ViaSizeHistory to select the value
unsigned m_ViaSizeSelector; // index for m_ViaSizeHistory to select the value
// O is the selection of the default value Netclass
int m_TrackWidthSelector; // index for m_TrackWidthHistory to select the value
unsigned m_TrackWidthSelector; // index for m_TrackWidthHistory to select the value
/**********************************/
public:
......@@ -369,8 +369,10 @@ public:
* Must be called after a netclass selection (or after a netclass parameter change
* Initialise vias and tracks values displayed in comb boxs of the auxiliary toolbar
* and some others parametres (netclass name ....)
* @param aNetClassName = the new netclass name
* @return true if lists of tracks and vias sizes are modified
*/
void SetCurrentNetClass( const wxString & aNetClassName);
bool SetCurrentNetClass( const wxString & aNetClassName);
/**
* Function Save
......
......@@ -114,8 +114,6 @@ void DIALOG_TRACKS_OPTIONS::OnButtonOkClick( wxCommandEvent& event )
g_DesignSettings.m_MaskMargin =
ReturnValueFromTextCtrl( *m_OptMaskMargin, m_Parent->m_InternalUnits );
m_Parent->DisplayTrackSettings();
m_Parent->AddHistory( g_DesignSettings.m_CurrentViaSize, TYPE_VIA );
m_Parent->AddHistory( g_DesignSettings.m_CurrentTrackWidth, TYPE_TRACK );
EndModal( 1 );
......
......@@ -36,8 +36,6 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
wxClientDC dc( DrawPanel );
BOARD_ITEM* DrawStruct = GetCurItem();
int toggle = 0;
DrawPanel->CursorOff( &dc );
DrawPanel->PrepareGraphicContext( &dc );
......@@ -49,8 +47,6 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
{
case wxID_CUT:
case wxID_COPY:
case ID_AUX_TOOLBAR_PCB_TRACK_WIDTH:
case ID_AUX_TOOLBAR_PCB_VIA_SIZE:
case ID_ON_GRID_SELECT:
case ID_ON_ZOOM_SELECT:
case ID_PCB_USER_GRID_SETUP:
......@@ -93,17 +89,6 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_SELECT_CU_LAYER:
case ID_POPUP_PCB_SELECT_LAYER_PAIR:
case ID_POPUP_PCB_SELECT_NO_CU_LAYER:
case ID_POPUP_PCB_SELECT_WIDTH:
case ID_POPUP_PCB_SELECT_AUTO_WIDTH:
case ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH:
case ID_POPUP_PCB_SELECT_WIDTH1:
case ID_POPUP_PCB_SELECT_WIDTH2:
case ID_POPUP_PCB_SELECT_WIDTH3:
case ID_POPUP_PCB_SELECT_WIDTH4:
case ID_POPUP_PCB_SELECT_WIDTH5:
case ID_POPUP_PCB_SELECT_WIDTH6:
case ID_POPUP_PCB_SELECT_WIDTH7:
case ID_POPUP_PCB_SELECT_WIDTH8:
case ID_POPUP_PCB_MOVE_TRACK_NODE:
case ID_POPUP_PCB_DRAG_TRACK_SEGMENT_KEEP_SLOPE:
case ID_POPUP_PCB_DRAG_TRACK_SEGMENT:
......@@ -149,9 +134,6 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
SetCursor( DrawPanel->m_PanelCursor = DrawPanel->m_PanelDefaultCursor );
break;
case ID_TOGGLE_PRESENT_COMMAND:
break;
default: // Finish (abort ) the command
if( DrawPanel->ManageCurseur && DrawPanel->ForceCloseManageCurseur )
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
......@@ -174,77 +156,6 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
Close( true );
break;
case ID_TOGGLE_PRESENT_COMMAND:
switch( m_ID_current_state )
{
case 0:
toggle = 1;
break;
case ID_TRACK_BUTT:
if( DrawStruct && (DrawStruct->m_Flags & IS_NEW) )
{
End_Route( (TRACK*) DrawStruct, &dc );
DrawPanel->m_AutoPAN_Request = false;
}
else
toggle = 1;
break;
case ID_PCB_ZONES_BUTT:
if( End_Zone( &dc ) )
{
DrawPanel->m_AutoPAN_Request = false;
SetCurItem( NULL );
}
else
toggle = 1;
break;
case ID_PCB_ADD_LINE_BUTT:
case ID_PCB_ARC_BUTT:
case ID_PCB_CIRCLE_BUTT:
if( DrawStruct == NULL )
{
}
else if( DrawStruct->Type() != TYPE_DRAWSEGMENT )
{
DisplayError( this, wxT( "DrawStruct Type error" ) );
DrawPanel->m_AutoPAN_Request = false;
}
else if( (DrawStruct->m_Flags & IS_NEW) )
{
End_Edge( (DRAWSEGMENT*) DrawStruct, &dc );
DrawPanel->m_AutoPAN_Request = false;
SetCurItem( NULL );
}
else
toggle = 1;
break;
default:
toggle = 1;
break;
}
if( toggle )
{
int swap = m_ID_last_state;
m_ID_last_state = m_ID_current_state;
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
m_ID_current_state = swap;
}
//SetCursor( DrawPanel->m_PanelCursor = DrawPanel->m_PanelDefaultCursor );
event.SetId( m_ID_current_state );
Process_Special_Functions( event );
break;
case ID_OPEN_MODULE_EDITOR:
if( m_ModuleEditFrame == NULL )
{
......@@ -321,7 +232,6 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_TRACK_BUTT:
SetToolID( id, wxCURSOR_PENCIL, _( "Add Tracks" ) );
DisplayTrackSettings();
if( (GetBoard()->m_Status_Pcb & LISTE_RATSNEST_ITEM_OK) == 0 )
{
Compile_Ratsnest( &dc, true );
......@@ -989,54 +899,6 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
}
break;
case ID_POPUP_PCB_SELECT_WIDTH:
break;
case ID_AUX_TOOLBAR_PCB_TRACK_WIDTH:
{
int ii = m_SelTrackWidthBox->GetChoice();
g_DesignSettings.m_CurrentTrackWidth = GetBoard()->m_TrackWidthHistory[ii];
DisplayTrackSettings();
m_TrackAndViasSizesList_Changed = false;
g_DesignSettings.m_UseConnectedTrackWidth = false;
}
break;
case ID_POPUP_PCB_SELECT_WIDTH1:
case ID_POPUP_PCB_SELECT_WIDTH2:
case ID_POPUP_PCB_SELECT_WIDTH3:
case ID_POPUP_PCB_SELECT_WIDTH4:
case ID_POPUP_PCB_SELECT_WIDTH5:
case ID_POPUP_PCB_SELECT_WIDTH6:
case ID_POPUP_PCB_SELECT_WIDTH7:
case ID_POPUP_PCB_SELECT_WIDTH8:
DrawPanel->MouseToCursorSchema();
g_DesignSettings.m_UseConnectedTrackWidth = false;
{
int ii = id - ID_POPUP_PCB_SELECT_WIDTH1;
g_DesignSettings.m_CurrentTrackWidth = GetBoard()->m_TrackWidthHistory[ii];
DisplayTrackSettings();
}
break;
case ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH:
g_DesignSettings.m_UseConnectedTrackWidth =
not g_DesignSettings.m_UseConnectedTrackWidth;
break;
case ID_POPUP_PCB_SELECT_AUTO_WIDTH:
DrawPanel->MouseToCursorSchema();
g_DesignSettings.m_UseConnectedTrackWidth = true;
break;
case ID_AUX_TOOLBAR_PCB_VIA_SIZE:
{
int ii = m_SelViaSizeBox->GetChoice();
g_DesignSettings.m_CurrentViaSize = GetBoard()->m_ViaSizeHistory[ii];
DisplayTrackSettings();
m_TrackAndViasSizesList_Changed = false;
}
break;
case ID_POPUP_PCB_MOVE_TRACK_SEGMENT:
DrawPanel->MouseToCursorSchema();
......
......@@ -14,29 +14,6 @@
#include "protos.h"
/* Routines Locales */
/* variables locales */
/***********************************************/
void WinEDA_PcbFrame::DisplayTrackSettings()
/***********************************************/
/* Display the current track width and via diameter
*/
{
wxString msg;
wxString buftrc, bufvia;
valeur_param( g_DesignSettings.m_CurrentTrackWidth, buftrc );
valeur_param( g_DesignSettings.m_CurrentViaSize, bufvia );
msg.Printf( _( "Track Width: %s Vias Size : %s" ),
buftrc.GetData(), bufvia.GetData() );
Affiche_Message( msg );
m_TrackAndViasSizesList_Changed = TRUE;
}
/***********************************************/
void WinEDA_PcbFrame::Ratsnest_On_Off( wxDC* DC )
/***********************************************/
......
......@@ -92,9 +92,6 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC )
BOARD_ITEM* LockPoint;
wxPoint pos = GetScreen()->m_Curseur;
static int InitialTrackWidthValue; /* first track segment width.
* used when we are in the auto tack width mode */
DrawPanel->ManageCurseur = ShowNewTrackWhenMovingCursor;
DrawPanel->ForceCloseManageCurseur = Exit_Editrack;
......@@ -110,8 +107,6 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC )
if( g_HightLigt_Status )
Hight_Light( DC );
InitialTrackWidthValue = -1; // Set to "no value"
g_CurrentTrackList.PushBack( new TRACK( GetBoard() ) );
g_CurrentTrackSegment->m_Flags = IS_NEW;
......@@ -153,26 +148,22 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC )
Hight_Light( DC );
// Display info about track Net class, and init track and vias sizes:
g_CurrentTrackSegment->SetNet( g_HightLigth_NetCode );
GetBoard()->SetCurrentNetClass( g_CurrentTrackSegment->GetNetClassName() );
m_TrackAndViasSizesList_Changed = true;
AuxiliaryToolBar_Update_UI();
g_CurrentTrackSegment->SetLayer( GetScreen()->m_Active_Layer );
g_CurrentTrackSegment->m_Width = g_DesignSettings.m_CurrentTrackWidth;
if( g_DesignSettings.m_UseConnectedTrackWidth )
{
if( TrackOnStartPoint && TrackOnStartPoint->Type() == TYPE_TRACK )
{
InitialTrackWidthValue = TrackOnStartPoint->m_Width;
g_CurrentTrackSegment->m_Width = InitialTrackWidthValue;
}
g_CurrentTrackSegment->m_Width = TrackOnStartPoint->m_Width;
}
g_CurrentTrackSegment->m_Start = pos;
g_CurrentTrackSegment->m_End = pos;
g_CurrentTrackSegment->SetNet( g_HightLigth_NetCode );
// Display info about track Net class:
GetBoard()->SetCurrentNetClass( g_CurrentTrackSegment->GetNetClassName() );
m_TrackAndViasSizesList_Changed = true;
AuxiliaryToolBar_DesignRules_Update_UI();
if( pt_pad )
{
......@@ -271,7 +262,6 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC )
newTrack->m_Start = newTrack->m_End;
newTrack->SetLayer( ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer );
if( !g_DesignSettings.m_UseConnectedTrackWidth )
{
newTrack->m_Width = g_DesignSettings.m_CurrentTrackWidth;
......@@ -674,10 +664,7 @@ static void PushTrack( WinEDA_DrawPanel* panel )
void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
/****************************************************************************/
/* redessin du contour de la piste lors des deplacements de la souris
* Cette routine est utilisee comme .ManageCurseur()
* si ShowIsolDuringCreateTrack_Item.State == RUN la marge d'isolation
* est aussi affichee
/* Redraw the current track beiing created when the mouse cursor is moved
*/
{
D( g_CurrentTrackList.VerifyListIntegrity(); );
......@@ -693,7 +680,7 @@ void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool erase
if( showTrackClearanceMode != DO_NOT_SHOW_CLEARANCE )
DisplayOpt.ShowTrackClearanceMode = SHOW_CLEARANCE_ALWAYS;
/* efface ancienne position si elle a ete deja dessinee */
/* Erase old track */
if( erase )
{
Trace_Une_Piste( panel, DC, g_FirstTrackSegment, g_CurrentTrackList.GetCount(), GR_XOR );
......@@ -715,10 +702,9 @@ void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool erase
if( g_CurrentTrackList.GetCount() == 0 )
return;
/* dessin de la nouvelle piste : mise a jour du point d'arrivee */
// Set track parameters, that can be modified while creating the track
g_CurrentTrackSegment->SetLayer( screen->m_Active_Layer );
if( !g_DesignSettings.m_UseConnectedTrackWidth )
g_CurrentTrackSegment->m_Width = netclass->GetTrackWidth();
g_CurrentTrackSegment->m_Width = g_DesignSettings.m_CurrentTrackWidth;
if( g_TwoSegmentTrackBuild )
{
......@@ -728,7 +714,7 @@ void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool erase
previous_track->SetLayer( screen->m_Active_Layer );
if( !g_DesignSettings.m_UseConnectedTrackWidth )
previous_track->m_Width = netclass->GetTrackWidth();
previous_track->m_Width = g_DesignSettings.m_CurrentTrackWidth;
}
}
......@@ -760,6 +746,7 @@ void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool erase
g_CurrentTrackSegment->m_End = screen->m_Curseur;
}
/* Redraw the new track */
D( g_CurrentTrackList.VerifyListIntegrity(); );
Trace_Une_Piste( panel, DC, g_FirstTrackSegment, g_CurrentTrackList.GetCount(), GR_XOR );
......
#include "wx/msw/wx.rc"
/* event_handlers_tracks_vias_sizes.cpp
*
* Handlers for popup and toolbars events relative
* to the tracks and vias sizes
*/
#include "fctsys.h"
//#include "appl_wxstruct.h"
#include "class_drawpanel.h"
#include "confirm.h"
#include "pcbnew_id.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
/** Function Tracks_and_Vias_Size_Event
* Event handler for tracks and vias size selection (and some options)
* relative to toolbars and popup events
*/
void WinEDA_PcbFrame::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
{
int ii;
int id = event.GetId();
/* Note: none of these events require aborting the current command (if any)
* (like move, edit or block command)
* so we do not test for a current command in progress and call
* DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
*/
switch( id )
{
case ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH:
g_DesignSettings.m_UseConnectedTrackWidth = not g_DesignSettings.m_UseConnectedTrackWidth;
g_DesignSettings.m_CurrentTrackWidth = GetBoard()->m_TrackWidthHistory[m_SelTrackWidthBox->GetChoice()];
g_DesignSettings.m_CurrentViaSize = GetBoard()->m_ViaSizeHistory[m_SelViaSizeBox->GetChoice()];
AuxiliaryToolBar_Update_UI( );
break;
case ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES:
GetBoard()->m_TrackWidthSelector = 0;
g_DesignSettings.m_CurrentTrackWidth = GetBoard()->m_TrackWidthHistory[0];
GetBoard()->m_ViaSizeSelector = 0;
g_DesignSettings.m_CurrentViaSize = GetBoard()->m_ViaSizeHistory[0];
AuxiliaryToolBar_Update_UI( );
break;
case ID_POPUP_PCB_SELECT_AUTO_WIDTH:
DrawPanel->MouseToCursorSchema();
g_DesignSettings.m_UseConnectedTrackWidth = true;
AuxiliaryToolBar_Update_UI( );
break;
case ID_POPUP_PCB_SELECT_WIDTH1:
case ID_POPUP_PCB_SELECT_WIDTH2:
case ID_POPUP_PCB_SELECT_WIDTH3:
case ID_POPUP_PCB_SELECT_WIDTH4:
case ID_POPUP_PCB_SELECT_WIDTH5:
case ID_POPUP_PCB_SELECT_WIDTH6:
case ID_POPUP_PCB_SELECT_WIDTH7:
case ID_POPUP_PCB_SELECT_WIDTH8:
DrawPanel->MouseToCursorSchema();
g_DesignSettings.m_UseConnectedTrackWidth = false;
ii = id - ID_POPUP_PCB_SELECT_WIDTH1;
GetBoard()->m_TrackWidthSelector = ii;
g_DesignSettings.m_CurrentTrackWidth = GetBoard()->m_TrackWidthHistory[ii];
AuxiliaryToolBar_Update_UI( );
break;
case ID_POPUP_PCB_SELECT_VIASIZE1:
case ID_POPUP_PCB_SELECT_VIASIZE2:
case ID_POPUP_PCB_SELECT_VIASIZE3:
case ID_POPUP_PCB_SELECT_VIASIZE4:
case ID_POPUP_PCB_SELECT_VIASIZE5:
case ID_POPUP_PCB_SELECT_VIASIZE6:
case ID_POPUP_PCB_SELECT_VIASIZE7:
case ID_POPUP_PCB_SELECT_VIASIZE8: // selec the new current value for via size (via diameter)
DrawPanel->MouseToCursorSchema();
ii = id - ID_POPUP_PCB_SELECT_VIASIZE1;
GetBoard()->m_ViaSizeSelector = ii;
g_DesignSettings.m_CurrentViaSize = GetBoard()->m_ViaSizeHistory[ii];
AuxiliaryToolBar_Update_UI( );
break;
case ID_AUX_TOOLBAR_PCB_TRACK_WIDTH:
ii = m_SelTrackWidthBox->GetChoice();
g_DesignSettings.m_CurrentTrackWidth = GetBoard()->m_TrackWidthHistory[ii];
GetBoard()->m_TrackWidthSelector = ii;
break;
case ID_AUX_TOOLBAR_PCB_VIA_SIZE:
ii = m_SelViaSizeBox->GetChoice();
g_DesignSettings.m_CurrentViaSize = GetBoard()->m_ViaSizeHistory[ii];
GetBoard()->m_ViaSizeSelector = ii;
break;
default:
wxMessageBox( wxT( "WinEDA_PcbFrame::Tracks_and_Vias_Size_Event() error") );
break;
}
}
......@@ -95,7 +95,6 @@ static Ki_HotkeyInfo HkTrackDisplayMode(wxT("Track Display Mode"),
HK_SWITCH_TRACK_DISPLAY_MODE, 'K');
static Ki_HotkeyInfo HkAddModule(wxT("Add Module"), HK_ADD_MODULE, 'O');
static Ki_HotkeyInfo HkAddTrack(wxT("Add Track or Via"), HK_ADD_TRACK, 'J');
static Ki_HotkeyInfo HkToggle(wxT("Toggle Present Command"), HK_TOGGLE, 'E');
// List of common hotkey descriptors
Ki_HotkeyInfo
......@@ -112,7 +111,7 @@ Ki_HotkeyInfo* s_board_edit_Hotkey_List[] = { &HkTrackDisplayMode, &HkDelete,
&HkSwitch2InnerLayer2, &HkSwitch2InnerLayer3, &HkSwitch2InnerLayer4,
&HkSwitch2InnerLayer5, &HkSwitch2InnerLayer6, &HkSwitch2ComponentLayer,
&HkSwitch2NextCopperLayer, &HkSwitch2PreviousCopperLayer, &HkAddModule,
&HkAddTrack, &HkToggle, NULL };
&HkAddTrack, NULL };
// List of hotkey descriptors for the module editor
Ki_HotkeyInfo* s_module_edit_Hotkey_List[] = { NULL };
......@@ -276,10 +275,6 @@ void WinEDA_PcbFrame::OnHotKey(wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct)
cmd.SetId(ID_TRACK_BUTT);
GetEventHandler()->ProcessEvent(cmd);
break;
case HK_TOGGLE:
cmd.SetId(ID_TOGGLE_PRESENT_COMMAND);
GetEventHandler()->ProcessEvent(cmd);
break;
case HK_ZOOM_AUTO:
cmd.SetId(ID_ZOOM_PAGE);
......
......@@ -50,7 +50,6 @@ enum hotkey_id_commnand {
HK_SWITCH_LAYER_TO_INNER14,
HK_ADD_MODULE,
HK_ADD_TRACK,
HK_TOGGLE,
HK_MOVE_TRACK,
HK_SLIDE_TRACK
};
......
......@@ -207,7 +207,7 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
case TYPE_TRACK:
case TYPE_VIA:
locate_track = TRUE;
locate_track = true;
createPopupMenuForTracks( (TRACK*) item, aPopMenu );
break;
......@@ -545,13 +545,13 @@ void WinEDA_PcbFrame::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
ADD_MENUITEM_WITH_SUBMENU( PopMenu, track_mnu,
ID_POPUP_PCB_SETFLAGS_TRACK_MNU, _( "Set Flags" ), flag_xpm );
track_mnu->Append( ID_POPUP_PCB_LOCK_ON_TRACKSEG, _( "Locked: Yes" ), wxEmptyString, TRUE );
track_mnu->Append( ID_POPUP_PCB_LOCK_OFF_TRACKSEG, _( "Locked: No" ), wxEmptyString, TRUE );
track_mnu->Append( ID_POPUP_PCB_LOCK_ON_TRACKSEG, _( "Locked: Yes" ), wxEmptyString, true );
track_mnu->Append( ID_POPUP_PCB_LOCK_OFF_TRACKSEG, _( "Locked: No" ), wxEmptyString, true );
if( Track->GetState( SEGM_FIXE ) )
track_mnu->Check( ID_POPUP_PCB_LOCK_ON_TRACKSEG, TRUE );
track_mnu->Check( ID_POPUP_PCB_LOCK_ON_TRACKSEG, true );
else
track_mnu->Check( ID_POPUP_PCB_LOCK_OFF_TRACKSEG, TRUE );
track_mnu->Check( ID_POPUP_PCB_LOCK_OFF_TRACKSEG, true );
if( !flags )
{
......@@ -830,7 +830,8 @@ void WinEDA_PcbFrame::createPopUpMenuForMarkers( MARKER_PCB* aMarker, wxMenu* aP
static wxMenu* Append_Track_Width_List( BOARD * aBoard )
/*******************************************************/
/* create a wxMenu * which shows the last used track widths and via diameters
/** function Append_Track_Width_List
* creates a wxMenu * which shows the last used track widths and via diameters
* @return a pointeur to the menu
*/
{
......@@ -847,10 +848,16 @@ static wxMenu* Append_Track_Width_List( BOARD * aBoard )
_( "Auto Width" ),
_(
"Use the track width when starting on a track, otherwise the current track width" ),
TRUE );
true );
if( g_DesignSettings.m_UseConnectedTrackWidth )
trackwidth_menu->Check( ID_POPUP_PCB_SELECT_AUTO_WIDTH, TRUE );
trackwidth_menu->Check( ID_POPUP_PCB_SELECT_AUTO_WIDTH, true );
if( aBoard->m_ViaSizeSelector != 0 || aBoard->m_TrackWidthSelector != 0 )
trackwidth_menu->Append( ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES,
_( "Use Netclass Values" ),
_( "Use track and via sizes from their Netclass values" ),
true );
for( unsigned ii = 0; ii < aBoard->m_TrackWidthHistory.size(); ii++ )
{
......@@ -862,11 +869,18 @@ static wxMenu* Append_Track_Width_List( BOARD * aBoard )
else
msg.Printf( _( "Track %.3f" ), value );
trackwidth_menu->Append( ID_POPUP_PCB_SELECT_WIDTH1 + ii, msg, wxEmptyString, TRUE );
if ( ii == 0 )
msg << _(" (Use NetClass)" );
trackwidth_menu->Append( ID_POPUP_PCB_SELECT_WIDTH1 + ii, msg, wxEmptyString, true );
if( (aBoard->m_TrackWidthHistory[ii] == g_DesignSettings.m_CurrentTrackWidth)
&& !g_DesignSettings.m_UseConnectedTrackWidth )
trackwidth_menu->Check( ID_POPUP_PCB_SELECT_WIDTH1 + ii, TRUE );
}
if( g_DesignSettings.m_UseConnectedTrackWidth )
trackwidth_menu->Check( ID_POPUP_PCB_SELECT_AUTO_WIDTH, true );
else
{
if( aBoard->m_TrackWidthSelector < (int)aBoard->m_TrackWidthHistory.size() )
trackwidth_menu->Check( ID_POPUP_PCB_SELECT_WIDTH1 + aBoard->m_TrackWidthSelector, true );
}
trackwidth_menu->AppendSeparator();
......@@ -879,10 +893,12 @@ static wxMenu* Append_Track_Width_List( BOARD * aBoard )
msg.Printf( _( "Via %.1f" ), value * 1000 );
else
msg.Printf( _( "Via %.3f" ), value );
trackwidth_menu->Append( ID_POPUP_PCB_SELECT_VIASIZE1 + ii, msg, wxEmptyString, TRUE );
if( aBoard->m_ViaSizeHistory[ii] == g_DesignSettings.m_CurrentViaSize )
trackwidth_menu->Check( ID_POPUP_PCB_SELECT_VIASIZE1 + ii, TRUE );
if ( ii == 0 )
msg << _(" (Use NetClass)" );
trackwidth_menu->Append( ID_POPUP_PCB_SELECT_VIASIZE1 + ii, msg, wxEmptyString, true );
}
if( aBoard->m_ViaSizeSelector < (int)aBoard->m_ViaSizeHistory.size() )
trackwidth_menu->Check( ID_POPUP_PCB_SELECT_VIASIZE1 + aBoard->m_ViaSizeSelector, true );
return trackwidth_menu;
}
This diff is collapsed.
......@@ -105,16 +105,6 @@ enum pcbnew_ids
ID_POPUP_PCB_IMPORT_PAD_SETTINGS,
ID_POPUP_PCB_EXPORT_PAD_SETTINGS,
ID_POPUP_PCB_SELECT_WIDTH,
ID_POPUP_PCB_SELECT_AUTO_WIDTH,
ID_POPUP_PCB_SELECT_WIDTH1,
ID_POPUP_PCB_SELECT_WIDTH2,
ID_POPUP_PCB_SELECT_WIDTH3,
ID_POPUP_PCB_SELECT_WIDTH4,
ID_POPUP_PCB_SELECT_WIDTH5,
ID_POPUP_PCB_SELECT_WIDTH6,
ID_POPUP_PCB_SELECT_WIDTH7,
ID_POPUP_PCB_SELECT_WIDTH8,
ID_POPUP_PCB_EDIT_TRACKSEG,
ID_POPUP_PCB_EDIT_TRACK_MNU,
ID_POPUP_PCB_EDIT_NET,
......@@ -157,8 +147,22 @@ enum pcbnew_ids
ID_POPUP_PCB_GETINFO_MARKER,
ID_POPUP_PCB_END_RANGE,
// Via edition
ID_POPUP_VIA_EDIT_START_RANGE,
// Tracks and vias sizes general options
ID_AUX_TOOLBAR_PCB_VIA_SIZE,
ID_AUX_TOOLBAR_PCB_TRACK_WIDTH,
ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH,
ID_POPUP_PCB_SELECT_WIDTH_START_RANGE,
ID_POPUP_PCB_SELECT_WIDTH,
ID_POPUP_PCB_SELECT_AUTO_WIDTH,
ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES,
ID_POPUP_PCB_SELECT_WIDTH1,
ID_POPUP_PCB_SELECT_WIDTH2,
ID_POPUP_PCB_SELECT_WIDTH3,
ID_POPUP_PCB_SELECT_WIDTH4,
ID_POPUP_PCB_SELECT_WIDTH5,
ID_POPUP_PCB_SELECT_WIDTH6,
ID_POPUP_PCB_SELECT_WIDTH7,
ID_POPUP_PCB_SELECT_WIDTH8,
ID_POPUP_PCB_SELECT_VIASIZE,
ID_POPUP_PCB_SELECT_VIASIZE1,
ID_POPUP_PCB_SELECT_VIASIZE2,
......@@ -168,6 +172,10 @@ enum pcbnew_ids
ID_POPUP_PCB_SELECT_VIASIZE6,
ID_POPUP_PCB_SELECT_VIASIZE7,
ID_POPUP_PCB_SELECT_VIASIZE8,
ID_POPUP_PCB_SELECT_WIDTH_END_RANGE,
// Via edition
ID_POPUP_VIA_EDIT_START_RANGE,
ID_POPUP_PCB_VIA_EDITING,
ID_POPUP_PCB_VIA_HOLE_TO_DEFAULT,
ID_POPUP_PCB_VIA_HOLE_TO_VALUE,
......@@ -225,16 +233,7 @@ enum pcbnew_ids
ID_TOOLBARH_PCB_AUTOROUTE,
ID_TOOLBARH_PCB_FREEROUTE_ACCESS,
ID_AUX_TOOLBAR_PCB_VIA_SIZE,
ID_AUX_TOOLBAR_PCB_TRACK_WIDTH,
ID_AUX_TOOLBAR_PCB_UNUSED2,
ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR,
ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH,
ID_AUX_TOOLBAR_PCB_UNUSED3,
ID_AUX_TOOLBAR_PCB_UNUSED4,
ID_AUX_TOOLBAR_PCB_UNUSED5,
ID_AUX_TOOLBAR_PCB_UNUSED6,
ID_AUX_TOOLBAR_PCB_UNUSED7,
ID_PCB_GEN_POS_MODULES_FILE,
ID_PCB_GEN_DRILL_FILE,
......@@ -281,9 +280,7 @@ enum pcbnew_ids
ID_PCB_MUWAVE_TOOL_STUB_CMD,
ID_PCB_MUWAVE_TOOL_STUB_ARC_CMD,
ID_PCB_MUWAVE_TOOL_FUNCTION_SHAPE_CMD,
ID_PCB_MUWAVE_END_CMD,
ID_TOGGLE_PRESENT_COMMAND,
ID_PCB_MUWAVE_END_CMD
};
#endif /* __PCBNEW_IDS_H__ */
......@@ -538,11 +538,12 @@ void WinEDA_PcbFrame::ReCreateAuxVToolbar()
void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar()
/****************************************************/
/* Create auxiliary horizontal toolbar
/* Creates auxiliary horizontal toolbar
* displays:
* existing track width choice
* selection for auto track width
* existing via size choice
* Current strategy (to choose the track and via sizes)
* grid size choice
* zoom level choice
*/
......@@ -555,14 +556,25 @@ void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar()
m_AuxiliaryToolBar = new WinEDA_Toolbar( TOOLBAR_AUX, this,
ID_AUX_TOOLBAR, true );
// Set up toolbar
m_AuxiliaryToolBar->AddSeparator();
m_TrackAndViasSizesList_Changed = true;
/* Set up toolbar items */
// Creates box to display and choose tracks widths:
m_SelTrackWidthBox = new WinEDAChoiceBox( m_AuxiliaryToolBar,
ID_AUX_TOOLBAR_PCB_TRACK_WIDTH,
wxPoint( -1, -1 ),
wxSize( LISTBOX_WIDTH + 20, -1 ) );
wxSize( LISTBOX_WIDTH + 10, -1 ) );
m_AuxiliaryToolBar->AddControl( m_SelTrackWidthBox );
m_TrackAndViasSizesList_Changed = true;
// Creates box to display and choose vias diameters:
m_SelViaSizeBox = new WinEDAChoiceBox( m_AuxiliaryToolBar,
ID_AUX_TOOLBAR_PCB_VIA_SIZE,
wxPoint( -1, -1 ),
wxSize( LISTBOX_WIDTH + 10, -1 ) );
m_AuxiliaryToolBar->AddControl( m_SelViaSizeBox );
// Creates box to display tracks and vias clearance:
m_ClearanceBox = new wxTextCtrl( m_AuxiliaryToolBar,
-1,
wxEmptyString,
......@@ -572,19 +584,7 @@ void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar()
m_AuxiliaryToolBar->AddControl( m_ClearanceBox );
m_ClearanceBox->SetToolTip(_("Current NetClass clearance value") );
m_AuxiliaryToolBar->AddTool( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH,
wxEmptyString,
wxBitmap( auto_track_width_xpm ),
_( "Auto track width: when starting on an existing track use its width\notherwise, use current width setting" ),
wxITEM_CHECK );
m_AuxiliaryToolBar->AddSeparator();
m_SelViaSizeBox = new WinEDAChoiceBox( m_AuxiliaryToolBar,
ID_AUX_TOOLBAR_PCB_VIA_SIZE,
wxPoint( -1, -1 ),
wxSize( LISTBOX_WIDTH, -1 ) );
m_AuxiliaryToolBar->AddControl( m_SelViaSizeBox );
// Creates box to display the current NetClass:
m_NetClassSelectedBox = new wxTextCtrl( m_AuxiliaryToolBar,
-1,
wxEmptyString,
......@@ -594,7 +594,14 @@ void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar()
m_AuxiliaryToolBar->AddControl( m_NetClassSelectedBox );
m_NetClassSelectedBox->SetToolTip(_("Name of the current NetClass") );
// Boite de selection du pas de grille
// Creates box to display and choose strategy to handle tracks an vias sizes:
m_AuxiliaryToolBar->AddTool( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH,
wxEmptyString,
wxBitmap( auto_track_width_xpm ),
_( "Auto track width: when starting on an existing track use its width\notherwise, use current width setting" ),
wxITEM_CHECK );
// Add the box to display and select the current grid size:
m_AuxiliaryToolBar->AddSeparator();
m_SelGridBox = new WinEDAChoiceBox( m_AuxiliaryToolBar,
ID_ON_GRID_SELECT,
......@@ -602,7 +609,7 @@ void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar()
wxSize( LISTBOX_WIDTH, -1 ) );
m_AuxiliaryToolBar->AddControl( m_SelGridBox );
// Boite de selection du Zoom
// Add the box to display and select the current Zoom
m_AuxiliaryToolBar->AddSeparator();
m_SelZoomBox = new WinEDAChoiceBox( m_AuxiliaryToolBar,
ID_ON_ZOOM_SELECT,
......@@ -630,7 +637,7 @@ void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar()
m_AuxiliaryToolBar->Realize();
}
// mise a jour des affichages
// Update displayed values
m_SelGridBox->Clear();
wxString format = _( "Grid");
if( g_UnitMetric == INCHES )
......
......@@ -74,8 +74,6 @@ void WinEDA_PcbFrame::AuxiliaryToolBar_DesignRules_Update_UI( )
void WinEDA_PcbFrame::AuxiliaryToolBar_Update_UI( )
{
wxString msg;
m_AuxiliaryToolBar->ToggleTool( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH,
g_DesignSettings.m_UseConnectedTrackWidth );
AuxiliaryToolBar_DesignRules_Update_UI( );
......@@ -85,12 +83,14 @@ void WinEDA_PcbFrame::AuxiliaryToolBar_Update_UI( )
for( unsigned ii = 0; ii < GetBoard()->m_TrackWidthHistory.size(); ii++ )
{
msg = _( "Track" ) + ReturnStringValue(GetBoard()->m_TrackWidthHistory[ii]);
if (ii == 0 )
msg << _(" *");
m_SelTrackWidthBox->Append( msg );
}
if( GetBoard()->m_TrackWidthSelector >= (int)GetBoard()->m_TrackWidthHistory.size() )
}
if( GetBoard()->m_TrackWidthSelector >= GetBoard()->m_TrackWidthHistory.size() )
GetBoard()->m_TrackWidthSelector = 0;
m_SelTrackWidthBox->SetSelection( GetBoard()->m_TrackWidthSelector );
}
if( m_SelViaSizeBox && m_TrackAndViasSizesList_Changed )
{
......@@ -98,12 +98,14 @@ void WinEDA_PcbFrame::AuxiliaryToolBar_Update_UI( )
for( unsigned ii = 0; ii < GetBoard()->m_ViaSizeHistory.size(); ii++ )
{
msg = _( "Via" ) + ReturnStringValue(GetBoard()->m_ViaSizeHistory[ii]);
if (ii == 0 )
msg << _(" *");
m_SelViaSizeBox->Append( msg );
}
if( GetBoard()->m_ViaSizeSelector >= (int)GetBoard()->m_ViaSizeHistory.size() )
}
if( GetBoard()->m_ViaSizeSelector >= GetBoard()->m_ViaSizeHistory.size() )
GetBoard()->m_ViaSizeSelector = 0;
m_SelViaSizeBox->SetSelection( GetBoard()->m_ViaSizeSelector );
}
if( m_SelZoomBox )
{
......
......@@ -19,7 +19,6 @@ void WinEDA_PcbFrame::Via_Edit_Control( wxCommandEvent& event )
* Execute edit commands relative to vias
*/
{
int ii;
TRACK* via_struct;
SEGVIA* via = (SEGVIA*) GetCurItem();
wxClientDC dc( DrawPanel );
......@@ -33,20 +32,6 @@ void WinEDA_PcbFrame::Via_Edit_Control( wxCommandEvent& event )
switch( event.GetId() )
{
case ID_POPUP_PCB_SELECT_VIASIZE1:
case ID_POPUP_PCB_SELECT_VIASIZE2:
case ID_POPUP_PCB_SELECT_VIASIZE3:
case ID_POPUP_PCB_SELECT_VIASIZE4:
case ID_POPUP_PCB_SELECT_VIASIZE5:
case ID_POPUP_PCB_SELECT_VIASIZE6:
case ID_POPUP_PCB_SELECT_VIASIZE7:
case ID_POPUP_PCB_SELECT_VIASIZE8: // selec the new current value for via size (via diameter)
DrawPanel->MouseToCursorSchema();
ii = event.GetId() - ID_POPUP_PCB_SELECT_VIASIZE1;
g_DesignSettings.m_CurrentViaSize = GetBoard()->m_ViaSizeHistory[ii];
DisplayTrackSettings();
break;
case ID_POPUP_PCB_VIA_HOLE_ENTER_VALUE: // Enter a new alternate value for drill via
InstallPcbOptionsFrame( wxDefaultPosition, &dc, ID_PCB_TRACK_SIZE_SETUP );
DrawPanel->MouseToCursorSchema();
......@@ -124,7 +109,7 @@ void WinEDA_PcbFrame::Via_Edit_Control( wxCommandEvent& event )
break;
default:
wxMessageBox( wxT( "WinEDA_PcbFrame::Via_Edition() error: unknown command" ) );
wxMessageBox( wxT( "WinEDA_PcbFrame::Via_Edit_Control() error: unknown command" ) );
break;
}
......
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