From 2884d1259ed626cf8307d8cf6cd47b49d32e03c1 Mon Sep 17 00:00:00 2001 From: stambaughw Date: Fri, 30 Oct 2009 19:26:25 +0000 Subject: [PATCH] Replace library editor pin properties dialog box and minor update. * Replaced library pin properties dialog with wxFormBuilder version. * Remove DialogBlocks version of pin properties dialog. * Add pin properties dialog support code to pin object. * Create single event handler for displaying pin properties dialog. * Remove left over DialogBlocks project file for annotate dialog. * Fixed escape key bug in library editor new component dialog. * Add GetUnitsLabel() to get human readable units for dialog labels. * Translate French comments in all modified files. * Some minor clean up of Doxygen comments. --- common/common.cpp | 55 +- eeschema/CMakeLists.txt | 3 +- eeschema/annotate_dialog.pjd | 1550 -------------------- eeschema/class_BodyItem_Text.cpp | 2 +- eeschema/class_libentry.cpp | 26 +- eeschema/class_libentry.h | 57 +- eeschema/class_libentry_fields.cpp | 7 +- eeschema/class_libentry_fields.h | 42 +- eeschema/class_pin.cpp | 560 ++++++- eeschema/class_sch_component.cpp | 33 +- eeschema/class_sch_component.h | 19 +- eeschema/classes_body_items.cpp | 13 +- eeschema/classes_body_items.h | 532 ++++--- eeschema/dialog_lib_new_component.cpp | 3 +- eeschema/eeschema_id.h | 2 +- eeschema/find.cpp | 12 +- eeschema/hotkeys.cpp | 5 +- eeschema/libedit_onleftclick.cpp | 6 +- eeschema/libedit_onrightclick.cpp | 2 +- eeschema/libeditfrm.h | 12 +- eeschema/libframe.cpp | 20 +- eeschema/locate.cpp | 89 +- eeschema/pinedit-dialog.cpp | 463 ------ eeschema/pinedit-dialog.h | 161 -- eeschema/pinedit-dialog.pjd | 1937 ------------------------- eeschema/pinedit-dialog.rc | 1 - eeschema/pinedit.cpp | 685 +++------ eeschema/protos.h | 59 +- include/common.h | 53 +- 29 files changed, 1299 insertions(+), 5110 deletions(-) delete mode 100644 eeschema/annotate_dialog.pjd delete mode 100644 eeschema/pinedit-dialog.cpp delete mode 100644 eeschema/pinedit-dialog.h delete mode 100644 eeschema/pinedit-dialog.pjd delete mode 100644 eeschema/pinedit-dialog.rc diff --git a/common/common.cpp b/common/common.cpp index 6a17b82e4b..1e61aa1878 100644 --- a/common/common.cpp +++ b/common/common.cpp @@ -73,10 +73,7 @@ int g_DebugLevel; int g_MouseOldButtons; int g_KeyPressed; -// Nom (full file name) du file Configuration par defaut (kicad.pro) wxString g_Prj_Default_Config_FullFilename; - -// Nom du file Configuration local (.pro) wxString g_Prj_Config_LocalFilename; // Handle the preferd editor for browsing report files: @@ -257,6 +254,31 @@ wxString ReturnUnitSymbol( int Units ) } +wxString GetUnitsLabel( int units ) +{ + wxString label; + + switch( units ) + { + case INCHES: + label = _( "inches" ); + break; + + case MILLIMETRE: + label = _( "millimeters" ); + break; + + case CENTIMETRE: + label = _( "centimeters" ); + break; + default: + label = _( "Unknown" ); + break; + } + + return label; +} + /* * Add string " (mm):" or " ("):" to the static text Stext. * Used in dialog boxes for entering values depending on selected units @@ -669,17 +691,6 @@ void WinEDA_TextFrame::OnClose( wxCloseEvent& event ) } -/** - * Routine d'affichage d'un parametre. - * pos_X = cadrage horizontal - * si pos_X < 0 : la position horizontale est la derniere - * valeur demandee >= 0 - * texte_H = texte a afficher en ligne superieure. - * si "", par d'affichage sur cette ligne - * texte_L = texte a afficher en ligne inferieure. - * si "", par d'affichage sur cette ligne - * color = couleur d'affichage - */ /*****************************************************************************/ void Affiche_1_Parametre( WinEDA_DrawFrame* frame, int pos_X, const wxString& texte_H, const wxString& texte_L, @@ -693,10 +704,6 @@ void Affiche_1_Parametre( WinEDA_DrawFrame* frame, int pos_X, /***********************/ int GetTimeStamp() /***********************/ - -/* - * Retourne une identification temporelle (Time stamp) differente a chaque appel - */ { static int OldTimeStamp, NewTimeStamp; @@ -708,16 +715,12 @@ int GetTimeStamp() } -/** - * TODO replace this obsolete funtion by ReturnStringFromValue - * Retourne pour affichage la valeur d'un parametre, selon type d'unites choisies - * entree : valeur en mils , buffer de texte - * retourne en buffer : texte : valeur exprimee en pouces ou millimetres - * suivie de " ou mm +/* Returns to display the value of a parameter, by type of units selected + * Input: value in mils, buffer text + * Returns to buffer: text: value expressed in inches or millimeters + * Followed by " or mm */ -/*********************************************/ const wxString& valeur_param( int valeur, wxString& buf_texte ) -/*********************************************/ { if( g_UnitMetric ) { diff --git a/eeschema/CMakeLists.txt b/eeschema/CMakeLists.txt index 6212ebf6cf..1a79c24520 100644 --- a/eeschema/CMakeLists.txt +++ b/eeschema/CMakeLists.txt @@ -57,6 +57,8 @@ set(EESCHEMA_SRCS # dialog_find.cpp dialog_lib_edit_draw_item.cpp dialog_lib_edit_draw_item_base.cpp + dialog_lib_edit_pin.cpp + dialog_lib_edit_pin_base.cpp dialog_lib_new_component.cpp dialog_lib_new_component_base.cpp dialog_options.cpp @@ -97,7 +99,6 @@ set(EESCHEMA_SRCS onrightclick.cpp operations_on_items_lists.cpp pinedit.cpp -# pinedit-dialog.cpp plot.cpp plothpgl.cpp plotps.cpp diff --git a/eeschema/annotate_dialog.pjd b/eeschema/annotate_dialog.pjd deleted file mode 100644 index 849c02a323..0000000000 --- a/eeschema/annotate_dialog.pjd +++ /dev/null @@ -1,1550 +0,0 @@ - - -
- 0 - "" - "" - "" - "" - "" - 0 - 0 - 0 - 1 - 1 - 1 - 1 - 0 - "jean-pierre Charras" - "License GNU" - "" - 0 - 0 - 0 - "<All platforms>" - "<Any>" - "///////////////////////////////////////////////////////////////////////////// -// Name: %HEADER-FILENAME% -// Purpose: -// Author: %AUTHOR% -// Modified by: -// Created: %DATE% -// RCS-ID: -// Copyright: %COPYRIGHT% -// Licence: -///////////////////////////////////////////////////////////////////////////// - -" - "///////////////////////////////////////////////////////////////////////////// -// Name: %SOURCE-FILENAME% -// Purpose: -// Author: %AUTHOR% -// Modified by: -// Created: %DATE% -// RCS-ID: -// Copyright: %COPYRIGHT% -// Licence: -///////////////////////////////////////////////////////////////////////////// - -" - "///////////////////////////////////////////////////////////////////////////// -// Name: %SYMBOLS-FILENAME% -// Purpose: Symbols file -// Author: %AUTHOR% -// Modified by: -// Created: %DATE% -// RCS-ID: -// Copyright: %COPYRIGHT% -// Licence: -///////////////////////////////////////////////////////////////////////////// - -" - "#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma interface "%HEADER-FILENAME%" -#endif - -" - "#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma implementation "%HEADER-FILENAME%" -#endif - -// For compilers that support precompilation, includes "wx/wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#ifndef WX_PRECOMP -#include "wx/wx.h" -#endif - -" - " /// %BODY% -" - " -/*! - * %BODY% - */ - -" - "app_resources.h" - "app_resources.cpp" - "AppResources" - "app.h" - "app.cpp" - "Application" - 0 - "" - "<None>" - "<System>" - "utf-8" - "<System>" - "" - 0 - 0 - 4 - " " - "" - 0 - 0 - 1 - 0 - 1 - 1 - 0 - 1 - 0 - 0 -
- - - "" - "data-document" - "" - "" - 0 - 1 - 0 - 0 - - "Configurations" - "config-data-document" - "" - "" - 0 - 1 - 0 - 0 - "" - 1 - -8519680 - "" - "Debug" - "ANSI" - "Static" - "Modular" - "GUI" - "wxMSW" - "Dynamic" - "Yes" - "No" - "No" - "%WXVERSION%" - "%EXECUTABLE%" - "" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - 0 - 1 - "" - - - - - - - "Projects" - "root-document" - "" - "project" - 1 - 1 - 0 - 1 - - "Windows" - "html-document" - "" - "dialogsfolder" - 1 - 1 - 0 - 1 - - "EESchema Annotation" - "dialog-document" - "" - "dialog" - 0 - 1 - 0 - 0 - "5/2/2006" - "wbDialogProxy" - 10000 - 0 - "" - 0 - "" - 0 - 0 - "ID_DIALOG" - 10000 - "WinEDA_AnnotateFrame" - "wxDialog" - "wxDialog" - "annotate_dialog.cpp" - "annotate_dialog.h" - "" - "EESchema Annotation" - 1 - "" - 0 - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - "" - "" - "" - "" - "" - "" - "Tiled" - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 1 - 0 - "MAYBE_RESIZE_BORDER" - 0 - 1 - -1 - -1 - 400 - 300 - 0 - "" - - "wxBoxSizer V" - "dialog-control-document" - "" - "sizer" - 0 - 1 - 0 - 0 - "wbBoxSizerProxy" - "Vertical" - "" - 0 - 0 - 0 - "<Any platform>" - - "wxBoxSizer V" - "dialog-control-document" - "" - "sizer" - 0 - 1 - 0 - 0 - "5/2/2006" - "wbBoxSizerProxy" - "Vertical" - "" - "Expand" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "<Any platform>" - - "wxStaticText: wxID_STATIC" - "dialog-control-document" - "" - "statictext" - 0 - 1 - 0 - 0 - "16/4/2008" - "wbStaticTextProxy" - "wxID_STATIC" - 5105 - "" - "wxStaticText" - "wxStaticText" - 1 - 0 - "" - "" - "" - "Scope" - -1 - "" - "" - "" - "" - "wxSYS_DEFAULT_GUI_FONT:*1.2,default,default,wxBOLD,false,default" - 0 - 1 - "<Any platform>" - "" - "" - "" - "" - "" - "" - "" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Left" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - "wxBoxSizer V" - "dialog-control-document" - "" - "sizer" - 0 - 1 - 0 - 0 - "16/4/2008" - "wbBoxSizerProxy" - "Vertical" - "" - "Expand" - "Centre" - 0 - 25 - 1 - 0 - 0 - 0 - 0 - 0 - 0 - "<Any platform>" - - "wxRadioButton: ID_ENTIRE_SCHEMATIC" - "dialog-control-document" - "" - "radiobutton" - 0 - 1 - 0 - 0 - "16/4/2008" - "wbRadioButtonProxy" - "ID_ENTIRE_SCHEMATIC" - 10002 - "" - "wxRadioButton" - "wxRadioButton" - 1 - 0 - "" - "" - "m_rbEntireSchematic" - "Use the &entire schematic" - 1 - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - "" - "" - "" - "" - "" - "" - "" - 1 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Expand" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - "wxRadioButton: ID_CURRENT_PAGE" - "dialog-control-document" - "" - "radiobutton" - 0 - 1 - 0 - 0 - "16/4/2008" - "wbRadioButtonProxy" - "ID_CURRENT_PAGE" - 10003 - "" - "wxRadioButton" - "wxRadioButton" - 1 - 0 - "" - "" - "" - "Use the current &page only" - 0 - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - "" - "" - "" - "" - "" - "" - "" - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Expand" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - "wxStaticLine: wxID_STATIC" - "dialog-control-document" - "" - "staticline" - 0 - 1 - 0 - 0 - "21/4/2008" - "wbStaticLineProxy" - "wxID_STATIC" - 5105 - "" - "wxStaticLine" - "wxStaticLine" - 1 - 0 - "" - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Expand" - "Expand" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - - - "wxRadioButton: ID_KEEP_ANNOTATION" - "dialog-control-document" - "" - "radiobutton" - 0 - 1 - 0 - 0 - "21/4/2008" - "wbRadioButtonProxy" - "ID_KEEP_ANNOTATION" - 10009 - "" - "wxRadioButton" - "wxRadioButton" - 1 - 0 - "" - "" - "m_rbKeepAnnotation" - "&Keep existing annotation" - 1 - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - "" - "" - "" - "" - "" - "" - "" - 1 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Expand" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - "wxRadioButton: ID_RESET_ANNOTATION" - "dialog-control-document" - "" - "radiobutton" - 0 - 1 - 0 - 0 - "21/4/2008" - "wbRadioButtonProxy" - "ID_RESET_ANNOTATION" - 10009 - "" - "wxRadioButton" - "wxRadioButton" - 1 - 0 - "" - "" - "m_rbResetAnnotation" - "&Reset existing annotation" - 0 - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - "" - "" - "" - "" - "" - "" - "" - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Expand" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - - "wxStaticText: wxID_STATIC" - "dialog-control-document" - "" - "statictext" - 0 - 1 - 0 - 0 - "16/4/2008" - "wbStaticTextProxy" - "wxID_STATIC" - 5105 - "" - "wxStaticText" - "wxStaticText" - 1 - 0 - "" - "" - "" - "Order" - -1 - "" - "" - "" - "" - "wxSYS_DEFAULT_GUI_FONT:*1.2,default,default,wxBOLD,false,default" - 0 - 1 - "<Any platform>" - "" - "" - "" - "" - "" - "" - "" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Left" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - "wxBoxSizer V" - "dialog-control-document" - "" - "sizer" - 0 - 1 - 0 - 0 - "16/4/2008" - "wbBoxSizerProxy" - "Vertical" - "" - "Expand" - "Centre" - 0 - 25 - 1 - 0 - 0 - 0 - 0 - 0 - 0 - "<Any platform>" - - "wxBoxSizer H" - "dialog-control-document" - "" - "sizer" - 0 - 1 - 0 - 0 - "21/4/2008" - "wbBoxSizerProxy" - "Horizontal" - "" - "Expand" - "Centre" - 0 - 5 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "<Any platform>" - - "wxStaticBitmap: wxID_STATIC" - "dialog-control-document" - "" - "staticbitmap" - 0 - 1 - 0 - 0 - "21/4/2008" - "wbStaticBitmapProxy" - "wxID_STATIC" - 5105 - "" - "wxStaticBitmap" - "wxStaticBitmap" - 1 - 0 - "" - "" - "" - "annotate_down_right_xpm" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Left" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - "wxRadioButton: ID_SORT_BY_X_POSITION" - "dialog-control-document" - "" - "radiobutton" - 0 - 1 - 0 - 0 - "21/4/2008" - "wbRadioButtonProxy" - "ID_SORT_BY_X_POSITION" - 10001 - "" - "wxRadioButton" - "wxRadioButton" - 1 - 0 - "" - "" - "m_rbSortBy_X_Position" - "Sort components by &X position" - 1 - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - "" - "" - "" - "" - "" - "" - "" - 1 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Expand" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - - "wxBoxSizer H" - "dialog-control-document" - "" - "sizer" - 0 - 1 - 0 - 0 - "21/4/2008" - "wbBoxSizerProxy" - "Horizontal" - "" - "Expand" - "Centre" - 0 - 5 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "<Any platform>" - - "wxStaticBitmap: wxID_STATIC" - "dialog-control-document" - "" - "staticbitmap" - 0 - 1 - 0 - 0 - "21/4/2008" - "wbStaticBitmapProxy" - "wxID_STATIC" - 5105 - "" - "wxStaticBitmap" - "wxStaticBitmap" - 1 - 0 - "" - "" - "" - "annotate_right_down_xpm" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Left" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - "wxRadioButton: ID_SORT_BY_Y_POSITION" - "dialog-control-document" - "" - "radiobutton" - 0 - 1 - 0 - 0 - "21/4/2008" - "wbRadioButtonProxy" - "ID_SORT_BY_Y_POSITION" - 10001 - "" - "wxRadioButton" - "wxRadioButton" - 1 - 0 - "" - "" - "m_rbSortBy_Y_Position" - "Sort components by &Y position" - 0 - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - "" - "" - "" - "" - "" - "" - "" - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Expand" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - - "wxBoxSizer H" - "dialog-control-document" - "" - "sizer" - 0 - 1 - 0 - 0 - "21/4/2008" - "wbBoxSizerProxy" - "Horizontal" - "" - "Expand" - "Centre" - 0 - 5 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "<Any platform>" - - "wxStaticBitmap: wxID_STATIC" - "dialog-control-document" - "" - "staticbitmap" - 0 - 1 - 0 - 0 - "21/4/2008" - "wbStaticBitmapProxy" - "wxID_STATIC" - 5105 - "" - "wxStaticBitmap" - "wxStaticBitmap" - 1 - 0 - "" - "" - "" - "add_text_xpm" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Left" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - "wxRadioButton: ID_SORT_BY_VALUE" - "dialog-control-document" - "" - "radiobutton" - 0 - 1 - 0 - 0 - "21/4/2008" - "wbRadioButtonProxy" - "ID_SORT_BY_VALUE" - 10011 - "" - "wxRadioButton" - "wxRadioButton" - 1 - 0 - "" - "" - "rbSortByValue" - "Sort components by &value" - 0 - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - "" - "" - "" - "" - "" - "" - "" - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Expand" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - - - - "wxBoxSizer H" - "dialog-control-document" - "" - "sizer" - 0 - 1 - 0 - 0 - "5/2/2006" - "wbBoxSizerProxy" - "Horizontal" - "sizerDialogButtons" - "Centre" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "<Any platform>" - - "wxButton: wxID_CANCEL" - "dialog-control-document" - "" - "dialogcontrol" - 0 - 1 - 0 - 0 - "16/4/2008" - "wbButtonProxy" - "wxEVT_COMMAND_BUTTON_CLICKED|OnCancelClick|||" - "wxID_CANCEL" - 5101 - "" - "wxButton" - "wxButton" - 1 - 0 - "" - "" - "m_btnClose" - "Close" - 1 - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Expand" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - "wxButton: ID_CLEAR_ANNOTATION_CMP" - "dialog-control-document" - "" - "dialogcontrol" - 0 - 1 - 0 - 0 - "16/4/2008" - "wbButtonProxy" - "wxEVT_COMMAND_BUTTON_CLICKED|OnClearAnnotationCmpClick|||" - "ID_CLEAR_ANNOTATION_CMP" - 10004 - "" - "wxButton" - "wxButton" - 1 - 0 - "" - "" - "m_btnClear" - "Clear Annotation" - 0 - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Expand" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - "wxButton: wxID_APPLY" - "dialog-control-document" - "" - "dialogcontrol" - 0 - 1 - 0 - 0 - "5/2/2006" - "wbButtonProxy" - "wxEVT_COMMAND_BUTTON_CLICKED|OnApplyClick|||" - "wxID_APPLY" - 5102 - "" - "wxButton" - "wxButton" - 1 - 0 - "" - "" - "m_btnApply" - "Annotation" - 1 - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Expand" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - - - - - "Sources" - "html-document" - "" - "sourcesfolder" - 1 - 1 - 0 - 1 - - "annotate_dialog.rc" - "source-editor-document" - "annotate_dialog.rc" - "source-editor" - 0 - 0 - 1 - 0 - "5/2/2006" - "" - - - - "Images" - "html-document" - "" - "bitmapsfolder" - 1 - 1 - 0 - 1 - - - - -
diff --git a/eeschema/class_BodyItem_Text.cpp b/eeschema/class_BodyItem_Text.cpp index 590824a7b6..e0d94eb2c8 100644 --- a/eeschema/class_BodyItem_Text.cpp +++ b/eeschema/class_BodyItem_Text.cpp @@ -30,7 +30,7 @@ LIB_TEXT::LIB_TEXT(LIB_COMPONENT * aParent) : } -bool LIB_TEXT::Save( FILE* ExportFile ) const +bool LIB_TEXT::Save( FILE* ExportFile ) { wxString text = m_Text; diff --git a/eeschema/class_libentry.cpp b/eeschema/class_libentry.cpp index f7b9d568c5..415cbd5250 100644 --- a/eeschema/class_libentry.cpp +++ b/eeschema/class_libentry.cpp @@ -81,7 +81,6 @@ bool CMP_LIB_ENTRY::SaveDoc( FILE* aFile ) if( m_Doc.IsEmpty() && m_KeyWord.IsEmpty() && m_DocFile.IsEmpty() ) return true; - /* Generation des lignes utiles */ if( fprintf( aFile, "#\n$CMP %s\n", CONV_TO_UTF8( m_Name ) ) < 0 ) return false; @@ -427,6 +426,27 @@ void LIB_COMPONENT::GetPins( LIB_PIN_LIST& pins, int unit, int convert ) } +LIB_PIN* LIB_COMPONENT::GetPin( const wxString& number, int unit, int convert ) +{ + wxString pNumber; + LIB_PIN_LIST pinList; + + GetPins( pinList, unit, convert ); + + for( size_t i = 0; i < pinList.size(); i++ ) + { + wxASSERT( pinList[i]->Type() == COMPONENT_PIN_DRAW_TYPE ); + + pinList[i]->ReturnPinStringNum( pNumber ); + + if( number == pNumber ) + return pinList[i]; + } + + return NULL; +} + + bool LIB_COMPONENT::Save( FILE* aFile ) { size_t i; @@ -930,7 +950,7 @@ LIB_FIELD& LIB_COMPONENT::GetReferenceField( void ) /* - * lit date et time de modif composant sous le format: + * Read date and time of component in the format: * "Ti yy/mm/jj hh:mm:ss" */ bool LIB_COMPONENT::SaveDateAndTime( FILE* file ) @@ -964,7 +984,7 @@ bool LIB_COMPONENT::LoadDateAndTime( char* Line ) year = mon = day = hour = min = sec = 0; text = strtok( Line, " \r\t\n" ); - text = strtok( NULL, " \r\t\n" ); // text pointe donnees utiles + text = strtok( NULL, " \r\t\n" ); if (sscanf( Line, "%d/%d/%d %d:%d:%d", &year, &mon, &day, &hour, &min, &sec ) != 6 ) diff --git a/eeschema/class_libentry.h b/eeschema/class_libentry.h index a7a3847732..8013cf4e5b 100644 --- a/eeschema/class_libentry.h +++ b/eeschema/class_libentry.h @@ -69,8 +69,7 @@ public: * Write the entry document information to a FILE in "*.dcm" format. * * @param aFile The FILE to write to. - * - * @return bool - true if success writing else false. + * @return True if success writing else false. */ bool SaveDoc( FILE* aFile ); @@ -157,8 +156,7 @@ public: * Write the data structures out to a FILE in "*.lib" format. * * @param aFile - The FILE to write to. - * - * @return bool - true if success writing else false. + * @return True if success writing else false. */ bool Save( FILE* aFile ); @@ -169,8 +167,7 @@ public: * @param line - The first line of the component definition. * @param lineNum - The current line number in the file. * @param errorMsg - Description of error on load failure. - * - * @return bool - Result of the load, false if there was an error. + * @return True if the load was successful, false if there was an error. */ bool Load( FILE* file, char* line, int* lineNum, wxString& errorMsg ); bool LoadField( char* line, wxString& errorMsg ); @@ -198,9 +195,7 @@ public: * Return pointer to the requested field. * * @param id - Id of field to return. - * - * @return LIB_FIELD* - Pointer to field if found. NULL is returned if - * field not found. + * @return The field if found, otherwise NULL. */ LIB_FIELD* GetField( int id ); @@ -220,7 +215,7 @@ public: * @param convert - Component conversion (DeMorgan) if available. * @param drawMode - Device context drawing mode, see wxDC. * @param color - Color to draw component. - * @param transformMatrix - Cooridinate adjustment settings. + * @param transformMatrix - Coordinate adjustment settings. * @param showPinText - Show pin text if true. * @param drawFields - Draw field text if true otherwise just draw * body items (useful to draw a body in schematic, @@ -264,16 +259,14 @@ public: WinEDA_DrawPanel* panel = NULL, wxDC* dc = NULL ); - /** GetNextDrawItem() + /** * Return the next draw object pointer. * * @param item - Pointer to the current draw item. Setting item NULL * with return the first item of type in the list. * @param type - type of searched item (filter). * if TYPE_NOT_INIT search for all items types - * - * @return - Pointer to the next drawing object in the list if found, - * otherwise NULL. + * @return - The next drawing object in the list if found, otherwise NULL. */ LIB_DRAW_ITEM* GetNextDrawItem( LIB_DRAW_ITEM* item = NULL, @@ -286,9 +279,7 @@ public: * * @param item - Pointer to the previous pin item, or NULL to get the * first pin in the draw object list. - * - * @return - Pointer to the next pin object in the list if found, - * otherwise NULL. + * @return - The next pin object in the list if found, otherwise NULL. */ LIB_PIN* GetNextPin( LIB_PIN* item = NULL ) { @@ -312,6 +303,18 @@ public: */ void GetPins( LIB_PIN_LIST& pins, int unit = 0, int convert = 0 ); + /** + * Return pin object with the requested pin number. + * + * @param number - Number of the pin to find. + * @param unit - Unit of the component to find. Set to 0 if a specific + * unit number is not required. + * @param convert - Alternate body style filter (DeMorgan). Set to 0 if + * no alternate body style is required. + * @return The pin object if found. Otherwise NULL. + */ + LIB_PIN* GetPin( const wxString& number, int unit = 0, int convert = 0 ); + /** * Move the component offset. * @@ -327,7 +330,7 @@ public: /** * Test if component has more than one body conversion type (DeMorgan). * - * @return bool - True if component has more than one conversion. + * @return True if component has more than one conversion. */ bool HasConversion() const; @@ -337,8 +340,7 @@ public: * Alias name comparisons are case insensitive. * * @param name - Name of alias. - * - * @return bool - True if alias name in alias list. + * @return True if alias name in alias list. */ bool HasAlias( const wxChar* name ) { @@ -362,9 +364,8 @@ public: * @param convert - Are the draw items being selected a conversion. * @param editPinByPin - Used to ignore pin selections when in edit pin * by pin mode is enabled. - * - * @return int - The number of draw object found inside the block select - * rectangle. + * @return The number of draw objects found inside the block select + * rectangle. */ int SelectItems( EDA_Rect& rect, int unit, int convert, bool editPinByPin ); @@ -378,7 +379,7 @@ public: * Deletes the select draw items marked by a block select. * * The name and reference field will not be deleted. They are the - * minimum drawing items required for any component. Thier properties + * minimum drawing items required for any component. Their properties * can be changed but the cannot be removed. */ void DeleteSelectedItems( void ); @@ -411,9 +412,7 @@ public: * @param convert - Body style of draw item. * @param type - Draw object type, set to 0 to search for any type. * @param pt - Coordinate for hit testing. - * - * @return LIB_DRAW_ITEM - Pointer the the draw object if found. - * Otherwise NULL. + * @return The draw object if found. Otherwise NULL. */ LIB_DRAW_ITEM* LocateDrawItem( int unit, int convert, KICAD_T type, const wxPoint& pt ); @@ -426,9 +425,7 @@ public: * @param type - Draw object type, set to 0 to search for any type. * @param pt - Coordinate for hit testing. * @param aTransMat = the transform matrix - * - * @return LIB_DRAW_ITEM - Pointer the the draw object if found. - * Otherwise NULL. + * @return The draw object if found. Otherwise NULL. */ LIB_DRAW_ITEM* LocateDrawItem( int unit, int convert, KICAD_T type, const wxPoint& pt, diff --git a/eeschema/class_libentry_fields.cpp b/eeschema/class_libentry_fields.cpp index a38b40ae11..348eb0a875 100644 --- a/eeschema/class_libentry_fields.cpp +++ b/eeschema/class_libentry_fields.cpp @@ -84,7 +84,7 @@ void LIB_FIELD::Init( int id ) } -bool LIB_FIELD::Save( FILE* ExportFile ) const +bool LIB_FIELD::Save( FILE* ExportFile ) { int hjustify, vjustify; wxString text = m_Text; @@ -144,14 +144,13 @@ bool LIB_FIELD::Load( char* line, wxString& errorMsg ) return false; } - /* Recherche du debut des donnees (debut du texte suivant) */ + /* Search the beginning of the data. */ while( *line != 0 ) line++; while( *line == 0 ) line++; - /* recherche du texte */ while( *line && (*line != '"') ) line++; @@ -161,7 +160,7 @@ bool LIB_FIELD::Load( char* line, wxString& errorMsg ) text = line; - /* recherche fin de texte */ + /* Find end of text. */ while( *line && (*line != '"') ) line++; diff --git a/eeschema/class_libentry_fields.h b/eeschema/class_libentry_fields.h index 72fc29010a..3591e06549 100644 --- a/eeschema/class_libentry_fields.h +++ b/eeschema/class_libentry_fields.h @@ -63,18 +63,18 @@ public: int GetPenSize( ); /** - * Function Save - * writes the data structures for this object out to a FILE in "*.brd" - * format. + * Writes field object out to a FILE in "*.lib" format. + * * @param aFile The FILE to write to. - * @return bool - true if success writing else false. + * @return True if success writing else false. */ - virtual bool Save( FILE* aFile ) const; + virtual bool Save( FILE* aFile ); virtual bool Load( char* line, wxString& errorMsg ); - /** Function Copy - * copy parameters of this to Target. Pointers are not copied - * @param aTarget = the LIB_FIELD to set with "this" values + /** + * Copy parameters of this field to another field. Pointers are not copied. + * + * @param aTarget = Target field to copy values to. */ void Copy( LIB_FIELD* aTarget ) const; @@ -87,26 +87,25 @@ public: /** * Return the bounding rectangle of the field text. * - * @return EDA_Rect - Bounding rectangle. + * @return Bounding rectangle. */ virtual EDA_Rect GetBoundingBox(); /** - * Function HitTest - * tests if the given wxPoint is within the bounds of this object. - * @param refPos A wxPoint to test, in Field coordinate system - * @return bool - true if a hit, else false + * Test if the given point is within the bounds of this object. + * + * @param refPos A point to test in field coordinate system + * @return True if a hit, else false */ bool HitTest( const wxPoint& refPos ); /** - * Function HitTest - * @return true if the point aPosRef is near this object - * @param aPosRef = a wxPoint to test - * @param aThreshold = max distance to this object (usually the half - * thickness of a line) - * @param aTransMat = the transform matrix - */ + * @param aPosRef = a wxPoint to test + * @param aThreshold = max distance to this object (usually the half + * thickness of a line) + * @param aTransMat = the transform matrix + * @return True if the point aPosRef is near this object + */ virtual bool HitTest( wxPoint aPosRef, int aThreshold, const int aTransMat[2][2] ); @@ -135,8 +134,7 @@ public: * the string U?A will be returned for unit = 1. * * @param unit - The package unit number. Only effects reference field. - * - * @return wxString - Field text. + * @return Field text. */ wxString GetFullText( int unit = 1 ); diff --git a/eeschema/class_pin.cpp b/eeschema/class_pin.cpp index adefd7757b..f43803ade6 100644 --- a/eeschema/class_pin.cpp +++ b/eeschema/class_pin.cpp @@ -18,8 +18,78 @@ #include "class_libentry.h" -extern void PlotPinSymbol( PLOTTER* plotter, const wxPoint& pos, - int len, int orient, int Shape ); +/** + * Note: The following name lists are sentence capitalized per the GNOME UI + * standards for list controls. Please do not change the capitalization + * of these strings unless the GNOME UI standards are changed. + */ +static const wxString pin_orientation_names[] = +{ + _( "Right" ), + _( "Left" ), + _( "Up" ), + _( "Down" ) +}; + + +static const int pin_orientation_codes[] = +{ + PIN_RIGHT, + PIN_LEFT, + PIN_UP, + PIN_DOWN +}; + + +#define PIN_ORIENTATION_CNT ( sizeof( pin_orientation_names ) / \ + sizeof( wxString* ) ) + + +static const wxString pin_style_names[] = +{ + _( "Line" ), + _( "Inverted" ), + _( "Clock" ), + _( "Inverted clock" ), + _( "Input low" ), + _( "Clock low" ), + _( "Output low" ) +}; + + +#define PIN_STYLE_CNT ( sizeof( pin_style_names ) / sizeof( wxString* ) ) + + +static const int pin_style_codes[] = +{ + NONE, + INVERT, + CLOCK, + CLOCK | INVERT, + LOWLEVEL_IN, + LOWLEVEL_IN | CLOCK, + LOWLEVEL_OUT +}; + + +static const wxString pin_electrical_type_names[] = +{ + _( "Input" ), + _( "Output" ), + _( "Bidirectional" ), + _( "Tri-state" ), + _( "Passive" ), + _( "Unspecified" ), + _( "Power input" ), + _( "Power output" ), + _( "Open collector" ), + _( "Open emitter" ), + _( "Not connected" ) +}; + + +#define PIN_ELECTRICAL_TYPE_CNT ( sizeof( pin_electrical_type_names ) / \ + sizeof( wxString* ) ) const wxChar* MsgPinElectricType[] = @@ -37,12 +107,17 @@ const wxChar* MsgPinElectricType[] = wxT( "?????" ) }; + +extern void PlotPinSymbol( PLOTTER* plotter, const wxPoint& pos, + int len, int orient, int Shape ); + + LIB_PIN::LIB_PIN(LIB_COMPONENT * aParent) : LIB_DRAW_ITEM( COMPONENT_PIN_DRAW_TYPE, aParent ) { m_PinLen = 300; /* default Pin len */ m_Orient = PIN_RIGHT; /* Pin oprient: Up, Down, Left, Right */ - m_PinShape = NONE; /* Bit a bit: Pin shape (voir enum prec) */ + m_PinShape = NONE; /* Pin shape, bitwise. */ m_PinType = PIN_UNSPECIFIED; /* electrical type of pin */ m_Attributs = 0; /* bit 0 != 0: pin invisible */ m_PinNum = 0; /* pin number ( i.e. 4 codes ASCII ) */ @@ -77,6 +152,343 @@ LIB_PIN::LIB_PIN( const LIB_PIN& pin ) : LIB_DRAW_ITEM( pin ) } +void LIB_PIN::SetName( const wxString& name ) +{ + wxString tmp = ( name.IsEmpty() ) ? wxT( "~" ) : name; + tmp.Replace( wxT( " " ), wxT( "_" ) ); + + if( m_PinName != tmp ) + { + m_PinName = tmp; + m_Flags |= IS_CHANGED; + } + + if( GetParent() == NULL ) + return; + + LIB_PIN_LIST pinList; + GetParent()->GetPins( pinList ); + + for( size_t i = 0; i < pinList.size(); i++ ) + { + if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 + || pinList[i]->m_PinName == m_PinName ) + continue; + + pinList[i]->m_PinName = m_PinName; + pinList[i]->m_Flags |= IS_CHANGED; + } +} + + +void LIB_PIN::SetNameTextSize( int size ) +{ + if( size != m_PinNameSize ) + { + m_PinNameSize = size; + m_Flags |= IS_CHANGED; + } + + if( GetParent() == NULL ) + return; + + LIB_PIN_LIST pinList; + GetParent()->GetPins( pinList ); + + for( size_t i = 0; i < pinList.size(); i++ ) + { + if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 + || pinList[i]->m_PinNameSize == size ) + continue; + + pinList[i]->m_PinNameSize = size; + pinList[i]->m_Flags |= IS_CHANGED; + } +} + + +void LIB_PIN::SetNumber( const wxString& number ) +{ + wxString tmp = ( number.IsEmpty() ) ? wxT( "~" ) : number; + tmp.Replace( wxT( " " ), wxT( "_" ) ); + long oldNumber = m_PinNum; + SetPinNumFromString( tmp ); + + if( m_PinNum != oldNumber ) + { + m_Flags |= IS_CHANGED; + } + + if( GetParent() == NULL ) + return; + + LIB_PIN_LIST pinList; + GetParent()->GetPins( pinList ); + + for( size_t i = 0; i < pinList.size(); i++ ) + { + if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 + || pinList[i]->m_PinNum == m_PinNum ) + continue; + + pinList[i]->m_PinNum = m_PinNum; + pinList[i]->m_Flags |= IS_CHANGED; + } +} + + +void LIB_PIN::SetNumberTextSize( int size ) +{ + if( size != m_PinNumSize ) + { + m_PinNumSize = size; + m_Flags |= IS_CHANGED; + } + + if( GetParent() == NULL ) + return; + + LIB_PIN_LIST pinList; + GetParent()->GetPins( pinList ); + + for( size_t i = 0; i < pinList.size(); i++ ) + { + if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 + || pinList[i]->m_PinNumSize == size ) + continue; + + pinList[i]->m_PinNumSize = size; + pinList[i]->m_Flags |= IS_CHANGED; + } +} + + +void LIB_PIN::SetOrientation( int orientation ) +{ + if( m_Orient != orientation ) + { + m_Orient = orientation; + m_Flags |= IS_CHANGED; + } + + if( GetParent() == NULL ) + return; + + LIB_PIN_LIST pinList; + GetParent()->GetPins( pinList ); + + for( size_t i = 0; i < pinList.size(); i++ ) + { + if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 + || pinList[i]->m_Orient == orientation ) + continue; + + pinList[i]->m_Orient = orientation; + pinList[i]->m_Flags |= IS_CHANGED; + } +} + + +void LIB_PIN::SetDrawStyle( int style ) +{ + if( m_PinShape != style ) + { + m_PinShape = style; + m_Flags |= IS_CHANGED; + } + + if( GetParent() == NULL ) + return; + + LIB_PIN_LIST pinList; + GetParent()->GetPins( pinList ); + + for( size_t i = 0; i < pinList.size(); i++ ) + { + if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 + || pinList[i]->m_PinShape == style ) + continue; + + pinList[i]->m_PinShape = style; + pinList[i]->m_Flags |= IS_CHANGED; + } +} + + +void LIB_PIN::SetElectricalType( int type ) +{ + if( m_PinType != type ) + { + m_PinType = type; + m_Flags |= IS_CHANGED; + } + + if( GetParent() == NULL ) + return; + + LIB_PIN_LIST pinList; + GetParent()->GetPins( pinList ); + + for( size_t i = 0; i < pinList.size(); i++ ) + { + if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 + || pinList[i]->m_PinType == type ) + continue; + + pinList[i]->m_PinType = type; + pinList[i]->m_Flags |= IS_CHANGED; + } +} + + +void LIB_PIN::SetLength( int length ) +{ + if( m_PinLen != length ) + { + m_PinLen = length; + m_Flags |= IS_CHANGED; + } + + if( GetParent() == NULL ) + return; + + LIB_PIN_LIST pinList; + GetParent()->GetPins( pinList ); + + for( size_t i = 0; i < pinList.size(); i++ ) + { + if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 + || pinList[i]->m_Convert != m_Convert + || pinList[i]->m_PinLen == length ) + continue; + + pinList[i]->m_PinLen = length; + pinList[i]->m_Flags |= IS_CHANGED; + } +} + + +void LIB_PIN::SetPartNumber( int part ) +{ + if( m_Unit == part ) + return; + + m_Unit = part; + m_Flags |= IS_CHANGED; + + if( m_Unit == 0 ) + { + LIB_PIN* pin; + LIB_PIN* tmp = GetParent()->GetNextPin(); + + while( tmp != NULL ) + { + pin = tmp; + tmp = GetParent()->GetNextPin( pin ); + + if( pin->m_Flags == 0 || pin == this + || ( m_Convert && ( m_Convert != pin->m_Convert ) ) + || ( m_Pos != pin->m_Pos ) + || ( pin->m_Orient != m_Orient ) ) + continue; + + GetParent()->RemoveDrawItem( (LIB_DRAW_ITEM*) pin ); + } + } +} + + +void LIB_PIN::SetConversion( int style ) +{ + if( m_Convert == style ) + return; + + m_Convert = style; + m_Flags |= IS_CHANGED; + + if( style == 0 ) + { + LIB_PIN* pin; + LIB_PIN* tmp = GetParent()->GetNextPin(); + + while( tmp != NULL ) + { + pin = tmp; + tmp = GetParent()->GetNextPin( pin ); + + if( ( pin->m_Flags & IS_LINKED ) == 0 + || ( pin == this ) + || ( m_Unit && ( m_Unit != pin->m_Unit ) ) + || ( m_Pos != pin->m_Pos ) + || ( pin->m_Orient != m_Orient ) ) + continue; + + GetParent()->RemoveDrawItem( (LIB_DRAW_ITEM*) pin ); + } + } +} + + +void LIB_PIN::SetVisible( bool visible ) +{ + if( visible == IsVisible() ) + return; + + if( visible ) + m_Attributs &= ~PINNOTDRAW; + else + m_Attributs |= PINNOTDRAW; + + m_Flags |= IS_CHANGED; + + if( GetParent() == NULL ) + return; + + LIB_PIN_LIST pinList; + GetParent()->GetPins( pinList ); + + for( size_t i = 0; i < pinList.size(); i++ ) + { + if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 + || pinList[i]->IsVisible() == visible ) + continue; + + if( visible ) + pinList[i]->m_Attributs &= ~PINNOTDRAW; + else + pinList[i]->m_Attributs |= PINNOTDRAW; + + pinList[i]->m_Flags |= IS_CHANGED; + } +} + + +void LIB_PIN::EnableEditMode( bool enable, bool editPinByPin ) +{ + LIB_PIN_LIST pinList; + + if( GetParent() == NULL ) + return; + + GetParent()->GetPins( pinList ); + + for( size_t i = 0; i < pinList.size(); i++ ) + { + if( pinList[i] == this ) + continue; + + if( ( pinList[i]->m_Pos == m_Pos ) + && ( pinList[i]->m_Orient == m_Orient ) + && ( !( m_Flags & IS_NEW ) ) + && !editPinByPin == false + && enable ) + pinList[i]->m_Flags |= IS_LINKED | IN_EDIT; + else + pinList[i]->m_Flags &= ~( IS_LINKED | IN_EDIT ); + } +} + + /** * Function HitTest * tests if the given wxPoint is within the bounds of this object. @@ -110,7 +522,7 @@ bool LIB_PIN::HitTest( wxPoint aRefPos, int aThreshold, } -bool LIB_PIN::Save( FILE* ExportFile ) const +bool LIB_PIN::Save( FILE* ExportFile ) { wxString StringPinNum; int Etype; @@ -204,6 +616,8 @@ bool LIB_PIN::Save( FILE* ExportFile ) const if( fprintf( ExportFile, "\n" ) < 0 ) return false; + m_Flags &= ~IS_CHANGED; + return true; } @@ -363,7 +777,7 @@ void LIB_PIN::Draw( WinEDA_DrawPanel* aPanel, /* Calculate the pin position */ wxPoint pos1 = TransformCoordinate( aTransformMatrix, m_Pos ) + aOffset; - /* Dessin de la pin et du symbole special associe */ + /* Drawing from the pin and the special symbol combination */ DrawPinSymbol( aPanel, aDC, pos1, orient, aDrawMode, aColor ); if( DrawPinText ) @@ -554,6 +968,7 @@ void LIB_PIN::DrawPinSymbol( WinEDA_DrawPanel* aPanel, * Current Zoom factor is taken into account. * If TextInside then the text is been put inside,otherwise all is drawn outside. * Pin Name: substring beteween '~' is negated +* DrawMode = GR_OR, XOR ... *****************************************************************************/ void LIB_PIN::DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC, @@ -564,7 +979,6 @@ void LIB_PIN::DrawPinTexts( WinEDA_DrawPanel* panel, bool DrawPinName, int Color, int DrawMode ) -/* DrawMode = GR_OR, XOR ... */ { int x, y, x1, y1; wxString StringPinNum; @@ -803,7 +1217,8 @@ void LIB_PIN::PlotPinTexts( PLOTTER *plotter, if( m_PinName.IsEmpty() ) DrawPinName = FALSE; - if( TextInside ) /* Draw the text inside, but the pin numbers outside. */ + /* Draw the text inside, but the pin numbers outside. */ + if( TextInside ) { if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) ) /* Its an horizontal line. */ { @@ -944,12 +1359,9 @@ void LIB_PIN::PlotPinTexts( PLOTTER *plotter, } -/******************************************/ -wxPoint LIB_PIN::ReturnPinEndPoint() -/******************************************/ -/* return the pin end position, for a component in normal orient - */ +/* return the pin end position, for a component in normal orient */ +wxPoint LIB_PIN::ReturnPinEndPoint() { wxPoint pos = m_Pos; @@ -997,7 +1409,8 @@ int LIB_PIN::ReturnPinDrawOrient( const int TransMat[2][2] ) end.x = 1; break; } - end = TransformCoordinate( TransMat, end ); // = pos of end point, according to the component orientation + // = pos of end point, according to the component orientation + end = TransformCoordinate( TransMat, end ); orient = PIN_UP; if( end.x == 0 ) { @@ -1026,6 +1439,7 @@ void LIB_PIN::ReturnPinStringNum( wxString& aStringBuffer ) const aStringBuffer = ReturnPinStringNum( m_PinNum ); } + /** Function ReturnPinStringNum (static function) * Pin num is coded as a long or 4 ascii chars * @param aPinNum = a long containing a pin num @@ -1044,6 +1458,12 @@ wxString LIB_PIN::ReturnPinStringNum( long aPinNum ) } +wxString LIB_PIN::GetNumber( void ) +{ + return ReturnPinStringNum( m_PinNum ); +} + + /** Function LIB_PIN::SetPinNumFromString() * fill the buffer with pin num as a wxString * Pin num is coded as a long @@ -1067,9 +1487,7 @@ void LIB_PIN::SetPinNumFromString( wxString& buffer ) } -/*************************************/ LIB_DRAW_ITEM* LIB_PIN::DoGenCopy() -/*************************************/ { LIB_PIN* newpin = new LIB_PIN( GetParent() ); @@ -1178,59 +1596,35 @@ void LIB_PIN::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill, void LIB_PIN::DisplayInfo( WinEDA_DrawFrame* frame ) { wxString Text; - int ii; LIB_DRAW_ITEM::DisplayInfo( frame ); - frame->AppendMsgPanel( _( "Pin name" ), m_PinName, DARKCYAN ); + frame->AppendMsgPanel( _( "Name" ), m_PinName, DARKCYAN ); if( m_PinNum == 0 ) Text = wxT( "?" ); else ReturnPinStringNum( Text ); - frame->AppendMsgPanel( _( "Pin number" ), Text, DARKCYAN ); + frame->AppendMsgPanel( _( "Number" ), Text, DARKCYAN ); - ii = m_PinType; - frame->AppendMsgPanel( _( "Pin type" ), MsgPinElectricType[ii], - RED ); - - ii = m_Attributs; - if( ii & 1 ) - Text = _( "Not visible" ); + frame->AppendMsgPanel( _( "Type" ), + pin_electrical_type_names[ m_PinType ], RED ); + Text = pin_style_names[ GetStyleCodeIndex( m_PinShape ) ]; + frame->AppendMsgPanel( _( "Style" ), Text, BLUE ); + if( IsVisible() ) + Text = _( "Yes" ); else - Text = _( "Visible" ); - frame->AppendMsgPanel( _( "Display" ), Text, DARKGREEN ); + Text = _( "No" ); + frame->AppendMsgPanel( _( "Visible" ), Text, DARKGREEN ); /* Display pin length */ Text = ReturnStringFromValue( g_UnitMetric, m_PinLen, EESCHEMA_INTERNAL_UNIT, true ); frame->AppendMsgPanel( _( "Length" ), Text, MAGENTA ); - switch( m_Orient ) - { - case PIN_UP: - Text = _( "Up" ); - break; - - case PIN_DOWN: - Text = _( "Down" ); - break; - - case PIN_LEFT: - Text = _( "Left" ); - break; - - case PIN_RIGHT: - Text = _( "Right" ); - break; - - default: - Text = _( "Unknown" ); - break; - } - - frame->AppendMsgPanel( _( "Orientation" ), Text, MAGENTA ); + Text = pin_orientation_names[ GetOrientationCodeIndex( m_Orient ) ]; + frame->AppendMsgPanel( _( "Orientation" ), Text, DARKMAGENTA ); } @@ -1245,3 +1639,67 @@ EDA_Rect LIB_PIN::GetBoundingBox() return EDA_Rect( pt, wxSize( 1, 1 ) ); } + + +wxArrayString LIB_PIN::GetOrientationNames( void ) +{ + return wxArrayString( PIN_ORIENTATION_CNT, pin_orientation_names ); +} + + +int LIB_PIN::GetOrientationCode( int index ) +{ + if( index >= 0 && index < (int) PIN_ORIENTATION_CNT ) + return pin_orientation_codes[ index ]; + + return PIN_RIGHT; +} + + +int LIB_PIN::GetOrientationCodeIndex( int code ) +{ + size_t i; + + for( i = 0; i < PIN_ORIENTATION_CNT; i++ ) + { + if( pin_orientation_codes[i] == code ) + return (int) i; + } + + return wxNOT_FOUND; +} + + +wxArrayString LIB_PIN::GetStyleNames( void ) +{ + return wxArrayString( PIN_STYLE_CNT, pin_style_names ); +} + + +int LIB_PIN::GetStyleCode( int index ) +{ + if( index >= 0 && index < (int) PIN_STYLE_CNT ) + return pin_style_codes[ index ]; + + return NONE; +} + + +int LIB_PIN::GetStyleCodeIndex( int code ) +{ + size_t i; + + for( i = 0; i < PIN_STYLE_CNT; i++ ) + { + if( pin_style_codes[i] == code ) + return (int) i; + } + + return wxNOT_FOUND; +} + + +wxArrayString LIB_PIN::GetElectricalTypeNames( void ) +{ + return wxArrayString( PIN_ELECTRICAL_TYPE_CNT, pin_electrical_type_names ); +} diff --git a/eeschema/class_sch_component.cpp b/eeschema/class_sch_component.cpp index 8c0b95fa5a..4da01d2f47 100644 --- a/eeschema/class_sch_component.cpp +++ b/eeschema/class_sch_component.cpp @@ -178,8 +178,8 @@ void SCH_COMPONENT::Init( const wxPoint& pos ) /***************************************************************************** -* Routine to draw the given part at given position, transformed/mirror as * -* specified, and in the given drawing mode. Only this one is visible... * +* Routine to draw the given part at given position, transformed/mirror as * +* specified, and in the given drawing mode. Only this one is visible... * *****************************************************************************/ void SCH_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int DrawMode, int Color, @@ -261,7 +261,7 @@ void SCH_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, /** * Function AddHierarchicalReference - * adds a full hierachical reference (path + local reference) + * adds a full hierarchical reference (path + local reference) * @param aPath = hierarchical path (//component timestamp> * like /05678E50/A23EF560) * @param aRef = local reference like C45, R56 @@ -408,7 +408,7 @@ void SCH_COMPONENT::SetRef( DrawSheetPath* sheet, const wxString& ref ) } rf->m_Text = ref; // for drawing. - + // Reinit the m_PrefixString member if needed wxString prefix = ref; while( prefix.Last() == '?' or isdigit(prefix.Last()) ) @@ -525,6 +525,19 @@ void SCH_COMPONENT::AddField( const SCH_CMP_FIELD& aField ) } +LIB_PIN* SCH_COMPONENT::GetPin( const wxString& number ) +{ + LIB_COMPONENT* Entry = CMP_LIBRARY::FindLibraryComponent( m_ChipName ); + + if( Entry == NULL ) + return NULL; + + wxASSERT( Entry->Type == ROOT ); + + return Entry->GetPin( number, m_Multi, m_Convert ); +} + + EDA_Rect SCH_COMPONENT::GetBoundaryBox() const { LIB_COMPONENT* Entry = CMP_LIBRARY::FindLibraryComponent( m_ChipName ); @@ -663,7 +676,7 @@ void SCH_COMPONENT::ClearAnnotation( DrawSheetPath* aSheet ) path = GetPath( aSheet ); for( unsigned int ii = 0; ii < m_PathsAndReferences.GetCount(); ii++ ) { - // Break hierachical reference in path, ref and multi selection: + // Break hierarchical reference in path, ref and multi selection: reference_fields = wxStringTokenize( m_PathsAndReferences[ii], separators ); if( aSheet == NULL || reference_fields[0].Cmp( path ) == 0 ) @@ -882,9 +895,9 @@ int SCH_COMPONENT::GetRotationMiroir() /** - * Renvoie la coordonn�e du point coord, en fonction de l'orientation - * du composant (rotation, miroir). - * Les coord sont toujours relatives a l'ancre (coord 0,0) du composant + * Returns the coordinated point, depending on the orientation of the + * component (rotation, mirror). + * The coordinates are always relative to the anchor position of the component. */ wxPoint SCH_COMPONENT::GetScreenCoord( const wxPoint& coord ) { @@ -986,7 +999,7 @@ bool SCH_COMPONENT::Save( FILE* f ) const if( fprintf( f, "L %s %s\n", Name2, Name1 ) == EOF ) return false; - /* Generation de numero d'unit, convert et Time Stamp*/ + /* Generate unit number, convert and time stamp*/ if( fprintf( f, "U %d %d %8.8lX\n", m_Multi, m_Convert, m_TimeStamp ) == EOF ) return false; @@ -998,7 +1011,7 @@ bool SCH_COMPONENT::Save( FILE* f ) const /* If this is a complex hierarchy; save hierarchical references. * but for simple hierarchies it is not necessary. * the reference inf is already saved - * this is usefull for old eeschema version compatibility + * this is useful for old eeschema version compatibility */ if( m_PathsAndReferences.GetCount() > 1 ) { diff --git a/eeschema/class_sch_component.h b/eeschema/class_sch_component.h index ea60b97946..5bb425ad54 100644 --- a/eeschema/class_sch_component.h +++ b/eeschema/class_sch_component.h @@ -17,8 +17,7 @@ WX_DECLARE_OBJARRAY( DrawSheetPath, ArrayOfSheetLists ); /** - * Struct Error - * is a holder of an error message and may be thrown from functions. + * Holder of an error message and may be thrown from functions. */ struct Error { @@ -87,7 +86,7 @@ public: * first non-digits in the reference * fields. */ - int m_Convert; /* Handle mutiple shape (for instance + int m_Convert; /* Handle multiple shape (for instance * De Morgan conversion) */ int m_Transform[2][2]; /* The rotation/mirror transformation * matrix. */ @@ -101,7 +100,7 @@ private: * format is * path reference multi * with: - * path = // (subsheet path, = / for the root scheet) + * path = // (subsheet path, = / for the root sheet) * reference = reference for this path (C23, R5, U78 ... ) * multi = part selection in multi parts per package (0 or 1 for one part per package) */ @@ -118,7 +117,7 @@ public: * * @param libComponent - Component library object to create schematic * component from. - * @param sheet - Schemitic sheet the component is place into. + * @param sheet - Schematic sheet the component is place into. * @param unit - Part for components that have multiple parts per * package. * @param convert - Use the alternate body style for the schematic @@ -249,6 +248,14 @@ public: */ int GetFieldCount() const { return (int) m_Fields.size(); } + /** + * Find a component pin by number. + * + * @param number - The number of the pin to find. + * @return Pin object if found, otherwise NULL. + */ + LIB_PIN* GetPin( const wxString& number ); + virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, @@ -310,7 +317,7 @@ public: // Geometric transforms (used in block operations): /** virtual function Move * move item to a new position. - * @param aMoveVector = the deplacement vector + * @param aMoveVector = the displacement vector */ virtual void Move(const wxPoint& aMoveVector) { diff --git a/eeschema/classes_body_items.cpp b/eeschema/classes_body_items.cpp index 245af671b9..ac5d09f5b0 100644 --- a/eeschema/classes_body_items.cpp +++ b/eeschema/classes_body_items.cpp @@ -63,7 +63,6 @@ void LIB_DRAW_ITEM::DisplayInfo( WinEDA_DrawFrame* frame ) frame->ClearMsgPanel(); frame->AppendMsgPanel( _( "Type" ), m_typeName, CYAN ); - /* Affichage de l'appartenance */ if( m_Unit == 0 ) msg = _( "All" ); else @@ -147,7 +146,7 @@ LIB_ARC::LIB_ARC( const LIB_ARC& arc ) : LIB_DRAW_ITEM( arc ) * A centre_posx centre_posy rayon start_angle end_angle unit convert * fill('N', 'F' ou 'f') startx starty endx endy */ -bool LIB_ARC::Save( FILE* ExportFile ) const +bool LIB_ARC::Save( FILE* ExportFile ) { int x1 = m_t1; @@ -559,7 +558,7 @@ LIB_CIRCLE::LIB_CIRCLE( const LIB_CIRCLE& circle ) : } -bool LIB_CIRCLE::Save( FILE* ExportFile ) const +bool LIB_CIRCLE::Save( FILE* ExportFile ) { if( fprintf( ExportFile, "C %d %d %d %d %d %d %c\n", m_Pos.x, m_Pos.y, m_Radius, m_Unit, m_Convert, m_Width, fill_tab[m_Fill] ) < 0 ) @@ -825,7 +824,7 @@ LIB_RECTANGLE::LIB_RECTANGLE( const LIB_RECTANGLE& rect ) : } -bool LIB_RECTANGLE::Save( FILE* ExportFile ) const +bool LIB_RECTANGLE::Save( FILE* ExportFile ) { if( fprintf( ExportFile, "S %d %d %d %d %d %d %d %c\n", m_Pos.x, m_Pos.y, m_End.x, m_End.y, m_Unit, m_Convert, m_Width, @@ -1110,7 +1109,7 @@ LIB_SEGMENT::LIB_SEGMENT( const LIB_SEGMENT& segment ) : } -bool LIB_SEGMENT::Save( FILE* ExportFile ) const +bool LIB_SEGMENT::Save( FILE* ExportFile ) { if( fprintf( ExportFile, "L %d %d %d", m_Unit, m_Convert, m_Width ) ) return false; @@ -1330,7 +1329,7 @@ LIB_POLYLINE::LIB_POLYLINE( const LIB_POLYLINE& polyline ) : } -bool LIB_POLYLINE::Save( FILE* ExportFile ) const +bool LIB_POLYLINE::Save( FILE* ExportFile ) { int ccount = GetCornerCount(); @@ -1705,7 +1704,7 @@ LIB_BEZIER::LIB_BEZIER( const LIB_BEZIER& bezier ) : LIB_DRAW_ITEM( bezier ) } -bool LIB_BEZIER::Save( FILE* ExportFile ) const +bool LIB_BEZIER::Save( FILE* ExportFile ) { int ccount = GetCornerCount(); diff --git a/eeschema/classes_body_items.h b/eeschema/classes_body_items.h index d9bac3d826..842687ded6 100644 --- a/eeschema/classes_body_items.h +++ b/eeschema/classes_body_items.h @@ -35,8 +35,7 @@ class LIB_PIN; /** - * Enum ElectricPinType - * is the set of schematic pin types, used in ERC tests. + * The component library pin object electrical types used in ERC tests. */ enum ElectricPinType { @@ -54,16 +53,15 @@ enum ElectricPinType PIN_NMAX /* End of List (no used as pin type) */ }; -/* Messages d'affichage du type electrique */ +/* Electrical pin type names. */ extern const wxChar* MsgPinElectricType[]; -/* Autres bits: bits du membre .Flag des Pins */ -#define PINNOTDRAW 1 /* si 1: pin invisible */ +/* Pin visibility flag bit. */ +#define PINNOTDRAW 1 /* Set makes pin invisible */ /** - * Enum DrawPinShape - * is the set of shapes allowed for pins. + * The component library pin object drawing shapes. */ enum DrawPinShape { @@ -76,10 +74,9 @@ enum DrawPinShape /** - * Enum DrawPinOrient - * is the set of orientations allowed for pins. + * The component library pin object orientations. */ -enum DrawPinOrient +enum DrawPinOrient { PIN_RIGHT = 'R', PIN_LEFT = 'L', @@ -110,17 +107,25 @@ typedef std::vector< LIB_PIN* > LIB_PIN_LIST; /****************************************************************************/ -/* class LIB_DRAW_ITEM : Basic class for items used in a library component +/** + * Base class for drawable items used in library components. * (graphic shapes, texts, fields, pins) */ - class LIB_DRAW_ITEM : public EDA_BaseStruct { public: - int m_Unit; /* Unit identification (for multi part per package) - * 0 if the item is common to all units */ - int m_Convert; /* Shape identification (for parts which have a convert - * shape) 0 if the item is common to all shapes */ + /** + * Unit identification for multiple parts per package. Set to 0 if the + * item is common to all units. + */ + int m_Unit; + + /** + * Shape identification for alternate body styles. Set 0 if the item + * is common to all body styles. This is commonly referred to as + * DeMorgan style and this is typically how it is used in Kicad. + */ + int m_Convert; FILL_T m_Fill; /* NO_FILL, FILLED_SHAPE or FILLED_WITH_BG_BODYCOLOR. * has meaning only for some items */ wxString m_typeName; /* Name of object displayed in the message panel. */ @@ -137,40 +142,38 @@ public: virtual ~LIB_DRAW_ITEM() { } /** - * Function Draw (virtual pure) - * * Draw A body item - * @param aPanel = DrawPanel to use (can be null) mainly used for clipping + * + * @param aPanel - DrawPanel to use (can be null) mainly used for clipping * purposes - * @param aDC = Device Context (can be null) - * @param aOffset = offset to draw - * @param aColor = -1 to use the normal body item color, or use this color + * @param aDC - Device Context (can be null) + * @param aOffset - offset to draw + * @param aColor - -1 to use the normal body item color, or use this color * if >= 0 - * @param aDrawMode = GR_OR, GR_XOR, ... - * @param aData = value or pointer used to pass others parameters, + * @param aDrawMode - GR_OR, GR_XOR, ... + * @param aData - value or pointer used to pass others parameters, * depending on body items. used for some items to force * to force no fill mode ( has meaning only for items what * can be filled ). used in printing or moving objects mode * or to pass reference to the lib component for pins - * @param aTransformMatrix = Transform Matrix (rotation, mirror ..) + * @param aTransformMatrix - Transform Matrix (rotation, mirror ..) */ virtual void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset, int aColor, int aDrawMode, void* aData, const int aTransformMatrix[2][2] ) = 0; - /** Function GetPenSize virtual pure + /** * @return the size of the "pen" that be used to draw or plot this item */ virtual int GetPenSize( ) = 0; /** - * Function Save - * writes the data structures for this object out to a FILE in "*.brd" - * format. - * @param aFile The FILE to write to. + * Write draw item object to a FILE in "*.lib" format. + * + * @param aFile - The FILE to write to. * @return bool - true if success writing else false. */ - virtual bool Save( FILE* aFile ) const = 0; + virtual bool Save( FILE* aFile ) = 0; virtual bool Load( char* line, wxString& errorMsg ) = 0; LIB_COMPONENT * GetParent() @@ -179,8 +182,8 @@ public: } /** - * Function HitTest - * tests if the given wxPoint is within the bounds of this object. + * Tests if the given point is within the bounds of this object. + * * @param refPos A wxPoint to test * @return bool - true if a hit, else false */ @@ -189,17 +192,17 @@ public: return false; // derived classes should override this function } - /** Function HitTest (overlaid) - * @return true if the point aPosRef is near this object - * @param aPosRef = a wxPoint to test - * @param aThreshold = max distance to this object (usually the half + /** + * @param aPosRef - a wxPoint to test + * @param aThreshold - max distance to this object (usually the half * thickness of a line) - * @param aTransMat = the transform matrix + * @param aTransMat - the transform matrix + * @return true if the point aPosRef is near this object */ virtual bool HitTest( wxPoint aPosRef, int aThreshold, const int aTransMat[2][2] ) = 0; - /** Function GetBoundingBox + /** * @return the boundary box for this, in library coordinates */ virtual EDA_Rect GetBoundingBox() @@ -223,7 +226,6 @@ public: * Test LIB_DRAW_ITEM objects for equivalence. * * @param other - Object to test against. - * * @return bool - True if object is identical to this object. */ bool operator==( const LIB_DRAW_ITEM& other ) const; @@ -236,7 +238,6 @@ public: * Test if another draw item is less than this draw object. * * @param other - Draw item to compare against. - * * @return bool - True if object is less than this object. */ bool operator<( const LIB_DRAW_ITEM& other) const; @@ -255,7 +256,6 @@ public: * DoTestInside method for each derived object type. * * @param rect - Rectangle to check against. - * * @return bool - True if object is inside rectangle. */ bool Inside( EDA_Rect& rect ) { return DoTestInside( rect ); } @@ -313,6 +313,21 @@ public: */ bool IsFillable( void ) { return m_isFillable; } + /** + * Return the modified status of the draw object. + * + * @return bool - True if the draw object has been modified. + */ + bool IsModified( void ) { return ( m_Flags & IS_CHANGED ) != 0; } + + /** + * Return the new item status of the draw object. + * + * @return bool - True if the draw item has been added to the + * parent component. + */ + bool IsNew( void ) { return ( m_Flags & IS_NEW ) != 0; } + protected: virtual LIB_DRAW_ITEM* DoGenCopy() = 0; @@ -388,30 +403,29 @@ public: /** - * Function Save - * writes the data structures for this object out to a FILE in "*.brd" - * format. + * Write pin object to a FILE in "*.lib" format. + * * @param aFile The FILE to write to. * @return bool - true if success writing else false. */ - virtual bool Save( FILE* aFile ) const; + virtual bool Save( FILE* aFile ); virtual bool Load( char* line, wxString& errorMsg ); /** - * Function HitTest - * tests if the given wxPoint is within the bounds of this object. + * Test if the given point is within the bounds of this object. + * * @param aRefPos A wxPoint to test * @return bool - true if a hit, else false */ virtual bool HitTest( const wxPoint& aRefPos ); - /** Function HitTest - * @return true if the point aPosRef is near this object - * @param aPosRef = a wxPoint to test - * @param aThreshold = max distance to this object (usually the half + /** + * @param aPosRef - a wxPoint to test + * @param aThreshold - max distance to this object (usually the half * thickness of a line) - * @param aTransMat = the transform matrix + * @param aTransMat - the transform matrix + * @return true if the point aPosRef is near this object */ virtual bool HitTest( wxPoint aPosRef, int aThreshold, const int aTransMat[2][2] ); @@ -422,15 +436,19 @@ public: int ReturnPinDrawOrient( const int TransMat[2][2] ); - /** Function ReturnPinStringNum - * fill a buffer with pin num as a wxString - * Pin num is coded as a long or 4 ASCII chars - * Used to print/draw the pin num - * @param aStringBuffer = the wxString to store the pin num as an unicode - * string + /** + * Fill a string buffer with pin number. + * + * Pin numbers are coded as a long or 4 ASCII characters. Used to print + * or draw the pin number. + * + * @param aStringBuffer - the wxString to store the pin num as an unicode + * string */ void ReturnPinStringNum( wxString& aStringBuffer ) const; + wxString GetNumber( void ); + /** Function ReturnPinStringNum (static function) * Pin num is coded as a long or 4 ascii chars * @param aPinNum = a long containing a pin num @@ -441,10 +459,144 @@ public: void SetPinNumFromString( wxString& buffer ); - /** Function GetPenSize - * @return the size of the "pen" that be used to draw or plot this item + /** + * Set the pin name. + * + * This will also all of the pin names marked by EnableEditMode(). + * + * @param name - New pin name. */ - virtual int GetPenSize( ); + void SetName( const wxString& name ); + + /** + * Set the size of the pin name text. + * + * This will also update the text size of the name of the pins marked + * by EnableEditMode(). + * + * @param size - The text size of the pin name in schematic units ( mils ). + */ + void SetNameTextSize( int size ); + + /** + * Set the pin number. + * + * This will also all of the pin numbers marked by EnableEditMode(). + * + * @param number - New pin number. + */ + void SetNumber( const wxString& number ); + + /** + * Set the size of the pin number text. + * + * This will also update the text size of the number of the pins marked + * by EnableEditMode(). + * + * @param size - The text size of the pin number in schematic + * units ( mils ). + */ + void SetNumberTextSize( int size ); + + /** + * Set orientation on the pin. + * + * This will also update the orientation of the pins marked by + * EnableEditMode(). + * + * @param orientation - The orientation of the pin. + */ + void SetOrientation( int orientation ); + + /** + * Set the draw style of the pin. + * + * This will also update the draw style of the pins marked by + * EnableEditMode(). + * + * @param style - The draw style of the pin. + */ + void SetDrawStyle( int style ); + + /** + * Set the electrical type of the pin. + * + * This will also update the electrical type of the pins marked by + * EnableEditMode(). + * + * @param type - The electrical type of the pin. + */ + void SetElectricalType( int style ); + + /** + * Set the pin length. + * + * This will also update the length of the pins marked by EnableEditMode(). + * + * @param size - The length of the pin in mils. + */ + void SetLength( int length ); + + /** + * Set the pin part number. + * + * If the pin is changed from not common to common to all parts, any + * linked pins will be removed from the parent component. + * + * @param part - Number of the part the pin belongs to. Set to zero to + * make pin common to all parts in a multi-part component. + */ + void SetPartNumber( int part ); + + /** + * Set the body style (conversion) of the pin. + * + * If the pin is changed from not common to common to all body styles, any + * linked pins will be removed from the parent component. + * + * @param conversion - Body style of the pin. Set to zero to make pin + * common to all body styles. + */ + void SetConversion( int conversion ); + + /** + * Set or clear the visibility flag for the pin. + * + * This will also update the visibility of the pins marked by + * EnableEditMode(). + * + * @param visible - True to make the pin visible or false to hide the pin. + */ + void SetVisible( bool visible ); + + /** + * Enable or clear pin editing mode. + * + * The pin editing mode marks or unmarks all pins common to this + * pin object for further editing. If any of the pin modifcation + * methods are called after enabling the editing mode, all pins + * marked for editing will have the same attribute changed. The + * only case were this is not true making this pin common to all + * parts or body styles in the component. See SetCommonToAllParts() + * and SetCommonToAllBodyStyles() for more information. + * + * @params enable - True marks all common pins for editing mode. False + * clears the editing mode. + * @params editpinByPin - Enables the edit pin by pin mode. + */ + void EnableEditMode( bool enable, bool pinByPin = false ); + + /** + * Return the visibility status of the draw object. + * + * @return bool - True if draw object is visible otherwise false. + */ + bool IsVisible( void ) { return ( m_Attributs & PINNOTDRAW ) == 0; } + + /** + * @return the size of the "pen" that be used to draw or plot this item. + */ + virtual int GetPenSize(); void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset, int aColor, int aDrawMode, void* aData, @@ -467,6 +619,62 @@ public: bool DrawPinNameint, int aWidth ); + /** + * Get a list of pin orientation names. + * + * @return wxArrayString - List of valid pin orientation names. + */ + static wxArrayString GetOrientationNames( void ); + + /** + * Get the orientation code by index used to set the pin orientation. + * + * @param index - The index of the orientation code to look up. + * @return int - Orientation code if index is valid. Returns right + * orientation on index error. + */ + static int GetOrientationCode( int index ); + + /** + * Get the index of the orientation code. + * + * @param code - The orientation code to look up. + * @return int - The index of the orientation code if found. Otherwise, + * return wxNOT_FOUND. + */ + static int GetOrientationCodeIndex( int code ); + + /** + * Get a list of pin draw style names. + * + * @return wxArrayString - List of valid pin draw style names. + */ + static wxArrayString GetStyleNames( void ); + + /** + * Get the pin draw style code by index used to set the pin draw style. + * + * @param index - The index of the pin draw style code to look up. + * @return int - Pin draw style code if index is valid. Returns NONE + * style on index error. + */ + static int GetStyleCode( int index ); + + /** + * Get the index of the pin draw style code. + * + * @param code - The pin draw style code to look up. + * @return int - The index of the pin draw style code if found. Otherwise, + * return wxNOT_FOUND. + */ + static int GetStyleCodeIndex( int code ); + + /** + * Get a list of pin electrical type names. + * @return wxArrayString - List of valid pin electrical type names. + */ + static wxArrayString GetElectricalTypeNames( void ); + protected: virtual LIB_DRAW_ITEM* DoGenCopy(); @@ -500,12 +708,11 @@ class LIB_ARC : public LIB_DRAW_ITEM { public: int m_Radius; - int m_t1; - int m_t2; /* position des 2 extremites de l'arc en 0.1 degres */ + int m_t1; /* First radius angle of the arc in 0.1 degrees. */ + int m_t2; /* Second radius angle of the arc in 0.1 degrees. */ wxPoint m_ArcStart; - wxPoint m_ArcEnd; /* position des 2 extremites de l'arc en coord reelles*/ - wxPoint m_Pos; /* Position or centre (Arc and Circle) or start point - * (segments) */ + wxPoint m_ArcEnd; /* Arc end position. */ + wxPoint m_Pos; /* Radius center point. */ int m_Width; /* Line width */ public: @@ -519,29 +726,28 @@ public: /** - * Function Save - * writes the data structures for this object out to a FILE in "*.brd" - * format. + * Save arc object to a FILE in "*.lib" format. + * * @param aFile The FILE to write to. * @return bool - true if success writing else false. */ - virtual bool Save( FILE* aFile ) const; + virtual bool Save( FILE* aFile ); virtual bool Load( char* line, wxString& errorMsg ); /** - * Function HitTest - * tests if the given wxPoint is within the bounds of this object. + * Tests if the given wxPoint is within the bounds of this object. + * * @param aRefPos A wxPoint to test * @return bool - true if a hit, else false */ virtual bool HitTest( const wxPoint& aRefPos ); - /** Function HitTest - * @return true if the point aPosRef is near this object - * @param aPosRef = a wxPoint to test - * @param aThreshold = max distance to this object (usually the half + /** + * @param aPosRef - a wxPoint to test + * @param aThreshold - max distance to this object (usually the half * thickness of a line) - * @param aTransMat = the transform matrix + * @param aTransMat - the transform matrix + * @return true if the point aPosRef is near this object */ virtual bool HitTest( wxPoint aPosRef, int aThreshold, const int aTransMat[2][2] ); @@ -552,7 +758,7 @@ public: virtual EDA_Rect GetBoundingBox(); virtual void DisplayInfo( WinEDA_DrawFrame* frame ); - /** Function GetPenSize + /** * @return the size of the "pen" that be used to draw or plot this item */ virtual int GetPenSize( ); @@ -604,34 +810,33 @@ public: /** - * Function Save - * writes the data structures for this object out to a FILE in "*.brd" - * format. - * @param aFile The FILE to write to. + * Write circle object to a FILE in "*.lib" format. + * + * @param aFile - The FILE to write to. * @return bool - true if success writing else false. */ - virtual bool Save( FILE* aFile ) const; + virtual bool Save( FILE* aFile ); virtual bool Load( char* line, wxString& errorMsg ); /** - * Function HitTest - * tests if the given wxPoint is within the bounds of this object. - * @param aRefPos A wxPoint to test + * Test if the given point is within the bounds of this object. + * + * @param aRefPos - A wxPoint to test * @return bool - true if a hit, else false */ virtual bool HitTest( const wxPoint& aRefPos ); - /** Function HitTest - * @return true if the point aPosRef is near this object - * @param aPosRef = a wxPoint to test - * @param aThreshold = max distance to this object (usually the half - * thickness of a line) - * @param aTransMat = the transform matrix - */ + /** + * @param aPosRef - a wxPoint to test + * @param aThreshold - max distance to this object (usually the half + * thickness of a line) + * @param aTransMat - the transform matrix + * @return true if the point aPosRef is near this object + */ virtual bool HitTest( wxPoint aPosRef, int aThreshold, const int aTransMat[2][2] ); - /** Function GetPenSize + /** * @return the size of the "pen" that be used to draw or plot this item */ virtual int GetPenSize( ); @@ -687,37 +892,37 @@ public: /** - * Function Save - * writes the data structures for this object out to a FILE in "*.brd" - * format. - * @param aFile The FILE to write to. + * Write text object out to a FILE in "*.lib" format. + * + * @param aFile - The FILE to write to. * @return bool - true if success writing else false. */ - virtual bool Save( FILE* aFile ) const; + virtual bool Save( FILE* aFile ); virtual bool Load( char* line, wxString& errorMsg ); /** - * Function HitTest - * tests if the given wxPoint is within the bounds of this object. - * @param refPos A wxPoint to test + * Test if the given point is within the bounds of this object. + * + * @param refPos - A wxPoint to test * @return bool - true if a hit, else false */ virtual bool HitTest( const wxPoint& refPos ); - /** Function HitTest - * @return true if the point aPosRef is near a segment - * @param aPosRef = a wxPoint to test, in eeschema coordinates - * @param aThreshold = max distance to a segment - * @param aTransMat = the transform matrix - */ + /** + * @param aPosRef = a wxPoint to test, in eeschema coordinates + * @param aThreshold = max distance to a segment + * @param aTransMat = the transform matrix + * @return true if the point aPosRef is near a segment + */ virtual bool HitTest( wxPoint aPosRef, int aThreshold, const int aTransMat[2][2] ); /** - * Function HitTest (overlayed) - * tests if the given EDA_Rect intersect this object. + * Test if the given rectangle intersects this object. + * * For now, an ending point must be inside this rect. - * @param refArea : the given EDA_Rect + * + * @param refArea - the given EDA_Rect * @return bool - true if a hit, else false */ virtual bool HitTest( EDA_Rect& refArea ) @@ -725,7 +930,7 @@ public: return TextHitTest( refArea ); } - /** Function GetPenSize + /** * @return the size of the "pen" that be used to draw or plot this item */ virtual int GetPenSize( ); @@ -786,34 +991,33 @@ public: /** - * Function Save - * writes the data structures for this object out to a FILE in "*.brd" - * format. - * @param aFile The FILE to write to. + * Write rectangle object out to a FILE in "*.lib" format. + * + * @param aFile - The FILE to write to. * @return bool - true if success writing else false. */ - virtual bool Save( FILE* aFile ) const; + virtual bool Save( FILE* aFile ); virtual bool Load( char* line, wxString& errorMsg ); /** - * Function HitTest - * tests if the given wxPoint is within the bounds of this object. - * @param aRefPos A wxPoint to test + * Test if the given point is within the bounds of this object. + * + * @param aRefPos - A wxPoint to test * @return bool - true if a hit, else false */ virtual bool HitTest( const wxPoint& aRefPos ); - /** Function HitTest - * @return true if the point aPosRef is near this object - * @param aPosRef = a wxPoint to test - * @param aThreshold = max distance to this object (usually the half + /** + * @param aPosRef - a wxPoint to test + * @param aThreshold - max distance to this object (usually the half * thickness of a line) - * @param aTransMat = the transform matrix + * @param aTransMat - the transform matrix + * @return true if the point aPosRef is near this object */ virtual bool HitTest( wxPoint aPosRef, int aThreshold, const int aTransMat[2][2] ); - /** Function GetPenSize + /** * @return the size of the "pen" that be used to draw or plot this item */ virtual int GetPenSize( ); @@ -857,8 +1061,7 @@ class LIB_SEGMENT : public LIB_DRAW_ITEM { public: wxPoint m_End; - wxPoint m_Pos; /* Position or centre (Arc and Circle) or start point - * (segments) */ + wxPoint m_Pos; /* Segment start point */ int m_Width; /* Line width */ public: @@ -872,34 +1075,33 @@ public: /** - * Function Save - * writes the data structures for this object out to a FILE in "*.brd" - * format. - * @param aFile The FILE to write to. + * Writes segment object out to a FILE in "*.lib" format. + * + * @param aFile - The FILE to write to. * @return bool - true if success writing else false. */ - virtual bool Save( FILE* aFile ) const; + virtual bool Save( FILE* aFile ); virtual bool Load( char* line, wxString& errorMsg ); /** - * Function HitTest - * tests if the given wxPoint is within the bounds of this object. - * @param aRefPos A wxPoint to test + * Test if the given point is within the bounds of this object. + * + * @param aRefPos - A wxPoint to test * @return bool - true if a hit, else false */ virtual bool HitTest( const wxPoint& aRefPos ); - /** Function HitTest - * @return true if the point aPosRef is near this object + /** * @param aPosRef = a wxPoint to test * @param aThreshold = max distance to this object (usually the half * thickness of a line) * @param aTransMat = the transform matrix + * @return true if the point aPosRef is near this object */ virtual bool HitTest( wxPoint aPosRef, int aThreshold, const int aTransMat[2][2] ); - /** Function GetPenSize + /** * @return the size of the "pen" that be used to draw or plot this item */ virtual int GetPenSize( ); @@ -957,45 +1159,44 @@ public: /** - * Function Save - * writes the data structures for this object out to a FILE in "*.brd" - * format. - * @param aFile The FILE to write to. + * Write polyline object out to a FILE in "*.lib" format. + * + * @param aFile - The FILE to write to. * @return bool - true if success writing else false. */ - virtual bool Save( FILE* aFile ) const; + virtual bool Save( FILE* aFile ); virtual bool Load( char* line, wxString& errorMsg ); void AddPoint( const wxPoint& point ); - /** Function GetCornerCount + /** * @return the number of corners */ unsigned GetCornerCount() const { return m_PolyPoints.size(); } /** - * Function HitTest - * tests if the given wxPoint is within the bounds of this object. - * @param aRefPos A wxPoint to test + * Test if the given point is within the bounds of this object. + * + * @param aRefPos - A wxPoint to test * @return bool - true if a hit, else false */ virtual bool HitTest( const wxPoint& aRefPos ); - /** Function HitTest - * @return true if the point aPosRef is near a segment + /** * @param aPosRef = a wxPoint to test * @param aThreshold = max distance to a segment * @param aTransMat = the transform matrix + * @return true if the point aPosRef is near a segment */ virtual bool HitTest( wxPoint aPosRef, int aThreshold, const int aTransMat[2][2] ); - /** Function GetBoundingBox + /** * @return the boundary box for this, in library coordinates */ virtual EDA_Rect GetBoundingBox(); - /** Function GetPenSize + /** * @return the size of the "pen" that be used to draw or plot this item */ virtual int GetPenSize( ); @@ -1051,45 +1252,44 @@ public: /** - * Function Save - * writes the data structures for this object out to a FILE in "*.brd" - * format. - * @param aFile The FILE to write to. + * Write bezier curve object out to a FILE in "*.lib" format. + * + * @param aFile - The FILE to write to. * @return bool - true if success writing else false. */ - virtual bool Save( FILE* aFile ) const; + virtual bool Save( FILE* aFile ); virtual bool Load( char* line, wxString& errorMsg ); void AddPoint( const wxPoint& point ); - /** Function GetCornerCount + /** * @return the number of corners */ unsigned GetCornerCount() const { return m_PolyPoints.size(); } /** - * Function HitTest - * tests if the given wxPoint is within the bounds of this object. - * @param aRefPos A wxPoint to test + * Test if the given point is within the bounds of this object. + * + * @param aRefPos - A wxPoint to test * @return bool - true if a hit, else false */ virtual bool HitTest( const wxPoint& aRefPos ); - /** Function HitTest - * @return true if the point aPosRef is near a segment + /** * @param aPosRef = a wxPoint to test * @param aThreshold = max distance to a segment * @param aTransMat = the transform matrix + * @return true if the point aPosRef is near a segment */ virtual bool HitTest( wxPoint aPosRef, int aThreshold, const int aTransMat[2][2] ); - /** Function GetBoundingBox + /** * @return the boundary box for this, in library coordinates */ virtual EDA_Rect GetBoundingBox(); - /** Function GetPenSize + /** * @return the size of the "pen" that be used to draw or plot this item */ virtual int GetPenSize( ); diff --git a/eeschema/dialog_lib_new_component.cpp b/eeschema/dialog_lib_new_component.cpp index e6c48d3695..1f03fb4fc4 100644 --- a/eeschema/dialog_lib_new_component.cpp +++ b/eeschema/dialog_lib_new_component.cpp @@ -3,5 +3,6 @@ DIALOG_LIB_NEW_COMPONENT::DIALOG_LIB_NEW_COMPONENT( wxWindow* parent ) : DIALOG_LIB_NEW_COMPONENT_BASE( parent ) { - SetDefaultItem( m_sdbSizerOK ); + /* Required to make escape key work correctly in wxGTK. */ + m_sdbSizerOK->SetFocus(); } diff --git a/eeschema/eeschema_id.h b/eeschema/eeschema_id.h index 421f4a5e91..06f6738305 100644 --- a/eeschema/eeschema_id.h +++ b/eeschema/eeschema_id.h @@ -161,7 +161,7 @@ enum id_eeschema_frm ID_LIBEDIT_EXPORT_BODY_BUTT, /* Library editor context menu IDs */ - ID_POPUP_LIBEDIT_PIN_EDIT, + ID_LIBEDIT_EDIT_PIN, ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_ITEM, ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINSIZE_ITEM, ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNAMESIZE_ITEM, diff --git a/eeschema/find.cpp b/eeschema/find.cpp index 6228698b3a..ef4178d07a 100644 --- a/eeschema/find.cpp +++ b/eeschema/find.cpp @@ -114,7 +114,7 @@ SCH_ITEM* WinEDA_SchematicFrame::FindComponentAndItem( case 1: // find a pin pos = pSch->m_Pos; // temporary: will be changed if the pin is found - pin = LocatePinByNumber( text_to_find, pSch ); + pin = pSch->GetPin( text_to_find ); if( pin == NULL ) break; NotFound = FALSE; @@ -167,10 +167,10 @@ SCH_ITEM* WinEDA_SchematicFrame::FindComponentAndItem( &( GetScreen()->m_StartVisu.x ), &( GetScreen()->m_StartVisu.y ) ); - // calcul des coord curseur avec origine = screen + // Calculating cursor position with original screen. curpos -= GetScreen()->m_StartVisu; - /* Il y a peut-etre necessite de recadrer le dessin: */ + /* There may be need to reframe the drawing */ #define MARGIN 30 if( (curpos.x <= MARGIN) || (curpos.x >= DrawAreaSize.x - MARGIN) || (curpos.y <= MARGIN) || (curpos.y >= DrawAreaSize.y - MARGIN) ) @@ -342,7 +342,6 @@ SCH_ITEM* WinEDA_SchematicFrame::FindMarker( int SearchType ) sheet->LastScreen()->m_Curseur = pos; curpos = DrawPanel->CursorScreenPosition(); - // calcul des coord curseur avec origine = screen DrawPanel->GetViewStart( &m_CurrentSheet->LastScreen()->m_StartVisu.x, &m_CurrentSheet->LastScreen()->m_StartVisu.y ); curpos.x -= m_CurrentSheet->LastScreen()->m_StartVisu.x; @@ -511,7 +510,7 @@ SCH_ITEM* WinEDA_SchematicFrame::FindSchematicItem( StartCount++; if( s_ItemsCount >= StartCount ) { - NotFound = TRUE; /* Continue recherche de l'element suivant */ + NotFound = TRUE; /* Continue search of the next element */ } else { @@ -573,10 +572,9 @@ SCH_ITEM* WinEDA_SchematicFrame::FindSchematicItem( &( GetScreen()->m_StartVisu.x ), &( GetScreen()->m_StartVisu.y ) ); - // calcul des coord curseur avec origine = screen curpos -= m_CurrentSheet->LastScreen()->m_StartVisu; - /* Il y a peut-etre necessite de recadrer le dessin: */ + /* There may be need to reframe the drawing */ #define MARGIN 30 if( (curpos.x <= MARGIN) || (curpos.x >= DrawAreaSize.x - MARGIN) || (curpos.y <= MARGIN) || (curpos.y >= DrawAreaSize.y - MARGIN) ) diff --git a/eeschema/hotkeys.cpp b/eeschema/hotkeys.cpp index a8d6d28174..6703833b62 100644 --- a/eeschema/hotkeys.cpp +++ b/eeschema/hotkeys.cpp @@ -633,7 +633,10 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey, m_drawItem = LocateItemUsingCursor(); if( m_drawItem && m_drawItem->Type() == COMPONENT_PIN_DRAW_TYPE ) - InstallPineditFrame( this, DC, MousePos ); + { + cmd.SetId( ID_LIBEDIT_EDIT_PIN ); + GetEventHandler()->ProcessEvent( cmd ); + } break; diff --git a/eeschema/libedit_onleftclick.cpp b/eeschema/libedit_onleftclick.cpp index 8f49da9aed..5e084d4bbc 100644 --- a/eeschema/libedit_onleftclick.cpp +++ b/eeschema/libedit_onleftclick.cpp @@ -194,10 +194,12 @@ void WinEDA_LibeditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) switch( DrawEntry->Type() ) { - case COMPONENT_PIN_DRAW_TYPE: + case COMPONENT_PIN_DRAW_TYPE: if( DrawEntry->m_Flags == 0 ) { - InstallPineditFrame( this, DC, pos ); + wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); + cmd.SetId( ID_LIBEDIT_EDIT_PIN ); + GetEventHandler()->ProcessEvent( cmd ); } break; diff --git a/eeschema/libedit_onrightclick.cpp b/eeschema/libedit_onrightclick.cpp index 0869233c2d..bf0b4c23ac 100644 --- a/eeschema/libedit_onrightclick.cpp +++ b/eeschema/libedit_onrightclick.cpp @@ -233,7 +233,7 @@ void AddMenusForPin( wxMenu* PopMenu, wxString msg; msg = AddHotkeyName( _( "Edit Pin " ), s_Libedit_Hokeys_Descr, HK_EDIT_PIN ); - ADD_MENUITEM( PopMenu, ID_POPUP_LIBEDIT_PIN_EDIT, msg, edit_xpm ); + ADD_MENUITEM( PopMenu, ID_LIBEDIT_EDIT_PIN, msg, edit_xpm ); if( not_in_move ) { diff --git a/eeschema/libeditfrm.h b/eeschema/libeditfrm.h index 7c9f21f752..be5eebc0f3 100644 --- a/eeschema/libeditfrm.h +++ b/eeschema/libeditfrm.h @@ -47,6 +47,7 @@ public: void OnViewEntryDoc( wxCommandEvent& event ); void OnCheckComponent( wxCommandEvent& event ); void OnSelectBodyStyle( wxCommandEvent& event ); + void OnEditPin( wxCommandEvent& event ); void OnUpdateEditingPart( wxUpdateUIEvent& event ); void OnUpdateNotEditingPart( wxUpdateUIEvent& event ); @@ -69,7 +70,7 @@ public: void ReCreateVToolbar(); void OnLeftClick( wxDC* DC, const wxPoint& MousePos ); bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ); - int BestZoom(); // Retourne le meilleur zoom + int BestZoom(); // Returns the best zoom void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ); SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) GetBaseScreen(); } @@ -146,17 +147,17 @@ private: void GetComponentFromUndoList( wxCommandEvent& event ); void GetComponentFromRedoList( wxCommandEvent& event ); - // Edition des Pins: + // Editing pins void CreatePin( wxDC* DC ); void DeletePin( wxDC* DC, LIB_COMPONENT* LibEntry, LIB_PIN* Pin ); void StartMovePin( wxDC* DC ); - // Edition de l'ancre + // Editing anchor void PlaceAncre(); - // Edition des graphismes: + // Editing graphic items LIB_DRAW_ITEM* CreateGraphicItem( LIB_COMPONENT* LibEntry, wxDC* DC ); void GraphicItemBeginDraw( wxDC* DC ); void StartMoveDrawSymbol( wxDC* DC ); @@ -181,10 +182,9 @@ public: int HandleBlockEnd( wxDC* DC ); void PlacePin( wxDC* DC ); - void InitEditOnePin(); void GlobalSetPins( wxDC* DC, LIB_PIN* MasterPin, int id ); - // Repetition automatique de placement de pins + // Automatic placement of pins void RepeatPinItem( wxDC* DC, LIB_PIN* Pin ); protected: diff --git a/eeschema/libframe.cpp b/eeschema/libframe.cpp index daceec5469..b62f7eedbb 100644 --- a/eeschema/libframe.cpp +++ b/eeschema/libframe.cpp @@ -109,7 +109,9 @@ BEGIN_EVENT_TABLE( WinEDA_LibeditFrame, WinEDA_DrawFrame ) WinEDA_LibeditFrame::Process_Special_Functions ) /* Context menu events and commands. */ - EVT_MENU_RANGE( ID_POPUP_LIBEDIT_PIN_EDIT, + EVT_MENU( ID_LIBEDIT_EDIT_PIN, WinEDA_LibeditFrame::OnEditPin ) + + EVT_MENU_RANGE( ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_ITEM, ID_POPUP_LIBEDIT_ROTATE_GRAPHIC_TEXT, WinEDA_LibeditFrame::Process_Special_Functions ) @@ -155,8 +157,8 @@ WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father, WinEDA_DrawFrame( father, LIBEDITOR_FRAME, title, pos, size, style ) { m_FrameName = wxT( "LibeditFrame" ); - m_Draw_Axis = true; // true pour avoir les axes dessines - m_Draw_Grid = true; // true pour avoir la axes dessinee + m_Draw_Axis = true; // true to draw axis + m_Draw_Grid = true; // true to draw grid m_ConfigPath = wxT( "LibraryEditor" ); SetShowDeMorgan( false ); m_drawSpecificConvert = true; @@ -579,10 +581,10 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event ) wxGetMousePosition( &pos.x, &pos.y ); pos.y += 20; - switch( id ) // Arret de la commande de d�placement en cours + switch( id ) // Stop placement commands before handling new command. { case ID_POPUP_LIBEDIT_END_CREATE_ITEM: - case ID_POPUP_LIBEDIT_PIN_EDIT: + case ID_LIBEDIT_EDIT_PIN: case ID_POPUP_LIBEDIT_BODY_EDIT_ITEM: case ID_POPUP_LIBEDIT_FIELD_ROTATE_ITEM: case ID_POPUP_LIBEDIT_FIELD_EDIT_ITEM: @@ -626,10 +628,6 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event ) g_EditPinByPinIsOn = g_EditPinByPinIsOn ? false : true; break; - case ID_POPUP_LIBEDIT_PIN_EDIT: - InstallPineditFrame( this, &dc, pos ); - break; - case ID_LIBEDIT_PIN_BUTT: if( m_component ) { @@ -638,7 +636,9 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event ) else { SetToolID( id, wxCURSOR_ARROW, _( "Set pin options" ) ); - InstallPineditFrame( this, &dc, pos ); + wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); + cmd.SetId( ID_LIBEDIT_EDIT_PIN ); + GetEventHandler()->ProcessEvent( cmd ); SetToolID( 0, wxCURSOR_ARROW, wxEmptyString ); } break; diff --git a/eeschema/locate.cpp b/eeschema/locate.cpp index b401666693..2fb65fc312 100644 --- a/eeschema/locate.cpp +++ b/eeschema/locate.cpp @@ -1,5 +1,5 @@ /******************************************************/ -/* Routines de localisation d'un element d'un schema. */ +/* Routines for locating an element of a schematic. */ /******************************************************/ #include "fctsys.h" @@ -480,8 +480,8 @@ bool DrawStructInBox( int x1, int y1, int x2, int y2, SCH_ITEM* DrawStruct ) case TYPE_SCH_GLOBALLABEL: #undef STRUCT #define STRUCT ( (SCH_LABEL*) DrawStruct ) - dx = STRUCT->m_Size.x * ( STRUCT->GetLength() + 1); /* longueur totale */ - dy = STRUCT->m_Size.y / 2; /* Demi hauteur */ + dx = STRUCT->m_Size.x * ( STRUCT->GetLength() + 1); /* total length */ + dy = STRUCT->m_Size.y / 2; /* half height */ xt1 = xt2 = STRUCT->m_Pos.x; yt1 = yt2 = STRUCT->m_Pos.y; @@ -525,7 +525,7 @@ bool DrawStructInBox( int x1, int y1, int x2, int y2, SCH_ITEM* DrawStruct ) case DRAW_SHEET_STRUCT_TYPE: #undef STRUCT #define STRUCT ( (DrawSheetStruct*) DrawStruct ) - /* Recalcul des coordonnees de l'encadrement du composant */ + /* Recalculate the coordinates of the worksheet component */ xt1 = STRUCT->m_Pos.x; yt1 = STRUCT->m_Pos.y; xt2 = STRUCT->m_Pos.x + STRUCT->m_Size.x; @@ -556,12 +556,12 @@ static bool IsBox1InBox2( int StartX1, int StartY1, int EndX1, int EndY1, int StartX2, int StartY2, int EndX2, int EndY2 ) /****************************************************************************/ -/* Routine detectant que le rectangle 1 (Box1) et le rectangle 2 (Box2) se - * recouvrent. - * Retourne TRUE ou FALSE. +/* Routine detects that the rectangle 1 (Box1) and the rectangle 2 (Box2) is + * Overlap. + * Returns TRUE or FALSE. * - * On Considere ici qu'il y a recouvrement si l'un au moins des coins - * d'un 'Box' est compris dans l'autre + * These assume that there is recovery if at least one corner + * A 'Box' is included in the other */ { int cX, cY; @@ -575,87 +575,52 @@ static bool IsBox1InBox2( int StartX1, int StartY1, int EndX1, int EndY1, if( StartY2 > EndY2 ) EXCHG( StartY2, EndY2 ); - /* Tst des 4 coins du rectangle 1 */ - cX = StartX1; cY = StartY1; /* 1er coin */ + /* Test the 4 corners of the rectangle 1 */ + cX = StartX1; + cY = StartY1; if( (cX >= StartX2) && (cX <= EndX2) && (cY >= StartY2) && (cY <= EndY2) ) return TRUE; - cX = EndX1; cY = StartY1; /* 2er coin */ + cX = EndX1; + cY = StartY1; if( (cX >= StartX2) && (cX <= EndX2) && (cY >= StartY2) && (cY <= EndY2) ) return TRUE; - cX = EndX1; cY = EndY1; /* 3eme coin */ + cX = EndX1; + cY = EndY1; if( (cX >= StartX2) && (cX <= EndX2) && (cY >= StartY2) && (cY <= EndY2) ) return TRUE; - cX = StartX1; cY = EndY1; /* 4eme coin */ + cX = StartX1; + cY = EndY1; if( (cX >= StartX2) && (cX <= EndX2) && (cY >= StartY2) && (cY <= EndY2) ) return TRUE; - /* Tst des 4 coins du rectangle 2 */ - cX = StartX2; cY = StartY2; /* 1er coin */ + /* Test the 4 corners of the rectangle 2 */ + cX = StartX2; + cY = StartY2; if( (cX >= StartX1) && (cX <= EndX1) && (cY >= StartY1) && (cY <= EndY1) ) return TRUE; - cX = EndX2; cY = StartY2; /* 2er coin */ + cX = EndX2; + cY = StartY2; if( (cX >= StartX1) && (cX <= EndX1) && (cY >= StartY1) && (cY <= EndY1) ) return TRUE; - cX = EndX2; cY = EndY2; /* 3er coin */ + cX = EndX2; + cY = EndY2; if( (cX >= StartX1) && (cX <= EndX1) && (cY >= StartY1) && (cY <= EndY1) ) return TRUE; - cX = StartX2; cY = EndY2; /* 4er coin */ + cX = StartX2; + cY = EndY2; if( (cX >= StartX1) && (cX <= EndX1) && (cY >= StartY1) && (cY <= EndY1) ) return TRUE; - return FALSE; } -/** - * Find a PIN in a component by pin number. - * - * @param ePin_Number - pin number to locate. - * @param eComponent - schematic component object to search. - * - * @return a pointer to the located the pin, or NULL if not found - */ -LIB_PIN* LocatePinByNumber( const wxString& ePin_Number, - SCH_COMPONENT* eComponent ) -{ - LIB_COMPONENT* Entry; - LIB_PIN_LIST pinList; - int Unit, Convert; - - Entry = CMP_LIBRARY::FindLibraryComponent( eComponent->m_ChipName ); - - if( Entry == NULL ) - return NULL; - - wxASSERT( Entry->Type == ROOT ); - - Unit = eComponent->m_Multi; - Convert = eComponent->m_Convert; - - Entry->GetPins( pinList, Unit, Convert ); - - for( size_t i = 0; i < pinList.size(); i++ ) - { - wxASSERT( pinList[i]->Type() == COMPONENT_PIN_DRAW_TYPE ); - - wxString pNumber; - pinList[i]->ReturnPinStringNum( pNumber ); - - if( ePin_Number == pNumber ) - return pinList[i]; - } - - return NULL; -} - - Hierarchical_PIN_Sheet_Struct* LocateSheetLabel( DrawSheetStruct* Sheet, const wxPoint& pos ) { diff --git a/eeschema/pinedit-dialog.cpp b/eeschema/pinedit-dialog.cpp deleted file mode 100644 index 8ee5354da3..0000000000 --- a/eeschema/pinedit-dialog.cpp +++ /dev/null @@ -1,463 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: pinedit-dialog.cpp -// Purpose: -// Author: jean-pierre Charras -// Modified by: -// Created: 11/02/2006 13:30:59 -// RCS-ID: -// Copyright: License GNU -// Licence: -///////////////////////////////////////////////////////////////////////////// - -// Generated by DialogBlocks (unregistered), 11/02/2006 13:30:59 - -////@begin includes -////@end includes -#include "confirm.h" - -#include "pinedit-dialog.h" - -////@begin XPM images -////@end XPM images - -void InstallPineditFrame( WinEDA_LibeditFrame* parent, wxDC* DC, - const wxPoint & pos ) -{ - wxPoint MousePos = parent->GetScreen()->m_Curseur; - int accept = TRUE; - - if ( ( parent->GetDrawItem() == NULL ) - || ( parent->GetDrawItem()->Type() == COMPONENT_PIN_DRAW_TYPE ) ) - { - LIB_PIN* Pin = (LIB_PIN*) parent->GetDrawItem(); - WinEDA_PinPropertiesFrame dlg( parent ); - accept = dlg.ShowModal(); - - if ( !accept && Pin && ( Pin->m_Flags & IS_NEW ) ) - { - if ( parent->DrawPanel->ForceCloseManageCurseur && DC ) - parent->DrawPanel->ForceCloseManageCurseur( parent->DrawPanel, - DC ); - } - } - else - DisplayError( parent, wxT( "Error: Not a Pin!" ) ); - - parent->GetScreen()->m_Curseur = MousePos; - parent->DrawPanel->MouseToCursorSchema(); -} - -/*! - * WinEDA_PinPropertiesFrame type definition - */ - -IMPLEMENT_DYNAMIC_CLASS( WinEDA_PinPropertiesFrame, wxDialog ) - -/*! - * WinEDA_PinPropertiesFrame event table definition - */ - -BEGIN_EVENT_TABLE( WinEDA_PinPropertiesFrame, wxDialog ) - -////@begin WinEDA_PinPropertiesFrame event table entries - EVT_SPIN_UP( ID_SPINBUTTON_INC_DEC_PINSIZE, WinEDA_PinPropertiesFrame::OnSpinbuttonIncDecPinsizeUp ) - EVT_SPIN_DOWN( ID_SPINBUTTON_INC_DEC_PINSIZE, WinEDA_PinPropertiesFrame::OnSpinbuttonIncDecPinsizeDown ) - - EVT_BUTTON( wxID_CANCEL, WinEDA_PinPropertiesFrame::OnCancelClick ) - - EVT_BUTTON( wxID_OK, WinEDA_PinPropertiesFrame::OnOkClick ) - -////@end WinEDA_PinPropertiesFrame event table entries - -END_EVENT_TABLE() - -/*! - * WinEDA_PinPropertiesFrame constructors - */ - -WinEDA_PinPropertiesFrame::WinEDA_PinPropertiesFrame( ) -{ -} - -WinEDA_PinPropertiesFrame::WinEDA_PinPropertiesFrame( WinEDA_LibeditFrame* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) -{ - LIB_PIN* CurrentPin = (LIB_PIN*) parent->GetDrawItem(); - - m_Parent = parent; - if ( CurrentPin ) - { - m_Parent->InitEditOnePin(); - } - Create(parent, id, caption, pos, size, style); - - /* Init dialog pin name and pin name size values */ - SetValuesInDialog( ); -} - -/*! - * WinEDA_PinPropertiesFrame creator - */ - -bool WinEDA_PinPropertiesFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) -{ -////@begin WinEDA_PinPropertiesFrame member initialisation - m_PinNameCtrl = NULL; - m_PinNumCtrl = NULL; - m_PinSizeCtrl = NULL; - m_PinSizeIncDecButton = NULL; - m_PinSizeText = NULL; - m_CommonUnit = NULL; - m_CommonConvert = NULL; - m_NoDraw = NULL; - m_PinNameSizeText = NULL; - m_PinNameSizeCtrl = NULL; - m_PinNumSizeText = NULL; - m_PinNumSizeCtrl = NULL; - m_PinOrient = NULL; - m_btClose = NULL; - m_PinShape = NULL; - m_PinElectricalType = NULL; -////@end WinEDA_PinPropertiesFrame member initialisation - -////@begin WinEDA_PinPropertiesFrame creation - SetExtraStyle(wxWS_EX_BLOCK_EVENTS); - wxDialog::Create( parent, id, caption, pos, size, style ); - - CreateControls(); - if (GetSizer()) - { - GetSizer()->SetSizeHints(this); - } - Centre(); -////@end WinEDA_PinPropertiesFrame creation - return true; -} - -/*! - * Control creation for WinEDA_PinPropertiesFrame - */ - -void WinEDA_PinPropertiesFrame::CreateControls() -{ -////@begin WinEDA_PinPropertiesFrame content construction - // Generated by DialogBlocks, 01/05/2009 16:19:57 (unregistered) - - WinEDA_PinPropertiesFrame* itemDialog1 = this; - - wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxHORIZONTAL); - itemDialog1->SetSizer(itemBoxSizer2); - - wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxVERTICAL); - itemBoxSizer2->Add(itemBoxSizer3, 0, wxGROW|wxALL, 5); - - wxStaticText* itemStaticText4 = new wxStaticText( itemDialog1, wxID_STATIC, _("Pin Name :"), wxDefaultPosition, wxDefaultSize, 0 ); - itemBoxSizer3->Add(itemStaticText4, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); - - m_PinNameCtrl = new wxTextCtrl( itemDialog1, ID_TEXTCTRL_PINNAME, _T(""), wxDefaultPosition, wxDefaultSize, 0 ); - itemBoxSizer3->Add(m_PinNameCtrl, 0, wxGROW|wxALL, 5); - - wxStaticText* itemStaticText6 = new wxStaticText( itemDialog1, wxID_STATIC, _("Pin Num :"), wxDefaultPosition, wxDefaultSize, 0 ); - itemBoxSizer3->Add(itemStaticText6, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); - - m_PinNumCtrl = new wxTextCtrl( itemDialog1, ID_TEXTCTRL_PINNUM, _T(""), wxDefaultPosition, wxDefaultSize, 0 ); - itemBoxSizer3->Add(m_PinNumCtrl, 0, wxGROW|wxALL, 5); - - itemBoxSizer3->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); - - wxStaticBox* itemStaticBoxSizer9Static = new wxStaticBox(itemDialog1, wxID_ANY, _(" Pin Options :")); - wxStaticBoxSizer* itemStaticBoxSizer9 = new wxStaticBoxSizer(itemStaticBoxSizer9Static, wxVERTICAL); - itemBoxSizer3->Add(itemStaticBoxSizer9, 0, wxGROW|wxALL, 5); - - wxBoxSizer* itemBoxSizer10 = new wxBoxSizer(wxHORIZONTAL); - itemStaticBoxSizer9->Add(itemBoxSizer10, 0, wxGROW, 5); - - m_PinSizeCtrl = new wxTextCtrl( itemDialog1, ID_TEXTCTRL_PINSIZE, _T(""), wxDefaultPosition, wxDefaultSize, 0 ); - itemBoxSizer10->Add(m_PinSizeCtrl, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); - - m_PinSizeIncDecButton = new wxSpinButton( itemDialog1, ID_SPINBUTTON_INC_DEC_PINSIZE, wxDefaultPosition, wxDefaultSize, wxSP_VERTICAL ); - m_PinSizeIncDecButton->SetRange(0, 2000); - m_PinSizeIncDecButton->SetValue(0); - itemBoxSizer10->Add(m_PinSizeIncDecButton, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5); - - m_PinSizeText = new wxStaticText( itemDialog1, wxID_STATIC, _("Pin Lenght"), wxDefaultPosition, wxDefaultSize, 0 ); - itemStaticBoxSizer9->Add(m_PinSizeText, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); - - m_CommonUnit = new wxCheckBox( itemDialog1, ID_CHECKBOX_COMMON_UNITS, _("Common to Units"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); - m_CommonUnit->SetValue(false); - itemStaticBoxSizer9->Add(m_CommonUnit, 0, wxALIGN_LEFT|wxALL, 5); - - m_CommonConvert = new wxCheckBox( itemDialog1, ID_CHECKBOX_COMMON_CONVERT, _("Common to convert"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); - m_CommonConvert->SetValue(false); - itemStaticBoxSizer9->Add(m_CommonConvert, 0, wxALIGN_LEFT|wxALL, 5); - - m_NoDraw = new wxCheckBox( itemDialog1, ID_CHECKBOX_NOT_DRAWN, _("No Draw"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); - m_NoDraw->SetValue(false); - itemStaticBoxSizer9->Add(m_NoDraw, 0, wxALIGN_LEFT|wxALL, 5); - - wxBoxSizer* itemBoxSizer17 = new wxBoxSizer(wxVERTICAL); - itemBoxSizer2->Add(itemBoxSizer17, 0, wxGROW|wxALL, 5); - - m_PinNameSizeText = new wxStaticText( itemDialog1, wxID_STATIC, _("Size"), wxDefaultPosition, wxDefaultSize, 0 ); - itemBoxSizer17->Add(m_PinNameSizeText, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); - - m_PinNameSizeCtrl = new wxTextCtrl( itemDialog1, ID_TEXTCTRL_PINNAME_SIZE, _T(""), wxDefaultPosition, wxDefaultSize, 0 ); - itemBoxSizer17->Add(m_PinNameSizeCtrl, 0, wxALIGN_LEFT|wxALL, 5); - - m_PinNumSizeText = new wxStaticText( itemDialog1, wxID_STATIC, _("Size"), wxDefaultPosition, wxDefaultSize, 0 ); - itemBoxSizer17->Add(m_PinNumSizeText, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); - - m_PinNumSizeCtrl = new wxTextCtrl( itemDialog1, ID_TEXTCTRL_PINNUM_SIZE, _T(""), wxDefaultPosition, wxDefaultSize, 0 ); - itemBoxSizer17->Add(m_PinNumSizeCtrl, 0, wxALIGN_LEFT|wxALL, 5); - - itemBoxSizer17->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); - - wxArrayString m_PinOrientStrings; - m_PinOrientStrings.Add(_("Right")); - m_PinOrientStrings.Add(_("Left")); - m_PinOrientStrings.Add(_("Up")); - m_PinOrientStrings.Add(_("Down")); - m_PinOrient = new wxRadioBox( itemDialog1, ID_RADIOBOX, _("Pin Orient:"), wxDefaultPosition, wxDefaultSize, m_PinOrientStrings, 1, wxRA_SPECIFY_COLS ); - m_PinOrient->SetSelection(0); - itemBoxSizer17->Add(m_PinOrient, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); - - wxBoxSizer* itemBoxSizer24 = new wxBoxSizer(wxVERTICAL); - itemBoxSizer2->Add(itemBoxSizer24, 0, wxGROW|wxALL, 5); - - wxBoxSizer* itemBoxSizer25 = new wxBoxSizer(wxHORIZONTAL); - itemBoxSizer24->Add(itemBoxSizer25, 0, wxGROW|wxALL, 5); - - m_btClose = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); - itemBoxSizer25->Add(m_btClose, 0, wxGROW|wxALL, 5); - - wxButton* itemButton27 = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 ); - itemButton27->SetDefault(); - itemBoxSizer25->Add(itemButton27, 0, wxGROW|wxALL, 5); - - wxBoxSizer* itemBoxSizer28 = new wxBoxSizer(wxHORIZONTAL); - itemBoxSizer24->Add(itemBoxSizer28, 0, wxGROW|wxALL, 5); - - wxArrayString m_PinShapeStrings; - m_PinShapeStrings.Add(_("line")); - m_PinShapeStrings.Add(_("invert")); - m_PinShapeStrings.Add(_("clock")); - m_PinShapeStrings.Add(_("clock inv")); - m_PinShapeStrings.Add(_("low in")); - m_PinShapeStrings.Add(_("low clock")); - m_PinShapeStrings.Add(_("low out")); - m_PinShape = new wxRadioBox( itemDialog1, ID_RADIOBOX1, _("Pin Shape:"), wxDefaultPosition, wxDefaultSize, m_PinShapeStrings, 1, wxRA_SPECIFY_COLS ); - m_PinShape->SetSelection(0); - itemBoxSizer28->Add(m_PinShape, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); - - wxArrayString m_PinElectricalTypeStrings; - m_PinElectricalTypeStrings.Add(_("Input")); - m_PinElectricalTypeStrings.Add(_("Output")); - m_PinElectricalTypeStrings.Add(_("Bidi")); - m_PinElectricalTypeStrings.Add(_("3 States")); - m_PinElectricalTypeStrings.Add(_("Passive")); - m_PinElectricalTypeStrings.Add(_("Unspecified")); - m_PinElectricalTypeStrings.Add(_("Power In")); - m_PinElectricalTypeStrings.Add(_("Power Out")); - m_PinElectricalTypeStrings.Add(_("Open coll")); - m_PinElectricalTypeStrings.Add(_("Open emit")); - m_PinElectricalType = new wxRadioBox( itemDialog1, ID_RADIOBOX2, _("Electrical Type:"), wxDefaultPosition, wxDefaultSize, m_PinElectricalTypeStrings, 1, wxRA_SPECIFY_COLS ); - m_PinElectricalType->SetSelection(0); - itemBoxSizer28->Add(m_PinElectricalType, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); - -////@end WinEDA_PinPropertiesFrame content construction - - m_btClose->SetFocus(); -} - -/*! - * Should we show tooltips? - */ - -bool WinEDA_PinPropertiesFrame::ShowToolTips() -{ - return true; -} - -/*! - * Get bitmap resources - */ - -wxBitmap WinEDA_PinPropertiesFrame::GetBitmapResource( const wxString& name ) -{ - // Bitmap retrieval -////@begin WinEDA_PinPropertiesFrame bitmap retrieval - wxUnusedVar(name); - return wxNullBitmap; -////@end WinEDA_PinPropertiesFrame bitmap retrieval -} - -/*! - * Get icon resources - */ - -wxIcon WinEDA_PinPropertiesFrame::GetIconResource( const wxString& name ) -{ - // Icon retrieval -////@begin WinEDA_PinPropertiesFrame icon retrieval - wxUnusedVar(name); - return wxNullIcon; -////@end WinEDA_PinPropertiesFrame icon retrieval -} -/*! - * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK - */ - -void WinEDA_PinPropertiesFrame::OnOkClick( wxCommandEvent& event ) -{ - PinPropertiesAccept(event); - EndModal(1); -} - -/*! - * wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL - */ - -void WinEDA_PinPropertiesFrame::OnCancelClick( wxCommandEvent& event ) -{ - EndModal(0); -} - -/*******************************************************/ -void WinEDA_PinPropertiesFrame::SetValuesInDialog(void) -/*******************************************************/ -{ - wxString number; - LIB_PIN* CurrentPin = (LIB_PIN*) m_Parent->GetDrawItem(); - wxString msg; - int tmp, ii; - - // Init values and texts for pin name: - if ( CurrentPin ) msg = CurrentPin->m_PinName; - else msg = wxEmptyString; - m_PinNameCtrl->SetValue(msg); - tmp = CurrentPin ? CurrentPin->m_PinNameSize : LastPinNameSize; - msg = ReturnStringFromValue(g_UnitMetric, tmp, m_Parent->m_InternalUnits); - m_PinNameSizeCtrl->SetValue(msg); - msg = m_PinNameSizeText->GetLabel() + ReturnUnitSymbol(); - m_PinNameSizeText->SetLabel(msg); - - /* Init dialog pin num and pin num size values */ - if ( CurrentPin ) CurrentPin->ReturnPinStringNum(msg); - else msg = wxEmptyString; - m_PinNumCtrl->SetValue(msg); - tmp = CurrentPin ? CurrentPin->m_PinNumSize : LastPinNumSize; - msg = ReturnStringFromValue(g_UnitMetric, tmp, m_Parent->m_InternalUnits); - m_PinNumSizeCtrl->SetValue(msg); - msg = m_PinNumSizeText->GetLabel() + ReturnUnitSymbol(); - m_PinNumSizeText->SetLabel(msg); - - /* init dialog pin size */ - msg = m_PinSizeText->GetLabel() + ReturnUnitSymbol(); - m_PinSizeText->SetLabel(msg); - - int pinsize = CurrentPin ? CurrentPin->m_PinLen : LastPinSize; - msg = ReturnStringFromValue(g_UnitMetric, pinsize, m_Parent->m_InternalUnits); - m_PinSizeCtrl->SetValue(msg); - m_PinSizeIncDecButton->SetValue(pinsize); - - /* init pin options */ - if ( CurrentPin ) - { - if ( CurrentPin->m_Unit == 0 ) m_CommonUnit->SetValue(TRUE); - } - else m_CommonUnit->SetValue(LastPinCommonUnit); - if ( CurrentPin ) - { - if ( CurrentPin->m_Convert == 0 ) m_CommonConvert->SetValue(TRUE); - } - else m_CommonConvert->SetValue(LastPinCommonConvert); - if ( CurrentPin ) - { - if ( CurrentPin->m_Attributs & PINNOTDRAW ) m_NoDraw->SetValue(TRUE); - } - else m_NoDraw->SetValue(LastPinNoDraw); - - tmp = CurrentPin ? CurrentPin->m_Orient : LastPinOrient; - switch ( tmp ) - { - case PIN_RIGHT: - m_PinOrient->SetSelection(0); - break; - - case PIN_LEFT: - m_PinOrient->SetSelection(1); - break; - - case PIN_UP: - m_PinOrient->SetSelection(2); - break; - - case PIN_DOWN: - m_PinOrient->SetSelection(3); - break; - } - - tmp = CurrentPin ? CurrentPin->m_PinShape : LastPinShape; - m_PinShape->SetSelection( 0 ); - for ( ii = 0; ii < NBSHAPES; ii++ ) - { - if ( CodeShape[ii] == tmp ) - { - m_PinShape->SetSelection( ii ); break ; - } - } - - tmp = CurrentPin ? CurrentPin->m_PinShape : LastPinShape; - m_PinShape->SetSelection( 0 ); - for ( ii = 0; ii < NBSHAPES; ii++ ) - { - if ( CodeShape[ii] == tmp ) - { - m_PinShape->SetSelection( ii ); break ; - } - } - - m_PinElectricalType->SetSelection( CurrentPin ? CurrentPin->m_PinType : LastPinType); -} - - -/*! - * wxEVT_SCROLL_LINEUP event handler for ID_SPINBUTTON_INC_DEC_PINSIZE - */ - -void WinEDA_PinPropertiesFrame::OnSpinbuttonIncDecPinsizeUp( wxSpinEvent& event ) -{ -int pinsize; -wxString msg; - - // Get the new value, which can be edited by hand, so the value can not match the spin button value - msg = m_PinSizeCtrl->GetValue(); - pinsize = ReturnValueFromString( g_UnitMetric, msg, m_Parent->m_InternalUnits ); - pinsize += 10; - if ( pinsize < 0 ) pinsize = 0; - if ( pinsize > 2000 ) pinsize = 2000; - msg = ReturnStringFromValue(g_UnitMetric, pinsize, m_Parent->m_InternalUnits); - m_PinSizeCtrl->SetValue(msg); - m_PinSizeIncDecButton->SetValue(pinsize); -} - - -/*! - * wxEVT_SCROLL_LINEDOWN event handler for ID_SPINBUTTON_INC_DEC_PINSIZE - */ - -void WinEDA_PinPropertiesFrame::OnSpinbuttonIncDecPinsizeDown( wxSpinEvent& event ) -{ -int pinsize; -wxString msg; - - // Get the new value, which can be edited by hand, so the value can not match the spin button value - msg = m_PinSizeCtrl->GetValue(); - pinsize = ReturnValueFromString( g_UnitMetric, msg, m_Parent->m_InternalUnits ); - pinsize -= 10; - if ( pinsize < 0 ) pinsize = 0; - if ( pinsize > 2000 ) pinsize = 2000; - msg = ReturnStringFromValue(g_UnitMetric, pinsize, m_Parent->m_InternalUnits); - m_PinSizeCtrl->SetValue(msg); - m_PinSizeIncDecButton->SetValue(pinsize); -} - diff --git a/eeschema/pinedit-dialog.h b/eeschema/pinedit-dialog.h deleted file mode 100644 index ec444439b5..0000000000 --- a/eeschema/pinedit-dialog.h +++ /dev/null @@ -1,161 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: pinedit-dialog.h -// Purpose: -// Author: jean-pierre Charras -// Modified by: -// Created: 11/02/2006 13:30:59 -// RCS-ID: -// Copyright: License GNU -// Licence: -///////////////////////////////////////////////////////////////////////////// - -// Generated by DialogBlocks (unregistered), 11/02/2006 13:30:59 - -#ifndef _PINEDIT_DIALOG_H_ -#define _PINEDIT_DIALOG_H_ - -/* #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) */ -/* #pragma interface "pinedit-dialog.h" */ -/* #endif */ - -/*! - * Includes - */ -#include "fctsys.h" -#include "gr_basic.h" -#include "class_drawpanel.h" - -#include "common.h" -#include "program.h" -#include "general.h" -#include "eeschema_id.h" -#include "libeditfrm.h" -#include "protos.h" - -////@begin includes -#include "wx/spinbutt.h" -////@end includes - -/*! - * Forward declarations - */ - -////@begin forward declarations -class wxSpinButton; -////@end forward declarations - -/*! - * Control identifiers - */ - -////@begin control identifiers -#define ID_DIALOG 10000 -#define ID_TEXTCTRL_PINNAME 10001 -#define ID_TEXTCTRL_PINNUM 10002 -#define ID_TEXTCTRL_PINSIZE 10003 -#define ID_SPINBUTTON_INC_DEC_PINSIZE 10010 -#define ID_CHECKBOX_COMMON_UNITS 10004 -#define ID_CHECKBOX_COMMON_CONVERT 10005 -#define ID_CHECKBOX_NOT_DRAWN 10006 -#define ID_TEXTCTRL_PINNAME_SIZE 10007 -#define ID_TEXTCTRL_PINNUM_SIZE 10008 -#define ID_RADIOBOX 10009 -#define ID_RADIOBOX1 10012 -#define ID_RADIOBOX2 10013 -#define SYMBOL_WINEDA_PINPROPERTIESFRAME_STYLE wxCAPTION|wxSYSTEM_MENU|wxCLOSE_BOX|MAYBE_RESIZE_BORDER -#define SYMBOL_WINEDA_PINPROPERTIESFRAME_TITLE _("Pin properties") -#define SYMBOL_WINEDA_PINPROPERTIESFRAME_IDNAME ID_DIALOG -#define SYMBOL_WINEDA_PINPROPERTIESFRAME_SIZE wxSize(400, 300) -#define SYMBOL_WINEDA_PINPROPERTIESFRAME_POSITION wxDefaultPosition -////@end control identifiers - -/*! - * Compatibility - */ - -#ifndef wxCLOSE_BOX -#define wxCLOSE_BOX 0x1000 -#endif - -/*! - * WinEDA_PinPropertiesFrame class declaration - */ - -class WinEDA_PinPropertiesFrame: public wxDialog -{ - DECLARE_DYNAMIC_CLASS( WinEDA_PinPropertiesFrame ) - DECLARE_EVENT_TABLE() - -public: - /// Constructors - WinEDA_PinPropertiesFrame( ); - WinEDA_PinPropertiesFrame( WinEDA_LibeditFrame* parent, wxWindowID id = SYMBOL_WINEDA_PINPROPERTIESFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_PINPROPERTIESFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_PINPROPERTIESFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_PINPROPERTIESFRAME_SIZE, long style = SYMBOL_WINEDA_PINPROPERTIESFRAME_STYLE ); - - /// Creation - bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WINEDA_PINPROPERTIESFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_PINPROPERTIESFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_PINPROPERTIESFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_PINPROPERTIESFRAME_SIZE, long style = SYMBOL_WINEDA_PINPROPERTIESFRAME_STYLE ); - - /// Creates the controls and sizers - void CreateControls(); - -////@begin WinEDA_PinPropertiesFrame event handler declarations - - /// wxEVT_SCROLL_LINEUP event handler for ID_SPINBUTTON_INC_DEC_PINSIZE - void OnSpinbuttonIncDecPinsizeUp( wxSpinEvent& event ); - - /// wxEVT_SCROLL_LINEDOWN event handler for ID_SPINBUTTON_INC_DEC_PINSIZE - void OnSpinbuttonIncDecPinsizeDown( wxSpinEvent& event ); - - /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL - void OnCancelClick( wxCommandEvent& event ); - - /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK - void OnOkClick( wxCommandEvent& event ); - -////@end WinEDA_PinPropertiesFrame event handler declarations - -////@begin WinEDA_PinPropertiesFrame member function declarations - - /// Retrieves bitmap resources - wxBitmap GetBitmapResource( const wxString& name ); - - /// Retrieves icon resources - wxIcon GetIconResource( const wxString& name ); -////@end WinEDA_PinPropertiesFrame member function declarations - - /// Should we show tooltips? - static bool ShowToolTips(); - - void SetValuesInDialog(void); - void PinPropertiesAccept(wxCommandEvent& event); - void SetPinName(const wxString & newname, int newsize); - void SetPinNum(const wxString & newnum, int newsize); - void NewSizePin(int newsize); - void SetPinShape( int newshape); - void SetPinType(int newtype); - void SetPinOrientation(int neworient); - void SetPinAttributes(bool draw, bool unit, bool convert); - -////@begin WinEDA_PinPropertiesFrame member variables - wxTextCtrl* m_PinNameCtrl; - wxTextCtrl* m_PinNumCtrl; - wxTextCtrl* m_PinSizeCtrl; - wxSpinButton* m_PinSizeIncDecButton; - wxStaticText* m_PinSizeText; - wxCheckBox* m_CommonUnit; - wxCheckBox* m_CommonConvert; - wxCheckBox* m_NoDraw; - wxStaticText* m_PinNameSizeText; - wxTextCtrl* m_PinNameSizeCtrl; - wxStaticText* m_PinNumSizeText; - wxTextCtrl* m_PinNumSizeCtrl; - wxRadioBox* m_PinOrient; - wxButton* m_btClose; - wxRadioBox* m_PinShape; - wxRadioBox* m_PinElectricalType; -////@end WinEDA_PinPropertiesFrame member variables - - WinEDA_LibeditFrame * m_Parent; -}; - -#endif - // _PINEDIT_DIALOG_H_ diff --git a/eeschema/pinedit-dialog.pjd b/eeschema/pinedit-dialog.pjd deleted file mode 100644 index c38b57d585..0000000000 --- a/eeschema/pinedit-dialog.pjd +++ /dev/null @@ -1,1937 +0,0 @@ - - -
- 0 - "" - "" - "" - "" - "" - 0 - 0 - 0 - 1 - 1 - 1 - 1 - 0 - "jean-pierre Charras" - "License GNU" - "" - 0 - 0 - 0 - "<All platforms>" - "<Any>" - "///////////////////////////////////////////////////////////////////////////// -// Name: %HEADER-FILENAME% -// Purpose: -// Author: %AUTHOR% -// Modified by: -// Created: %DATE% -// RCS-ID: -// Copyright: %COPYRIGHT% -// Licence: -///////////////////////////////////////////////////////////////////////////// - -" - "///////////////////////////////////////////////////////////////////////////// -// Name: %SOURCE-FILENAME% -// Purpose: -// Author: %AUTHOR% -// Modified by: -// Created: %DATE% -// RCS-ID: -// Copyright: %COPYRIGHT% -// Licence: -///////////////////////////////////////////////////////////////////////////// - -" - "///////////////////////////////////////////////////////////////////////////// -// Name: %SYMBOLS-FILENAME% -// Purpose: Symbols file -// Author: %AUTHOR% -// Modified by: -// Created: %DATE% -// RCS-ID: -// Copyright: %COPYRIGHT% -// Licence: -///////////////////////////////////////////////////////////////////////////// - -" - "#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma interface "%HEADER-FILENAME%" -#endif - -" - "#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma implementation "%HEADER-FILENAME%" -#endif - -// For compilers that support precompilation, includes "wx/wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -#ifndef WX_PRECOMP -#include "wx/wx.h" -#endif - -" - " /// %BODY% -" - " -/*! - * %BODY% - */ - -" - "app_resources.h" - "app_resources.cpp" - "AppResources" - "app.h" - "app.cpp" - "Application" - 0 - "" - "<None>" - "<System>" - "utf-8" - "<System>" - "" - 0 - 0 - 4 - " " - "" - 0 - 0 - 1 - 0 - 1 - 1 - 0 - 1 - 0 - 0 -
- - - "" - "data-document" - "" - "" - 0 - 1 - 0 - 0 - - "Configurations" - "config-data-document" - "" - "" - 0 - 1 - 0 - 0 - "" - 1 - -8519680 - "" - "Debug" - "ANSI" - "Static" - "Modular" - "GUI" - "wxMSW" - "Dynamic" - "Yes" - "No" - "No" - "%WXVERSION%" - "%EXECUTABLE%" - "" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - "%AUTO%" - 0 - 1 - "" - - - - - - - "Projects" - "root-document" - "" - "project" - 1 - 1 - 0 - 1 - - "Windows" - "html-document" - "" - "dialogsfolder" - 1 - 1 - 0 - 1 - - "Pin properties" - "dialog-document" - "" - "dialog" - 0 - 1 - 0 - 0 - "11/5/2006" - "wbDialogProxy" - 10000 - 0 - "" - 0 - "" - 0 - 0 - "ID_DIALOG" - 10000 - "WinEDA_PinPropertiesFrame" - "wxDialog" - "wxDialog" - "pinedit-dialog.cpp" - "pinedit-dialog.h" - "" - "Pin properties" - 1 - "" - 0 - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - "" - "" - "" - "" - "" - "" - "Tiled" - 0 - 1 - 0 - 1 - 0 - 0 - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 1 - 0 - "MAYBE_RESIZE_BORDER" - 0 - 1 - -1 - -1 - 400 - 300 - 0 - "" - - "wxBoxSizer H" - "dialog-control-document" - "" - "sizer" - 0 - 1 - 0 - 0 - "wbBoxSizerProxy" - "Horizontal" - "" - 0 - 0 - 0 - "<Any platform>" - - "wxBoxSizer V" - "dialog-control-document" - "" - "sizer" - 0 - 1 - 0 - 0 - "11/5/2006" - "wbBoxSizerProxy" - "Vertical" - "" - "Centre" - "Expand" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "<Any platform>" - - "wxStaticText: wxID_STATIC" - "dialog-control-document" - "" - "statictext" - 0 - 1 - 0 - 0 - "11/5/2006" - "wbStaticTextProxy" - "wxID_STATIC" - 5105 - "" - "wxStaticText" - "wxStaticText" - 1 - 0 - "" - "" - "" - "Pin Name :" - -1 - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - "" - "" - "" - "" - "" - "" - "" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Left" - "Centre" - 0 - 5 - 1 - 1 - 1 - 0 - 0 - 1 - 0 - "" - "" - - - "wxTextCtrl: ID_TEXTCTRL_PINNAME" - "dialog-control-document" - "" - "textctrl" - 0 - 1 - 0 - 0 - "11/5/2006" - "wbTextCtrlProxy" - "ID_TEXTCTRL_PINNAME" - 10001 - "" - "wxTextCtrl" - "wxTextCtrl" - 1 - 0 - "" - "" - "m_PinNameCtrl" - "" - 0 - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - "" - "" - "" - "" - "" - "" - "" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Expand" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - "wxStaticText: wxID_STATIC" - "dialog-control-document" - "" - "statictext" - 0 - 1 - 0 - 0 - "11/5/2006" - "wbStaticTextProxy" - "wxID_STATIC" - 5105 - "" - "wxStaticText" - "wxStaticText" - 1 - 0 - "" - "" - "" - "Pin Num :" - -1 - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - "" - "" - "" - "" - "" - "" - "" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Left" - "Centre" - 0 - 5 - 1 - 1 - 1 - 0 - 0 - 1 - 0 - "" - "" - - - "wxTextCtrl: ID_TEXTCTRL_PINNUM" - "dialog-control-document" - "" - "textctrl" - 0 - 1 - 0 - 0 - "11/5/2006" - "wbTextCtrlProxy" - "ID_TEXTCTRL_PINNUM" - 10002 - "" - "wxTextCtrl" - "wxTextCtrl" - 1 - 0 - "" - "" - "m_PinNumCtrl" - "" - 0 - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - "" - "" - "" - "" - "" - "" - "" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Expand" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - "Spacer" - "dialog-control-document" - "" - "spacer" - 0 - 1 - 0 - 0 - "11/5/2006" - "wbSpacerProxy" - 5 - 5 - "Centre" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "<Any platform>" - - - "wxStaticBoxSizer V" - "dialog-control-document" - "" - "sizer" - 0 - 1 - 0 - 0 - "11/5/2006" - "wbStaticBoxSizerProxy" - "wxID_ANY" - "-1" - " Pin Options :" - "" - "" - "" - "" - 0 - 1 - "wxStaticBox" - "Vertical" - "Expand" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "<Any platform>" - - "wxBoxSizer H" - "dialog-control-document" - "" - "sizer" - 0 - 1 - 0 - 0 - "11/8/2008" - "wbBoxSizerProxy" - "Horizontal" - "" - "Expand" - "Centre" - 0 - 5 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "<Any platform>" - - "wxTextCtrl: ID_TEXTCTRL_PINSIZE" - "dialog-control-document" - "" - "textctrl" - 0 - 1 - 0 - 0 - "11/8/2008" - "wbTextCtrlProxy" - "ID_TEXTCTRL_PINSIZE" - 10003 - "" - "wxTextCtrl" - "wxTextCtrl" - 1 - 0 - "" - "" - "m_PinSizeCtrl" - "" - 0 - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - "" - "" - "" - "" - "" - "" - "" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Centre" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - "wxSpinButton: ID_SPINBUTTON_INC_DEC_PINSIZE" - "dialog-control-document" - "" - "spinctrl" - 0 - 1 - 0 - 0 - "11/8/2008" - "wbSpinButtonProxy" - "wxEVT_SCROLL_LINEUP|OnSpinbuttonIncDecPinsizeUp|NONE||WinEDA_PinPropertiesFrame" - "wxEVT_SCROLL_LINEDOWN|OnSpinbuttonIncDecPinsizeDown|NONE||" - "ID_SPINBUTTON_INC_DEC_PINSIZE" - 10010 - "" - "wxSpinButton" - "wxSpinButton" - 1 - 0 - "" - "" - "m_PinSizeIncDecButton" - 0 - 2000 - 0 - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - "" - "" - "" - "" - "" - "" - "" - 0 - 1 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Centre" - "Centre" - 0 - 5 - 0 - 1 - 0 - 0 - 0 - 0 - 0 - "" - "" - - - - "wxStaticText: wxID_STATIC" - "dialog-control-document" - "" - "statictext" - 0 - 1 - 0 - 0 - "11/8/2008" - "wbStaticTextProxy" - "wxID_STATIC" - 5105 - "" - "wxStaticText" - "wxStaticText" - 1 - 0 - "" - "" - "m_PinSizeText" - "Pin Lenght" - -1 - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - "" - "" - "" - "" - "" - "" - "" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Left" - "Centre" - 0 - 5 - 1 - 1 - 1 - 0 - 0 - 1 - 0 - "" - "" - - - "wxCheckBox: ID_CHECKBOX_COMMON_UNITS" - "dialog-control-document" - "" - "checkbox" - 0 - 1 - 0 - 0 - "11/5/2006" - "wbCheckBoxProxy" - "ID_CHECKBOX_COMMON_UNITS" - 10004 - "" - "wxCheckBox" - "wxCheckBox" - 1 - 0 - "" - "" - "m_CommonUnit" - "Common to Units" - 0 - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - 0 - 1 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Left" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - "wxCheckBox: ID_CHECKBOX_COMMON_CONVERT" - "dialog-control-document" - "" - "checkbox" - 0 - 1 - 0 - 0 - "11/5/2006" - "wbCheckBoxProxy" - "ID_CHECKBOX_COMMON_CONVERT" - 10005 - "" - "wxCheckBox" - "wxCheckBox" - 1 - 0 - "" - "" - "m_CommonConvert" - "Common to convert" - 0 - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - 0 - 1 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Left" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - "wxCheckBox: ID_CHECKBOX_NOT_DRAWN" - "dialog-control-document" - "" - "checkbox" - 0 - 1 - 0 - 0 - "11/5/2006" - "wbCheckBoxProxy" - "ID_CHECKBOX_NOT_DRAWN" - 10006 - "" - "wxCheckBox" - "wxCheckBox" - 1 - 0 - "" - "" - "m_NoDraw" - "No Draw" - 0 - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - 0 - 1 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Left" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - - - "wxBoxSizer V" - "dialog-control-document" - "" - "sizer" - 0 - 1 - 0 - 0 - "11/5/2006" - "wbBoxSizerProxy" - "Vertical" - "" - "Centre" - "Expand" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "<Any platform>" - - "wxStaticText: wxID_STATIC" - "dialog-control-document" - "" - "statictext" - 0 - 1 - 0 - 0 - "11/5/2006" - "wbStaticTextProxy" - "wxID_STATIC" - 5105 - "" - "wxStaticText" - "wxStaticText" - 1 - 0 - "" - "" - "m_PinNameSizeText" - "Size" - -1 - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - "" - "" - "" - "" - "" - "" - "" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Left" - "Centre" - 0 - 5 - 1 - 1 - 1 - 0 - 0 - 1 - 0 - "" - "" - - - "wxTextCtrl: ID_TEXTCTRL_PINNAME_SIZE" - "dialog-control-document" - "" - "textctrl" - 0 - 1 - 0 - 0 - "11/5/2006" - "wbTextCtrlProxy" - "ID_TEXTCTRL_PINNAME_SIZE" - 10007 - "" - "wxTextCtrl" - "wxTextCtrl" - 1 - 0 - "" - "" - "m_PinNameSizeCtrl" - "" - 0 - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - "" - "" - "" - "" - "" - "" - "" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Left" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - "wxStaticText: wxID_STATIC" - "dialog-control-document" - "" - "statictext" - 0 - 1 - 0 - 0 - "11/5/2006" - "wbStaticTextProxy" - "wxID_STATIC" - 5105 - "" - "wxStaticText" - "wxStaticText" - 1 - 0 - "" - "" - "m_PinNumSizeText" - "Size" - -1 - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - "" - "" - "" - "" - "" - "" - "" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Left" - "Centre" - 0 - 5 - 1 - 1 - 1 - 0 - 0 - 1 - 0 - "" - "" - - - "wxTextCtrl: ID_TEXTCTRL_PINNUM_SIZE" - "dialog-control-document" - "" - "textctrl" - 0 - 1 - 0 - 0 - "11/5/2006" - "wbTextCtrlProxy" - "ID_TEXTCTRL_PINNUM_SIZE" - 10008 - "" - "wxTextCtrl" - "wxTextCtrl" - 1 - 0 - "" - "" - "m_PinNumSizeCtrl" - "" - 0 - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - "" - "" - "" - "" - "" - "" - "" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Left" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - "Spacer" - "dialog-control-document" - "" - "spacer" - 0 - 1 - 0 - 0 - "11/5/2006" - "wbSpacerProxy" - 5 - 5 - "Centre" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "<Any platform>" - - - "wxRadioBox: ID_RADIOBOX" - "dialog-control-document" - "" - "radiobox" - 0 - 1 - 0 - 0 - "11/5/2006" - "wbRadioBoxProxy" - "ID_RADIOBOX" - 10009 - "" - "wxRadioBox" - "wxRadioBox" - 1 - 0 - "" - "" - "m_PinOrient" - "Pin Orient:" - 1 - "Right|Left|Up|Down" - 0 - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - "" - "" - "" - "" - "" - "" - "" - 0 - 1 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Centre" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - - "wxBoxSizer V" - "dialog-control-document" - "" - "sizer" - 0 - 1 - 0 - 0 - "11/5/2006" - "wbBoxSizerProxy" - "Vertical" - "" - "Centre" - "Expand" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "<Any platform>" - - "wxBoxSizer H" - "dialog-control-document" - "" - "sizer" - 0 - 1 - 0 - 0 - "11/5/2006" - "wbBoxSizerProxy" - "Horizontal" - "" - "Expand" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "<Any platform>" - - "wxButton: wxID_CANCEL" - "dialog-control-document" - "" - "dialogcontrol" - 0 - 1 - 0 - 0 - "20/2/2007" - "wbButtonProxy" - "wxEVT_COMMAND_BUTTON_CLICKED|OnCancelClick|||WinEDA_PinPropertiesFrame" - "wxID_CANCEL" - 5101 - "" - "wxButton" - "wxButton" - 1 - 0 - "" - "" - "m_btClose" - "&Cancel" - 0 - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Centre" - "Expand" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - "wxButton: wxID_OK" - "dialog-control-document" - "" - "dialogcontrol" - 0 - 1 - 0 - 0 - "11/5/2006" - "wbButtonProxy" - "wxEVT_COMMAND_BUTTON_CLICKED|OnOkClick" - "wxID_OK" - 5100 - "" - "wxButton" - "wxButton" - 1 - 0 - "" - "" - "" - "&OK" - 1 - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Centre" - "Expand" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - - "wxBoxSizer H" - "dialog-control-document" - "" - "sizer" - 0 - 1 - 0 - 0 - "11/5/2006" - "wbBoxSizerProxy" - "Horizontal" - "" - "Expand" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "<Any platform>" - - "wxRadioBox: ID_RADIOBOX1" - "dialog-control-document" - "" - "radiobox" - 0 - 1 - 0 - 0 - "11/5/2006" - "wbRadioBoxProxy" - "ID_RADIOBOX1" - 10012 - "" - "wxRadioBox" - "wxRadioBox" - 1 - 0 - "" - "" - "m_PinShape" - "Pin Shape:" - 1 - "line|invert|clock|clock inv|low in|low clock|low out" - 0 - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - "" - "" - "" - "" - "" - "" - "" - 0 - 1 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Centre" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - "wxRadioBox: ID_RADIOBOX2" - "dialog-control-document" - "" - "radiobox" - 0 - 1 - 0 - 0 - "11/5/2006" - "wbRadioBoxProxy" - "ID_RADIOBOX2" - 10013 - "" - "wxRadioBox" - "wxRadioBox" - 1 - 0 - "" - "" - "m_PinElectricalType" - "Electrical Type:" - 1 - "Input|Output|Bidi|3 States|Passive|Unspecified|Power In|Power Out|Open coll|Open emit" - 0 - "" - "" - "" - "" - "" - 0 - 1 - "<Any platform>" - "" - "" - "" - "" - "" - "" - "" - 0 - 1 - 0 - 0 - 0 - "" - -1 - -1 - -1 - -1 - "Centre" - "Centre" - 0 - 5 - 1 - 1 - 1 - 1 - 0 - 0 - 0 - "" - "" - - - - - - - - "Sources" - "html-document" - "" - "sourcesfolder" - 1 - 1 - 0 - 1 - - "pinedit-dialog.rc" - "source-editor-document" - "pinedit-dialog.rc" - "source-editor" - 0 - 0 - 1 - 0 - "11/5/2006" - "" - - - - "Images" - "html-document" - "" - "bitmapsfolder" - 1 - 1 - 0 - 1 - - - - -
diff --git a/eeschema/pinedit-dialog.rc b/eeschema/pinedit-dialog.rc deleted file mode 100644 index b86c4e2265..0000000000 --- a/eeschema/pinedit-dialog.rc +++ /dev/null @@ -1 +0,0 @@ -#include "wx/msw/wx.rc" diff --git a/eeschema/pinedit.cpp b/eeschema/pinedit.cpp index 31c413b9fd..500177ef2e 100644 --- a/eeschema/pinedit.cpp +++ b/eeschema/pinedit.cpp @@ -3,151 +3,121 @@ /***************************/ #include "fctsys.h" +#include "common.h" +#include "gr_basic.h" +#include "class_drawpanel.h" +#include "confirm.h" #include "program.h" #include "libeditfrm.h" #include "eeschema_id.h" #include "class_libentry.h" +#include "general.h" +#include "protos.h" -#include "pinedit-dialog.h" #include "dialog_display_info_HTML_base.h" - -static int CodeOrient[4] = -{ - PIN_RIGHT, - PIN_LEFT, - PIN_UP, - PIN_DOWN -}; - -#define NBSHAPES 7 -static wxString shape_list[NBSHAPES] = -{ - _( "line" ), _( "invert" ), _( "clock" ), _( "clock inv" ), - _( "low in" ), _( "low clock" ), _( "low out" ) -}; - -int CodeShape[NBSHAPES] = -{ - NONE, INVERT, CLOCK, CLOCK | INVERT, LOWLEVEL_IN, LOWLEVEL_IN | CLOCK, - LOWLEVEL_OUT -}; +#include "dialog_lib_edit_pin.h" -/* Routines locales */ static void CreateImagePins( LIB_PIN* Pin, int unit, int convert, bool asDeMorgan ); static void AbortPinMove( WinEDA_DrawPanel* Panel, wxDC* DC ); static void DrawMovePin( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); -/* Variables importees */ -/* Variables locales */ -static wxPoint OldPos, PinPreviousPos; -static int LastPinType = PIN_INPUT, - LastPinOrient = PIN_RIGHT, - LastPinShape = NONE, - LastPinSize = 300, - LastPinNameSize = 50, - LastPinNumSize = 50, - LastPinCommonConvert = false, - LastPinCommonUnit = false, - LastPinNoDraw = false; +static wxPoint OldPos; +static wxPoint PinPreviousPos; +static int LastPinType = PIN_INPUT; +static int LastPinOrient = PIN_RIGHT; +static int LastPinShape = NONE; +static int LastPinLength = 300; +static int LastPinNameSize = 50; +static int LastPinNumSize = 50; +static bool LastPinCommonConvert = false; +static bool LastPinCommonUnit = false; +static bool LastPinVisible = true; -#include "pinedit-dialog.cpp" - -/*************************************************************************/ -void WinEDA_PinPropertiesFrame::PinPropertiesAccept( wxCommandEvent& event ) -/*************************************************************************/ - -/* Met a jour les differents parametres pour le composant en cours d'�dition - */ +void WinEDA_LibeditFrame::OnEditPin( wxCommandEvent& event ) { - wxString msg; - - LastPinType = m_PinElectricalType->GetSelection(); - LastPinShape = CodeShape[m_PinShape->GetSelection()]; - LastPinOrient = CodeOrient[m_PinOrient->GetSelection()]; - LastPinCommonConvert = m_CommonConvert->GetValue(); - LastPinCommonUnit = m_CommonUnit->GetValue(); - LastPinNoDraw = m_NoDraw->GetValue(); - - msg = m_PinSizeCtrl->GetValue(); - LastPinSize = ReturnValueFromString( g_UnitMetric, msg, - m_Parent->m_InternalUnits ); - - msg = m_PinNameSizeCtrl->GetValue(); - LastPinNameSize = ReturnValueFromString( g_UnitMetric, msg, - m_Parent->m_InternalUnits ); - - msg = m_PinNumSizeCtrl->GetValue(); - LastPinNumSize = ReturnValueFromString( g_UnitMetric, msg, - m_Parent->m_InternalUnits ); - - LIB_DRAW_ITEM* item = m_Parent->GetDrawItem(); - - if( item == NULL ) + if( m_drawItem == NULL || m_drawItem->Type() != COMPONENT_PIN_DRAW_TYPE ) return; - if( !( item->m_Flags & IS_NEW ) ) // if IS_NEW, copy for undo is done before place - m_Parent->SaveCopyInUndoList( item->GetParent() ); + LIB_PIN* pin = (LIB_PIN*) m_drawItem; - SetPinName( m_PinNameCtrl->GetValue(), LastPinNameSize ); - msg = m_PinNumCtrl->GetValue(); + DIALOG_LIB_EDIT_PIN dlg( this ); - if( msg.IsEmpty() ) - msg = wxT( "~" ); + wxString units = GetUnitsLabel( g_UnitMetric ); + dlg.SetOrientationList( LIB_PIN::GetOrientationNames() ); + dlg.SetOrientation( LIB_PIN::GetOrientationCodeIndex( pin->m_Orient ) ); + dlg.SetStyleList( LIB_PIN::GetStyleNames() ); + dlg.SetStyle( LIB_PIN::GetStyleCodeIndex( pin->m_PinShape ) ); + dlg.SetElectricalTypeList( LIB_PIN::GetElectricalTypeNames() ); + dlg.SetElectricalType( pin->m_PinType ); + dlg.SetName( pin->m_PinName ); + dlg.SetNameTextSize( ReturnStringFromValue( g_UnitMetric, + pin->m_PinNameSize, + m_InternalUnits ) ); + dlg.SetNameTextSizeUnits( units ); + dlg.SetNumber( pin->GetNumber() ); + dlg.SetNumberTextSize( ReturnStringFromValue( g_UnitMetric, + pin->m_PinNumSize, + m_InternalUnits ) ); + dlg.SetNumberTextSizeUnits( units ); + dlg.SetLength( ReturnStringFromValue( g_UnitMetric, pin->m_PinLen, + m_InternalUnits ) ); + dlg.SetLengthUnits( units ); + dlg.SetAddToAllParts( pin->m_Unit == 0 ); + dlg.SetAddToAllBodyStyles( pin->m_Convert == 0 ); + dlg.SetVisible( pin->IsVisible() ); - SetPinNum( msg, LastPinNumSize ); - NewSizePin( LastPinSize ); - SetPinShape( LastPinShape ); - SetPinType( LastPinType ); - SetPinOrientation( LastPinOrient ); - - // Set all attributes (visibility, common to units and common to - // convert options) - SetPinAttributes( true, true, true ); - item->DisplayInfo( m_Parent ); - - m_Parent->DrawPanel->Refresh(); -} - - -/* - * Called when installing the edit pin dialog frame - * Set pins flags (.m_Flags pins member) to ensure a correctins edition: - * If 2 or more pins are on the same location (and the same orientation) they - * are all moved or resized. - * This is usefull for components which have more than one part per package - * In this case all parts can be edited at once. - * Note: if the option "Edit Pin per Pin" (tool of the main toolbar) is - * activated, only the current part is edited. - */ -void WinEDA_LibeditFrame::InitEditOnePin() -{ - LIB_PIN* Pin; - LIB_PIN* CurrentPin = (LIB_PIN*) m_drawItem; - - if( m_component == NULL || CurrentPin == NULL - || m_drawItem->Type() != COMPONENT_PIN_DRAW_TYPE ) - return; - - for( Pin = m_component->GetNextPin(); Pin != NULL; - Pin = m_component->GetNextPin( Pin ) ) + if( dlg.ShowModal() == wxID_CANCEL ) { - if( Pin == CurrentPin ) - continue; - if( ( Pin->m_Pos == CurrentPin->m_Pos ) - && ( Pin->m_Orient == CurrentPin->m_Orient ) - && ( !( CurrentPin->m_Flags & IS_NEW ) ) - && ( g_EditPinByPinIsOn == false ) ) - Pin->m_Flags |= IS_LINKED | IN_EDIT; - else - Pin->m_Flags = 0; + if( pin->IsNew() ) + DrawPanel->UnManageCursor(); + return; } - CurrentPin->DisplayInfo( this ); + /* Save the pin properties to use for the next new pin. */ + LastPinNameSize = ReturnValueFromString( g_UnitMetric, + dlg.GetNameTextSize(), + m_InternalUnits ); + LastPinNumSize = ReturnValueFromString( g_UnitMetric, + dlg.GetNumberTextSize(), + m_InternalUnits ); + LastPinOrient = LIB_PIN::GetOrientationCode( dlg.GetOrientation() ); + LastPinLength = ReturnValueFromString( g_UnitMetric, dlg.GetLength(), + m_InternalUnits ); + LastPinShape = LIB_PIN::GetStyleCode( dlg.GetStyle() ); + LastPinType = dlg.GetElectricalType(); + LastPinCommonConvert = dlg.GetAddToAllBodyStyles(); + LastPinCommonUnit = dlg.GetAddToAllParts(); + LastPinVisible = dlg.GetVisible(); + + pin->EnableEditMode( true, g_EditPinByPinIsOn ); + pin->SetName( dlg.GetName() ); + pin->SetNameTextSize( LastPinNameSize ); + pin->SetNumber( dlg.GetNumber() ); + pin->SetNumberTextSize( LastPinNumSize ); + pin->SetOrientation( LastPinOrient ); + pin->SetLength( LastPinLength ); + pin->SetElectricalType( LastPinType ); + pin->SetDrawStyle( LastPinShape ); + pin->SetConversion( ( LastPinCommonConvert ) ? 0 : m_convert ); + pin->SetPartNumber( ( LastPinCommonUnit ) ? 0 : m_unit ); + pin->SetVisible( LastPinVisible ); + + if( pin->IsModified() || pin->IsNew() ) + { + if( !pin->IsNew() ) + SaveCopyInUndoList( pin->GetParent() ); + + GetScreen()->SetModify(); + pin->DisplayInfo( this ); + DrawPanel->Refresh(); + } + + pin->EnableEditMode( false, g_EditPinByPinIsOn ); } @@ -224,7 +194,7 @@ another pin. Continue?" ) ); GetScreen()->SetModify(); CurrentPin->m_Pos = newpos; - if( CurrentPin->m_Flags & IS_NEW ) + if( CurrentPin->IsNew() ) { LastPinOrient = CurrentPin->m_Orient; LastPinType = CurrentPin->m_PinType; @@ -236,7 +206,7 @@ another pin. Continue?" ) ); /* Put linked pins in new position, and clear flags */ for( Pin = m_component->GetNextPin(); Pin != NULL; - Pin = m_component->GetNextPin( Pin ) ) + Pin = m_component->GetNextPin( Pin ) ) { if( Pin->m_Flags == 0 ) continue; @@ -254,36 +224,11 @@ another pin. Continue?" ) ); }; -void WinEDA_PinPropertiesFrame::SetPinOrientation( int neworient ) -{ - LIB_PIN* CurrentPin = (LIB_PIN*) m_Parent->GetDrawItem(); - LIB_PIN* Pin, * RefPin = CurrentPin; - - if( CurrentPin == NULL || CurrentPin->GetParent() == NULL || RefPin == NULL ) - return; - - m_Parent->GetScreen()->SetModify(); - - /* Rotation */ - RefPin->m_Orient = neworient; - - Pin = CurrentPin->GetParent()->GetNextPin(); - - for( ; Pin != NULL; Pin = CurrentPin->GetParent()->GetNextPin( Pin ) ) - { - if( Pin->m_Flags == 0 ) - continue; - Pin->m_Orient = RefPin->m_Orient; - if( CurrentPin == NULL ) - Pin->m_Flags = 0; - } -} - - /** - * Prepare le deplacement d'une pin : - * Localise la pin pointee par le curseur, et si elle existe active - * la fonction de gestion curseur ( DrawMovePin() ). + * Prepare the displacement of a pin + * + * Locate the pin pointed to by the cursor, and set the cursor management + * function move the pin. */ void WinEDA_LibeditFrame::StartMovePin( wxDC* DC ) { @@ -291,7 +236,7 @@ void WinEDA_LibeditFrame::StartMovePin( wxDC* DC ) LIB_PIN* CurrentPin = (LIB_PIN*) m_drawItem; wxPoint startPos; - /* Marquage des pins a traiter */ + /* Mark pins for moving. */ Pin = m_component->GetNextPin(); for( ; Pin != NULL; Pin = m_component->GetNextPin( Pin ) ) { @@ -321,10 +266,8 @@ void WinEDA_LibeditFrame::StartMovePin( wxDC* DC ) } -/******************************************************************************/ -/* Routine de deplacement de la Pin courante selon position du curseur souris */ -/* Routine normalement appelee par la routine de gestion du curseur */ -/******************************************************************************/ +/* Move pin to the current mouse position. This function is called by the + * cursor management code. */ static void DrawMovePin( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) { WinEDA_LibeditFrame* parent = (WinEDA_LibeditFrame*) panel->GetParent(); @@ -341,7 +284,7 @@ static void DrawMovePin( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) bool showPinText = true; /* Erase pin in old position */ - if( erase || ( CurrentPin->m_Flags & IS_NEW ) ) + if( erase || CurrentPin->IsNew() ) { wxLogDebug( _( "Initial pin position (%d, %d)" ), PinPreviousPos.x, PinPreviousPos.y ); @@ -360,159 +303,20 @@ static void DrawMovePin( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) /* Keep the original position for existing pin (for Undo command) * and the current position for a new pin */ - if( ( CurrentPin->m_Flags & IS_NEW ) == 0 ) + if( !CurrentPin->IsNew() ) CurrentPin->m_Pos = pinpos; } -/**********************************************************/ -void WinEDA_PinPropertiesFrame::SetPinShape( int newshape ) -/**********************************************************/ - -/* Changement de la forme de la pin courante. - * Le changement est egalement fait sur les autres pins correspondantes - * des autres unites de la seule forme convert courante +/* + * Delete pin at the current mouse position. + * If g_EditPinByPinIsOn == false: + * All pins at the same position will be erased. + * Otherwise only the pin of the current unit and convert will be erased. */ -{ - LIB_PIN* Pin; - LIB_PIN* CurrentPin = (LIB_PIN*) m_Parent->GetDrawItem(); - - if( CurrentPin ) - { - CurrentPin->m_PinShape = newshape; - m_Parent->GetScreen()->SetModify(); - CurrentPin->DisplayInfo( m_Parent ); - - Pin = CurrentPin->GetParent()->GetNextPin(); - for( ; Pin != NULL; Pin = CurrentPin->GetParent()->GetNextPin( Pin ) ) - { - if( Pin->m_Flags == 0 || Pin->m_Convert != CurrentPin->m_Convert ) - continue; - Pin->m_PinShape = newshape; - } - } -} - - -/******************************************************/ -void WinEDA_PinPropertiesFrame::SetPinType( int newtype ) -/******************************************************/ - -/* Changement du type electrique de la pin courante. - * Le changement est egalement fait sur les autres pins correspondantes - * des autres unites du boitier - */ -{ - LIB_PIN* Pin; - LIB_PIN* CurrentPin = (LIB_PIN*) m_Parent->GetDrawItem(); - - if( CurrentPin == NULL || CurrentPin->GetParent() == NULL ) - return; - - CurrentPin->m_PinType = newtype; - m_Parent->GetScreen()->SetModify(); - - Pin = CurrentPin->GetParent()->GetNextPin(); - for( ; Pin != NULL; Pin = CurrentPin->GetParent()->GetNextPin( Pin ) ) - { - if( Pin->m_Flags == 0 ) - continue; - Pin->m_PinType = newtype; - } -} - - -/********************************************************************************/ -void WinEDA_PinPropertiesFrame::SetPinName( const wxString& newname, int newsize ) -/********************************************************************************/ - -/* Met a jour le nom et la taille de ce nom de la pin courante - * si newname == NULL, pas de changement de nom - * si newsize < 0 : pas de changement de taille - */ -{ - LIB_PIN* Pin; - LIB_PIN* CurrentPin = (LIB_PIN*) m_Parent->GetDrawItem(); - wxString buf; - - if( CurrentPin == NULL || CurrentPin->GetParent() == NULL ) - return; - - buf = newname; - buf.Replace( wxT( " " ), wxT( "_" ) ); - - if( newsize >= 0 ) - CurrentPin->m_PinNameSize = newsize; - - CurrentPin->m_PinName = buf; - - m_Parent->GetScreen()->SetModify(); - - /* Traitement des autres pins */ - Pin = CurrentPin->GetParent()->GetNextPin(); - for( ; Pin != NULL; Pin = CurrentPin->GetParent()->GetNextPin( Pin ) ) - { - if( (Pin->m_Flags & IS_LINKED) == 0 ) - continue; - if( newsize >= 0 ) - Pin->m_PinNameSize = newsize; - Pin->m_PinName = buf; - } -} - - -/******************************************************************************/ -void WinEDA_PinPropertiesFrame::SetPinNum( const wxString& newnum, int newsize ) -/******************************************************************************/ - -/* Changement du numero de la pin courante. - * Le changement est egalement fait sur les autres pins correspondantes - * a la forme convertie - * Si newnum == NULL: pas de changement de numero - * Si newsize < 0 ) pase de changement de taille - */ -{ - LIB_PIN* Pin; - LIB_PIN* CurrentPin = (LIB_PIN*) m_Parent->GetDrawItem(); - wxString buf; - - buf = newnum; - buf.Replace( wxT( " " ), wxT( "_" ) ); - - if( CurrentPin == NULL || CurrentPin->GetParent() == NULL ) - return; - - CurrentPin->m_PinNum = 0; - - if( newsize >= 0 ) - CurrentPin->m_PinNumSize = newsize; - CurrentPin->SetPinNumFromString( buf ); - m_Parent->GetScreen()->SetModify(); - - Pin = CurrentPin->GetParent()->GetNextPin(); - for( ; Pin != NULL; Pin = CurrentPin->GetParent()->GetNextPin( Pin ) ) - { - if( ( Pin->m_Flags & IS_LINKED ) == 0 - || Pin->m_Unit != CurrentPin->m_Unit ) - continue; - if( newsize >= 0 ) - Pin->m_PinNumSize = newsize; - Pin->m_PinNum = CurrentPin->m_PinNum; - } -} - - -/*************************************************/ void WinEDA_LibeditFrame::DeletePin( wxDC* DC, LIB_COMPONENT* LibEntry, LIB_PIN* Pin ) -/*************************************************/ - -/* Routine d'effacement de la pin pointee par la souris - * Si g_EditPinByPinIsOn == false : - * toutes les pins de meme coordonnee seront effacees. - * Sinon seule la pin de l'unite en convert courante sera effacee - */ { LIB_PIN* tmp; wxPoint PinPos; @@ -523,7 +327,6 @@ void WinEDA_LibeditFrame::DeletePin( wxDC* DC, PinPos = Pin->m_Pos; LibEntry->RemoveDrawItem( (LIB_DRAW_ITEM*) Pin, DrawPanel, DC ); - /* Effacement des autres pins de meme coordonnees */ if( g_EditPinByPinIsOn == false ) { tmp = LibEntry->GetNextPin(); @@ -549,214 +352,68 @@ void WinEDA_LibeditFrame::DeletePin( wxDC* DC, */ void WinEDA_LibeditFrame::CreatePin( wxDC* DC ) { - LIB_PIN* CurrentPin; + LIB_PIN* pin; bool showPinText = true; if( m_component == NULL ) return; - /* Effacement des flags */ m_component->ClearStatus(); - CurrentPin = new LIB_PIN( m_component ); + pin = new LIB_PIN( m_component ); - m_drawItem = CurrentPin; - - if( CurrentPin == NULL || CurrentPin->Type() != COMPONENT_PIN_DRAW_TYPE ) + if( pin == NULL ) return; - CurrentPin->m_Flags = IS_NEW; - CurrentPin->m_Unit = m_unit; - CurrentPin->m_Convert = m_convert; + + m_drawItem = pin; + + pin->m_Flags = IS_NEW; + pin->m_Unit = m_unit; + pin->m_Convert = m_convert; /* Flag pins to consider */ if( g_EditPinByPinIsOn == false ) - CurrentPin->m_Flags |= IS_LINKED; + pin->m_Flags |= IS_LINKED; + + pin->m_Pos.x = GetScreen()->m_Curseur.x; + pin->m_Pos.y = -GetScreen()->m_Curseur.y; + pin->m_PinLen = LastPinLength; + pin->m_Orient = LastPinOrient; + pin->m_PinType = LastPinType; + pin->m_PinShape = LastPinShape; + pin->m_PinNameSize = LastPinNameSize; + pin->m_PinNumSize = LastPinNumSize; - CurrentPin->m_Pos.x = GetScreen()->m_Curseur.x; - CurrentPin->m_Pos.y = -GetScreen()->m_Curseur.y; - CurrentPin->m_PinLen = LastPinSize; - CurrentPin->m_Orient = LastPinOrient; - CurrentPin->m_PinType = LastPinType; - CurrentPin->m_PinShape = LastPinShape; - CurrentPin->m_PinNameSize = LastPinNameSize; - CurrentPin->m_PinNumSize = LastPinNumSize; if( LastPinCommonConvert ) - CurrentPin->m_Convert = 0; + pin->m_Convert = 0; else - CurrentPin->m_Convert = m_convert; + pin->m_Convert = m_convert; + if( LastPinCommonUnit ) - CurrentPin->m_Unit = 0; + pin->m_Unit = 0; else - CurrentPin->m_Unit = m_unit; - if( LastPinNoDraw ) - CurrentPin->m_Attributs |= PINNOTDRAW; + pin->m_Unit = m_unit; + + if( LastPinVisible ) + pin->m_Attributs &= ~PINNOTDRAW; else - CurrentPin->m_Attributs &= ~PINNOTDRAW; + pin->m_Attributs |= PINNOTDRAW; if( DC ) - CurrentPin->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, wxCOPY, - &showPinText, DefaultTransformMatrix ); + pin->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, wxCOPY, &showPinText, + DefaultTransformMatrix ); - PinPreviousPos = CurrentPin->m_Pos; + PinPreviousPos = pin->m_Pos; wxLogDebug( _( "Initial pin position (%d, %d)" ), PinPreviousPos.x, PinPreviousPos.y ); DrawPanel->m_IgnoreMouseEvents = true; - InstallPineditFrame( this, DC, wxPoint( -1, -1 ) ); + wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED ); + cmd.SetId( ID_LIBEDIT_EDIT_PIN ); + GetEventHandler()->ProcessEvent( cmd ); DrawPanel->MouseToCursorSchema(); DrawPanel->m_IgnoreMouseEvents = false; DrawPanel->ManageCurseur = DrawMovePin; DrawPanel->ForceCloseManageCurseur = AbortPinMove; - - CurrentPin->DisplayInfo( this ); - GetScreen()->SetModify(); -} - - -/* si draw == true - * - Ajuste le flag visible / invisible (.U.Pin.Flags bit 0 ) de la pin - * editee - * - * si unit == true - * - Modifie l'attribut Commun / Particulier U.Pin.Unit = 0 ou Num Unite - * de la pin editee - * - * si convert == true - * - Modifie l'attribut Commun / Particulier U.Pin.Convert = 0 ou Num Unite - * de la pin editee - * - */ -void WinEDA_PinPropertiesFrame::SetPinAttributes( bool draw, bool unit, - bool convert ) -{ - LIB_PIN* tmp; - LIB_PIN* Pin; - LIB_PIN* CurrentPin = (LIB_PIN*) m_Parent->GetDrawItem(); - - if( CurrentPin == NULL ) - return; - - m_Parent->GetScreen()->SetModify(); - - if( unit ) - { - if( LastPinCommonUnit ) - CurrentPin->m_Unit = 0; - else - CurrentPin->m_Unit = m_Parent->GetUnit(); - - if( CurrentPin->m_Unit == 0 ) - { - tmp = CurrentPin->GetParent()->GetNextPin(); - - while( tmp != NULL ) - { - Pin = tmp; - tmp = CurrentPin->GetParent()->GetNextPin( Pin ); - - if( Pin->m_Flags == 0 || Pin == CurrentPin ) - continue; - if( CurrentPin->m_Convert - && ( CurrentPin->m_Convert != Pin->m_Convert ) ) - continue; - if( CurrentPin->m_Pos != Pin->m_Pos ) - continue; - if( Pin->m_Orient != CurrentPin->m_Orient ) - continue; - - CurrentPin->GetParent()->RemoveDrawItem( (LIB_DRAW_ITEM*) Pin ); - } - } - } // end if unit - - if( convert ) - { - if( LastPinCommonConvert ) - CurrentPin->m_Convert = 0; - else - CurrentPin->m_Convert = m_Parent->GetConvert(); - - if( CurrentPin->m_Convert == 0 ) /* Effacement des pins redondantes */ - { - tmp = CurrentPin->GetParent()->GetNextPin(); - - while( tmp != NULL ) - { - Pin = tmp; - tmp = CurrentPin->GetParent()->GetNextPin( Pin ); - - if( Pin->m_Flags == 0 ) - continue; - if( Pin == CurrentPin ) - continue; - if( CurrentPin->m_Unit && ( CurrentPin->m_Unit != Pin->m_Unit ) ) - continue; - if( CurrentPin->m_Pos != Pin->m_Pos ) - continue; - if( Pin->m_Orient != CurrentPin->m_Orient ) - continue; - - CurrentPin->GetParent()->RemoveDrawItem( (LIB_DRAW_ITEM*) Pin ); - } - } - } // end if convert - - if( draw ) - { - if( LastPinNoDraw ) - CurrentPin->m_Attributs |= PINNOTDRAW; - else - CurrentPin->m_Attributs &= ~PINNOTDRAW; - - Pin = CurrentPin->GetParent()->GetNextPin(); - for( ; Pin != NULL; Pin = CurrentPin->GetParent()->GetNextPin( Pin ) ) - { - if( Pin->m_Flags == 0 ) - continue; - if( LastPinNoDraw ) - Pin->m_Attributs |= PINNOTDRAW; - else - Pin->m_Attributs &= ~PINNOTDRAW; - } - } -} - - -/******************************************************/ -void WinEDA_PinPropertiesFrame::NewSizePin( int newsize ) -/******************************************************/ - -/* Fonction permettant la mise aux dimensions courantes: - * - longueur, dimension des textes - * de la pin courante - * - */ -{ - LIB_PIN* RefPin, * Pin = (LIB_PIN*) m_Parent->GetDrawItem(); - - if( Pin == NULL || Pin->GetParent() == NULL ) - return; - - m_Parent->GetScreen()->SetModify(); - - Pin->m_PinLen = newsize; - - Pin->DisplayInfo( m_Parent ); - - RefPin = Pin; - - if( g_EditPinByPinIsOn == false ) - { - Pin = Pin->GetParent()->GetNextPin(); - for( ; Pin != NULL; Pin = Pin->GetParent()->GetNextPin( Pin ) ) - { - if( Pin->m_Pos != RefPin->m_Pos ) - continue; - if( Pin->m_Orient != RefPin->m_Orient ) - continue; - if( Pin->m_Convert == RefPin->m_Convert ) - Pin->m_PinLen = newsize; - } - } } @@ -774,7 +431,7 @@ static void CreateImagePins( LIB_PIN* Pin, int unit, int convert, if( asDeMorgan && ( Pin->m_Convert != 0 ) ) CreateConv = true; - /* Creation de la pin " convert " pour la part courante */ + /* Create "convert" pin at the current position. */ if( CreateConv == true ) { NewPin = (LIB_PIN*) Pin->GenCopy(); @@ -788,16 +445,14 @@ static void CreateImagePins( LIB_PIN* Pin, int unit, int convert, for( ii = 1; ii <= Pin->GetParent()->GetPartCount(); ii++ ) { if( ii == unit || Pin->m_Unit == 0 ) - continue; /* Pin commune a toutes les unites */ + continue; /* Pin common to all units. */ - /* Creation pour la representation "normale" */ NewPin = (LIB_PIN*) Pin->GenCopy(); if( convert != 0 ) NewPin->m_Convert = 1; NewPin->m_Unit = ii; Pin->GetParent()->AddDrawItem( NewPin ); - /* Creation pour la representation "Convert" */ if( CreateConv == false ) continue; @@ -865,10 +520,8 @@ void WinEDA_LibeditFrame::GlobalSetPins( wxDC* DC, LIB_PIN* MasterPin, int id ) } -/************************************************************************/ +/* Create a new pin based on the previous pin with an incremented pin number. */ void WinEDA_LibeditFrame::RepeatPinItem( wxDC* DC, LIB_PIN* SourcePin ) -/************************************************************************/ -/* Creation d'une nouvelle pin par copie de la pr�c�dente ( fct REPEAT) */ { LIB_PIN* Pin; wxString msg; @@ -885,8 +538,7 @@ void WinEDA_LibeditFrame::RepeatPinItem( wxDC* DC, LIB_PIN* SourcePin ) Pin->m_Pos.x += g_RepeatStep.x; ox = Pin->m_Pos.x; Pin->m_Pos.y += -g_RepeatStep.y; - oy = Pin->m_Pos.y; // ici axe Y comme en math - /*** Increment du numero de label ***/ + oy = Pin->m_Pos.y; IncrementLabelMember( Pin->m_PinName ); Pin->ReturnPinStringNum( msg ); @@ -895,7 +547,6 @@ void WinEDA_LibeditFrame::RepeatPinItem( wxDC* DC, LIB_PIN* SourcePin ) m_drawItem = Pin; - /* Marquage des pins a traiter */ if( g_EditPinByPinIsOn == false ) Pin->m_Flags |= IS_LINKED; @@ -905,8 +556,6 @@ void WinEDA_LibeditFrame::RepeatPinItem( wxDC* DC, LIB_PIN* SourcePin ) GetScreen()->m_Curseur.y = -Pin->m_Pos.y; PlacePin( DC ); GetScreen()->m_Curseur = savepos; - -// DrawPanel->MouseToCursorSchema(); DrawPanel->CursorOn( DC ); Pin->DisplayInfo( this ); @@ -938,23 +587,17 @@ bool sort_by_pin_number( const LIB_PIN* ref, const LIB_PIN* tst ) void WinEDA_LibeditFrame::OnCheckComponent( wxCommandEvent& event ) { #define MIN_GRID_SIZE 25 - int dup_error; - int offgrid_error; - LIB_PIN* Pin; - wxString msg; - wxString aux_msg; + int dup_error; + int offgrid_error; + LIB_PIN* Pin; + LIB_PIN_LIST PinList; + wxString msg; + wxString aux_msg; if( m_component == NULL ) return; - // Build the pin list: - std::vector PinList; - Pin = m_component->GetNextPin(); - for( ; Pin != NULL; Pin = m_component->GetNextPin( Pin ) ) - { - if( Pin->Type() == COMPONENT_PIN_DRAW_TYPE ) - PinList.push_back( Pin ); - } + m_component->GetPins( PinList ); if( PinList.size() == 0 ) { @@ -968,8 +611,11 @@ void WinEDA_LibeditFrame::OnCheckComponent( wxCommandEvent& event ) // Test for duplicates: dup_error = 0; - DIALOG_DISPLAY_HTML_TEXT_BASE error_display( this, wxID_ANY, _( "Marker Info" ), - wxDefaultPosition, wxSize( 750, 600 ) ); + DIALOG_DISPLAY_HTML_TEXT_BASE error_display( this, wxID_ANY, + _( "Marker Information" ), + wxDefaultPosition, + wxSize( 750, 600 ) ); + for( unsigned ii = 1; ii < PinList.size(); ii++ ) { wxString stringPinNum, stringCurrPinNum; @@ -985,15 +631,16 @@ void WinEDA_LibeditFrame::OnCheckComponent( wxCommandEvent& event ) dup_error++; Pin->ReturnPinStringNum( stringPinNum ); curr_pin->ReturnPinStringNum( stringCurrPinNum ); - msg.Printf( _( - "Duplicate pin %s \"%s\" at location (%.3f, %.3f) conflicts \ -with pin %s \"%s\" at location (%.3f, %.3f)" ), + msg.Printf( _( "Duplicate pin %s \"%s\" at location (%.3f, \ +%.3f) conflicts with pin %s \"%s\" at location (%.3f, %.3f)" ), GetChars( stringCurrPinNum ), GetChars( curr_pin->m_PinName ), - (float) curr_pin->m_Pos.x / 1000.0, (float) -curr_pin->m_Pos.y / 1000.0, + (float) curr_pin->m_Pos.x / 1000.0, + (float) -curr_pin->m_Pos.y / 1000.0, GetChars( stringPinNum ), GetChars( Pin->m_PinName ), - (float) Pin->m_Pos.x / 1000.0, (float) -Pin->m_Pos.y / 1000.0 ); + (float) Pin->m_Pos.x / 1000.0, + (float) -Pin->m_Pos.y / 1000.0 ); if( m_component->GetPartCount() > 1 ) { @@ -1027,11 +674,12 @@ with pin %s \"%s\" at location (%.3f, %.3f)" offgrid_error++; wxString stringPinNum; Pin->ReturnPinStringNum( stringPinNum ); - msg.Printf( _( "Off grid pin %s \"%s\" at location (%.3f, %.3f)" ), + msg.Printf( _( "Off grid pin %s \"%s\" at location (%.3f, \ +%.3f)" ), GetChars( stringPinNum ), GetChars( Pin->m_PinName ), - (float) Pin->m_Pos.x / 1000.0, (float) -Pin->m_Pos.y / 1000.0 - ); + (float) Pin->m_Pos.x / 1000.0, + (float) -Pin->m_Pos.y / 1000.0 ); if( m_component->GetPartCount() > 1 ) { @@ -1052,7 +700,8 @@ with pin %s \"%s\" at location (%.3f, %.3f)" } if( !dup_error && !offgrid_error ) - DisplayInfoMessage( this, _( "No off grid or duplicate pins were found." ) ); + DisplayInfoMessage( this, + _( "No off grid or duplicate pins were found." ) ); else error_display.ShowModal(); diff --git a/eeschema/protos.h b/eeschema/protos.h index dbe25c3b1a..8fa2c03b5a 100644 --- a/eeschema/protos.h +++ b/eeschema/protos.h @@ -1,6 +1,3 @@ -//*****************************************/ -/* prototypage des fonctions de EESchema */ -/*****************************************/ #ifndef __PROTOS_H__ #define __PROTOS_H__ @@ -58,7 +55,6 @@ bool MapAngles( int* Angle1, * * @param aTransformMatrix = rotation, mirror .. matrix * @param aPosition = the position to transform - * * @return the new coordinate */ wxPoint TransformCoordinate( const int aTransformMatrix[2][2], @@ -71,10 +67,6 @@ void SnapLibItemPoint( int OrigX, SCH_COMPONENT* DrawLibItem ); bool LibItemInBox( int x1, int y1, int x2, int y2, SCH_COMPONENT* DrawLibItem ); -char* StrPurge( char* text ); - -/* Supprime les caracteres Space en debut de la ligne text - * retourne un pointeur sur le 1er caractere non Space de text */ /************/ /* BLOCK.CPP */ @@ -87,13 +79,10 @@ void DeleteStruct( WinEDA_DrawPanel* panel, /*************/ /* LOCATE.CPP */ /*************/ -LIB_PIN* LocatePinByNumber( const wxString& ePin_Number, - SCH_COMPONENT* eComponent ); SCH_COMPONENT* LocateSmallestComponent( SCH_SCREEN* Screen ); -/* Recherche du plus petit (en surface) composant pointe par la souris */ - +/* Find the item within block selection. */ int PickItemsInBlock( BLOCK_SELECTOR& aBlock, BASE_SCREEN* screen ); @@ -123,14 +112,10 @@ int PickItemsInBlock( BLOCK_SELECTOR& aBlock, * * * Return: - * -Bloc search: - * pointeur sur liste de pointeurs de structures si Plusieurs - * structures selectionnees. - * pointeur sur la structure si 1 seule - * - * Positon search: - * pointeur sur la structure. - * Si pas de structures selectionnees: retourne NULL */ + * Pointer to list of pointers to structures if several items are selected. + * Pointer to the structure if only 1 item is selected. + * NULL if no items are selects. + */ SCH_ITEM* PickStruct( const wxPoint& refpos, BASE_SCREEN* screen, int SearchMask ); @@ -237,13 +222,14 @@ void InstallPineditFrame( WinEDA_LibeditFrame* parent, /** * Function DisplayComponentsNamesInLib - * Routine de selection d'un composant en librairie, par affichage de la - * liste des composants de cette librairie - * Si Library == NULL, selection de librairie demandee - * sinon recherche uniquement dans library - * Retourne - * 1 si composant selectionne - * 0 si commande annulee + * Select component from list of components in this library + * + * If == NULL Library, selection of library REQUESTED + * If only in research library + * + * Returns + * 1 if selected component + * 0 if canceled order */ int DisplayComponentsNamesInLib( WinEDA_DrawFrame* frame, CMP_LIBRARY* Library, @@ -259,15 +245,13 @@ int DisplayComponentsNamesInLib( WinEDA_DrawFrame* frame, CMP_LIBRARY* SelectLibraryFromList( WinEDA_DrawFrame* frame ); /** - * Function GetNameOfPartToLoad - * Routine de selection du nom d'un composant en librairie pour chargement, - * dans la librairie Library. - * Si Library == NULL, il y aura demande de selection d'une librairie - * Retourne - * 1 si composant selectionne - * 0 si commande annulee - * place le nom du composant a charger, selectionne a partir d'une liste dans - * BufName + * Get the name component from a library to load. + * + * If no library specified, there will be demand for selection of a library. + * Returns + * 1 if selected component + * 0 if canceled order + * Place the name of the selected component list in BufName */ int GetNameOfPartToLoad( WinEDA_DrawFrame* frame, CMP_LIBRARY* Lib, @@ -292,9 +276,6 @@ void SchematicCleanUp( SCH_SCREEN* screen, wxDC* DC ); void BreakSegmentOnJunction( SCH_SCREEN* Screen ); -/* Routine creant des debuts / fin de segment (BUS ou WIRES) sur les jonctions - * et les raccords */ - /* Break a segment ( BUS, WIRE ) int 2 segments at location aBreakpoint, * if aBreakpoint in on segment segment * ( excluding ends) diff --git a/include/common.h b/include/common.h index e714d4d5ac..44ce3d2801 100644 --- a/include/common.h +++ b/include/common.h @@ -65,11 +65,9 @@ enum pseudokeys { #define TEXT_ORIENT_HORIZ 0 #define TEXT_ORIENT_VERT 900 -/* Affichage ou Effacement d'Item */ -#define ON 1 /* Affichage */ -#define OFF 0 /* Effacement */ +#define ON 1 +#define OFF 0 -/* unites d'affichage sur ecran et autres */ #define INCHES 0 #define MILLIMETRE 1 #define CENTIMETRE 2 @@ -86,7 +84,7 @@ class LibNameList; /***********************************/ -/* Classe pour affichage de textes */ +/* Class to display text */ /***********************************/ class WinEDA_TextFrame : public wxDialog { @@ -169,9 +167,9 @@ extern const wxString PdfFileWildcard; extern const wxString AllFilesWildcard; -// Nom (full file name) du file Configuration par defaut (kicad.pro) +// Name of default configuration file. (kicad.pro) extern wxString g_Prj_Default_Config_FullFilename; -// Nom du file Configuration local (.pro) +// Name of local configuration file. (.pro) extern wxString g_Prj_Config_LocalFilename; extern int g_UnitMetric; // display units mm = 1, inches = 0, cm = 2 @@ -273,15 +271,15 @@ wxString GetAboutBuildVersion(); /* Return custom build date for about dialog /** * function Affiche_1_Parametre - * Routine d'affichage d'un parametre. - * pos_X = cadrage horizontal - * si pos_X < 0 : la position horizontale est la derniere - * valeur demandee >= 0 - * texte_H = texte a afficher en ligne superieure. - * si "", par d'affichage sur cette ligne - * texte_L = texte a afficher en ligne inferieure. - * si "", par d'affichage sur cette ligne - * color = couleur d'affichage + * Routine to display a parameter. + * = POS_X horizontal framing + * If POS_X <0: horizontal position is the last + * Required value> = 0 + * Texte_H = text to be displayed in top line. + * If "by posting on this line + * Texte_L = text to be displayed in bottom line. + * If "by posting on this line + * Color = color display */ void Affiche_1_Parametre( WinEDA_DrawFrame* frame, int pos_X, @@ -289,25 +287,34 @@ void Affiche_1_Parametre( WinEDA_DrawFrame* frame, const wxString& texte_L, int color ); -/* Routine d'affichage de la documentation associee a un composant */ - int GetTimeStamp(); -/* Retoure une identification temporelle (Time stamp) differente a chaque appel */ int DisplayColorFrame( wxWindow* parent, int OldColor ); int GetCommandOptions( const int argc, const char** argv, const char* stringtst, const char** optarg, int* optind ); -/* Retourne pour affichage la valeur d'un parametre, selon type d'unites choisies - * entree : valeur en mils , buffer de texte - * retourne en buffer : texte : valeur exprimee en pouces ou millimetres - * suivie de " ou mm +/* Returns to display the value of a parameter, by type of units selected + * Input: value in mils, buffer text + * Returns to buffer: text: value expressed in inches or millimeters + * Followed by " or mm */ const wxString& valeur_param( int valeur, wxString& buf_texte ); wxString ReturnUnitSymbol( int Units = g_UnitMetric ); + +/** + * Get a human readable units string. + * + * The strings returned are full text name and not abbreviations or symbolic + * representations of units. Set ReturnUnitSymbol() for that. + * + * @param units - The units text to return. + * @return The human readable units string. + */ +wxString GetUnitsLabel( int units ); + int ReturnValueFromString( int Units, const wxString& TextValue, int Internal_Unit );