From 29e217d310dc8def5def4e4db47e619c770a9ab3 Mon Sep 17 00:00:00 2001 From: charras Date: Fri, 30 Oct 2009 17:58:15 +0000 Subject: [PATCH] pcbnew Rewrite the GUI relative to the tracks widths and vias diameters and drills selection and edition, for compatibility with new netclass approach. --- CHANGELOG.txt | 16 + copyright.h | 4 +- gerbview/gerbview_config.cpp | 3 +- gerbview/options.cpp | 2 +- gerbview/wxGerberFrame.h | 2 +- include/class_board_design_settings.h | 4 - include/id.h | 1 - include/wxPcbStruct.h | 20 +- pcbnew/CMakeLists.txt | 12 +- pcbnew/class_board.cpp | 39 +- pcbnew/class_board.h | 77 +- pcbnew/class_board_design_settings.cpp | 4 - pcbnew/class_netinfo.h | 2 - pcbnew/dialog_design_rules.cpp | 41 +- pcbnew/dialog_design_rules.h | 2 +- pcbnew/dialog_general_options.cpp | 42 +- pcbnew/dialog_general_options.h | 2 + pcbnew/dialog_global_edit_tracks_and_vias.cpp | 170 +++ pcbnew/dialog_global_edit_tracks_and_vias.h | 50 + ...ialog_global_edit_tracks_and_vias_base.cpp | 171 +++ ...ialog_global_edit_tracks_and_vias_base.fbp | 1098 +++++++++++++++++ .../dialog_global_edit_tracks_and_vias_base.h | 71 ++ pcbnew/dialog_mask_clearance.cpp | 63 + pcbnew/dialog_mask_clearance.h | 33 + pcbnew/dialog_mask_clearance_base.cpp | 57 + pcbnew/dialog_mask_clearance_base.fbp | 238 ++++ pcbnew/dialog_mask_clearance_base.h | 58 + pcbnew/dialog_track_options.cpp | 229 ---- pcbnew/dialog_track_options.h | 40 - pcbnew/dialog_track_options_base.cpp | 116 -- pcbnew/dialog_track_options_base.fbp | 740 ----------- pcbnew/dialog_track_options_base.h | 84 -- pcbnew/edit.cpp | 27 +- pcbnew/edit_track_width.cpp | 104 +- pcbnew/editrack-part2.cpp | 9 +- pcbnew/editrack.cpp | 8 +- pcbnew/event_handlers_tracks_vias_sizes.cpp | 20 +- pcbnew/ioascii.cpp | 49 +- pcbnew/menubarpcb.cpp | 29 +- pcbnew/muonde.cpp | 10 +- pcbnew/onrightclick.cpp | 153 +-- pcbnew/pcbframe.cpp | 6 +- pcbnew/pcbnew_config.cpp | 19 +- pcbnew/pcbnew_config.h | 18 - pcbnew/pcbnew_id.h | 19 +- pcbnew/solve.cpp | 12 +- pcbnew/specctra_export.cpp | 11 +- pcbnew/tool_onrightclick.cpp | 6 +- pcbnew/tool_pcb.cpp | 14 +- pcbnew/toolbars_update_user_interface.cpp | 11 +- pcbnew/{via_edit.cpp => via_edit.cpp.unused} | 29 +- 51 files changed, 2425 insertions(+), 1620 deletions(-) create mode 100644 pcbnew/dialog_global_edit_tracks_and_vias.cpp create mode 100644 pcbnew/dialog_global_edit_tracks_and_vias.h create mode 100644 pcbnew/dialog_global_edit_tracks_and_vias_base.cpp create mode 100644 pcbnew/dialog_global_edit_tracks_and_vias_base.fbp create mode 100644 pcbnew/dialog_global_edit_tracks_and_vias_base.h create mode 100644 pcbnew/dialog_mask_clearance.cpp create mode 100644 pcbnew/dialog_mask_clearance.h create mode 100644 pcbnew/dialog_mask_clearance_base.cpp create mode 100644 pcbnew/dialog_mask_clearance_base.fbp create mode 100644 pcbnew/dialog_mask_clearance_base.h delete mode 100644 pcbnew/dialog_track_options.cpp delete mode 100644 pcbnew/dialog_track_options.h delete mode 100644 pcbnew/dialog_track_options_base.cpp delete mode 100644 pcbnew/dialog_track_options_base.fbp delete mode 100644 pcbnew/dialog_track_options_base.h rename pcbnew/{via_edit.cpp => via_edit.cpp.unused} (79%) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index af4815b227..39f17f97f6 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -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 +================================================================================ +++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 ================================================================================ diff --git a/copyright.h b/copyright.h index 7e5ca37737..43331ac60c 100644 --- a/copyright.h +++ b/copyright.h @@ -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 diff --git a/gerbview/gerbview_config.cpp b/gerbview/gerbview_config.cpp index 25c7939f82..820fa529e4 100644 --- a/gerbview/gerbview_config.cpp +++ b/gerbview/gerbview_config.cpp @@ -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: diff --git a/gerbview/options.cpp b/gerbview/options.cpp index 1c160f2449..51ddfc913c 100644 --- a/gerbview/options.cpp +++ b/gerbview/options.cpp @@ -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 ) diff --git a/gerbview/wxGerberFrame.h b/gerbview/wxGerberFrame.h index 8c37a18e65..bbf17b4faf 100644 --- a/gerbview/wxGerberFrame.h +++ b/gerbview/wxGerberFrame.h @@ -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 */ diff --git a/include/class_board_design_settings.h b/include/class_board_design_settings.h index 233177efc3..94e4a682f4 100644 --- a/include/class_board_design_settings.h +++ b/include/class_board_design_settings.h @@ -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) diff --git a/include/id.h b/include/id.h index f9e6db79de..f89bcef747 100644 --- a/include/id.h +++ b/include/id.h @@ -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 }; diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h index 51f2de3b18..cd20ecb5d5 100644 --- a/include/wxPcbStruct.h +++ b/include/wxPcbStruct.h @@ -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 ); diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt index 6cd7d1e7b6..bc14421516 100644 --- a/pcbnew/CMakeLists.txt +++ b/pcbnew/CMakeLists.txt @@ -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 diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp index b878d42a1b..6741655e2f 100644 --- a/pcbnew/class_board.cpp +++ b/pcbnew/class_board.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 { diff --git a/pcbnew/class_board.h b/pcbnew/class_board.h index 38c06604a1..7fbca2941b 100644 --- a/pcbnew/class_board.h +++ b/pcbnew/class_board.h @@ -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 m_ViaSizeList; // vias sizes list(max count = HISTORY_MAX_COUNT) + std::vector m_ViasDimensionsList; // vias size and drill list(max count = HISTORY_MAX_COUNT) // The first value is the current netclass via size std::vector 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(); /***************************************************************************/ /** diff --git a/pcbnew/class_board_design_settings.cpp b/pcbnew/class_board_design_settings.cpp index ffe858dfea..14528b3bcf 100644 --- a/pcbnew/class_board_design_settings.cpp +++ b/pcbnew/class_board_design_settings.cpp @@ -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) diff --git a/pcbnew/class_netinfo.h b/pcbnew/class_netinfo.h index 97aa681325..a5951cd099 100644 --- a/pcbnew/class_netinfo.h +++ b/pcbnew/class_netinfo.h @@ -227,8 +227,6 @@ public: */ int GetTrackMinWidth() { -// wxASSERT( m_NetClass ); -// return m_NetClass->GetTrackMinWidth(); return g_DesignSettings.m_TrackMinWidth; } #endif diff --git a/pcbnew/dialog_design_rules.cpp b/pcbnew/dialog_design_rules.cpp index 3443f1b567..7d79f6e9e7 100644 --- a/pcbnew/dialog_design_rules.cpp +++ b/pcbnew/dialog_design_rules.cpp @@ -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 * 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 * 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 * 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; } diff --git a/pcbnew/dialog_design_rules.h b/pcbnew/dialog_design_rules.h index 97c5164239..c5541e76e0 100644 --- a/pcbnew/dialog_design_rules.h +++ b/pcbnew/dialog_design_rules.h @@ -43,7 +43,7 @@ private: NETCUPS m_AllNets; // List of values to "customize" some tracks and vias - std::vector m_ViasDiameterList; + std::vector m_ViasDimensionsList; std::vector m_TracksWidthList; private: diff --git a/pcbnew/dialog_general_options.cpp b/pcbnew/dialog_general_options.cpp index 0cbbef2331..5482858cd3 100644 --- a/pcbnew/dialog_general_options.cpp +++ b/pcbnew/dialog_general_options.cpp @@ -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(); } diff --git a/pcbnew/dialog_general_options.h b/pcbnew/dialog_general_options.h index 58cd868b92..fa65cf5837 100644 --- a/pcbnew/dialog_general_options.h +++ b/pcbnew/dialog_general_options.h @@ -1,6 +1,8 @@ #ifndef __dialog_general_options_h #define __dialog_general_options_h +#include "dialog_general_options_BoardEditor_base.h" + /***********************************************************************/ class Dialog_GeneralOptions : public DialogGeneralOptionsBoardEditor_base /***********************************************************************/ diff --git a/pcbnew/dialog_global_edit_tracks_and_vias.cpp b/pcbnew/dialog_global_edit_tracks_and_vias.cpp new file mode 100644 index 0000000000..d0e266a7f3 --- /dev/null +++ b/pcbnew/dialog_global_edit_tracks_and_vias.cpp @@ -0,0 +1,170 @@ +///////////////////////////////////////////////////////////////////////////// + +// 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 ); +} diff --git a/pcbnew/dialog_global_edit_tracks_and_vias.h b/pcbnew/dialog_global_edit_tracks_and_vias.h new file mode 100644 index 0000000000..79ba64973a --- /dev/null +++ b/pcbnew/dialog_global_edit_tracks_and_vias.h @@ -0,0 +1,50 @@ +/* + * 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__ diff --git a/pcbnew/dialog_global_edit_tracks_and_vias_base.cpp b/pcbnew/dialog_global_edit_tracks_and_vias_base.cpp new file mode 100644 index 0000000000..78325ec80e --- /dev/null +++ b/pcbnew/dialog_global_edit_tracks_and_vias_base.cpp @@ -0,0 +1,171 @@ +/////////////////////////////////////////////////////////////////////////// +// 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 ); +} diff --git a/pcbnew/dialog_global_edit_tracks_and_vias_base.fbp b/pcbnew/dialog_global_edit_tracks_and_vias_base.fbp new file mode 100644 index 0000000000..25ec0fef23 --- /dev/null +++ b/pcbnew/dialog_global_edit_tracks_and_vias_base.fbp @@ -0,0 +1,1098 @@ + + + + + + C++ + 1 + UTF-8 + connect + dialog_global_edit_tracks_and_vias_base + 1000 + none + 1 + dialog_global_edit_tracks_and_vias_base + + . + + 1 + 0 + 0 + + + + + 1 + + + + 0 + wxID_ANY + + + DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE + + 647,380 + wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bMainSizer + wxVERTICAL + none + + 5 + wxEXPAND + 0 + + wxID_ANY + Current Settings + + sbCurrSettingsSizer + wxVERTICAL + none + + + 5 + wxEXPAND + 1 + + 2 + wxBOTH + + + 0 + + fgSizeNetInfo + wxFLEX_GROWMODE_SPECIFIED + none + 2 + 0 + + 5 + wxALL|wxALIGN_RIGHT + 0 + + + + 1 + + + 0 + wxID_ANY + Current Net: + + + m_CurrentNetText + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + + 1 + + ,90,92,-1,70,0 + 0 + wxID_ANY + NetName + + + m_CurrentNetName + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_RIGHT + 0 + + + + 1 + + + 0 + wxID_ANY + Current NetClass: + + + m_CurrentNetclassText + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + + 1 + + ,90,92,-1,70,0 + 0 + wxID_ANY + NetClassName + + + m_CurrentNetclassName + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxTOP|wxBOTTOM + 0 + + 1 + 1 + + + + wxALIGN_CENTRE + + wxALIGN_CENTRE + wxALIGN_CENTRE + 30 + "Track size" "Via size" "Via Diameter" "Via drill" "uVia size" "uVia Drill" + wxALIGN_CENTRE + 5 + + + 0 + 1 + 0 + 1 + 1 + 1 + + + + 1 + 0 + wxID_ANY + + + + 0 + 0 + + + m_gridDisplayCurrentSettings + protected + + wxALIGN_CENTRE + 100 + "Netclass value" "Current value" + wxALIGN_CENTRE + + 2 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND | wxALL + 0 + + + + 1 + + + 0 + wxID_ANY + + + m_staticline1 + protected + + + wxLI_HORIZONTAL + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxEXPAND + 1 + + + bLowerSizer + wxHORIZONTAL + none + + 5 + + 1 + + wxID_ANY + Options + + sbSizerCommands + wxVERTICAL + none + + + 5 + wxEXPAND + 1 + + 2 + wxBOTH + + + 0 + + fgSizer2 + wxFLEX_GROWMODE_SPECIFIED + none + 5 + 0 + + 5 + wxALL|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL + 0 + + + + 1 + + + 0 + wxID_ANY + Set tracks and vias of the current Net to the current value + + + m_Net2CurrValueText + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxEXPAND + 0 + + + + 0 + 1 + + + 0 + ID_CURRENT_VALUES_TO_CURRENT_NET + Ok + + + m_Net2CurrValueButton + protected + + + + + + + + + OnOkClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT + 0 + + + + 1 + + + 0 + wxID_ANY + Set tracks and vias of the current Net to the Netclass value + + + m_staticText5 + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + + 0 + 1 + + + 0 + ID_NETCLASS_VALUES_TO_CURRENT_NET + Ok + + + m_button3 + protected + + + + + + + + + OnOkClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT + 0 + + + + 1 + + + 0 + wxID_ANY + Set ALL tracks and vias to their Netclass value + + + m_staticText6 + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + + 0 + 1 + + + 0 + ID_ALL_TRACKS_VIAS + Ok + + + m_button4 + protected + + + + + + + + + OnOkClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT + 0 + + + + 1 + + + 0 + wxID_ANY + Set ALL vias (no track) to their Netclass value + + + m_staticText7 + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + + 0 + 1 + + + 0 + ID_ALL_VIAS + Ok + + + m_button5 + protected + + + + + + + + + OnOkClick + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL|wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT + 0 + + + + 1 + + + 0 + wxID_ANY + Set ALL tracks (no via) to their Netclass value + + + m_staticText8 + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALL + 0 + + + + 0 + 1 + + + 0 + ID_ALL_TRACKS + Ok + + + m_button6 + protected + + + + + + + + + OnOkClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_VERTICAL + 0 + + + bbuttonsSizer + wxVERTICAL + none + + 5 + wxALL|wxEXPAND + 0 + + + + 0 + 1 + + + 0 + wxID_CANCEL + Cancel + + + m_buttonCancel + protected + + + + + + + + + OnCancelClick + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/pcbnew/dialog_global_edit_tracks_and_vias_base.h b/pcbnew/dialog_global_edit_tracks_and_vias_base.h new file mode 100644 index 0000000000..e356a2adbf --- /dev/null +++ b/pcbnew/dialog_global_edit_tracks_and_vias_base.h @@ -0,0 +1,71 @@ +/////////////////////////////////////////////////////////////////////////// +// 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 + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + +#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__ diff --git a/pcbnew/dialog_mask_clearance.cpp b/pcbnew/dialog_mask_clearance.cpp new file mode 100644 index 0000000000..6faa59bba5 --- /dev/null +++ b/pcbnew/dialog_mask_clearance.cpp @@ -0,0 +1,63 @@ +///////////////////////////////////////////////////////////////////////////// +// 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 ); +} + diff --git a/pcbnew/dialog_mask_clearance.h b/pcbnew/dialog_mask_clearance.h new file mode 100644 index 0000000000..7481719131 --- /dev/null +++ b/pcbnew/dialog_mask_clearance.h @@ -0,0 +1,33 @@ +///////////////////////////////////////////////////////////////////////////// + +// Name: dialog_track_options.h +// Author: jean-pierre Charras +// Created: 17 feb 2009 +// Licence: GPL +///////////////////////////////////////////////////////////////////////////// + +#ifndef _DIALOG_MASK_CLEARANCE_H_ +#define _DIALOG_MASK_CLEARANCE_H_ + +#include "dialog_mask_clearance_base.h" + +/** + * 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_PADS_MASK_CLEARANCE : public DIALOG_PADS_MASK_CLEARANCE_BASE +{ +private: + WinEDA_PcbFrame* m_Parent; + +public: + DIALOG_PADS_MASK_CLEARANCE( WinEDA_PcbFrame* parent ); + ~DIALOG_PADS_MASK_CLEARANCE() {}; +private: + void MyInit(); + virtual void OnButtonOkClick( wxCommandEvent& event ); + virtual void OnButtonCancelClick( wxCommandEvent& event ); +}; + +#endif // _DIALOG_MASK_CLEARANCE_H_ diff --git a/pcbnew/dialog_mask_clearance_base.cpp b/pcbnew/dialog_mask_clearance_base.cpp new file mode 100644 index 0000000000..bb7d8c2e21 --- /dev/null +++ b/pcbnew/dialog_mask_clearance_base.cpp @@ -0,0 +1,57 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Apr 16 2008) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#include "dialog_mask_clearance_base.h" + +/////////////////////////////////////////////////////////////////////////// + +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_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 ); + + wxBoxSizer* bMainSizer; + bMainSizer = new wxBoxSizer( wxVERTICAL ); + + wxBoxSizer* bMainUpperSizer; + bMainUpperSizer = new wxBoxSizer( wxHORIZONTAL ); + + wxStaticBoxSizer* sbMiddleRightSizer; + sbMiddleRightSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Dimensions:") ), wxVERTICAL ); + + 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 ); + + m_OptMaskMargin = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); + m_OptMaskMargin->SetToolTip( _("This is the clearance between pads and the mask") ); + + sbMiddleRightSizer->Add( m_OptMaskMargin, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); + + bMainUpperSizer->Add( sbMiddleRightSizer, 1, wxEXPAND, 5 ); + + bMainSizer->Add( bMainUpperSizer, 1, wxEXPAND, 5 ); + + m_sdbButtonsSizer = new wxStdDialogButtonSizer(); + m_sdbButtonsSizerOK = new wxButton( this, wxID_OK ); + m_sdbButtonsSizer->AddButton( m_sdbButtonsSizerOK ); + m_sdbButtonsSizerCancel = new wxButton( this, wxID_CANCEL ); + m_sdbButtonsSizer->AddButton( m_sdbButtonsSizerCancel ); + m_sdbButtonsSizer->Realize(); + bMainSizer->Add( m_sdbButtonsSizer, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); + + this->SetSizer( bMainSizer ); + this->Layout(); +} + +DIALOG_PADS_MASK_CLEARANCE_BASE::~DIALOG_PADS_MASK_CLEARANCE_BASE() +{ +} diff --git a/pcbnew/dialog_mask_clearance_base.fbp b/pcbnew/dialog_mask_clearance_base.fbp new file mode 100644 index 0000000000..f9c5479b8a --- /dev/null +++ b/pcbnew/dialog_mask_clearance_base.fbp @@ -0,0 +1,238 @@ + + + + + + C++ + 1 + UTF-8 + table + dialog_mask_clearance_base + 1000 + none + 1 + DialogMaskClearanceOptions + + . + + 1 + 1 + 0 + + + + + 1 + + + + 0 + wxID_ANY + + + DIALOG_PADS_MASK_CLEARANCE_BASE + + 256,117 + wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER + + Pads Mask Clearance + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + bMainSizer + wxVERTICAL + none + + 5 + wxEXPAND + 1 + + + bMainUpperSizer + wxHORIZONTAL + none + + 5 + wxEXPAND + 1 + + wxID_ANY + Dimensions: + + sbMiddleRightSizer + wxVERTICAL + none + + + 5 + wxTOP|wxRIGHT|wxLEFT + 0 + + + + 1 + + + 0 + wxID_ANY + Pads Mask Clearance: + + + m_MaskClearanceTitle + protected + + + + + + + + + -1 + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND + 0 + + + + 1 + + + 0 + wxID_ANY + + 0 + + m_OptMaskMargin + protected + + + + + This is the clearance between pads and the mask + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 + wxALIGN_CENTER_HORIZONTAL + 0 + + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + + m_sdbButtonsSizer + protected + + OnButtonCancelClick + + + + OnButtonOkClick + + + + + + + + diff --git a/pcbnew/dialog_mask_clearance_base.h b/pcbnew/dialog_mask_clearance_base.h new file mode 100644 index 0000000000..9f5d669aa6 --- /dev/null +++ b/pcbnew/dialog_mask_clearance_base.h @@ -0,0 +1,58 @@ +/////////////////////////////////////////////////////////////////////////// +// C++ code generated with wxFormBuilder (version Apr 16 2008) +// http://www.wxformbuilder.org/ +// +// PLEASE DO "NOT" EDIT THIS FILE! +/////////////////////////////////////////////////////////////////////////// + +#ifndef __dialog_mask_clearance_base__ +#define __dialog_mask_clearance_base__ + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/////////////////////////////////////////////////////////////////////////// + +/////////////////////////////////////////////////////////////////////////////// +/// Class DIALOG_PADS_MASK_CLEARANCE_BASE +/////////////////////////////////////////////////////////////////////////////// +class DIALOG_PADS_MASK_CLEARANCE_BASE : public wxDialog +{ + DECLARE_EVENT_TABLE() + private: + + // Private event handlers + void _wxFB_OnButtonCancelClick( wxCommandEvent& event ){ OnButtonCancelClick( event ); } + void _wxFB_OnButtonOkClick( wxCommandEvent& event ){ OnButtonOkClick( event ); } + + + protected: + wxStaticText* m_MaskClearanceTitle; + wxTextCtrl* m_OptMaskMargin; + wxStdDialogButtonSizer* m_sdbButtonsSizer; + wxButton* m_sdbButtonsSizerOK; + wxButton* m_sdbButtonsSizerCancel; + + // Virtual event handlers, overide them in your derived class + virtual void OnButtonCancelClick( wxCommandEvent& event ){ event.Skip(); } + virtual void OnButtonOkClick( wxCommandEvent& event ){ event.Skip(); } + + + public: + 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_mask_clearance_base__ diff --git a/pcbnew/dialog_track_options.cpp b/pcbnew/dialog_track_options.cpp deleted file mode 100644 index 687a1a99f7..0000000000 --- a/pcbnew/dialog_track_options.cpp +++ /dev/null @@ -1,229 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// - -// 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 - -/** - * 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 * 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 ); -} - diff --git a/pcbnew/dialog_track_options.h b/pcbnew/dialog_track_options.h deleted file mode 100644 index dff845b122..0000000000 --- a/pcbnew/dialog_track_options.h +++ /dev/null @@ -1,40 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// - -// Name: dialog_track_options.h -// Author: jean-pierre Charras -// Created: 17 feb 2009 -// Licence: GPL -///////////////////////////////////////////////////////////////////////////// - -#ifndef _DIALOG_TRACK_OPTIONS_H_ -#define _DIALOG_TRACK_OPTIONS_H_ - -#include "dialog_track_options_base.h" - -/** - * 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 - */ -class DIALOG_TRACKS_OPTIONS : public DIALOG_TRACKS_OPTIONS_BASE -{ -private: - WinEDA_PcbFrame* m_Parent; - std::vector m_ViasDiameterList; - std::vector m_TracksWidthList; - -public: - DIALOG_TRACKS_OPTIONS( WinEDA_PcbFrame* parent ); - ~DIALOG_TRACKS_OPTIONS() {}; -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_ diff --git a/pcbnew/dialog_track_options_base.cpp b/pcbnew/dialog_track_options_base.cpp deleted file mode 100644 index 414e6fb3bd..0000000000 --- a/pcbnew/dialog_track_options_base.cpp +++ /dev/null @@ -1,116 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 16 2008) -// http://www.wxformbuilder.org/ -// -// PLEASE DO "NOT" EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - -#include "dialog_track_options_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 ) -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 ) -{ - this->SetSizeHints( wxDefaultSize, wxDefaultSize ); - - wxBoxSizer* bMainSizer; - bMainSizer = new wxBoxSizer( wxVERTICAL ); - - 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 ); - - m_OptMaskMargin = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 ); - m_OptMaskMargin->SetToolTip( _("This is the clearance between pads and the mask") ); - - sbMiddleRightSizer->Add( m_OptMaskMargin, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); - - bMainUpperSizer->Add( sbMiddleRightSizer, 1, wxEXPAND, 5 ); - - bMainSizer->Add( bMainUpperSizer, 1, wxEXPAND, 5 ); - - m_sdbButtonsSizer = new wxStdDialogButtonSizer(); - m_sdbButtonsSizerOK = new wxButton( this, wxID_OK ); - m_sdbButtonsSizer->AddButton( m_sdbButtonsSizerOK ); - m_sdbButtonsSizerCancel = new wxButton( this, wxID_CANCEL ); - m_sdbButtonsSizer->AddButton( m_sdbButtonsSizerCancel ); - m_sdbButtonsSizer->Realize(); - bMainSizer->Add( m_sdbButtonsSizer, 0, wxALIGN_CENTER_HORIZONTAL, 5 ); - - this->SetSizer( bMainSizer ); - this->Layout(); -} - -DIALOG_TRACKS_OPTIONS_BASE::~DIALOG_TRACKS_OPTIONS_BASE() -{ -} diff --git a/pcbnew/dialog_track_options_base.fbp b/pcbnew/dialog_track_options_base.fbp deleted file mode 100644 index 0304b0fa05..0000000000 --- a/pcbnew/dialog_track_options_base.fbp +++ /dev/null @@ -1,740 +0,0 @@ - - - - - - C++ - 1 - UTF-8 - table - dialog_track_options_base - 1000 - none - 1 - DialogTrackAndViasOptions - - . - - 1 - 1 - 0 - - - - - 1 - - - - 0 - wxID_ANY - - - DIALOG_TRACKS_OPTIONS_BASE - - 500,351 - wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER - - Tracks and Vias Sizes - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bMainSizer - wxVERTICAL - none - - 5 - wxEXPAND - 1 - - - bMainUpperSizer - wxHORIZONTAL - none - - 5 - wxEXPAND - 1 - - wxID_ANY - Vias: - - sbLeftSizer - wxVERTICAL - none - - - 5 - wxEXPAND - 1 - - wxID_ANY - Vias Custom Sizes List: - - sViaSizeBox - wxHORIZONTAL - none - - - 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT - 1 - - - - - 1 - - - 0 - wxID_ANY - - - m_ViaSizeListCtrl - protected - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL - 0 - - - bSizeViasListButtons - wxVERTICAL - none - - 5 - wxALL - 1 - - - - 0 - 1 - - - 0 - wxID_ADD_VIA_SIZE - Add - - - m_buttonAddViasSize - protected - - - - - - - - - OnButtonAddViaSizeClick - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL - 1 - - - - 0 - 1 - - - 0 - wxID_DELETED_WIA_SIEZ - Delete - - - m_button4 - protected - - - - - - - - - OnButtonDeleteViaSizeClick - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - - 0 - - 10 - protected - 10 - - - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - - - 1 - - - 0 - wxID_ANY - Specific Via Drill - - - m_ViaAltDrillValueTitle - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND - 0 - - - - 1 - - - 0 - wxID_ANY - - 0 - - m_OptCustomViaDrill - protected - - - - - Use a specific drill value for all vias that must have a given drill value, and set the via hole to this specific drill value using the pop up menu. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxEXPAND - 1 - - wxID_ANY - Dimensions: - - sbMiddleRightSizer - wxVERTICAL - none - - - 5 - wxEXPAND - 1 - - wxID_ANY - Tracks Custom Widths List: - - sbTracksListSizer - wxHORIZONTAL - none - - - 5 - wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT - 1 - - - - - 1 - - - 0 - wxID_ANY - - - m_TrackWidthListCtrl - protected - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALIGN_CENTER_VERTICAL - 0 - - - bSizerTacksButtSizer - wxVERTICAL - none - - 5 - wxALL|wxEXPAND - 0 - - - - 0 - 1 - - - 0 - wxID_ADD_TRACK_WIDTH - Add - - - m_buttonAddTrackSize - protected - - - - - - - - - OnButtonAddTrackSizeClick - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALL|wxEXPAND - 0 - - - - 0 - 1 - - - 0 - wxID_DELETED_TRACK_WIDTH - Delete - - - m_buttonDeleteTrackWidth - protected - - - - - - - - - OnButtonDeleteTrackSizeClick - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - - 0 - - 10 - protected - 10 - - - - 5 - wxTOP|wxRIGHT|wxLEFT - 0 - - - - 1 - - - 0 - wxID_ANY - Pads Mask Clearance: - - - m_MaskClearanceTitle - protected - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND - 0 - - - - 1 - - - 0 - wxID_ANY - - 0 - - m_OptMaskMargin - protected - - - - - This is the clearance between pads and the mask - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 5 - wxALIGN_CENTER_HORIZONTAL - 0 - - 0 - 1 - 0 - 0 - 0 - 1 - 0 - 0 - - m_sdbButtonsSizer - protected - - OnButtonCancelClick - - - - OnButtonOkClick - - - - - - - - diff --git a/pcbnew/dialog_track_options_base.h b/pcbnew/dialog_track_options_base.h deleted file mode 100644 index 0a95bbb1c4..0000000000 --- a/pcbnew/dialog_track_options_base.h +++ /dev/null @@ -1,84 +0,0 @@ -/////////////////////////////////////////////////////////////////////////// -// C++ code generated with wxFormBuilder (version Apr 16 2008) -// http://www.wxformbuilder.org/ -// -// PLEASE DO "NOT" EDIT THIS FILE! -/////////////////////////////////////////////////////////////////////////// - -#ifndef __dialog_track_options_base__ -#define __dialog_track_options_base__ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/////////////////////////////////////////////////////////////////////////// - -/////////////////////////////////////////////////////////////////////////////// -/// Class DIALOG_TRACKS_OPTIONS_BASE -/////////////////////////////////////////////////////////////////////////////// -class DIALOG_TRACKS_OPTIONS_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; - wxButton* m_sdbButtonsSizerOK; - 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(); - -}; - -#endif //__dialog_track_options_base__ diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index b73dc8c425..7faa4e0535 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -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 @@ -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; diff --git a/pcbnew/edit_track_width.cpp b/pcbnew/edit_track_width.cpp index d787e2c78f..b9efedb64e 100644 --- a/pcbnew/edit_track_width.cpp +++ b/pcbnew/edit_track_width.cpp @@ -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; diff --git a/pcbnew/editrack-part2.cpp b/pcbnew/editrack-part2.cpp index c93c85ce07..8bfdf68bfc 100644 --- a/pcbnew/editrack-part2.cpp +++ b/pcbnew/editrack-part2.cpp @@ -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; } diff --git a/pcbnew/editrack.cpp b/pcbnew/editrack.cpp index e336679ab5..37faab6418 100644 --- a/pcbnew/editrack.cpp +++ b/pcbnew/editrack.cpp @@ -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(); } } diff --git a/pcbnew/event_handlers_tracks_vias_sizes.cpp b/pcbnew/event_handlers_tracks_vias_sizes.cpp index f35e3ef4a1..5dd066a668 100644 --- a/pcbnew/event_handlers_tracks_vias_sizes.cpp +++ b/pcbnew/event_handlers_tracks_vias_sizes.cpp @@ -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: diff --git a/pcbnew/ioascii.cpp b/pcbnew/ioascii.cpp index 1f1760bd63..7e861f1e00 100644 --- a/pcbnew/ioascii.cpp +++ b/pcbnew/ioascii.cpp @@ -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 ); diff --git a/pcbnew/menubarpcb.cpp b/pcbnew/menubarpcb.cpp index abb9e59908..bd66b3b0ca 100644 --- a/pcbnew/menubarpcb.cpp +++ b/pcbnew/menubarpcb.cpp @@ -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" ), diff --git a/pcbnew/muonde.cpp b/pcbnew/muonde.cpp index 005e1588a7..8213d1e236 100644 --- a/pcbnew/muonde.cpp +++ b/pcbnew/muonde.cpp @@ -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; diff --git a/pcbnew/onrightclick.cpp b/pcbnew/onrightclick.cpp index b879091e00..a893badef1 100644 --- a/pcbnew/onrightclick.cpp +++ b/pcbnew/onrightclick.cpp @@ -20,7 +20,7 @@ /* Bitmaps */ #include "bitmaps.h" -static wxMenu* Append_Track_Width_List( BOARD * aBoard ); +static wxMenu* Append_Track_Width_List( BOARD* aBoard ); /******************************************************************************/ @@ -83,8 +83,6 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) PutOnGrid( &selectPos ); - // printf( "cursor=(%d, %d) select=(%d,%d)\n", cursorPos.x, cursorPos.y, selectPos.x, selectPos.y ); - /* We can reselect another item only if there are no item being edited * because ALL moving functions use GetCurItem(), therefore GetCurItem() * must return the same item during moving. We know an item is moving @@ -269,7 +267,7 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) msg, move_module_xpm ); } - /* Traitement des fonctions specifiques */ + /* Display context sensitive comands: */ switch( m_ID_current_state ) { case ID_PCB_ZONES_BUTT: @@ -289,7 +287,8 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu ) break; case ID_TRACK_BUTT: - ADD_MENUITEM_WITH_SUBMENU( aPopMenu, Append_Track_Width_List( GetBoard() ), + if ( ! locate_track ) // This menu is already added when a track is located + ADD_MENUITEM_WITH_SUBMENU( aPopMenu, Append_Track_Width_List( GetBoard() ), ID_POPUP_PCB_SELECT_WIDTH, _( "Select Track Width" ), width_track_xpm ); ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_SELECT_CU_LAYER, @@ -397,7 +396,7 @@ void WinEDA_PcbFrame::createPopUpBlockMenu( wxMenu* menu ) void WinEDA_PcbFrame::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu ) /******************************************************************************/ -/* Create command lines for a popup menu, for track editing +/* Create command lines for a popup menu, for track and via editing * also update Netclass selection */ { @@ -408,45 +407,12 @@ void WinEDA_PcbFrame::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu ) m_TrackAndViasSizesList_Changed = true; AuxiliaryToolBar_Update_UI(); - int flags = Track->m_Flags; + int flags = Track->m_Flags; if( flags == 0 ) { if( Track->Type() == TYPE_VIA ) { ADD_MENUITEM( PopMenu, ID_POPUP_PCB_MOVE_TRACK_NODE, _( "Drag Via" ), move_xpm ); - wxMenu* via_mnu = new wxMenu(); - - ADD_MENUITEM_WITH_SUBMENU( PopMenu, via_mnu, - ID_POPUP_PCB_VIA_EDITING, _( "Edit Via Drill" ), edit_xpm ); - ADD_MENUITEM( via_mnu, ID_POPUP_PCB_VIA_HOLE_TO_DEFAULT, - _( "Set Via Hole to Netclass Default" ), apply_xpm ); - - msg = _( "Set Via Hole to the Specific Value" ); - msg << wxT( " " ) << ReturnStringFromValue( g_UnitMetric, - g_DesignSettings.m_ViaDrillCustomValue, - m_InternalUnits ); - ADD_MENUITEM_WITH_HELP( via_mnu, ID_POPUP_PCB_VIA_HOLE_TO_VALUE, - msg, - _("Set via hole to a specific value, rather than its default Netclass value."), - options_new_pad_xpm ); - msg = _( "Set a specific via hole value. This value is currently" ); - msg << wxT( " " ) << ReturnStringFromValue( g_UnitMetric, - g_DesignSettings.m_ViaDrillCustomValue, - m_InternalUnits ); - ADD_MENUITEM_WITH_HELP( via_mnu, ID_POPUP_PCB_VIA_HOLE_ENTER_VALUE, - _( "Change the Current Specific Drill Value" ), msg, edit_xpm ); - ADD_MENUITEM( via_mnu, ID_POPUP_PCB_VIA_HOLE_EXPORT, _( - "Use this Via Hole as Specific Value" ), export_options_pad_xpm ); - ADD_MENUITEM( via_mnu, ID_POPUP_PCB_VIA_HOLE_EXPORT_TO_OTHERS, - _( "Export this Via Hole to Others id Vias" ), global_options_pad_xpm ); - ADD_MENUITEM( via_mnu, ID_POPUP_PCB_VIA_HOLE_RESET_TO_DEFAULT, - _( "Set All Via Holes to Netclass Default" ), apply_xpm ); - if( Track->IsDrillDefault() ) // Can't export the drill value, because this value is 0 (default) - { - via_mnu->Enable( ID_POPUP_PCB_VIA_HOLE_EXPORT, FALSE ); - } - if( g_DesignSettings.m_ViaDrillCustomValue <= 0 ) - via_mnu->Enable( ID_POPUP_PCB_VIA_HOLE_TO_VALUE, FALSE ); } else { @@ -461,10 +427,6 @@ void WinEDA_PcbFrame::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu ) _( "Drag Segments, Keep Slope" ), drag_segment_withslope_xpm ); ADD_MENUITEM( PopMenu, ID_POPUP_PCB_DRAG_TRACK_SEGMENT, _( "Drag Segment" ), drag_track_segment_xpm ); -#if 0 - ADD_MENUITEM( PopMenu, ID_POPUP_PCB_MOVE_TRACK_SEGMENT, - _( "Move Segment" ), move_track_segment_xpm ); -#endif ADD_MENUITEM( PopMenu, ID_POPUP_PCB_BREAK_TRACK, _( "Break Track" ), break_line_xpm ); } @@ -497,39 +459,36 @@ void WinEDA_PcbFrame::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu ) } // track Width control : - wxMenu* track_mnu; if( !flags ) // track Width control : { - track_mnu = new wxMenu; - ADD_MENUITEM_WITH_SUBMENU( PopMenu, track_mnu, - ID_POPUP_PCB_EDIT_TRACK_MNU, _( - "Change Tracks and Vias Sizes" ), width_track_xpm ); if( Track->Type() == TYPE_VIA ) { - ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_TRACKSEG,_( "Change Via Size" ), width_segment_xpm ); + ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_TRACKSEG, _( + "Change Via Size and Drill" ), width_segment_xpm ); } else { - ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_TRACKSEG, _( "Change Segment Width" ), width_segment_xpm ); - ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_TRACK, - _( "Change Track Width" ), width_track_xpm ); + ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_TRACKSEG, _( + "Change Segment Width" ), width_segment_xpm ); + ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_TRACK, + _( "Change Track Width" ), width_track_xpm ); } - ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_NET, - _( "Set Net to NetClass values" ), width_net_xpm ); - ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_ALL_VIAS_AND_TRACK_SIZE, - _( "Set ALL Tracks and Vias to NetClass Values" ), width_track_via_xpm ); - ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_ALL_VIAS_SIZE, - _( "Set ALL Vias (No Track) to NetClass Values" ), width_vias_xpm ); - ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_ALL_TRACK_SIZE, - _( "Set ALL Tracks (No Via) to NetClass Values" ), width_track_xpm ); + ADD_MENUITEM_WITH_SUBMENU( PopMenu, Append_Track_Width_List( GetBoard() ), + ID_POPUP_PCB_SELECT_WIDTH, + _( "Select Track Width" ), width_track_xpm ); + PopMenu->AppendSeparator(); + ADD_MENUITEM( PopMenu, ID_POPUP_PCB_EDIT_ALL_VIAS_AND_TRACK_SIZE, + _( "Global Tracks and Vias Edition" ), width_track_via_xpm ); + PopMenu->AppendSeparator(); } // Delete control: - track_mnu = new wxMenu; + wxMenu* track_mnu = new wxMenu; ADD_MENUITEM_WITH_SUBMENU( PopMenu, track_mnu, ID_POPUP_PCB_DELETE_TRACK_MNU, _( "Delete" ), delete_xpm ); - msg = AddHotkeyName( Track->Type()==TYPE_VIA ? _( "Delete Via" ) : _( "Delete Segment" ), + msg = AddHotkeyName( Track->Type()==TYPE_VIA ? + _( "Delete Via" ) : _( "Delete Segment" ), s_Board_Editor_Hokeys_Descr, HK_BACK_SPACE ); ADD_MENUITEM( track_mnu, ID_POPUP_PCB_DELETE_TRACKSEG, @@ -734,6 +693,7 @@ void WinEDA_PcbFrame::createPopUpMenuForFpTexts( TEXTE_MODULE* FpText, wxMenu* m /************************************************************************/ void WinEDA_PcbFrame::createPopUpMenuForFpPads( D_PAD* Pad, wxMenu* menu ) /************************************************************************/ + /* Create pop menu for pads * also update Netclass selection */ @@ -834,7 +794,7 @@ void WinEDA_PcbFrame::createPopUpMenuForMarkers( MARKER_PCB* aMarker, wxMenu* aP /*******************************************************/ -static wxMenu* Append_Track_Width_List( BOARD * aBoard ) +static wxMenu* Append_Track_Width_List( BOARD* aBoard ) /*******************************************************/ /** function Append_Track_Width_List @@ -842,15 +802,12 @@ static wxMenu* Append_Track_Width_List( BOARD * aBoard ) * @return a pointeur to the menu */ { - wxString msg; + wxString msg; wxMenu* trackwidth_menu; - double value; + wxString value; trackwidth_menu = new wxMenu; - ADD_MENUITEM( trackwidth_menu, ID_PCB_TRACK_SIZE_SETUP, - _( "New Width/Size" ), showtrack_xpm ); - trackwidth_menu->Append( ID_POPUP_PCB_SELECT_AUTO_WIDTH, _( "Auto Width" ), _( @@ -860,53 +817,53 @@ static wxMenu* Append_Track_Width_List( BOARD * aBoard ) if( g_DesignSettings.m_UseConnectedTrackWidth ) trackwidth_menu->Check( ID_POPUP_PCB_SELECT_AUTO_WIDTH, true ); - if( aBoard->m_ViaSizeSelector != 0 || - aBoard->m_TrackWidthSelector != 0 || - g_DesignSettings.m_UseConnectedTrackWidth ) + if( aBoard->m_ViaSizeSelector != 0 + || aBoard->m_TrackWidthSelector != 0 + || g_DesignSettings.m_UseConnectedTrackWidth ) trackwidth_menu->Append( ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES, - _( "Use Netclass Values" ), - _( "Use track and via sizes from their Netclass values" ), - true ); + _( "Use Netclass Values" ), + _( "Use track and via sizes from their Netclass values" ), + true ); for( unsigned ii = 0; ii < aBoard->m_TrackWidthList.size(); ii++ ) { - value = To_User_Unit( g_UnitMetric, - aBoard->m_TrackWidthList[ii], - PCB_INTERNAL_UNIT ); - if( g_UnitMetric == INCHES ) // Affichage en mils - msg.Printf( _( "Track %.1f" ), value * 1000 ); - else - msg.Printf( _( "Track %.3f" ), value ); - - if ( ii == 0 ) - msg << _(" (from NetClass)" ); - + value = ReturnStringFromValue( g_UnitMetric, aBoard->m_TrackWidthList[ii], + PCB_INTERNAL_UNIT, true ); + msg.Printf( _( "Track %s" ), GetChars( value ) ); + if( ii == 0 ) + msg << _( " (use NetClass)" ); trackwidth_menu->Append( ID_POPUP_PCB_SELECT_WIDTH1 + ii, msg, wxEmptyString, true ); - } + if( g_DesignSettings.m_UseConnectedTrackWidth ) trackwidth_menu->Check( ID_POPUP_PCB_SELECT_AUTO_WIDTH, true ); else { if( aBoard->m_TrackWidthSelector < aBoard->m_TrackWidthList.size() ) - trackwidth_menu->Check( ID_POPUP_PCB_SELECT_WIDTH1 + aBoard->m_TrackWidthSelector, true ); + trackwidth_menu->Check( ID_POPUP_PCB_SELECT_WIDTH1 + aBoard->m_TrackWidthSelector, + true ); } trackwidth_menu->AppendSeparator(); - for( unsigned ii = 0; ii < aBoard->m_ViaSizeList.size(); ii++ ) + for( unsigned ii = 0; ii < aBoard->m_ViasDimensionsList.size(); ii++ ) { - value = To_User_Unit( g_UnitMetric, - aBoard->m_ViaSizeList[ii], - PCB_INTERNAL_UNIT ); - if( g_UnitMetric == INCHES ) - msg.Printf( _( "Via %.1f" ), value * 1000 ); + value = ReturnStringFromValue( g_UnitMetric, aBoard->m_ViasDimensionsList[ii].m_Diameter, + PCB_INTERNAL_UNIT, true ); + wxString drill = ReturnStringFromValue( g_UnitMetric, + aBoard->m_ViasDimensionsList[ii].m_Drill, + PCB_INTERNAL_UNIT, true ); + if( aBoard->m_ViasDimensionsList[ii].m_Drill <= 0 ) + msg.Printf( _( "Via %s" ), GetChars( value ) ); else - msg.Printf( _( "Via %.3f" ), value ); - if ( ii == 0 ) - msg << _(" (from NetClass)" ); + { + msg.Printf( _( "Via %s; (drl %s)" ), GetChars( value ), GetChars( drill ) ); + } + if( ii == 0 ) + msg << _( " (use NetClass)" ); trackwidth_menu->Append( ID_POPUP_PCB_SELECT_VIASIZE1 + ii, msg, wxEmptyString, true ); } - if( aBoard->m_ViaSizeSelector < aBoard->m_ViaSizeList.size() ) + + if( aBoard->m_ViaSizeSelector < aBoard->m_ViasDimensionsList.size() ) trackwidth_menu->Check( ID_POPUP_PCB_SELECT_VIASIZE1 + aBoard->m_ViaSizeSelector, true ); return trackwidth_menu; diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index 26c2354326..12f0143217 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -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() diff --git a/pcbnew/pcbnew_config.cpp b/pcbnew/pcbnew_config.cpp index 5185405351..e80f51a69d 100644 --- a/pcbnew/pcbnew_config.cpp +++ b/pcbnew/pcbnew_config.cpp @@ -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; diff --git a/pcbnew/pcbnew_config.h b/pcbnew/pcbnew_config.h index 36327ff804..3c21cf6312 100644 --- a/pcbnew/pcbnew_config.h +++ b/pcbnew/pcbnew_config.h @@ -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, diff --git a/pcbnew/pcbnew_id.h b/pcbnew/pcbnew_id.h index af7dd72a9a..a68b213528 100644 --- a/pcbnew/pcbnew_id.h +++ b/pcbnew/pcbnew_id.h @@ -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, diff --git a/pcbnew/solve.cpp b/pcbnew/solve.cpp index 7b54049a9a..cbbb51ebcd 100644 --- a/pcbnew/solve.cpp +++ b/pcbnew/solve.cpp @@ -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 */ diff --git a/pcbnew/specctra_export.cpp b/pcbnew/specctra_export.cpp index a642cecb17..47156de2c2 100644 --- a/pcbnew/specctra_export.cpp +++ b/pcbnew/specctra_export.cpp @@ -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 ); } diff --git a/pcbnew/tool_onrightclick.cpp b/pcbnew/tool_onrightclick.cpp index 1e7753267c..642e2b812e 100644 --- a/pcbnew/tool_onrightclick.cpp +++ b/pcbnew/tool_onrightclick.cpp @@ -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; diff --git a/pcbnew/tool_pcb.cpp b/pcbnew/tool_pcb.cpp index 71939267a2..16ffdee6df 100644 --- a/pcbnew/tool_pcb.cpp +++ b/pcbnew/tool_pcb.cpp @@ -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 ); diff --git a/pcbnew/toolbars_update_user_interface.cpp b/pcbnew/toolbars_update_user_interface.cpp index 5c5316ae9d..f7a91f02f8 100644 --- a/pcbnew/toolbars_update_user_interface.cpp +++ b/pcbnew/toolbars_update_user_interface.cpp @@ -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 ); diff --git a/pcbnew/via_edit.cpp b/pcbnew/via_edit.cpp.unused similarity index 79% rename from pcbnew/via_edit.cpp rename to pcbnew/via_edit.cpp.unused index 3757ebabef..168fa44832 100644 --- a/pcbnew/via_edit.cpp +++ b/pcbnew/via_edit.cpp.unused @@ -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 héave 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;