Commit 29e217d3 authored by charras's avatar charras

pcbnew Rewrite the GUI relative to the tracks widths and vias diameters and...

pcbnew Rewrite the GUI relative to the tracks widths and vias diameters and drills selection and edition, for compatibility with new netclass approach.
parent e027e659
......@@ -4,6 +4,22 @@ KiCad ChangeLog 2009
Please add newer entries at the top, list the date and your name with
email address.
2009-oct-30 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
++pcbnew
Rewrite the GUI relative to the tracks widths and vias diameters and drills selection
and edition, for compatibility with new netclass approach.
Now vias dimensions are defined by their diameter and drill values
(This is also a simpler an better way than the old one that considers
via diameters and drill values as independant parmeters)
When set a via to a "custom" value, the diameter and the drill values are set.
(of course one can use the drill defualt value of the netclass)
So the via hole edit options (in popup menu) does not exist no more.
The global tracks widths and vias diameters and drills changes are now
accessible by a specific dialog frame.
2009-oct-27 UPDATE Jerry Jacobs <xor.gate.engineering@gmail.com>
================================================================================
......
......@@ -12,8 +12,8 @@ may choose to document this corresponding work in the CHANGELOG.txt file.
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 1992-2008 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.fr
* Copyright (C) 1992-2008 Kicad Developers, see change_log.txt for contributors.
* Copyright (C) 1992-2009 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.fr
* Copyright (C) 1992-2009 Kicad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
......
......@@ -51,10 +51,9 @@ void WinEDA_GerberFrame::Process_Config( wxCommandEvent& event )
break;
}
case ID_PCB_TRACK_SIZE_SETUP:
case ID_PCB_DISPLAY_OPTIONS_SETUP:
case ID_OPTIONS_SETUP:
InstallPcbOptionsFrame( pos, id );
InstallGerberOptionsFrame( pos, id );
break;
case ID_CONFIG_SAVE:
......
......@@ -413,7 +413,7 @@ void WinEDA_LookFrame::OnOkClick( wxCommandEvent& event )
/***************************************************************************/
void WinEDA_GerberFrame::InstallPcbOptionsFrame( const wxPoint& pos, int id )
void WinEDA_GerberFrame::InstallGerberOptionsFrame( const wxPoint& pos, int id )
/***************************************************************************/
{
switch( id )
......
......@@ -70,7 +70,7 @@ public:
void Process_Settings( wxCommandEvent& event );
void Process_Config( wxCommandEvent& event );
void InstallConfigFrame( const wxPoint& pos );
void InstallPcbOptionsFrame( const wxPoint& pos, int id );
void InstallGerberOptionsFrame( const wxPoint& pos, int id );
void InstallPcbGlobalDeleteFrame( const wxPoint& pos );
/* handlers for block commands */
......
......@@ -11,12 +11,8 @@ class EDA_BoardDesignSettings
protected:
int m_CopperLayerCount; // Number of copper layers for this design
public:
int m_ViaDrillCustomValue; // via drill for vias that have a specific drill value
int m_CurrentViaSize; // Current via size
int m_CurrentMicroViaSize; // Current micro via size
bool m_MicroViasAllowed; // true to allow micro vias
int m_CurrentViaType; // via type (VIA_BLIND_BURIED, VIA_TROUGHT VIA_MICROVIA)
int m_CurrentTrackWidth; // current track width
bool m_UseConnectedTrackWidth; // if true, when creating a new track starting on an existing track, use this track width
int m_DrawSegmentWidth; // current graphic line width (not EDGE layer)
int m_EdgeSegmentWidth; // current graphic line width (EDGE layer only)
......
......@@ -253,7 +253,6 @@ enum main_id
ID_POPUP_PCB_DELETE_TRACKSEG,
ID_TOOLBARH_PCB_SELECT_LAYER,
ID_PCB_DISPLAY_OPTIONS_SETUP,
ID_PCB_TRACK_SIZE_SETUP,
ID_END_LIST
};
......
......@@ -420,8 +420,22 @@ public:
void Delete_Track( wxDC* DC, TRACK* Track );
void Delete_net( wxDC* DC, TRACK* Track );
void Remove_One_Track( wxDC* DC, TRACK* pt_segm );
bool Resize_Pistes_Vias( wxDC* DC, bool Track, bool Via );
void Edit_Net_Width( wxDC* DC, int Netcode );
/** function Reset_All_Tracks_And_Vias_To_Netclass_Values
* Reset all tracks width and/or vias diameters and drill
* to their default Netclass value
* @param aTrack : bool true to modify tracks
* @param aVia : bool true to modify vias
*/
bool Reset_All_Tracks_And_Vias_To_Netclass_Values( bool aTrack, bool aVia );
/** function Change_Net_Tracks_And_Vias_Sizes
* Reset all tracks width and vias diameters and drill
* to their default Netclass value ou current values
* @param aNetcode : the netcode of the net to edit
* @param aUseNetclassValue : bool. True to use netclass values, false to use current values
*/
bool Change_Net_Tracks_And_Vias_Sizes( int aNetcode, bool aUseNetclassValue );
/** Function Edit_Track_Width
* Modify a full track width (using DRC control).
......@@ -433,7 +447,7 @@ public:
/** Function Edit_TrackSegm_Width
* Modify one track segment width or one via diameter (using DRC control).
* @param DC = the curred device context (can be NULL)
* @param DC = the current device context (can be NULL)
* @param aTrackItem = the track segment or via to modify
*/
void Edit_TrackSegm_Width( wxDC* DC, TRACK* segm );
......
......@@ -20,13 +20,10 @@ set(PCBNEW_SRCS
# cleaningoptions_dialog.cpp
connect.cpp
controle.cpp
# copy_track.cpp <-- not used
cotation.cpp
cross-probing.cpp
debug_kbool_key_file_fct.cpp
deltrack.cpp
# dialog_copper_layers_setup_base.cpp
# dialog_copper_layers_setup.cpp
dialog_copper_zones.cpp
dialog_copper_zones_base.cpp
dialog_design_rules.cpp
......@@ -46,6 +43,8 @@ set(PCBNEW_SRCS
# dialog_gendrill.cpp
dialog_general_options.cpp
dialog_general_options_BoardEditor_base.cpp
dialog_global_edit_tracks_and_vias.cpp
dialog_global_edit_tracks_and_vias_base.cpp
# dialog_graphic_items_options.cpp
dialog_graphic_item_properties.cpp
dialog_graphic_item_properties_base.cpp
......@@ -64,15 +63,14 @@ set(PCBNEW_SRCS
dialog_print_for_modedit_base.cpp
dialog_print_using_printer.cpp
dialog_orient_footprints.cpp
dialog_track_options.cpp
dialog_track_options_base.cpp
dialog_mask_clearance.cpp
dialog_mask_clearance_base.cpp
dialog_SVG_print.cpp
dialog_SVG_print_base.cpp
dist.cpp
dragsegm.cpp
drc.cpp
dsn.cpp
# dupltrac.cpp <-- not used
edgemod.cpp
edit.cpp
editedge.cpp
......@@ -111,7 +109,6 @@ set(PCBNEW_SRCS
modedit_undo_redo.cpp
moduleframe.cpp
modules.cpp
# move_copy_track.cpp <-- not used
move-drag_pads.cpp
move_or_drag_track.cpp
muonde.cpp
......@@ -146,7 +143,6 @@ set(PCBNEW_SRCS
track.cpp
tr_modif.cpp
trpiste.cpp
via_edit.cpp
work.cpp
xchgmod.cpp
zones_by_polygon.cpp
......
......@@ -97,10 +97,11 @@ BOARD::~BOARD()
m_CurrentNetClassName = netClass->GetName();
// Initialize others values:
if( m_ViaSizeList.size() == 0 )
if( m_ViasDimensionsList.size() == 0 )
{
VIA_DIMENSION viadim;
lists_sizes_modified = true;
m_ViaSizeList.push_back(0);
m_ViasDimensionsList.push_back(viadim);
}
if( m_TrackWidthList.size() == 0 )
{
......@@ -108,23 +109,22 @@ BOARD::~BOARD()
m_TrackWidthList.push_back(0);
}
if( m_ViaSizeList[0] != netClass->GetViaDiameter() )
/* note the m_ViasDimensionsList[0] and m_TrackWidthList[0] values
* are always the Netclass values
*/
if( m_ViasDimensionsList[0].m_Diameter != netClass->GetViaDiameter() )
lists_sizes_modified = true;
m_ViaSizeList[0] = netClass->GetViaDiameter();
m_ViasDimensionsList[0].m_Diameter = netClass->GetViaDiameter();
if( m_TrackWidthList[0] != netClass->GetTrackWidth() )
lists_sizes_modified = true;
m_TrackWidthList[0] = netClass->GetTrackWidth();
if( m_ViaSizeSelector >= m_ViaSizeList.size() )
m_ViaSizeSelector = m_ViaSizeList.size();
if( m_ViaSizeSelector >= m_ViasDimensionsList.size() )
m_ViaSizeSelector = m_ViasDimensionsList.size();
if( m_TrackWidthSelector >= m_TrackWidthList.size() )
m_TrackWidthSelector = m_TrackWidthList.size();
//Initialize track and via current size:
g_DesignSettings.m_CurrentViaSize = m_ViaSizeList[m_ViaSizeSelector];
g_DesignSettings.m_CurrentTrackWidth = m_TrackWidthList[m_TrackWidthSelector];
return lists_sizes_modified;
}
......@@ -143,6 +143,25 @@ int BOARD::GetBiggestClearanceValue()
return clearance;
}
/** function GetCurrentMicroViaSize
* @return the current micro via size,
* that is the current netclass value
*/
int BOARD::GetCurrentMicroViaSize()
{
NETCLASS* netclass = m_NetClasses.Find( m_CurrentNetClassName );
return netclass->GetuViaDiameter();
}
/** function GetCurrentMicroViaDrill
* @return the current micro via drill,
* that is the current netclass value
*/
int BOARD::GetCurrentMicroViaDrill()
{
NETCLASS* netclass = m_NetClasses.Find( m_CurrentNetClassName );
return netclass->GetuViaDrill();
}
wxString BOARD::GetLayerName( int aLayerIndex ) const
{
......
......@@ -60,6 +60,33 @@ struct LAYER
};
/** a small helper class to handle a stock of specific vias diameter and drill pair
* in the BOARD class
*/
class VIA_DIMENSION
{
public:
int m_Diameter; // <= 0 means use Netclass via diameter
int m_Drill; // <= 0 means use Netclass via drill
VIA_DIMENSION()
{
m_Diameter = 0; m_Drill = 0;
}
bool operator == (const VIA_DIMENSION& other) const
{
return (m_Diameter == other.m_Diameter) &&
(m_Drill == other.m_Drill);
}
bool operator < (const VIA_DIMENSION& other) const
{
if (m_Diameter != other.m_Diameter)
return (m_Diameter < other.m_Diameter);
return m_Drill < other.m_Drill;
}
};
/**
* Class BOARD
* holds information pertinent to a PCBNEW printed circuit board.
......@@ -108,7 +135,7 @@ public:
// handling of vias and tracks size:
// the first value is always the value of the current NetClass
// The others values are extra values
std::vector <int> m_ViaSizeList; // vias sizes list(max count = HISTORY_MAX_COUNT)
std::vector <VIA_DIMENSION> m_ViasDimensionsList; // vias size and drill list(max count = HISTORY_MAX_COUNT)
// The first value is the current netclass via size
std::vector <int> m_TrackWidthList; // tracks widths (max count = HISTORY_MAX_COUNT)
// The first value is the current netclass track width
......@@ -404,7 +431,9 @@ public:
*/
int ReturnSortedNetnamesList( wxArrayString& aNames, bool aSortbyPadsCount );
/****** function relative to NetClasses: */
/**************************************/
/** function relative to NetClasses: **/
/**************************************/
/**
* Function SynchronizeNetsAndNetClasses
* copies NETCLASS info to each NET, based on NET membership in a NETCLASS.
......@@ -427,10 +456,52 @@ public:
bool SetCurrentNetClass( const wxString& aNetClassName );
/** function GetBiggestClearanceValue
* @return the biggest clerance value found in NetClasses list
* @return the biggest clearance value found in NetClasses list
*/
int GetBiggestClearanceValue();
/** function GetCurrentTrackWidth
* @return the current track width, accordint to the selected options
* ( using the default netclass value or a preset value )
* the default netclass is always in m_TrackWidthList[0]
*/
int GetCurrentTrackWidth()
{
return m_TrackWidthList[m_TrackWidthSelector];
}
/** function GetCurrentViaSize
* @return the current via size, accordint to the selected options
* ( using the default netclass value or a preset value )
* the default netclass is always in m_TrackWidthList[0]
*/
int GetCurrentViaSize()
{
return m_ViasDimensionsList[m_ViaSizeSelector].m_Diameter;
}
/** function GetCurrentViaDrill
* @return the current via size, accordint to the selected options
* ( using the default netclass value or a preset value )
* the default netclass is always in m_TrackWidthList[0]
*/
int GetCurrentViaDrill()
{
return m_ViasDimensionsList[m_ViaSizeSelector].m_Drill > 0 ?
m_ViasDimensionsList[m_ViaSizeSelector].m_Drill : -1;
}
/** function GetCurrentMicroViaSize
* @return the current micro via size,
* that is the current netclass value
*/
int GetCurrentMicroViaSize();
/** function GetCurrentMicroViaDrill
* @return the current micro via drill,
* that is the current netclass value
*/
int GetCurrentMicroViaDrill();
/***************************************************************************/
/**
......
......@@ -41,12 +41,8 @@ EDA_BoardDesignSettings::EDA_BoardDesignSettings()
m_VisibleElements = 0x00000fff; // IMB: All elements visible at first. TODO: Use a macro for the initial value.
SetCopperLayerCount( 2 ); // Default design is a double sided board
m_ViaDrillCustomValue = 250; // via drill for vias which must have a defined drill value
m_CurrentViaSize = 450; // Current via size
m_CurrentViaType = VIA_THROUGH; // via type (VIA_BLIND_BURIED, VIA_THROUGH VIA_MICROVIA)
m_CurrentTrackWidth = 170; // current track width
m_UseConnectedTrackWidth = false; // if true, when creating a new track starting on an existing track, use this track width
m_CurrentMicroViaSize = 150; // Current micro via size
m_MicroViasAllowed = false; // true to allow micro vias
m_DrawSegmentWidth = 100; // current graphic line width (not EDGE layer)
m_EdgeSegmentWidth = 100; // current graphic line width (EDGE layer only)
......
......@@ -227,8 +227,6 @@ public:
*/
int GetTrackMinWidth()
{
// wxASSERT( m_NetClass );
// return m_NetClass->GetTrackMinWidth();
return g_DesignSettings.m_TrackMinWidth;
}
#endif
......
......@@ -197,8 +197,8 @@ void DIALOG_DESIGN_RULES::InitGlobalRules()
// (the first value in histories list)
m_TracksWidthList = m_Parent->GetBoard()->m_TrackWidthList;
m_TracksWidthList.erase( m_TracksWidthList.begin() ); // remove the netclass value
m_ViasDiameterList = m_Parent->GetBoard()->m_ViaSizeList;
m_ViasDiameterList.erase( m_ViasDiameterList.begin() ); // remove the netclass value
m_ViasDimensionsList = m_Parent->GetBoard()->m_ViasDimensionsList;
m_ViasDimensionsList.erase( m_ViasDimensionsList.begin() ); // remove the netclass value
InitDimensionsLists();
}
......@@ -219,10 +219,17 @@ void DIALOG_DESIGN_RULES::InitDimensionsLists()
m_gridTrackWidthList->SetCellValue( ii, 0, msg );
}
for( unsigned ii = 0; ii < m_ViasDiameterList.size(); ii++ )
for( unsigned ii = 0; ii < m_ViasDimensionsList.size(); ii++ )
{
msg = ReturnStringFromValue( g_UnitMetric, m_ViasDiameterList[ii], Internal_Unit, false );
msg = ReturnStringFromValue( g_UnitMetric, m_ViasDimensionsList[ii].m_Diameter,
Internal_Unit, false );
m_gridViaSizeList->SetCellValue( ii, 0, msg );
if( m_ViasDimensionsList[ii].m_Drill > 0 )
{
msg = ReturnStringFromValue( g_UnitMetric, m_ViasDimensionsList[ii].m_Drill,
Internal_Unit, false );
m_gridViaSizeList->SetCellValue( ii, 1, msg );
}
}
// recompute the column widths here, after setting texts
......@@ -516,26 +523,34 @@ void DIALOG_DESIGN_RULES::CopyDimensionsListsToBoard( )
sort( m_TracksWidthList.begin(), m_TracksWidthList.end() );
// Reinitialize m_TrackWidthList
m_ViasDiameterList.clear();
m_ViasDimensionsList.clear();
for( int row = 0; row < m_gridViaSizeList->GetNumberRows(); ++row )
{
msg = m_gridViaSizeList->GetCellValue( row, 0 );
if( msg.IsEmpty() )
continue;
int value = ReturnValueFromString( g_UnitMetric, msg, m_Parent->m_InternalUnits );
m_ViasDiameterList.push_back( value);
VIA_DIMENSION via_dim;
via_dim.m_Diameter = value;
msg = m_gridViaSizeList->GetCellValue( row, 1 );
if( ! msg.IsEmpty() )
{
value = ReturnValueFromString( g_UnitMetric, msg, m_Parent->m_InternalUnits );
via_dim.m_Drill = value;
}
m_ViasDimensionsList.push_back( via_dim);
}
// Sort new list by by increasing value
sort( m_ViasDiameterList.begin(), m_ViasDiameterList.end() );
sort( m_ViasDimensionsList.begin(), m_ViasDimensionsList.end() );
std::vector <int>* list = &m_Parent->GetBoard()->m_TrackWidthList;
list->erase( list->begin() + 1, list->end() ); // Remove old "custom" sizes
list->insert( list->end(), m_TracksWidthList.begin(), m_TracksWidthList.end() ); //Add new "custom" sizes
std::vector <int>* tlist = &m_Parent->GetBoard()->m_TrackWidthList;
tlist->erase( tlist->begin() + 1, tlist->end() ); // Remove old "custom" sizes
tlist->insert( tlist->end(), m_TracksWidthList.begin(), m_TracksWidthList.end() ); //Add new "custom" sizes
// Reinitialize m_ViaSizeList
list = &m_Parent->GetBoard()->m_ViaSizeList;
list->erase( list->begin() + 1, list->end() );
list->insert( list->end(), m_ViasDiameterList.begin(), m_ViasDiameterList.end() );
std::vector <VIA_DIMENSION>* vialist = &m_Parent->GetBoard()->m_ViasDimensionsList;
vialist->erase( vialist->begin() + 1, vialist->end() );
vialist->insert( vialist->end(), m_ViasDimensionsList.begin(), m_ViasDimensionsList.end() );
m_Parent->m_TrackAndViasSizesList_Changed = true;
}
......
......@@ -43,7 +43,7 @@ private:
NETCUPS m_AllNets;
// List of values to "customize" some tracks and vias
std::vector <int> m_ViasDiameterList;
std::vector <VIA_DIMENSION> m_ViasDimensionsList;
std::vector <int> m_TracksWidthList;
private:
......
......@@ -13,13 +13,10 @@
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "class_board_design_settings.h"
#include "dialog_general_options.h"
#include "pcbnew_id.h"
#include "dialog_general_options_BoardEditor_base.h"
#include "dialog_general_options.h"
#include "dialog_track_options.h"
/***********************************************************************************/
Dialog_GeneralOptions::Dialog_GeneralOptions( WinEDA_PcbFrame* parent, wxDC* DC ) :
......@@ -105,11 +102,6 @@ void Dialog_GeneralOptions::OnOkClick( wxCommandEvent& event )
g_TimeOut = 60 * m_SaveTime->GetValue();
/* Mise a jour de la combobox d'affichage de la couche active */
/*
int layer_count[] = {1,2,4,6,8,10,12,14,16};
g_DesignSettings.m_CopperLayerCount = layer_count[m_LayerNumber->GetSelection()];
m_Parent->ReCreateLayerBox( NULL );
*/
g_MaxLinksShowed = m_MaxShowLinks->GetValue();
Drc_On = m_DrcOn->GetValue();
if( g_Show_Ratsnest != m_ShowGlobalRatsnest->GetValue() )
......@@ -141,35 +133,18 @@ void WinEDA_PcbFrame::InstallPcbOptionsFrame( const wxPoint& pos,
{
switch( id )
{
case ID_PCB_TRACK_SIZE_SETUP:
{
DIALOG_TRACKS_OPTIONS* OptionsFrame =
new DIALOG_TRACKS_OPTIONS( this );
OptionsFrame->ShowModal();
OptionsFrame->Destroy();
}
break;
case ID_PCB_DRAWINGS_WIDTHS_SETUP:
{
WinEDA_GraphicItemsOptionsDialog* OptionsFrame =
new WinEDA_GraphicItemsOptionsDialog( this );
OptionsFrame->ShowModal();
OptionsFrame->Destroy();
WinEDA_GraphicItemsOptionsDialog dlg( this );
dlg.ShowModal();
}
break;
case ID_OPTIONS_SETUP:
{
Dialog_GeneralOptions* OptionsFrame =
new Dialog_GeneralOptions( this, DC );
OptionsFrame->ShowModal();
OptionsFrame->Destroy();
}
default:
wxMessageBox(wxT("InstallPcbOptionsFrame() id error"));
break;
}
}
......@@ -178,9 +153,8 @@ void WinEDA_PcbFrame::InstallPcbOptionsFrame( const wxPoint& pos,
void WinEDA_ModuleEditFrame::InstallOptionsFrame( const wxPoint& pos )
/*******************************************************************/
{
WinEDA_GraphicItemsOptionsDialog OptionsFrame( this );
OptionsFrame.ShowModal();
WinEDA_GraphicItemsOptionsDialog dlg( this );
dlg.ShowModal();
}
......
#ifndef __dialog_general_options_h
#define __dialog_general_options_h
#include "dialog_general_options_BoardEditor_base.h"
/***********************************************************************/
class Dialog_GeneralOptions : public DialogGeneralOptionsBoardEditor_base
/***********************************************************************/
......
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_global_edit_tracks_and_vias.cpp
// Author: jean-pierre Charras
// Created: 30 oct 2009
// Licence: GPL
/////////////////////////////////////////////////////////////////////////////
#include "fctsys.h"
#include "common.h"
#include "confirm.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "class_drawpanel.h"
#include "dialog_global_edit_tracks_and_vias.h"
/**
* DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE, derived from DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE_BASE
* @see dialog_global_edit_tracks_and_vias_base.h and dialog_global_edit_tracks_and_vias_base.cpp,
* automatically created by wxFormBuilder
*/
DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS(
WinEDA_PcbFrame* aParent, int aNetcode ) :
DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE( aParent )
{
m_Parent = aParent;
m_Netcode = aNetcode;
MyInit();
Layout();
GetSizer()->Fit( this );
GetSizer()->SetSizeHints( this );
}
/*************************************************/
void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::MyInit()
/*************************************************/
{
SetFocus();
wxString msg;
// Display current setup for tracks and vias
int Internal_Unit = m_Parent->m_InternalUnits;
BOARD* board = m_Parent->GetBoard();
NETCLASSES& netclasses = board->m_NetClasses;
NETINFO_ITEM* net = board->FindNet( m_Netcode );
NETCLASS* netclass = netclasses.GetDefault();
if( net )
{
m_CurrentNetName->SetLabel( net->GetNetname() );
m_CurrentNetclassName->SetLabel( board->m_CurrentNetClassName );
netclass = netclasses.Find( board->m_CurrentNetClassName );
}
// Enable/disable the option "copy current to net" if we ause only default netclass values
if( ! board->m_TrackWidthSelector && !board->m_ViaSizeSelector )
{
m_Net2CurrValueButton->Enable(false);
m_Net2CurrValueText->Enable(false);
}
// Display current values, and current netclass values:
int value = netclass->GetTrackWidth();
msg = ReturnStringFromValue( g_UnitMetric, value, Internal_Unit, true );
m_gridDisplayCurrentSettings->SetCellValue( 0, 0, msg );
if( board->m_TrackWidthSelector )
{
value = board->GetCurrentTrackWidth();
msg = ReturnStringFromValue( g_UnitMetric, value, Internal_Unit, true );
}
else
msg = _( "Default" );
m_gridDisplayCurrentSettings->SetCellValue( 1, 0, msg );
// recompute the column widths here, after setting texts
value = netclass->GetViaDiameter();
msg = ReturnStringFromValue( g_UnitMetric, value, Internal_Unit, true );
m_gridDisplayCurrentSettings->SetCellValue( 0, 1, msg );
if( board->m_ViaSizeSelector )
{
value = board->GetCurrentViaSize();
msg = ReturnStringFromValue( g_UnitMetric, value, Internal_Unit, true );
}
else
msg = _( "Default" );
m_gridDisplayCurrentSettings->SetCellValue( 1, 1, msg );
value = netclass->GetViaDrill();
msg = ReturnStringFromValue( g_UnitMetric, value, Internal_Unit, true );
m_gridDisplayCurrentSettings->SetCellValue( 0, 2, msg );
value = board->GetCurrentViaDrill();
if( value >= 0 )
msg = ReturnStringFromValue( g_UnitMetric, value, Internal_Unit, true );
else
msg = _( "Default" );
m_gridDisplayCurrentSettings->SetCellValue( 1, 2, msg );
value = netclass->GetuViaDiameter();
msg = ReturnStringFromValue( g_UnitMetric, value, Internal_Unit, true );
m_gridDisplayCurrentSettings->SetCellValue( 0, 3, msg );
#if 0 // Currently we use always the default netclass value
value = board->GetCurrentMicroViaSize();
msg = ReturnStringFromValue( g_UnitMetric, value, Internal_Unit, true );
#endif
msg = _( "Default" );
m_gridDisplayCurrentSettings->SetCellValue( 1, 3, msg );
value = netclass->GetuViaDrill();
msg = ReturnStringFromValue( g_UnitMetric, value, Internal_Unit, true );
m_gridDisplayCurrentSettings->SetCellValue( 0, 4, msg );
#if 0 // Currently we use always the default netclass value
value = board->GetCurrentMicroViaDrill();
if( value >= 0 )
msg = ReturnStringFromValue( g_UnitMetric, value, Internal_Unit, true );
else
#endif
msg = _( "Default" );
m_gridDisplayCurrentSettings->SetCellValue( 1, 4, msg );
// Set all cells Roead Only
for( int ii = 0; ii < m_gridDisplayCurrentSettings->GetNumberRows(); ii++ )
{
for( int jj = 0; jj < m_gridDisplayCurrentSettings->GetNumberCols(); jj++ )
m_gridDisplayCurrentSettings->SetReadOnly( ii, jj, true );
}
m_gridDisplayCurrentSettings->Fit( );
}
/*******************************************************************/
void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::OnOkClick( wxCommandEvent& event )
/*******************************************************************/
{
bool change = false;
switch( event.GetId() )
{
case ID_CURRENT_VALUES_TO_CURRENT_NET:
change = m_Parent->Change_Net_Tracks_And_Vias_Sizes( m_Netcode, false );
break;
case ID_NETCLASS_VALUES_TO_CURRENT_NET:
change = m_Parent->Change_Net_Tracks_And_Vias_Sizes( m_Netcode, true );
break;
case ID_ALL_TRACKS_VIAS:
change = m_Parent->Reset_All_Tracks_And_Vias_To_Netclass_Values( true, true );
break;
case ID_ALL_VIAS:
change = m_Parent->Reset_All_Tracks_And_Vias_To_Netclass_Values( false, true );
break;
case ID_ALL_TRACKS:
change = m_Parent->Reset_All_Tracks_And_Vias_To_Netclass_Values( true, false );
break;
}
EndModal( 1 );
if( change )
m_Parent->DrawPanel->Refresh();
}
/*******************************
*event handler for wxID_CANCEL
******************************/
void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::OnCancelClick( wxCommandEvent& event )
{
EndModal( 0 );
}
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 1992-2009 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.fr
* Copyright (C) 1992-2009 Kicad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __dialog_global_edit_tracks_and_vias__
#define __dialog_global_edit_tracks_and_vias__
#include "dialog_global_edit_tracks_and_vias_base.h"
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS
///////////////////////////////////////////////////////////////////////////////
class DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS :
public DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE
{
private:
WinEDA_PcbFrame* m_Parent;
int m_Netcode;
public:
DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS( WinEDA_PcbFrame* aParent, int aNetcode );
~DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS() {};
// Virtual event handlers, overided here
void OnOkClick( wxCommandEvent& event );
void OnCancelClick( wxCommandEvent& event );
void MyInit();
};
#endif //__dialog_global_edit_tracks_and_vias__
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_global_edit_tracks_and_vias_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbCurrSettingsSizer;
sbCurrSettingsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Current Settings") ), wxVERTICAL );
wxFlexGridSizer* fgSizeNetInfo;
fgSizeNetInfo = new wxFlexGridSizer( 2, 2, 0, 0 );
fgSizeNetInfo->SetFlexibleDirection( wxBOTH );
fgSizeNetInfo->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_CurrentNetText = new wxStaticText( this, wxID_ANY, _("Current Net:"), wxDefaultPosition, wxDefaultSize, 0 );
m_CurrentNetText->Wrap( -1 );
fgSizeNetInfo->Add( m_CurrentNetText, 0, wxALL|wxALIGN_RIGHT, 5 );
m_CurrentNetName = new wxStaticText( this, wxID_ANY, _("NetName"), wxDefaultPosition, wxDefaultSize, 0 );
m_CurrentNetName->Wrap( -1 );
m_CurrentNetName->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) );
fgSizeNetInfo->Add( m_CurrentNetName, 0, wxALL, 5 );
m_CurrentNetclassText = new wxStaticText( this, wxID_ANY, _("Current NetClass:"), wxDefaultPosition, wxDefaultSize, 0 );
m_CurrentNetclassText->Wrap( -1 );
fgSizeNetInfo->Add( m_CurrentNetclassText, 0, wxALL|wxALIGN_RIGHT, 5 );
m_CurrentNetclassName = new wxStaticText( this, wxID_ANY, _("NetClassName"), wxDefaultPosition, wxDefaultSize, 0 );
m_CurrentNetclassName->Wrap( -1 );
m_CurrentNetclassName->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) );
fgSizeNetInfo->Add( m_CurrentNetclassName, 0, wxALL, 5 );
sbCurrSettingsSizer->Add( fgSizeNetInfo, 1, wxEXPAND, 5 );
m_gridDisplayCurrentSettings = new wxGrid( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
// Grid
m_gridDisplayCurrentSettings->CreateGrid( 2, 5 );
m_gridDisplayCurrentSettings->EnableEditing( true );
m_gridDisplayCurrentSettings->EnableGridLines( true );
m_gridDisplayCurrentSettings->EnableDragGridSize( false );
m_gridDisplayCurrentSettings->SetMargins( 0, 0 );
// Columns
m_gridDisplayCurrentSettings->AutoSizeColumns();
m_gridDisplayCurrentSettings->EnableDragColMove( false );
m_gridDisplayCurrentSettings->EnableDragColSize( true );
m_gridDisplayCurrentSettings->SetColLabelSize( 30 );
m_gridDisplayCurrentSettings->SetColLabelValue( 0, _("Track size") );
m_gridDisplayCurrentSettings->SetColLabelValue( 1, _("Via size") );
m_gridDisplayCurrentSettings->SetColLabelValue( 2, _("Via Diameter") );
m_gridDisplayCurrentSettings->SetColLabelValue( 3, _("Via drill") );
m_gridDisplayCurrentSettings->SetColLabelValue( 4, _("uVia size") );
m_gridDisplayCurrentSettings->SetColLabelValue( 5, _("uVia Drill") );
m_gridDisplayCurrentSettings->SetColLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Rows
m_gridDisplayCurrentSettings->AutoSizeRows();
m_gridDisplayCurrentSettings->EnableDragRowSize( true );
m_gridDisplayCurrentSettings->SetRowLabelSize( 100 );
m_gridDisplayCurrentSettings->SetRowLabelValue( 0, _("Netclass value") );
m_gridDisplayCurrentSettings->SetRowLabelValue( 1, _("Current value") );
m_gridDisplayCurrentSettings->SetRowLabelAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
// Label Appearance
// Cell Defaults
m_gridDisplayCurrentSettings->SetDefaultCellAlignment( wxALIGN_CENTRE, wxALIGN_CENTRE );
sbCurrSettingsSizer->Add( m_gridDisplayCurrentSettings, 0, wxTOP|wxBOTTOM, 5 );
bMainSizer->Add( sbCurrSettingsSizer, 0, wxEXPAND, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bMainSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
wxBoxSizer* bLowerSizer;
bLowerSizer = new wxBoxSizer( wxHORIZONTAL );
wxStaticBoxSizer* sbSizerCommands;
sbSizerCommands = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options") ), wxVERTICAL );
wxFlexGridSizer* fgSizer2;
fgSizer2 = new wxFlexGridSizer( 5, 2, 0, 0 );
fgSizer2->SetFlexibleDirection( wxBOTH );
fgSizer2->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_Net2CurrValueText = new wxStaticText( this, wxID_ANY, _("Set tracks and vias of the current Net to the current value"), wxDefaultPosition, wxDefaultSize, 0 );
m_Net2CurrValueText->Wrap( -1 );
fgSizer2->Add( m_Net2CurrValueText, 0, wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5 );
m_Net2CurrValueButton = new wxButton( this, ID_CURRENT_VALUES_TO_CURRENT_NET, _("Ok"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer2->Add( m_Net2CurrValueButton, 0, wxALL|wxEXPAND, 5 );
m_staticText5 = new wxStaticText( this, wxID_ANY, _("Set tracks and vias of the current Net to the Netclass value"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText5->Wrap( -1 );
fgSizer2->Add( m_staticText5, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 );
m_button3 = new wxButton( this, ID_NETCLASS_VALUES_TO_CURRENT_NET, _("Ok"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer2->Add( m_button3, 0, wxALL, 5 );
m_staticText6 = new wxStaticText( this, wxID_ANY, _("Set ALL tracks and vias to their Netclass value"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText6->Wrap( -1 );
fgSizer2->Add( m_staticText6, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 );
m_button4 = new wxButton( this, ID_ALL_TRACKS_VIAS, _("Ok"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer2->Add( m_button4, 0, wxALL, 5 );
m_staticText7 = new wxStaticText( this, wxID_ANY, _("Set ALL vias (no track) to their Netclass value"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText7->Wrap( -1 );
fgSizer2->Add( m_staticText7, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 );
m_button5 = new wxButton( this, ID_ALL_VIAS, _("Ok"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer2->Add( m_button5, 0, wxALL, 5 );
m_staticText8 = new wxStaticText( this, wxID_ANY, _("Set ALL tracks (no via) to their Netclass value"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText8->Wrap( -1 );
fgSizer2->Add( m_staticText8, 0, wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT, 5 );
m_button6 = new wxButton( this, ID_ALL_TRACKS, _("Ok"), wxDefaultPosition, wxDefaultSize, 0 );
fgSizer2->Add( m_button6, 0, wxALL, 5 );
sbSizerCommands->Add( fgSizer2, 1, wxEXPAND, 5 );
bLowerSizer->Add( sbSizerCommands, 1, 0, 5 );
wxBoxSizer* bbuttonsSizer;
bbuttonsSizer = new wxBoxSizer( wxVERTICAL );
m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
bbuttonsSizer->Add( m_buttonCancel, 0, wxALL|wxEXPAND, 5 );
bLowerSizer->Add( bbuttonsSizer, 0, wxALIGN_CENTER_VERTICAL, 5 );
bMainSizer->Add( bLowerSizer, 1, wxEXPAND, 5 );
this->SetSizer( bMainSizer );
this->Layout();
// Connect Events
m_Net2CurrValueButton->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnOkClick ), NULL, this );
m_button3->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnOkClick ), NULL, this );
m_button4->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnOkClick ), NULL, this );
m_button5->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnOkClick ), NULL, this );
m_button6->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnOkClick ), NULL, this );
m_buttonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnCancelClick ), NULL, this );
}
DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::~DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE()
{
// Disconnect Events
m_Net2CurrValueButton->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnOkClick ), NULL, this );
m_button3->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnOkClick ), NULL, this );
m_button4->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnOkClick ), NULL, this );
m_button5->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnOkClick ), NULL, this );
m_button6->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnOkClick ), NULL, this );
m_buttonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnCancelClick ), NULL, this );
}
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_global_edit_tracks_and_vias_base__
#define __dialog_global_edit_tracks_and_vias_base__
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/sizer.h>
#include <wx/grid.h>
#include <wx/statbox.h>
#include <wx/statline.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
#define ID_CURRENT_VALUES_TO_CURRENT_NET 1000
#define ID_NETCLASS_VALUES_TO_CURRENT_NET 1001
#define ID_ALL_TRACKS_VIAS 1002
#define ID_ALL_VIAS 1003
#define ID_ALL_TRACKS 1004
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE : public wxDialog
{
private:
protected:
wxStaticText* m_CurrentNetText;
wxStaticText* m_CurrentNetName;
wxStaticText* m_CurrentNetclassText;
wxStaticText* m_CurrentNetclassName;
wxGrid* m_gridDisplayCurrentSettings;
wxStaticLine* m_staticline1;
wxStaticText* m_Net2CurrValueText;
wxButton* m_Net2CurrValueButton;
wxStaticText* m_staticText5;
wxButton* m_button3;
wxStaticText* m_staticText6;
wxButton* m_button4;
wxStaticText* m_staticText7;
wxButton* m_button5;
wxStaticText* m_staticText8;
wxButton* m_button6;
wxButton* m_buttonCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnOkClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ){ event.Skip(); }
public:
DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 647,380 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE();
};
#endif //__dialog_global_edit_tracks_and_vias_base__
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_mask_clearance.cpp
// Author: jean-pierre Charras
// Modified by:
// Created: 17 feb 2009
// Licence: GPL
/////////////////////////////////////////////////////////////////////////////
#include "fctsys.h"
#include "common.h"
#include "confirm.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "class_board_design_settings.h"
#include "dialog_mask_clearance.h"
/**
* DIALOG_PADS_MASK_CLEARANCE_BASE, derived from DIALOG_PADS_MASK_CLEARANCE_BASE_BASE
* @see dialog_dialog_mask_clearance_base.h and dialog_mask_clearance.cpp,
* automatically created by wxFormBuilder
*/
DIALOG_PADS_MASK_CLEARANCE::DIALOG_PADS_MASK_CLEARANCE( WinEDA_PcbFrame* parent ) :
DIALOG_PADS_MASK_CLEARANCE_BASE( parent )
{
m_Parent = parent;
MyInit();
GetSizer()->SetSizeHints( this );
}
void DIALOG_PADS_MASK_CLEARANCE::MyInit()
{
SetFocus();
AddUnitSymbol( *m_MaskClearanceTitle );
int Internal_Unit = m_Parent->m_InternalUnits;
PutValueInLocalUnits( *m_OptMaskMargin, g_DesignSettings.m_MaskMargin, Internal_Unit );
}
/*******************************************************************/
void DIALOG_PADS_MASK_CLEARANCE::OnButtonOkClick( wxCommandEvent& event )
/*******************************************************************/
{
g_DesignSettings.m_MaskMargin =
ReturnValueFromTextCtrl( *m_OptMaskMargin, m_Parent->m_InternalUnits );
EndModal( 1 );
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
*/
void DIALOG_PADS_MASK_CLEARANCE::OnButtonCancelClick( wxCommandEvent& event )
{
EndModal( 0 );
}
......@@ -6,35 +6,28 @@
// Licence: GPL
/////////////////////////////////////////////////////////////////////////////
#ifndef _DIALOG_TRACK_OPTIONS_H_
#define _DIALOG_TRACK_OPTIONS_H_
#ifndef _DIALOG_MASK_CLEARANCE_H_
#define _DIALOG_MASK_CLEARANCE_H_
#include "dialog_track_options_base.h"
#include "dialog_mask_clearance_base.h"
/**
* DIALOG_TRACKS_OPTIONS, derived from DIALOG_TRACKS_OPTIONS_BASE
* @see dialog_track_options_base.h and dialog_track_options_base.cpp,
* DIALOG_PADS_MASK_CLEARANCE, derived from DIALOG_PADS_MASK_CLEARANCE_BASE
* @see dialog_mask_clearance.h and dialog_mask_clearance.cpp,
* automatically created by wxFormBuilder
*/
class DIALOG_TRACKS_OPTIONS : public DIALOG_TRACKS_OPTIONS_BASE
class DIALOG_PADS_MASK_CLEARANCE : public DIALOG_PADS_MASK_CLEARANCE_BASE
{
private:
WinEDA_PcbFrame* m_Parent;
std::vector <int> m_ViasDiameterList;
std::vector <int> m_TracksWidthList;
public:
DIALOG_TRACKS_OPTIONS( WinEDA_PcbFrame* parent );
~DIALOG_TRACKS_OPTIONS() {};
DIALOG_PADS_MASK_CLEARANCE( WinEDA_PcbFrame* parent );
~DIALOG_PADS_MASK_CLEARANCE() {};
private:
void MyInit();
void InitDimensionsLists();
virtual void OnButtonOkClick( wxCommandEvent& event );
virtual void OnButtonCancelClick( wxCommandEvent& event );
virtual void OnButtonAddViaSizeClick( wxCommandEvent& event );
virtual void OnButtonDeleteViaSizeClick( wxCommandEvent& event );
virtual void OnButtonAddTrackSizeClick( wxCommandEvent& event );
virtual void OnButtonDeleteTrackSizeClick( wxCommandEvent& event );
};
#endif // _DIALOG_TRACK_OPTIONS_H_
#endif // _DIALOG_MASK_CLEARANCE_H_
......@@ -5,20 +5,16 @@
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_track_options_base.h"
#include "dialog_mask_clearance_base.h"
///////////////////////////////////////////////////////////////////////////
BEGIN_EVENT_TABLE( DIALOG_TRACKS_OPTIONS_BASE, wxDialog )
EVT_BUTTON( wxID_ADD_VIA_SIZE, DIALOG_TRACKS_OPTIONS_BASE::_wxFB_OnButtonAddViaSizeClick )
EVT_BUTTON( wxID_DELETED_WIA_SIEZ, DIALOG_TRACKS_OPTIONS_BASE::_wxFB_OnButtonDeleteViaSizeClick )
EVT_BUTTON( wxID_ADD_TRACK_WIDTH, DIALOG_TRACKS_OPTIONS_BASE::_wxFB_OnButtonAddTrackSizeClick )
EVT_BUTTON( wxID_DELETED_TRACK_WIDTH, DIALOG_TRACKS_OPTIONS_BASE::_wxFB_OnButtonDeleteTrackSizeClick )
EVT_BUTTON( wxID_CANCEL, DIALOG_TRACKS_OPTIONS_BASE::_wxFB_OnButtonCancelClick )
EVT_BUTTON( wxID_OK, DIALOG_TRACKS_OPTIONS_BASE::_wxFB_OnButtonOkClick )
BEGIN_EVENT_TABLE( DIALOG_PADS_MASK_CLEARANCE_BASE, wxDialog )
EVT_BUTTON( wxID_CANCEL, DIALOG_PADS_MASK_CLEARANCE_BASE::_wxFB_OnButtonCancelClick )
EVT_BUTTON( wxID_OK, DIALOG_PADS_MASK_CLEARANCE_BASE::_wxFB_OnButtonOkClick )
END_EVENT_TABLE()
DIALOG_TRACKS_OPTIONS_BASE::DIALOG_TRACKS_OPTIONS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
DIALOG_PADS_MASK_CLEARANCE_BASE::DIALOG_PADS_MASK_CLEARANCE_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
......@@ -28,64 +24,9 @@ DIALOG_TRACKS_OPTIONS_BASE::DIALOG_TRACKS_OPTIONS_BASE( wxWindow* parent, wxWind
wxBoxSizer* bMainUpperSizer;
bMainUpperSizer = new wxBoxSizer( wxHORIZONTAL );
wxStaticBoxSizer* sbLeftSizer;
sbLeftSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Vias:") ), wxVERTICAL );
wxStaticBoxSizer* sViaSizeBox;
sViaSizeBox = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Vias Custom Sizes List:") ), wxHORIZONTAL );
m_ViaSizeListCtrl = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
sViaSizeBox->Add( m_ViaSizeListCtrl, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bSizeViasListButtons;
bSizeViasListButtons = new wxBoxSizer( wxVERTICAL );
m_buttonAddViasSize = new wxButton( this, wxID_ADD_VIA_SIZE, _("Add"), wxDefaultPosition, wxDefaultSize, 0 );
bSizeViasListButtons->Add( m_buttonAddViasSize, 1, wxALL, 5 );
m_button4 = new wxButton( this, wxID_DELETED_WIA_SIEZ, _("Delete"), wxDefaultPosition, wxDefaultSize, 0 );
bSizeViasListButtons->Add( m_button4, 1, wxALL, 5 );
sViaSizeBox->Add( bSizeViasListButtons, 0, wxALIGN_CENTER_VERTICAL, 5 );
sbLeftSizer->Add( sViaSizeBox, 1, wxEXPAND, 5 );
m_ViaAltDrillValueTitle = new wxStaticText( this, wxID_ANY, _("Specific Via Drill"), wxDefaultPosition, wxDefaultSize, 0 );
m_ViaAltDrillValueTitle->Wrap( -1 );
sbLeftSizer->Add( m_ViaAltDrillValueTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_OptCustomViaDrill = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_OptCustomViaDrill->SetToolTip( _("Use a specific drill value for all vias that must have a given drill value,\nand set the via hole to this specific drill value using the pop up menu.") );
sbLeftSizer->Add( m_OptCustomViaDrill, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
bMainUpperSizer->Add( sbLeftSizer, 1, wxEXPAND, 5 );
wxStaticBoxSizer* sbMiddleRightSizer;
sbMiddleRightSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Dimensions:") ), wxVERTICAL );
wxStaticBoxSizer* sbTracksListSizer;
sbTracksListSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Tracks Custom Widths List:") ), wxHORIZONTAL );
m_TrackWidthListCtrl = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
sbTracksListSizer->Add( m_TrackWidthListCtrl, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
wxBoxSizer* bSizerTacksButtSizer;
bSizerTacksButtSizer = new wxBoxSizer( wxVERTICAL );
m_buttonAddTrackSize = new wxButton( this, wxID_ADD_TRACK_WIDTH, _("Add"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerTacksButtSizer->Add( m_buttonAddTrackSize, 0, wxALL|wxEXPAND, 5 );
m_buttonDeleteTrackWidth = new wxButton( this, wxID_DELETED_TRACK_WIDTH, _("Delete"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerTacksButtSizer->Add( m_buttonDeleteTrackWidth, 0, wxALL|wxEXPAND, 5 );
sbTracksListSizer->Add( bSizerTacksButtSizer, 0, wxALIGN_CENTER_VERTICAL, 5 );
sbMiddleRightSizer->Add( sbTracksListSizer, 1, wxEXPAND, 5 );
sbMiddleRightSizer->Add( 10, 10, 0, 0, 5 );
m_MaskClearanceTitle = new wxStaticText( this, wxID_ANY, _("Pads Mask Clearance:"), wxDefaultPosition, wxDefaultSize, 0 );
m_MaskClearanceTitle->Wrap( -1 );
sbMiddleRightSizer->Add( m_MaskClearanceTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
......@@ -111,6 +52,6 @@ DIALOG_TRACKS_OPTIONS_BASE::DIALOG_TRACKS_OPTIONS_BASE( wxWindow* parent, wxWind
this->Layout();
}
DIALOG_TRACKS_OPTIONS_BASE::~DIALOG_TRACKS_OPTIONS_BASE()
DIALOG_PADS_MASK_CLEARANCE_BASE::~DIALOG_PADS_MASK_CLEARANCE_BASE()
{
}
This diff is collapsed.
......@@ -5,61 +5,39 @@
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_track_options_base__
#define __dialog_track_options_base__
#ifndef __dialog_mask_clearance_base__
#define __dialog_mask_clearance_base__
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/listbox.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/button.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_TRACKS_OPTIONS_BASE
/// Class DIALOG_PADS_MASK_CLEARANCE_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_TRACKS_OPTIONS_BASE : public wxDialog
class DIALOG_PADS_MASK_CLEARANCE_BASE : public wxDialog
{
DECLARE_EVENT_TABLE()
private:
// Private event handlers
void _wxFB_OnButtonAddViaSizeClick( wxCommandEvent& event ){ OnButtonAddViaSizeClick( event ); }
void _wxFB_OnButtonDeleteViaSizeClick( wxCommandEvent& event ){ OnButtonDeleteViaSizeClick( event ); }
void _wxFB_OnButtonAddTrackSizeClick( wxCommandEvent& event ){ OnButtonAddTrackSizeClick( event ); }
void _wxFB_OnButtonDeleteTrackSizeClick( wxCommandEvent& event ){ OnButtonDeleteTrackSizeClick( event ); }
void _wxFB_OnButtonCancelClick( wxCommandEvent& event ){ OnButtonCancelClick( event ); }
void _wxFB_OnButtonOkClick( wxCommandEvent& event ){ OnButtonOkClick( event ); }
protected:
enum
{
wxID_ADD_VIA_SIZE = 1000,
wxID_DELETED_WIA_SIEZ,
wxID_ADD_TRACK_WIDTH,
wxID_DELETED_TRACK_WIDTH,
};
wxListBox* m_ViaSizeListCtrl;
wxButton* m_buttonAddViasSize;
wxButton* m_button4;
wxStaticText* m_ViaAltDrillValueTitle;
wxTextCtrl* m_OptCustomViaDrill;
wxListBox* m_TrackWidthListCtrl;
wxButton* m_buttonAddTrackSize;
wxButton* m_buttonDeleteTrackWidth;
wxStaticText* m_MaskClearanceTitle;
wxTextCtrl* m_OptMaskMargin;
wxStdDialogButtonSizer* m_sdbButtonsSizer;
......@@ -67,18 +45,14 @@ class DIALOG_TRACKS_OPTIONS_BASE : public wxDialog
wxButton* m_sdbButtonsSizerCancel;
// Virtual event handlers, overide them in your derived class
virtual void OnButtonAddViaSizeClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonDeleteViaSizeClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonAddTrackSizeClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonDeleteTrackSizeClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonCancelClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnButtonOkClick( wxCommandEvent& event ){ event.Skip(); }
public:
DIALOG_TRACKS_OPTIONS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Tracks and Vias Sizes"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,351 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_TRACKS_OPTIONS_BASE();
DIALOG_PADS_MASK_CLEARANCE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Pads Mask Clearance"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 256,117 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_PADS_MASK_CLEARANCE_BASE();
};
#endif //__dialog_track_options_base__
#endif //__dialog_mask_clearance_base__
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_track_options.cpp
// Author: jean-pierre Charras
// Modified by:
// Created: 17 feb 2009
// Licence: GPL
/////////////////////////////////////////////////////////////////////////////
#include "fctsys.h"
#include "common.h"
#include "confirm.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "class_board_design_settings.h"
#include "dialog_track_options.h"
#include <algorithm>
/**
* DIALOG_TRACKS_OPTIONS, derived from DIALOG_TRACKS_OPTIONS_BASE
* @see dialog_track_options_base.h and dialog_track_options_base.cpp,
* automatically created by wxFormBuilder
*/
DIALOG_TRACKS_OPTIONS::DIALOG_TRACKS_OPTIONS( WinEDA_PcbFrame* parent ) :
DIALOG_TRACKS_OPTIONS_BASE( parent )
{
m_Parent = parent;
MyInit();
GetSizer()->SetSizeHints( this );
}
void DIALOG_TRACKS_OPTIONS::MyInit()
{
SetFocus();
AddUnitSymbol( *m_MaskClearanceTitle );
int Internal_Unit = m_Parent->m_InternalUnits;
PutValueInLocalUnits( *m_OptCustomViaDrill,
g_DesignSettings.m_ViaDrillCustomValue,
Internal_Unit );
PutValueInLocalUnits( *m_OptMaskMargin, g_DesignSettings.m_MaskMargin, Internal_Unit );
// Vias and Tracks sizes values.
// note we display only extra values, never the current netclass value.
// (the first value in histories list)
m_TracksWidthList = m_Parent->GetBoard()->m_TrackWidthList;
m_TracksWidthList.erase( m_TracksWidthList.begin() ); // remove the netclass value
m_ViasDiameterList = m_Parent->GetBoard()->m_ViaSizeList;
m_ViasDiameterList.erase( m_ViasDiameterList.begin() ); // remove the netclass value
// Display values:
InitDimensionsLists();
}
/*******************************************************************/
void DIALOG_TRACKS_OPTIONS::OnButtonDeleteViaSizeClick( wxCommandEvent& event )
/*******************************************************************/
{
int isel = m_ViaSizeListCtrl->GetSelection();
if( isel < 0 )
return;
m_ViasDiameterList.erase( m_ViasDiameterList.begin() + isel );
InitDimensionsLists();
}
/*******************************************************************/
void DIALOG_TRACKS_OPTIONS::OnButtonAddViaSizeClick( wxCommandEvent& event )
/*******************************************************************/
{
wxString msg = wxGetTextFromUser( wxEmptyString,
_( "Enter new via diameter value:" ), wxEmptyString, this );
if( msg.IsEmpty() )
return;
bool error = false;
int value = ReturnValueFromString( g_UnitMetric, msg, m_Parent->m_InternalUnits );
if( value <= 0 )
error = true;
if( value > 10000 ) // a value > 1 inch is surely a stupid value
error = true;
if( error )
{
DisplayError( this, _( "Incorrect entered value. Aborted" ) );
return;
}
// values are sorted by increasing value in list, so we can use binary_search()
// (see C++ Standard Template Library C++ Algorithms binary_search)
if( binary_search( m_ViasDiameterList.begin(), m_ViasDiameterList.end(), value ) == false ) // value not already existing
{
if( m_ViasDiameterList.size() >= HISTORY_MAX_COUNT - 1 )
{
DisplayError( this, _( "Too many values in list (max count reached). Aborted" ) );
return;
}
m_ViasDiameterList.push_back( value );
// Sort new list by by increasing value
sort( m_ViasDiameterList.begin(), m_ViasDiameterList.end() );
}
InitDimensionsLists();
}
/*******************************************************************/
void DIALOG_TRACKS_OPTIONS::OnButtonDeleteTrackSizeClick( wxCommandEvent& event )
/*******************************************************************/
{
int isel = m_TrackWidthListCtrl->GetSelection();
if( isel < 0 )
return;
m_TracksWidthList.erase( m_TracksWidthList.begin() + isel );
InitDimensionsLists();
}
/*******************************************************************/
void DIALOG_TRACKS_OPTIONS::OnButtonAddTrackSizeClick( wxCommandEvent& event )
/*******************************************************************/
{
wxString msg = wxGetTextFromUser( wxEmptyString,
_( "Enter new track size value:" ), wxEmptyString, this );
if( msg.IsEmpty() )
return;
bool error = false;
int value = ReturnValueFromString( g_UnitMetric, msg, m_Parent->m_InternalUnits );
if( value <= 0 )
error = true;
if( value > 10000 ) // a value > 1 inche is surely a stupid value
error = true;
if( error )
{
DisplayError( this, _( "Incorrect entered value. Aborted" ) );
return;
}
// values are sorted by increasing value in list, so we can use binary_search()
// (see C++ Standard Template Library C++ Algorithms binary_search)
if( binary_search( m_TracksWidthList.begin(), m_TracksWidthList.end(), value ) == false ) // value not already existing
{
if( m_TracksWidthList.size() >= HISTORY_MAX_COUNT - 1 )
{
DisplayError( this, _( "Too many values in list (max count reached). Aborted" ) );
return;
}
m_TracksWidthList.push_back( value );
// Sort new list by by increasing value
sort( m_TracksWidthList.begin(), m_TracksWidthList.end() );
}
InitDimensionsLists();
}
/***************************************************/
void DIALOG_TRACKS_OPTIONS::InitDimensionsLists()
/***************************************************/
/* Populates the 2 lists of sizes (Tracks width list and Vias diameters list)
*/
{
wxString msg;
int Internal_Unit = m_Parent->m_InternalUnits;
m_TrackWidthListCtrl->Clear();
for( unsigned ii = 0; ii < m_TracksWidthList.size(); ii++ )
{
msg = ReturnStringFromValue( g_UnitMetric, m_TracksWidthList[ii], Internal_Unit, true );
m_TrackWidthListCtrl->Append( msg );
}
m_ViaSizeListCtrl->Clear();
for( unsigned ii = 0; ii < m_ViasDiameterList.size(); ii++ )
{
msg = ReturnStringFromValue( g_UnitMetric, m_ViasDiameterList[ii], Internal_Unit, true );
m_ViaSizeListCtrl->Append( msg );
}
}
/*******************************************************************/
void DIALOG_TRACKS_OPTIONS::OnButtonOkClick( wxCommandEvent& event )
/*******************************************************************/
{
g_DesignSettings.m_ViaDrillCustomValue =
ReturnValueFromTextCtrl( *m_OptCustomViaDrill, m_Parent->m_InternalUnits );
g_DesignSettings.m_MaskMargin =
ReturnValueFromTextCtrl( *m_OptMaskMargin, m_Parent->m_InternalUnits );
// Reinitialize m_TrackWidthList and m_ViaSizeList
std::vector <int>* list = &m_Parent->GetBoard()->m_TrackWidthList;
list->erase( list->begin() + 1, list->end() ); // Remove old "custom" sizes
list->insert( list->end(), m_TracksWidthList.begin(), m_TracksWidthList.end() ); //Add new "custom" sizes
list = &m_Parent->GetBoard()->m_ViaSizeList;
list->erase( list->begin() + 1, list->end() );
list->insert( list->end(), m_ViasDiameterList.begin(), m_ViasDiameterList.end() );
EndModal( 1 );
m_Parent->m_TrackAndViasSizesList_Changed = true;
m_Parent->AuxiliaryToolBar_Update_UI();
}
/*!
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
*/
void DIALOG_TRACKS_OPTIONS::OnButtonCancelClick( wxCommandEvent& event )
{
EndModal( 0 );
}
......@@ -16,6 +16,8 @@
#include "autorout.h"
#include "protos.h"
#include "dialog_global_edit_tracks_and_vias.h"
// Uncomment following line to enable wxBell() command (which beeps speaker)
// #include <wx/utils.h>
......@@ -111,7 +113,6 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_FLIP_BLOCK:
case ID_POPUP_ROTATE_BLOCK:
case ID_POPUP_COPY_BLOCK:
case ID_POPUP_PCB_VIA_EDITING:
case ID_POPUP_PCB_EDIT_DRAWING:
case ID_POPUP_PCB_GETINFO_MARKER:
break;
......@@ -316,27 +317,17 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
GetScreen()->SetModify();
break;
case ID_POPUP_PCB_EDIT_NET:
if( GetCurItem() == NULL )
break;
Edit_Net_Width( &dc, ( (TRACK*) GetCurItem() )->GetNet() );
DrawPanel->MouseToCursorSchema();
GetScreen()->SetModify();
break;
case ID_POPUP_PCB_EDIT_ALL_VIAS_AND_TRACK_SIZE:
case ID_POPUP_PCB_EDIT_ALL_VIAS_SIZE:
case ID_POPUP_PCB_EDIT_ALL_TRACK_SIZE:
if( GetCurItem() == NULL )
break;
{
bool resize_vias = true, resize_track = true;
if( id == ID_POPUP_PCB_EDIT_ALL_VIAS_SIZE )
resize_track = false;
if( id == ID_POPUP_PCB_EDIT_ALL_TRACK_SIZE )
resize_vias = false;
if( Resize_Pistes_Vias( &dc, resize_track, resize_vias ) )
GetScreen()->SetModify();
int type = GetCurItem()->Type();
if( type == TYPE_TRACK || type == TYPE_VIA )
{
BOARD_CONNECTED_ITEM*item = (BOARD_CONNECTED_ITEM*) GetCurItem();
DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS dlg( this, item->GetNet() );
dlg.ShowModal();
}
}
DrawPanel->MouseToCursorSchema();
break;
......
......@@ -15,7 +15,7 @@
/** Function SetTrackSegmentWidth
* Modify one track segment width or one via diameter (using DRC control).
* Modify one track segment width or one via diameter and drill (using DRC control).
* Basic routine used by other routines when editing tracks or vias
* @param aTrackItem = the track segment or via to modify
* @param aItemsListPicker = the list picker to use for an undo command (can be NULL)
......@@ -26,7 +26,7 @@ bool WinEDA_PcbFrame::SetTrackSegmentWidth( TRACK* aTrackItem,
PICKED_ITEMS_LIST* aItemsListPicker,
bool aUseNetclassValue )
{
int initial_width, new_width;
int initial_width, new_width, new_drill = -1;
bool change_ok = false;
NETINFO_ITEM* net = NULL;
......@@ -37,20 +37,29 @@ bool WinEDA_PcbFrame::SetTrackSegmentWidth( TRACK* aTrackItem,
if( net )
new_width = net->GetTrackWidth();
else
new_width = g_DesignSettings.m_CurrentTrackWidth;
new_width = GetBoard()->GetCurrentTrackWidth();
if( aTrackItem->Type() == TYPE_VIA )
{
if( net )
new_width = net->GetViaSize();
else
new_width = aTrackItem->m_Width = g_DesignSettings.m_CurrentViaSize;
{
new_width = GetBoard()->GetCurrentViaSize();
new_drill = GetBoard()->GetCurrentViaDrill();
}
if( aTrackItem->m_Shape == VIA_MICROVIA )
{
if( net )
new_width = net->GetViaSize();
else
new_width = aTrackItem->m_Width = g_DesignSettings.m_CurrentMicroViaSize;
new_width = net->GetMicroViaSize();
}
// Set drill value. Note: currently microvias have only a default drill value
if( new_drill > 0 )
aTrackItem->SetDrillValue(new_drill);
else
aTrackItem->SetDrillDefault( );
}
aTrackItem->m_Width = new_width;
......@@ -161,14 +170,21 @@ void WinEDA_PcbFrame::Edit_Track_Width( wxDC* DC, TRACK* aTrackSegment )
}
/** function Change_Net_Tracks_And_Vias_Sizes
* Reset all tracks width and vias diameters and drill
* to their default Netclass value ou current values
* @param aNetcode : the netcode of the net to edit
* @param aUseNetclassValue : bool. True to use netclass values, false to use current values
*/
/***********************************************************/
void WinEDA_PcbFrame::Edit_Net_Width( wxDC* DC, int aNetcode )
bool WinEDA_PcbFrame::Change_Net_Tracks_And_Vias_Sizes(
int aNetcode, bool aUseNetclassValue )
/***********************************************************/
{
TRACK* pt_segm;
if( aNetcode <= 0 )
return;
return false;
NETINFO_ITEM* net = GetBoard()->FindNet( aNetcode );
wxASSERT( net );
......@@ -177,11 +193,16 @@ void WinEDA_PcbFrame::Edit_Net_Width( wxDC* DC, int aNetcode )
NETCLASS* netClass = net->GetNetClass();
wxASSERT( netClass );
wxString netClassName = netClass->GetName();
msg.Printf( _(
"Set tracks and vias sizes to the Netclass \"%s\"default value (entire NET \"%s\") ?" ),
if( aUseNetclassValue )
msg.Printf( _(
"Set tracks and vias sizes and drill to the Netclass \"%s\"default value (entire NET \"%s\") ?" ),
GetChars( netClassName ), GetChars( netName ) );
else
msg.Printf( _(
"Set tracks and vias sizes and drill to the current values (entire NET \"%s\") ?" ),
GetChars( netClassName ), GetChars( netName ) );
if( !IsOK( this, msg ) )
return;
return false;
/* Examine segments */
PICKED_ITEMS_LIST itemsListPicker;
......@@ -191,71 +212,54 @@ void WinEDA_PcbFrame::Edit_Net_Width( wxDC* DC, int aNetcode )
if( aNetcode != pt_segm->GetNet() ) /* not in net */
continue;
/* we have found a item member of the net */
if( SetTrackSegmentWidth( pt_segm, &itemsListPicker, true ) )
if( SetTrackSegmentWidth( pt_segm, &itemsListPicker, aUseNetclassValue ) )
change = true;
}
if( !change )
return;
// Some segment have changed: redraw them and save in undo list
if( DC )
{
DrawPanel->CursorOff( DC ); // Erase cursor shape
for( unsigned ii = 0; ii < itemsListPicker.GetCount(); ii++ )
{
TRACK* segm = (TRACK*) itemsListPicker.GetPickedItemLink( ii );
segm->Draw( DrawPanel, DC, GR_XOR ); // Erase old track shape
segm = (TRACK*) itemsListPicker.GetPickedItem( ii );
segm->Draw( DrawPanel, DC, GR_OR ); // Display new track shape
}
DrawPanel->CursorOn( DC ); // Display cursor shape
}
return false;
// Some segment have changed: save them in undo list
SaveCopyInUndoList( itemsListPicker, UR_CHANGED );
return true;
}
/*************************************************************************/
bool WinEDA_PcbFrame::Resize_Pistes_Vias( wxDC* DC, bool Track, bool Via )
bool WinEDA_PcbFrame::Reset_All_Tracks_And_Vias_To_Netclass_Values(
bool aTrack, bool aVia )
/*************************************************************************/
/* remet a jour la largeur des pistes et/ou le diametre des vias
* Si piste == 0 , pas de cht sur les pistes
* Si via == 0 , pas de cht sur les vias
*/
{
TRACK* pt_segm;
if( Track && Via )
if( aTrack && aVia )
{
if( !IsOK( this, _( "Set All Tracks and Vias to Netclass value" ) ) )
return FALSE;
return false;
}
else if( Via )
else if( aVia )
{
if( !IsOK( this, _( "Set All Via to Netclass value" ) ) )
return FALSE;
return false;
}
else if( Track )
else if( aTrack )
{
if( !IsOK( this, _( "Set All Track to Netclass value" ) ) )
return FALSE;
return false;
}
/* balayage des segments */
/* read and edit tracks and vias if required */
PICKED_ITEMS_LIST itemsListPicker;
bool change = false;
for( pt_segm = GetBoard()->m_Track; pt_segm != NULL; pt_segm = pt_segm->Next() )
{
if( (pt_segm->Type() == TYPE_VIA ) && Via )
if( (pt_segm->Type() == TYPE_VIA ) && aVia )
{
if( SetTrackSegmentWidth( pt_segm, &itemsListPicker, true ) )
change = true;
}
if( (pt_segm->Type() == TYPE_TRACK ) && Track )
if( (pt_segm->Type() == TYPE_TRACK ) && aTrack )
{
if( SetTrackSegmentWidth( pt_segm, &itemsListPicker, true ) )
change = true;;
......@@ -265,21 +269,7 @@ bool WinEDA_PcbFrame::Resize_Pistes_Vias( wxDC* DC, bool Track, bool Via )
if( !change )
return false;
// Some segment have changed: redraw them and save in undo list
if( DC )
{
DrawPanel->CursorOff( DC ); // Erase cursor shape
for( unsigned ii = 0; ii < itemsListPicker.GetCount(); ii++ )
{
TRACK* segm = (TRACK*) itemsListPicker.GetPickedItemLink( ii );
segm->Draw( DrawPanel, DC, GR_XOR ); // Erase old track shape
segm = (TRACK*) itemsListPicker.GetPickedItem( ii );
segm->Draw( DrawPanel, DC, GR_OR ); // Display new track shape
}
DrawPanel->CursorOn( DC ); // Display cursor shape
}
// Some segment have changed: save them in undo list
SaveCopyInUndoList( itemsListPicker, UR_CHANGED );
return true;
......
......@@ -183,7 +183,7 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
SEGVIA* via = new SEGVIA( GetBoard() );
via->m_Flags = IS_NEW;
via->m_Shape = g_DesignSettings.m_CurrentViaType;
via->m_Width = g_DesignSettings.m_CurrentViaSize;
via->m_Width = GetBoard()->GetCurrentViaSize();
via->SetNet( g_HightLigth_NetCode );
via->m_Start = via->m_End = g_CurrentTrackSegment->m_End;
int old_layer = ((PCB_SCREEN*)GetScreen())->m_Active_Layer;
......@@ -199,6 +199,7 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
{
case VIA_BLIND_BURIED:
via->SetLayerPair( old_layer, ((PCB_SCREEN*)GetScreen())->m_Active_Layer );
via->SetDrillValue( GetBoard()->GetCurrentViaDrill() );
break;
case VIA_MICROVIA: // from external to the near neghbour inner layer
......@@ -213,11 +214,15 @@ bool WinEDA_PcbFrame::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
((PCB_SCREEN*)GetScreen())->m_Active_Layer = LAYER_CMP_N;
// else error
via->SetLayerPair( old_layer, ((PCB_SCREEN*)GetScreen())->m_Active_Layer );
via->m_Width = g_DesignSettings.m_CurrentMicroViaSize;
{
NETINFO_ITEM* net = GetBoard()->FindNet( via->GetNet() );
via->m_Width = net->GetMicroViaSize();
}
break;
default:
// Usual via is from copper to component; layer pair is 0 and 0x0F.
via->SetDrillValue( GetBoard()->GetCurrentViaDrill() );
via->SetLayerPair( COPPER_LAYER_N, LAYER_CMP_N );
break;
}
......
......@@ -157,7 +157,7 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC )
AuxiliaryToolBar_Update_UI();
g_CurrentTrackSegment->SetLayer( GetScreen()->m_Active_Layer );
g_CurrentTrackSegment->m_Width = g_DesignSettings.m_CurrentTrackWidth;
g_CurrentTrackSegment->m_Width = GetBoard()->GetCurrentTrackWidth();
if( g_DesignSettings.m_UseConnectedTrackWidth )
{
......@@ -266,7 +266,7 @@ TRACK* WinEDA_PcbFrame::Begin_Route( TRACK* aTrack, wxDC* DC )
newTrack->SetLayer( ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer );
if( !g_DesignSettings.m_UseConnectedTrackWidth )
{
newTrack->m_Width = g_DesignSettings.m_CurrentTrackWidth;
newTrack->m_Width = GetBoard()->GetCurrentTrackWidth();
}
D( g_CurrentTrackList.VerifyListIntegrity(); );
......@@ -706,7 +706,7 @@ void ShowNewTrackWhenMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool erase
// Set track parameters, that can be modified while creating the track
g_CurrentTrackSegment->SetLayer( screen->m_Active_Layer );
g_CurrentTrackSegment->m_Width = g_DesignSettings.m_CurrentTrackWidth;
g_CurrentTrackSegment->m_Width = frame->GetBoard()->GetCurrentTrackWidth();
if( g_TwoSegmentTrackBuild )
{
......@@ -716,7 +716,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 = g_DesignSettings.m_CurrentTrackWidth;
previous_track->m_Width = frame->GetBoard()->GetCurrentTrackWidth();
}
}
......
......@@ -34,17 +34,13 @@ void WinEDA_PcbFrame::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
{
case ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH:
g_DesignSettings.m_UseConnectedTrackWidth = not g_DesignSettings.m_UseConnectedTrackWidth;
g_DesignSettings.m_CurrentTrackWidth = GetBoard()->m_TrackWidthList[m_SelTrackWidthBox->GetChoice()];
g_DesignSettings.m_CurrentViaSize = GetBoard()->m_ViaSizeList[m_SelViaSizeBox->GetChoice()];
AuxiliaryToolBar_Update_UI( );
break;
case ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES:
g_DesignSettings.m_UseConnectedTrackWidth = false;
GetBoard()->m_TrackWidthSelector = 0;
g_DesignSettings.m_CurrentTrackWidth = GetBoard()->m_TrackWidthList[0];
GetBoard()->m_ViaSizeSelector = 0;
g_DesignSettings.m_CurrentViaSize = GetBoard()->m_ViaSizeList[0];
AuxiliaryToolBar_Update_UI( );
break;
......@@ -54,8 +50,8 @@ void WinEDA_PcbFrame::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
AuxiliaryToolBar_Update_UI( );
break;
case ID_POPUP_PCB_SELECT_WIDTH1:
case ID_POPUP_PCB_SELECT_WIDTH2:
case ID_POPUP_PCB_SELECT_WIDTH1: // this is the default Netclass selection
case ID_POPUP_PCB_SELECT_WIDTH2: // this is a custom value selection
case ID_POPUP_PCB_SELECT_WIDTH3:
case ID_POPUP_PCB_SELECT_WIDTH4:
case ID_POPUP_PCB_SELECT_WIDTH5:
......@@ -66,36 +62,32 @@ void WinEDA_PcbFrame::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
g_DesignSettings.m_UseConnectedTrackWidth = false;
ii = id - ID_POPUP_PCB_SELECT_WIDTH1;
GetBoard()->m_TrackWidthSelector = ii;
g_DesignSettings.m_CurrentTrackWidth = GetBoard()->m_TrackWidthList[ii];
AuxiliaryToolBar_Update_UI( );
break;
case ID_POPUP_PCB_SELECT_VIASIZE1:
case ID_POPUP_PCB_SELECT_VIASIZE2:
case ID_POPUP_PCB_SELECT_VIASIZE1: // this is the default Netclass selection
case ID_POPUP_PCB_SELECT_VIASIZE2: // this is a custom value selection
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)
case ID_POPUP_PCB_SELECT_VIASIZE8: // select 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_ViaSizeList[ii];
AuxiliaryToolBar_Update_UI( );
break;
case ID_AUX_TOOLBAR_PCB_TRACK_WIDTH:
ii = m_SelTrackWidthBox->GetChoice();
g_DesignSettings.m_CurrentTrackWidth = GetBoard()->m_TrackWidthList[ii];
GetBoard()->m_TrackWidthSelector = ii;
break;
case ID_AUX_TOOLBAR_PCB_VIA_SIZE:
ii = m_SelViaSizeBox->GetChoice();
g_DesignSettings.m_CurrentViaSize = GetBoard()->m_ViaSizeList[ii];
GetBoard()->m_ViaSizeSelector = ii;
GetBoard()->m_ViaSizeSelector = ii;
break;
default:
......
......@@ -394,9 +394,8 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
continue;
}
if( stricmp( Line, "TrackWidth" ) == 0 )
if( stricmp( Line, "TrackWidth" ) == 0 ) // no more used
{
g_DesignSettings.m_CurrentTrackWidth = atoi( data );
continue;
}
......@@ -437,9 +436,8 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
continue;
}
if( stricmp( Line, "ViaSize" ) == 0 )
if( stricmp( Line, "ViaSize" ) == 0 ) // no more used
{
g_DesignSettings.m_CurrentViaSize = atoi( data );
continue;
}
......@@ -449,9 +447,8 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
continue;
}
if( stricmp( Line, "MicroViaSize" ) == 0 )
if( stricmp( Line, "MicroViaSize" ) == 0 ) // Not used
{
g_DesignSettings.m_CurrentMicroViaSize = atoi( data );
continue;
}
......@@ -464,7 +461,15 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
if( stricmp( Line, "ViaSizeList" ) == 0 )
{
int tmp = atoi( data );
GetBoard()->m_ViaSizeList.push_back( tmp );
VIA_DIMENSION via_dim;
via_dim.m_Diameter = tmp;
data = strtok( NULL, " \n\r" );
if( data )
{
tmp = atoi( data );
via_dim.m_Drill = tmp > 0 ? tmp : 0;
}
GetBoard()->m_ViasDimensionsList.push_back( via_dim );
continue;
}
......@@ -475,12 +480,6 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
continue;
}
if( stricmp( Line, "ViaAltDrill" ) == 0 )
{
g_DesignSettings.m_ViaDrillCustomValue = atoi( data );
continue;
}
if( stricmp( Line, "ViaMinDrill" ) == 0 )
{
g_DesignSettings.m_ViasMinDrill = atoi( data );
......@@ -567,13 +566,13 @@ int WinEDA_BasePcbFrame::ReadSetup( FILE* File, int* LineNum )
* Sort lists by by increasing value and remove duplicates
* (the first value is not tested, because it is the netclass value
*/
sort( GetBoard()->m_ViaSizeList.begin()+1, GetBoard()->m_ViaSizeList.end() );
sort( GetBoard()->m_ViasDimensionsList.begin()+1, GetBoard()->m_ViasDimensionsList.end() );
sort( GetBoard()->m_TrackWidthList.begin()+1, GetBoard()->m_TrackWidthList.end() );
for( unsigned ii = 1; ii < GetBoard()->m_ViaSizeList.size()-1; ii++ )
for( unsigned ii = 1; ii < GetBoard()->m_ViasDimensionsList.size()-1; ii++ )
{
if( GetBoard()->m_ViaSizeList[ii] == GetBoard()->m_ViaSizeList[ii+1] )
if( GetBoard()->m_ViasDimensionsList[ii] == GetBoard()->m_ViasDimensionsList[ii+1] )
{
GetBoard()->m_ViaSizeList.erase(GetBoard()->m_ViaSizeList.begin()+ii);
GetBoard()->m_ViasDimensionsList.erase(GetBoard()->m_ViasDimensionsList.begin()+ii);
ii--;
}
}
......@@ -618,7 +617,8 @@ static int WriteSetup( FILE* aFile, WinEDA_BasePcbFrame* aFrame, BOARD* aBoard )
}
}
fprintf( aFile, "TrackWidth %d\n", g_DesignSettings.m_CurrentTrackWidth );
// Save current default track width, for compatibility with older pcbnew version;
fprintf( aFile, "TrackWidth %d\n", aBoard->GetCurrentTrackWidth() );
// Save custom tracks width list (the first is not saved here: this is the netclass value
for( unsigned ii = 1; ii < aBoard->m_TrackWidthList.size(); ii++ )
fprintf( aFile, "TrackWidthList %d\n", aBoard->m_TrackWidthList[ii] );
......@@ -630,17 +630,20 @@ static int WriteSetup( FILE* aFile, WinEDA_BasePcbFrame* aFrame, BOARD* aBoard )
fprintf( aFile, "DrawSegmWidth %d\n", g_DesignSettings.m_DrawSegmentWidth );
fprintf( aFile, "EdgeSegmWidth %d\n", g_DesignSettings.m_EdgeSegmentWidth );
fprintf( aFile, "ViaSize %d\n", g_DesignSettings.m_CurrentViaSize );
// Save current default via size, for compatibility with older pcbnew version;
fprintf( aFile, "ViaSize %d\n", netclass_default->GetViaDiameter() );
fprintf( aFile, "ViaDrill %d\n", netclass_default->GetViaDrill() );
fprintf( aFile, "ViaAltDrill %d\n", g_DesignSettings.m_ViaDrillCustomValue );
fprintf( aFile, "ViaMinSize %d\n", g_DesignSettings.m_ViasMinSize );
fprintf( aFile, "ViaMinDrill %d\n", g_DesignSettings.m_ViasMinDrill );
// Save custom vias diameters list (the first is not saved here: this is the netclass value
for( unsigned ii = 1; ii < aBoard->m_ViaSizeList.size(); ii++ )
fprintf( aFile, "ViaSizeList %d\n", aBoard->m_ViaSizeList[ii] );
for( unsigned ii = 1; ii < aBoard->m_ViasDimensionsList.size(); ii++ )
fprintf( aFile, "ViaSizeList %d %d\n",
aBoard->m_ViasDimensionsList[ii].m_Diameter,
aBoard->m_ViasDimensionsList[ii].m_Drill );
fprintf( aFile, "MicroViaSize %d\n", g_DesignSettings.m_CurrentMicroViaSize);
// for old versions compatibility:
fprintf( aFile, "MicroViaSize %d\n", netclass_default->GetuViaDiameter() );
fprintf( aFile, "MicroViaDrill %d\n", netclass_default->GetuViaDrill());
fprintf( aFile, "MicroViasAllowed %d\n", g_DesignSettings.m_MicroViasAllowed);
fprintf( aFile, "MicroViaMinSize %d\n" , g_DesignSettings.m_MicroViasMinSize );
......
......@@ -167,7 +167,7 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
wxGetApp().m_fileHistory.AddFilesToMenu( filesMenu );
///////////////////////////////////
// Configuration et preferences: //
// Preferences an configuration //
///////////////////////////////////
wxMenu* configmenu = new wxMenu;
item = new wxMenuItem( configmenu, ID_CONFIG_REQ, _( "&Library" ),
......@@ -205,35 +205,32 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
item->SetBitmap( read_setup_xpm );
configmenu->Append( item );
// Add access to the Design Rules Dialog:
////////////////////////////////////////////////////////////
// Add access to the Design Rules Dialog and layers setup //
////////////////////////////////////////////////////////////
wxMenu* designRulesMenu = new wxMenu;
item = new wxMenuItem( designRulesMenu, ID_MENU_PCB_SHOW_DESIGN_RULES_DIALOG,
_( "Design Rules" ), _( "Open the design rules dialog editor" ) );
item->SetBitmap( hammer_xpm );
designRulesMenu->Append( item );
/*
item = new wxMenuItem( designRulesMenu, ID_PCB_COPPER_LAYERS_SETUP, _( "Copper &Layers" ),
_( "Select copper layers count and layers names" ) );
item->SetBitmap( copper_layers_setup_xpm );
designRulesMenu->Append( item );
*/
item = new wxMenuItem( configmenu, ID_PCB_LAYERS_SETUP, _( "&Layers Setup" ),
_( "Enable and set properties of layers" ) );
item->SetBitmap( copper_layers_setup_xpm );
designRulesMenu->Append( item );
/////////////////////////////
// Ajustage de dimensions: //
/////////////////////////////
/////////////////////////////////////////////////////////
// dimensions of some items (excluding tracks and vias //
/////////////////////////////////////////////////////////
wxMenu* sizes_menu = new wxMenu;
item = new wxMenuItem( sizes_menu, ID_PCB_TRACK_SIZE_SETUP,
_( "Tracks and Vias" ),
_( "Adjust size and width for tracks and vias" ) );
item->SetBitmap( showtrack_xpm );
item = new wxMenuItem( sizes_menu, ID_PCB_MASK_CLEARANCE,
_( "Pads Mask Clearance" ),
_( "Adjust the global clearance between pads and the solder resist mask" ) );
item->SetBitmap( pad_xpm );
sizes_menu->Append( item );
item = new wxMenuItem( sizes_menu, ID_PCB_USER_GRID_SETUP, _( "Grid" ),
......
......@@ -263,7 +263,7 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC )
}
/* Generation du composant: calcul des elements de la self */
Mself.m_Width = g_DesignSettings.m_CurrentTrackWidth;
Mself.m_Width = GetBoard()->GetCurrentTrackWidth();
Mself.m_Size.x = Mself.m_Size.y / 2;
// Choix d'une Valeur de depart raisonnable pour le rayon des arcs de cercle
......@@ -600,7 +600,7 @@ MODULE* WinEDA_PcbFrame::Create_MuWaveBasicShape( const wxString& name, int pad_
Module->m_Pads.PushFront( pad );
pad->m_Size.x = pad->m_Size.y = g_DesignSettings.m_CurrentTrackWidth;
pad->m_Size.x = pad->m_Size.y = GetBoard()->GetCurrentTrackWidth();
pad->m_Pos = Module->m_Pos;
pad->m_PadShape = PAD_RECT;
pad->m_Attribut = PAD_SMD;
......@@ -663,7 +663,7 @@ MODULE* WinEDA_PcbFrame::Create_MuWaveComponent( int shape_type )
bool abort;
/* Enter the size of the gap or stub*/
int gap_size = g_DesignSettings.m_CurrentTrackWidth; // Valeur raisonnable
int gap_size = GetBoard()->GetCurrentTrackWidth(); // Valeur raisonnable
switch( shape_type )
{
......@@ -1212,7 +1212,7 @@ void WinEDA_PcbFrame::Edit_Gap( wxDC* DC, MODULE* Module )
}
/* Mise a jour des tailles des pastilles formant le gap */
pad->m_Size.x = pad->m_Size.y = g_DesignSettings.m_CurrentTrackWidth;
pad->m_Size.x = pad->m_Size.y = GetBoard()->GetCurrentTrackWidth();
pad->m_Pos0.y = 0;
oX = pad->m_Pos0.x = -( (gap_size + pad->m_Size.x) / 2 );
pad->m_Pos.x = pad->m_Pos0.x + Module->m_Pos.x;
......@@ -1220,7 +1220,7 @@ void WinEDA_PcbFrame::Edit_Gap( wxDC* DC, MODULE* Module )
RotatePoint( &(pad->m_Pos.x), &(pad->m_Pos.y),
Module->m_Pos.x, Module->m_Pos.y, Module->m_Orient );
next_pad->m_Size.x = next_pad->m_Size.y = g_DesignSettings.m_CurrentTrackWidth;
next_pad->m_Size.x = next_pad->m_Size.y = GetBoard()->GetCurrentTrackWidth();
next_pad->m_Pos0.y = 0;
next_pad->m_Pos0.x = oX + gap_size + next_pad->m_Size.x;
next_pad->m_Pos.x = next_pad->m_Pos0.x + Module->m_Pos.x;
......
This diff is collapsed.
......@@ -84,9 +84,8 @@ EVT_MENU_RANGE( ID_CONFIG_AND_PREFERENCES_START,
EVT_MENU( ID_COLORS_SETUP, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_OPTIONS_SETUP, WinEDA_PcbFrame::Process_Config )
//EVT_MENU( ID_PCB_COPPER_LAYERS_SETUP, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_PCB_LAYERS_SETUP, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_PCB_TRACK_SIZE_SETUP, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_PCB_MASK_CLEARANCE, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_PCB_DRAWINGS_WIDTHS_SETUP, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_PCB_PAD_SETUP, WinEDA_PcbFrame::Process_Config )
EVT_MENU( ID_CONFIG_SAVE, WinEDA_PcbFrame::Process_Config )
......@@ -201,9 +200,6 @@ EVT_MENU( ID_POPUP_PCB_DELETE_TRACKSEG, WinEDA_PcbFrame::Process_Special_Functio
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
WinEDA_PcbFrame::Process_Special_Functions )
EVT_MENU_RANGE( ID_POPUP_VIA_EDIT_START_RANGE, ID_POPUP_VIA_EDIT_END_RANGE,
WinEDA_PcbFrame::Via_Edit_Control )
// PopUp Menus pour Zooms traites dans drawpanel.cpp
END_EVENT_TABLE()
......
......@@ -20,9 +20,10 @@
#include "hotkeys.h"
#include "protos.h"
/* Routines Locales */
#include "dialog_mask_clearance.h"
#include "dialog_general_options.h"
/* Variables locales */
#define HOTKEY_FILENAME wxT( "pcbnew" )
......@@ -57,8 +58,20 @@ void WinEDA_PcbFrame::Process_Config( wxCommandEvent& event )
InstallConfigFrame( pos );
break;
case ID_PCB_TRACK_SIZE_SETUP:
case ID_PCB_MASK_CLEARANCE:
{
DIALOG_PADS_MASK_CLEARANCE dlg( this );
dlg.ShowModal();
}
break;
case ID_OPTIONS_SETUP:
{
Dialog_GeneralOptions dlg( this, &dc );
dlg.ShowModal();
}
break;
case ID_PCB_DRAWINGS_WIDTHS_SETUP:
InstallPcbOptionsFrame( pos, &dc, id );
break;
......
......@@ -56,14 +56,6 @@ static PARAM_CFG_INT PadDimVCfg
);
static PARAM_CFG_INT ViaDiametreCfg
(
wxT( "ViaDiam" ), /* Keyword */
&g_DesignSettings.m_CurrentViaSize, /* Parameter address */
450, /* Default value */
0, 0xFFFF /* Min and max values*/
);
static PARAM_CFG_INT LayerThicknessCfg
(
wxT( "LayerThickness" ), /* Keyword */
......@@ -72,14 +64,6 @@ static PARAM_CFG_INT LayerThicknessCfg
0, 0xFFFF /* Min and max values*/
);
static PARAM_CFG_INT MicroViaDiametreCfg
(
wxT( "MViaDia" ), /* Keyword */
&g_DesignSettings.m_CurrentMicroViaSize, /* Parameter address */
200, /* Default value */
0, 1000 /* Min and max values*/
);
static PARAM_CFG_INT ViaShowHoleCfg
(
INSETUP,
......@@ -745,8 +729,6 @@ PARAM_CFG_BASE* ParamCfgList[] =
&PadDrillCfg,
&PadDimHCfg,
&PadDimVCfg,
&ViaDiametreCfg,
&MicroViaDiametreCfg,
&ViaShowHoleCfg,
&ShowNetNamesModeCfg,
&LayerThicknessCfg,
......
......@@ -15,7 +15,6 @@ enum pcbnew_ids
{
ID_MAIN_MENUBAR = ID_END_LIST,
ID_OPEN_MODULE_EDITOR,
ID_UNNUSED_BUTT,
ID_READ_NETLIST,
ID_PCB_CIRCLE_BUTT,
ID_PCB_ARC_BUTT,
......@@ -23,7 +22,7 @@ enum pcbnew_ids
ID_PCB_MIRE_BUTT,
ID_PCB_SHOW_1_RATSNEST_BUTT,
ID_PCB_PLACE_OFFSET_COORD_BUTT,
// ID_PCB_COPPER_LAYERS_SETUP,
ID_PCB_MASK_CLEARANCE,
ID_PCB_LAYERS_SETUP,
ID_PCB_ADD_LINE_BUTT,
ID_PCB_ADD_TEXT_BUTT,
......@@ -173,17 +172,6 @@ enum pcbnew_ids
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,
ID_POPUP_PCB_VIA_HOLE_ENTER_VALUE,
ID_POPUP_PCB_VIA_HOLE_EXPORT,
ID_POPUP_PCB_VIA_HOLE_RESET_TO_DEFAULT,
ID_POPUP_PCB_VIA_HOLE_EXPORT_TO_OTHERS,
ID_POPUP_VIA_EDIT_END_RANGE,
// reserve a block of MAX_ITEMS_IN_PICKER ids for the item selection popup
ID_POPUP_PCB_ITEM_SELECTION_START,
ID_POPUP_PCB_ITEM_SELECTION_END = MAX_ITEMS_IN_PICKER + ID_POPUP_PCB_ITEM_SELECTION_START,
......@@ -203,11 +191,6 @@ enum pcbnew_ids
ID_POPUP_PCB_AUTOPLACE_NEW_MODULES,
ID_POPUP_PCB_AUTOPLACE_NEXT_MODULE,
ID_POPUP_PCB_AUTOPLACE_UNUSED0,
ID_POPUP_PCB_AUTOPLACE_UNUSED1,
ID_POPUP_PCB_AUTOPLACE_UNUSED2,
ID_POPUP_PCB_AUTOPLACE_UNUSED3,
ID_POPUP_PCB_AUTOROUTE_COMMANDS,
ID_POPUP_PCB_AUTOROUTE_ALL_MODULES,
ID_POPUP_PCB_AUTOROUTE_MODULE,
......
......@@ -359,8 +359,8 @@ static int Autoroute_One_Track( WinEDA_PcbFrame* pcbframe, wxDC* DC,
result = NOSUCCESS;
marge = s_Clearance + (g_DesignSettings.m_CurrentTrackWidth / 2);
via_marge = s_Clearance + (g_DesignSettings.m_CurrentViaSize / 2);
marge = s_Clearance + (pcbframe->GetBoard()->GetCurrentTrackWidth() / 2);
via_marge = s_Clearance + (pcbframe->GetBoard()->GetCurrentViaSize() / 2);
/* clear direction flags */
i = Nrows * Ncols * sizeof(char);
......@@ -956,7 +956,7 @@ static void OrCell_Trace( BOARD* pcb, int col, int row,
g_CurrentTrackSegment->m_Start.y =
g_CurrentTrackSegment->m_End.y = pcb->m_BoundaryBox.m_Pos.y + (g_GridRoutingSize * col);
g_CurrentTrackSegment->m_Width = g_DesignSettings.m_CurrentViaSize;
g_CurrentTrackSegment->m_Width = pcb->GetCurrentViaSize();
g_CurrentTrackSegment->m_Shape = g_DesignSettings.m_CurrentViaType;
g_CurrentTrackSegment->SetNet( current_net_code );
......@@ -1010,7 +1010,7 @@ static void OrCell_Trace( BOARD* pcb, int col, int row,
g_CurrentTrackSegment->m_Start = g_CurrentTrackSegment->Back()->m_End;
}
}
g_CurrentTrackSegment->m_Width = g_DesignSettings.m_CurrentTrackWidth;
g_CurrentTrackSegment->m_Width = pcb->GetCurrentTrackWidth();
if( g_CurrentTrackSegment->m_Start != g_CurrentTrackSegment->m_End )
{
......@@ -1052,8 +1052,8 @@ static void Place_Piste_en_Buffer( WinEDA_PcbFrame* pcbframe, wxDC* DC )
int marge, via_marge;
WinEDA_DrawPanel* panel = pcbframe->DrawPanel;
marge = s_Clearance + (g_DesignSettings.m_CurrentTrackWidth / 2);
via_marge = s_Clearance + (g_DesignSettings.m_CurrentViaSize / 2);
marge = s_Clearance + (pcbframe->GetBoard()->GetCurrentTrackWidth() / 2);
via_marge = s_Clearance + (pcbframe->GetBoard()->GetCurrentViaSize() / 2);
/* tst point d'arrivee : doit etre sur pad start */
......
......@@ -1233,10 +1233,10 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IOError )
// must follow the initial padstack construction code.
// Next we add the via's which may be used.
int defaultViaSize = aBoard->m_BoardSettings->m_CurrentViaSize;
int defaultViaSize = aBoard->m_NetClasses.GetDefault()->GetViaDiameter();
int defaultViaDrill = aBoard->m_NetClasses.GetDefault()->GetViaDrill();
/**
*@todo: *** output vias sizes and drill in NetClasses ***
*@todo: *** output vias sizes and drill in NetClasses and in stock ***
*/
/* I need at least one via for the (class...) scope below
if( defaultViaSize )
......@@ -1252,14 +1252,15 @@ void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IOError )
pcb->library->SetViaStartIndex( pcb->library->padstacks.size()-1 );
}
for( unsigned i=0; i < aBoard->m_ViaSizeList.size(); ++i )
for( unsigned i=0; i < aBoard->m_ViasDimensionsList.size(); ++i )
{
int viaSize = aBoard->m_ViaSizeList[i];
int viaSize = aBoard->m_ViasDimensionsList[i].m_Diameter;
int viaDrill = aBoard->m_ViasDimensionsList[i].m_Drill;
if( viaSize == defaultViaSize )
continue;
PADSTACK* padstack = makeVia( viaSize, defaultViaDrill,
PADSTACK* padstack = makeVia( viaSize, viaDrill,
0, aBoard->GetCopperLayerCount()-1 );
pcb->library->AddPadstack( padstack );
}
......
......@@ -7,6 +7,7 @@
#include "confirm.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "dialog_design_rules.h"
#include "pcbnew_id.h"
......@@ -25,8 +26,11 @@ void WinEDA_PcbFrame::ToolOnRightClick( wxCommandEvent& event )
switch( id )
{
case ID_TRACK_BUTT:
InstallPcbOptionsFrame( pos, NULL, ID_PCB_TRACK_SIZE_SETUP );
{
DIALOG_DESIGN_RULES dlg( this );
dlg.ShowModal();
break;
}
case ID_COMPONENT_BUTT:
break;
......
......@@ -14,9 +14,9 @@
#include "pcbnew_id.h"
#ifdef __UNIX__
#define LISTBOX_WIDTH 140
#define LISTBOX_WIDTH 150
#else
#define LISTBOX_WIDTH 120
#define LISTBOX_WIDTH 130
#endif
#include "wx/ownerdrw.h"
......@@ -486,8 +486,6 @@ void WinEDA_PcbFrame::ReCreateVToolbar()
wxITEM_CHECK );
m_VToolBar->Realize();
D(printf("ReCreateVToolbar\n");)
SetToolbars();
}
......@@ -565,7 +563,7 @@ void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar()
m_SelTrackWidthBox = new WinEDAChoiceBox( m_AuxiliaryToolBar,
ID_AUX_TOOLBAR_PCB_TRACK_WIDTH,
wxPoint( -1, -1 ),
wxSize( LISTBOX_WIDTH + 10, -1 ) );
wxSize( LISTBOX_WIDTH, -1 ) );
m_AuxiliaryToolBar->AddControl( m_SelTrackWidthBox );
m_AuxiliaryToolBar->AddSeparator();
......@@ -573,14 +571,14 @@ void WinEDA_PcbFrame::ReCreateAuxiliaryToolbar()
m_SelViaSizeBox = new WinEDAChoiceBox( m_AuxiliaryToolBar,
ID_AUX_TOOLBAR_PCB_VIA_SIZE,
wxPoint( -1, -1 ),
wxSize( LISTBOX_WIDTH + 10, -1 ) );
wxSize( (LISTBOX_WIDTH*12)/10, -1 ) );
m_AuxiliaryToolBar->AddControl( m_SelViaSizeBox );
m_AuxiliaryToolBar->AddSeparator();
// Creates box to display tracks and vias clearance:
m_ClearanceBox = new wxTextCtrl( m_AuxiliaryToolBar, -1,
wxEmptyString, wxPoint( -1, -1 ),
wxSize( LISTBOX_WIDTH + 20, -1 ),
wxSize( LISTBOX_WIDTH + 10, -1 ),
wxTE_READONLY );
m_ClearanceBox->SetToolTip(_("Current NetClass clearance value") );
m_AuxiliaryToolBar->AddControl( m_ClearanceBox );
......@@ -723,7 +721,7 @@ WinEDAChoiceBox* WinEDA_PcbFrame::ReCreateLayerBox( WinEDA_Toolbar* parent )
// Maybe that string is too long?
wxSize( 230, -1 )
#else
wxSize( LISTBOX_WIDTH + 40, -1 )
wxSize( LISTBOX_WIDTH + 30, -1 )
#endif
);
......
......@@ -103,15 +103,20 @@ void WinEDA_PcbFrame::AuxiliaryToolBar_Update_UI()
if( m_SelViaSizeBox && m_TrackAndViasSizesList_Changed )
{
m_SelViaSizeBox->Clear();
for( unsigned ii = 0; ii < GetBoard()->m_ViaSizeList.size(); ii++ )
for( unsigned ii = 0; ii < GetBoard()->m_ViasDimensionsList.size(); ii++ )
{
msg = _( "Via" ) + ReturnStringValue( GetBoard()->m_ViaSizeList[ii] );
msg = _( "Via" );
msg << ReturnStringValue( GetBoard()->m_ViasDimensionsList[ii].m_Diameter );
if( GetBoard()->m_ViasDimensionsList[ii].m_Drill )
msg << wxT("/") << ReturnStringValue( GetBoard()->m_ViasDimensionsList[ii].m_Drill );
if( ii == 0 )
msg << _( " *" );
m_SelViaSizeBox->Append( msg );
}
}
if( GetBoard()->m_ViaSizeSelector >= GetBoard()->m_ViaSizeList.size() )
if( GetBoard()->m_ViaSizeSelector >= GetBoard()->m_ViasDimensionsList.size() )
GetBoard()->m_ViaSizeSelector = 0;
m_SelViaSizeBox->SetSelection( GetBoard()->m_ViaSizeSelector );
......
......@@ -33,16 +33,13 @@ void WinEDA_PcbFrame::Via_Edit_Control( wxCommandEvent& event )
switch( event.GetId() )
{
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();
case ID_POPUP_PCB_VIA_HOLE_TO_VALUE: // Set the drill via to custom
if( (g_DesignSettings.m_ViaDrillCustomValue > 0) && (g_DesignSettings.m_ViaDrillCustomValue < via->m_Width) )
case ID_POPUP_PCB_VIA_HOLE_TO_VALUE: // Set the via drill to custom
if( (GetBoard()->GetCurrentViaDrill() > 0) &&
(GetBoard()->GetCurrentViaDrill() < via->m_Width) )
{
SaveCopyInUndoList(via, UR_CHANGED);
via->Draw( DrawPanel, &dc, GR_XOR );
via->SetDrillValue( g_DesignSettings.m_ViaDrillCustomValue );
via->SetDrillValue( GetBoard()->GetCurrentViaDrill() );
via->Draw( DrawPanel, &dc, GR_OR );
GetScreen()->SetModify();
}
......@@ -50,15 +47,7 @@ void WinEDA_PcbFrame::Via_Edit_Control( wxCommandEvent& event )
DisplayError( this, _( "Incorrect value for Via drill. No via drill change" ) );
break;
case ID_POPUP_PCB_VIA_HOLE_EXPORT: // Export the current drill value as the new custom value
if( via->GetDrillValue() > 0 )
g_DesignSettings.m_ViaDrillCustomValue = via->GetDrillValue();
break;
case ID_POPUP_PCB_VIA_HOLE_EXPORT_TO_OTHERS: // Export the current drill value to via which have the same size
if( via->GetDrillValue() > 0 )
g_DesignSettings.m_ViaDrillCustomValue = via->GetDrillValue();
case ID_POPUP_PCB_VIA_HOLE_EXPORT_TO_OTHERS: // Export the current drill value to via which have the same size
via_struct = GetBoard()->m_Track;
for( ; via_struct != NULL; via_struct = via_struct->Next() )
{
......@@ -87,11 +76,11 @@ void WinEDA_PcbFrame::Via_Edit_Control( wxCommandEvent& event )
GetScreen()->SetModify();
break;
case ID_POPUP_PCB_VIA_HOLE_RESET_TO_DEFAULT: // Reset all via hole to default value
case ID_POPUP_PCB_VIA_HOLE_RESET_TO_DEFAULT: // Reset all via drill to default value
via_struct = GetBoard()->m_Track;
for( ; via_struct != NULL; via_struct = via_struct->Next() )
{
if( via_struct->Type() == TYPE_VIA ) /* mise a jour du diametre de la via */
if( via_struct->Type() == TYPE_VIA ) /* Update via drill */
{
if( ! via_struct->IsDrillDefault() )
{
......@@ -109,6 +98,10 @@ void WinEDA_PcbFrame::Via_Edit_Control( wxCommandEvent& event )
GetScreen()->SetModify();
break;
case ID_POPUP_PCB_VIA_HOLE_ENTER_VALUE: // Enter a new alternate value for drill via
wxMessageBox( wxT( "WinEDA_PcbFrame::Via_Edit_Control(): obsolete command" ) );
break;
default:
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