From ec02baab5ff8702451007e2bdb7bf7e9e8cfa2a6 Mon Sep 17 00:00:00 2001 From: CHARRAS Date: Sat, 27 Oct 2007 12:24:09 +0000 Subject: [PATCH] remove unused files. some translations. cvpcb: set flag wxFRAME_FLOAT_ON_PARENT when create the footprint 3D frame and the display frame --- 3d-viewer/3d_frame.cpp | 4 +- 3d-viewer/3d_viewer.h | 6 +- change_log.txt | 13 + common/basicframe.cpp | 5 +- common/{svg_print.h.notused => svg_print.h} | 267 ++-- cvpcb/affiche.cpp.notused | 19 - cvpcb/cvframe.cpp | 4 +- cvpcb/cvpcb.h | 163 ++- cvpcb/cvstruct.h | 7 +- cvpcb/dialog_cvpcb_config.cpp | 64 +- cvpcb/dialog_cvpcb_config.h | 10 +- cvpcb/dialog_cvpcb_config.pjd | 24 +- cvpcb/dialog_display_options.cpp | 10 +- cvpcb/dialog_display_options.pjd | 64 +- cvpcb/displayframe.cpp | 61 +- cvpcb/makefile.include | 3 - cvpcb/setvisu.cpp | 50 +- cvpcb/visumod.cpp | 44 - eeschema/dialog_set_status.cpp.notused | 282 ----- eeschema/dialog_set_status.h.notused | 124 -- eeschema/editpart.cpp.notused | 840 ------------- eeschema/eeclass.cpp.notused | 121 -- eeschema/fieldedi.cpp.notused | 1230 ------------------ eeschema/genliste.cpp.notused | 730 ----------- eeschema/libedpart.cpp.notused | 1237 ------------------- eeschema/libframe.cpp | 5 +- eeschema/options.cpp.notused | 285 ----- eeschema/optionsframe.cpp.notused | 172 --- eeschema/optionsframe.h.notused | 89 -- eeschema/schframe.cpp | 4 +- gerbview/gerberframe.cpp | 4 +- include/wxstruct.h | 69 +- pcbnew/basepcbframe.cpp | 21 +- pcbnew/clean.cpp | 49 +- pcbnew/moduleframe.cpp | 5 +- pcbnew/pcbframe.cpp | 5 +- share/drawframe.cpp | 4 +- share/selcolor.cpp.notused | 166 --- 38 files changed, 462 insertions(+), 5798 deletions(-) rename common/{svg_print.h.notused => svg_print.h} (78%) delete mode 100644 cvpcb/affiche.cpp.notused delete mode 100644 cvpcb/visumod.cpp delete mode 100644 eeschema/dialog_set_status.cpp.notused delete mode 100644 eeschema/dialog_set_status.h.notused delete mode 100644 eeschema/editpart.cpp.notused delete mode 100644 eeschema/eeclass.cpp.notused delete mode 100644 eeschema/fieldedi.cpp.notused delete mode 100644 eeschema/genliste.cpp.notused delete mode 100644 eeschema/libedpart.cpp.notused delete mode 100644 eeschema/options.cpp.notused delete mode 100644 eeschema/optionsframe.cpp.notused delete mode 100644 eeschema/optionsframe.h.notused delete mode 100644 share/selcolor.cpp.notused diff --git a/3d-viewer/3d_frame.cpp b/3d-viewer/3d_frame.cpp index bd2aeb0cef..5ed85f0694 100644 --- a/3d-viewer/3d_frame.cpp +++ b/3d-viewer/3d_frame.cpp @@ -38,9 +38,9 @@ END_EVENT_TABLE() /*******************************************************************/ WinEDA3D_DrawFrame::WinEDA3D_DrawFrame(WinEDA_BasePcbFrame * parent, - WinEDA_App *app_parent, const wxString& title ): + WinEDA_App *app_parent, const wxString& title, long style ): wxFrame(parent, DISPLAY3D_FRAME, title, - wxPoint(-1,-1), wxSize(-1,-1) ) + wxPoint(-1,-1), wxSize(-1,-1), style ) /*******************************************************************/ { m_FrameName = wxT("Frame3D"); diff --git a/3d-viewer/3d_viewer.h b/3d-viewer/3d_viewer.h index 5cec5f3a8c..8d4b370c03 100644 --- a/3d-viewer/3d_viewer.h +++ b/3d-viewer/3d_viewer.h @@ -29,6 +29,9 @@ #include "pcbstruct.h" #include "3d_struct.h" +#define KICAD_DEFAULT_3D_DRAWFRAME_STYLE wxDEFAULT_FRAME_STYLE|wxWANTS_CHARS + + #define LIB3D_PATH wxT("packages3d/") class Pcb3D_GLCanvas; @@ -124,11 +127,10 @@ public: private: wxString m_FrameName; // name used for writting and reading setup // It is "Frame3D" - public: WinEDA3D_DrawFrame(WinEDA_BasePcbFrame * parent, WinEDA_App *app_parent, - const wxString& title ); + const wxString& title, long style = KICAD_DEFAULT_3D_DRAWFRAME_STYLE ); void Exit3DFrame(wxCommandEvent& event); void OnCloseWindow(wxCloseEvent & Event); diff --git a/change_log.txt b/change_log.txt index 88c1156ae5..7b825e2e6d 100644 --- a/change_log.txt +++ b/change_log.txt @@ -4,6 +4,19 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with email address. +2007-Oct-27 UPDATE Jean-Pierre Charras +================================================================================ ++ all: + remove unused files. + some translations + ++cvpcb: + set flag wxFRAME_FLOAT_ON_PARENT when create the footprint 3D frame and the + display frame + minor other changes + + + 2007-Oct-26 UPDATE Jean-Pierre Charras ================================================================================ + pcbnew: diff --git a/common/basicframe.cpp b/common/basicframe.cpp index b472af0cb0..ee50d0a16d 100644 --- a/common/basicframe.cpp +++ b/common/basicframe.cpp @@ -18,9 +18,8 @@ WinEDA_BasicFrame::WinEDA_BasicFrame( wxWindow * father, int idtype, WinEDA_App *parent, const wxString & title, - const wxPoint& pos, const wxSize& size): - wxFrame(father, -1, title, pos, size, - wxDEFAULT_FRAME_STYLE|wxWANTS_CHARS) + const wxPoint& pos, const wxSize& size, long style): + wxFrame(father, -1, title, pos, size, style ) { wxSize minsize; diff --git a/common/svg_print.h.notused b/common/svg_print.h similarity index 78% rename from common/svg_print.h.notused rename to common/svg_print.h index 046cf467da..5c3fa37f51 100644 --- a/common/svg_print.h.notused +++ b/common/svg_print.h @@ -1,142 +1,125 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: svg_print.h -// Purpose: -// Author: jean-pierre Charras -// Modified by: -// Created: 05/02/2006 11:05:20 -// RCS-ID: -// Copyright: License GNU -// Licence: -///////////////////////////////////////////////////////////////////////////// - -// Generated by DialogBlocks (unregistered), 05/02/2006 11:05:20 - -#ifndef _SVG_PRINT_H_ -#define _SVG_PRINT_H_ - -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma interface "svg_print.h" -#endif - -/*! - * Includes - */ - -////@begin includes -#include "wx/valgen.h" -#include "wx/spinctrl.h" -////@end includes - -/*! - * Forward declarations - */ - -////@begin forward declarations -class wxSpinCtrl; -////@end forward declarations - -/*! - * Control identifiers - */ - -////@begin control identifiers -#define ID_DIALOG 10000 -#define SYMBOL_WINEDA_PRINTSVGFRAME_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX|wxFRAME_FLOAT_ON_PARENT -#define SYMBOL_WINEDA_PRINTSVGFRAME_TITLE _("Create SVG file") -#define SYMBOL_WINEDA_PRINTSVGFRAME_IDNAME ID_DIALOG -#define SYMBOL_WINEDA_PRINTSVGFRAME_SIZE wxSize(400, 300) -#define SYMBOL_WINEDA_PRINTSVGFRAME_POSITION wxDefaultPosition -#define ID_SPINCTRL 10003 -#define ID_RADIOBOX_SETPRINTMODE 10007 -#define ID_CHECKBOX 10004 -#define ID_RADIOBOX 10005 -#define ID_PRINT_EXECUTE 10002 -#define ID_TEXTCTRL 10001 -#define ID_TEXTCTRL1 10006 -////@end control identifiers - -/*! - * Compatibility - */ - -#ifndef wxCLOSE_BOX -#define wxCLOSE_BOX 0x1000 -#endif - -/*! - * WinEDA_PrintSVGFrame class declaration - */ - -class WinEDA_PrintSVGFrame: public wxDialog -{ - DECLARE_DYNAMIC_CLASS( WinEDA_PrintSVGFrame ) - DECLARE_EVENT_TABLE() - -public: - /// Constructors - WinEDA_PrintSVGFrame( ); - WinEDA_PrintSVGFrame( WinEDA_DrawFrame* parent, - wxWindowID id = SYMBOL_WINEDA_PRINTSVGFRAME_IDNAME, - const wxString& caption = SYMBOL_WINEDA_PRINTSVGFRAME_TITLE, - const wxPoint& pos = SYMBOL_WINEDA_PRINTSVGFRAME_POSITION, - const wxSize& size = SYMBOL_WINEDA_PRINTSVGFRAME_SIZE, - long style = SYMBOL_WINEDA_PRINTSVGFRAME_STYLE ); - - /// Creation - bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WINEDA_PRINTSVGFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_PRINTSVGFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_PRINTSVGFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_PRINTSVGFRAME_SIZE, long style = SYMBOL_WINEDA_PRINTSVGFRAME_STYLE ); - - /// Creates the controls and sizers - void CreateControls(); - -////@begin WinEDA_PrintSVGFrame event handler declarations - - /// wxEVT_CLOSE_WINDOW event handler for ID_DIALOG - void OnCloseWindow( wxCloseEvent& event ); - - /// wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_SPINCTRL - void OnSpinctrlUpdated( wxSpinEvent& event ); - - /// wxEVT_COMMAND_RADIOBOX_SELECTED event handler for ID_RADIOBOX_SETPRINTMODE - void OnRadioboxSetprintmodeSelected( wxCommandEvent& event ); - - /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_PRINT_EXECUTE - void OnPrintExecuteClick( wxCommandEvent& event ); - - /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CLOSE - void OnCloseClick( wxCommandEvent& event ); - -////@end WinEDA_PrintSVGFrame event handler declarations - -////@begin WinEDA_PrintSVGFrame member function declarations - - /// Retrieves bitmap resources - wxBitmap GetBitmapResource( const wxString& name ); - - /// Retrieves icon resources - wxIcon GetIconResource( const wxString& name ); -////@end WinEDA_PrintSVGFrame member function declarations - - /// Should we show tooltips? - static bool ShowToolTips(); - - void PrintSVGDoc(wxCommandEvent& event); - bool DrawPage(const wxString & FullFileName); - void SetPenWidth(wxSpinEvent& event); - wxString ReturnFullFileName(); - -////@begin WinEDA_PrintSVGFrame member variables - wxSpinCtrl* m_ButtPenWidth; - wxRadioBox* m_ModeColorOption; - wxCheckBox* m_Print_Sheet_Ref; - wxRadioBox* m_PagesOption; - wxTextCtrl* m_FileNameCtrl; - wxTextCtrl* m_MessagesBox; -////@end WinEDA_PrintSVGFrame member variables - - WinEDA_DrawFrame * m_Parent; - int m_PrintMaskLayer; - int m_ImageXSize_mm; -}; - -#endif - // _SVG_PRINT_H_ +///////////////////////////////////////////////////////////////////////////// +// Name: svg_print.h +// Purpose: +// Author: jean-pierre Charras +// Modified by: +// Created: 27/10/2007 12:48:35 +// RCS-ID: +// Copyright: License GNU +// Licence: +///////////////////////////////////////////////////////////////////////////// + +// Generated by DialogBlocks (unregistered), 27/10/2007 12:48:35 + +#ifndef _SVG_PRINT_H_ +#define _SVG_PRINT_H_ + +#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) +#pragma interface "svg_print.h" +#endif + +/*! + * Includes + */ + +////@begin includes +#include "wx/valgen.h" +#include "wx/spinctrl.h" +////@end includes + +/*! + * Forward declarations + */ + +////@begin forward declarations +class wxSpinCtrl; +////@end forward declarations + +/*! + * Control identifiers + */ + +////@begin control identifiers +#define ID_DIALOG 10000 +#define ID_SPINCTRL 10003 +#define ID_RADIOBOX_SETPRINTMODE 10007 +#define ID_CHECKBOX 10004 +#define ID_RADIOBOX 10005 +#define ID_PRINT_EXECUTE 10002 +#define ID_TEXTCTRL 10001 +#define ID_TEXTCTRL1 10006 +#define SYMBOL_WINEDA_PRINTSVGFRAME_STYLE wxCAPTION|wxSYSTEM_MENU|wxCLOSE_BOX|wxFRAME_FLOAT_ON_PARENT|MAYBE_RESIZE_BORDER +#define SYMBOL_WINEDA_PRINTSVGFRAME_TITLE _("Create SVG file") +#define SYMBOL_WINEDA_PRINTSVGFRAME_IDNAME ID_DIALOG +#define SYMBOL_WINEDA_PRINTSVGFRAME_SIZE wxSize(400, 300) +#define SYMBOL_WINEDA_PRINTSVGFRAME_POSITION wxDefaultPosition +////@end control identifiers + + +/*! + * WinEDA_PrintSVGFrame class declaration + */ + +class WinEDA_PrintSVGFrame: public wxDialog +{ + DECLARE_DYNAMIC_CLASS( WinEDA_PrintSVGFrame ) + DECLARE_EVENT_TABLE() + +public: + /// Constructors + WinEDA_PrintSVGFrame(); + WinEDA_PrintSVGFrame( wxWindow* parent, wxWindowID id = SYMBOL_WINEDA_PRINTSVGFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_PRINTSVGFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_PRINTSVGFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_PRINTSVGFRAME_SIZE, long style = SYMBOL_WINEDA_PRINTSVGFRAME_STYLE ); + + /// Creation + bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WINEDA_PRINTSVGFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_PRINTSVGFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_PRINTSVGFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_PRINTSVGFRAME_SIZE, long style = SYMBOL_WINEDA_PRINTSVGFRAME_STYLE ); + + /// Destructor + ~WinEDA_PrintSVGFrame(); + + /// Initialises member variables + void Init(); + + /// Creates the controls and sizers + void CreateControls(); + +////@begin WinEDA_PrintSVGFrame event handler declarations + /// wxEVT_CLOSE_WINDOW event handler for ID_DIALOG + void OnCloseWindow( wxCloseEvent& event ); + + /// wxEVT_COMMAND_SPINCTRL_UPDATED event handler for ID_SPINCTRL + void OnSpinctrlUpdated( wxSpinEvent& event ); + + /// wxEVT_COMMAND_RADIOBOX_SELECTED event handler for ID_RADIOBOX_SETPRINTMODE + void OnRadioboxSetprintmodeSelected( wxCommandEvent& event ); + + /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_PRINT_EXECUTE + void OnPrintExecuteClick( wxCommandEvent& event ); + + /// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CLOSE + void OnCloseClick( wxCommandEvent& event ); + +////@end WinEDA_PrintSVGFrame event handler declarations + +////@begin WinEDA_PrintSVGFrame member function declarations + /// Retrieves bitmap resources + wxBitmap GetBitmapResource( const wxString& name ); + + /// Retrieves icon resources + wxIcon GetIconResource( const wxString& name ); +////@end WinEDA_PrintSVGFrame member function declarations + + /// Should we show tooltips? + static bool ShowToolTips(); + +////@begin WinEDA_PrintSVGFrame member variables + wxSpinCtrl* m_ButtPenWidth; + wxRadioBox* m_ModeColorOption; + wxCheckBox* m_Print_Sheet_Ref; + wxRadioBox* m_PagesOption; + wxTextCtrl* m_FileNameCtrl; + wxTextCtrl* m_MessagesBox; +////@end WinEDA_PrintSVGFrame member variables +}; + +#endif + // _SVG_PRINT_H_ diff --git a/cvpcb/affiche.cpp.notused b/cvpcb/affiche.cpp.notused deleted file mode 100644 index 472af0c593..0000000000 --- a/cvpcb/affiche.cpp.notused +++ /dev/null @@ -1,19 +0,0 @@ - /**********************************************************/ - /* Routines d'affichage de parametres et caracteristiques */ - /**********************************************************/ - - /* Fichier AFFICHE.CC */ - - -#include "fctsys.h" - -#include "wxstruct.h" -#include "menu.h" -#include "pcbnew.h" -#include "cvpcb.h" - -#include "3d_struct.h" - -#include "protos.h" - - diff --git a/cvpcb/cvframe.cpp b/cvpcb/cvframe.cpp index 7a85074add..26e7ad0817 100644 --- a/cvpcb/cvframe.cpp +++ b/cvpcb/cvframe.cpp @@ -21,8 +21,8 @@ /*******************************************************/ /* Constructeur de WinEDA_CvpcbFrame: la fenetre generale */ /*******************************************************/ -WinEDA_CvpcbFrame::WinEDA_CvpcbFrame(WinEDA_App *parent, const wxString & title ): - WinEDA_BasicFrame(NULL, CVPCB_FRAME, parent, title, wxDefaultPosition, wxDefaultSize ) +WinEDA_CvpcbFrame::WinEDA_CvpcbFrame(WinEDA_App *parent, const wxString & title, long style ): + WinEDA_BasicFrame(NULL, CVPCB_FRAME, parent, title, wxDefaultPosition, wxDefaultSize, style ) { m_FrameName = wxT("CvpcbFrame"); m_ListCmp = NULL; diff --git a/cvpcb/cvpcb.h b/cvpcb/cvpcb.h index c28e2b503d..699cece83f 100644 --- a/cvpcb/cvpcb.h +++ b/cvpcb/cvpcb.h @@ -1,6 +1,6 @@ - /**********************************************/ - /* CVPCB : declaration des variables globales */ - /**********************************************/ +/**********************************************/ +/* CVPCB : declaration des variables globales */ +/**********************************************/ #ifndef eda_global @@ -15,140 +15,139 @@ #include "colors.h" // Define print format d to display a schematic component line -#define CMP_FORMAT wxT("%3d %8s - %16s : %-.32s") +#define CMP_FORMAT wxT( "%3d %8s - %16s : %-.32s" ) #define FILTERFOOTPRINTKEY "FilterFootprint" -enum TypeOfStruct - { - STRUCT_NOT_INIT, - STRUCT_COMPONENT, - STRUCT_PIN, - STRUCT_MODULE, - STRUCT_PSEUDOMODULE - }; +enum TypeOfStruct { + STRUCT_NOT_INIT, + STRUCT_COMPONENT, + STRUCT_PIN, + STRUCT_MODULE, + STRUCT_PSEUDOMODULE +}; class STOREPIN { public: - int m_Type; /* Type de la structure */ - STOREPIN * Pnext; /* Chainage avant */ - int m_Index; /* variable utilisee selon types de netlistes */ - int m_PinType; /* code type electrique ( Entree Sortie Passive..) */ - wxString m_PinNet; /* Pointeur sur le texte nom de net */ - wxString m_PinNum; - wxString m_PinName; - wxString m_Repere; /* utilise selon formats de netliste */ + int m_Type; /* Type de la structure */ + STOREPIN* Pnext; /* Chainage avant */ + int m_Index; /* variable utilisee selon types de netlistes */ + int m_PinType; /* code type electrique ( Entree Sortie Passive..) */ + wxString m_PinNet; /* Pointeur sur le texte nom de net */ + wxString m_PinNum; + wxString m_PinName; + wxString m_Repere; /* utilise selon formats de netliste */ - STOREPIN(); -} ; + STOREPIN(); +}; class STORECMP { public: - int m_Type; /* Type de la structure */ - STORECMP * Pnext; /* Chainage avant */ - STORECMP * Pback; /* Chainage arriere */ - int m_Num; /* Numero d'ordre */ - int m_Multi; /* Nombre d' unites par boitier */ - STOREPIN * m_Pins; /* pointeur sur la liste des Pins */ - wxString m_Reference; /* U3, R5 ... */ - wxString m_Valeur; /* 7400, 47K ... */ - wxString m_TimeStamp; /* Signature temporelle ("00000000" si absente) */ - wxString m_Module; /* Nom du module (Package) corresp */ - wxString m_Repere; /* utilise selon formats de netliste */ - wxArrayString m_FootprintFilter; /* List of allowed footprints (wildcart allowed - if void: no filtering */ + int m_Type; /* Type de la structure */ + STORECMP* Pnext; /* Chainage avant */ + STORECMP* Pback; /* Chainage arriere */ + int m_Num; /* Numero d'ordre */ + int m_Multi; /* Nombre d' unites par boitier */ + STOREPIN* m_Pins; /* pointeur sur la liste des Pins */ + wxString m_Reference; /* U3, R5 ... */ + wxString m_Valeur; /* 7400, 47K ... */ + wxString m_TimeStamp; /* Signature temporelle ("00000000" si absente) */ + wxString m_Module; /* Nom du module (Package) corresp */ + wxString m_Repere; /* utilise selon formats de netliste */ + wxArrayString m_FootprintFilter; /* List of allowed footprints (wildcart allowed + * if void: no filtering */ - STORECMP(); - ~STORECMP(); -} ; + STORECMP(); + ~STORECMP(); +}; class STOREMOD { public: - int m_Type; /* Type de la structure */ - STOREMOD * Pnext; /* Chainage avant */ - STOREMOD * Pback; /* Chainage arriere */ - wxString m_Module; /* Nom du module */ - wxString m_LibName; /* Nom de la librairie contenant ce module */ - int m_Num ; /* Numero d'ordre pour affichage sur la liste */ - wxString m_Doc; /* Doc associee */ - wxString m_KeyWord; /* Mots cles associes */ + int m_Type; /* Type de la structure */ + STOREMOD* Pnext; /* Chainage avant */ + STOREMOD* Pback; /* Chainage arriere */ + wxString m_Module; /* Nom du module */ + wxString m_LibName; /* Nom de la librairie contenant ce module */ + int m_Num; /* Numero d'ordre pour affichage sur la liste */ + wxString m_Doc; /* Doc associee */ + wxString m_KeyWord; /* Mots cles associes */ - STOREMOD(); + STOREMOD(); }; -eda_global STOREMOD * g_BaseListePkg; -eda_global STORECMP * g_BaseListeCmp; +eda_global STOREMOD* g_BaseListePkg; +eda_global STORECMP* g_BaseListeCmp; -eda_global FILE *source ; -eda_global FILE *dest ; -eda_global FILE *libcmp ; -eda_global FILE *lib_module ; +eda_global FILE* source; +eda_global FILE* dest; +eda_global FILE* libcmp; +eda_global FILE* lib_module; /* nom des fichiers a traiter */ -eda_global wxString FFileName; +eda_global wxString FFileName; /* Types de netliste: */ -#define TYPE_NON_SPECIFIE 0 -#define TYPE_ORCADPCB2 1 -#define TYPE_PCAD 2 +#define TYPE_NON_SPECIFIE 0 +#define TYPE_ORCADPCB2 1 +#define TYPE_PCAD 2 #define TYPE_VIEWLOGIC_WIR 3 #define TYPE_VIEWLOGIC_NET 4 /* Gestion des noms des librairies */ eda_global wxString g_EquivExtBuffer #ifdef MAIN -( wxT(".equ") ) +( wxT( ".equ" ) ) #endif ; eda_global wxString g_ExtCmpBuffer #ifdef MAIN - ( wxT(".cmp") ) +( wxT( ".cmp" ) ) #endif ; -eda_global wxString g_UserNetDirBuffer; // Netlist path (void = current working directory) +eda_global wxString g_UserNetDirBuffer; // Netlist path (void = current working directory) -eda_global wxArrayString g_ListName_Equ; // list of .equ files to load +eda_global wxArrayString g_ListName_Equ; // list of .equ files to load -eda_global int g_FlagEESchema; -eda_global int Rjustify; /* flag pout troncature des noms de Net: - = 0: debut de chaine conservee (->ORCADPCB2) - = 1: fin de chaine conservee (->VIEWLOGIC) */ -eda_global int selection_type; /* 0 pour sel par U??, 1 pour sel par ref ORCADPCB */ +eda_global int g_FlagEESchema; +eda_global int Rjustify; /* flag pout troncature des noms de Net: + * = 0: debut de chaine conservee (->ORCADPCB2) + * = 1: fin de chaine conservee (->VIEWLOGIC) */ +eda_global int selection_type; /* 0 pour sel par U??, 1 pour sel par ref ORCADPCB */ -eda_global int modified; /* Flag != 0 si modif attribution des modules */ -eda_global int ListModIsModified; /* Flag != 0 si modif liste des lib modules */ +eda_global int modified; /* Flag != 0 si modif attribution des modules */ +eda_global int ListModIsModified; /* Flag != 0 si modif liste des lib modules */ -eda_global char alim[1024]; +eda_global char alim[1024]; -eda_global int nbcomp ; /* nombre de composants trouves */ -eda_global int nblib ; /* nombre d'empreintes trouvees */ -eda_global int composants_non_affectes ;/* nbre de composants non affectes */ +eda_global int nbcomp; /* nombre de composants trouves */ +eda_global int nblib; /* nombre d'empreintes trouvees */ +eda_global int composants_non_affectes; /* nbre de composants non affectes */ -eda_global wxString NameBuffer; -eda_global wxString NetInNameBuffer; -eda_global wxString NetInExtBuffer; -eda_global wxString PkgInExtBuffer; -eda_global wxString NetDirBuffer; +eda_global wxString NameBuffer; +eda_global wxString NetInNameBuffer; +eda_global wxString NetInExtBuffer; +eda_global wxString PkgInExtBuffer; +eda_global wxString NetDirBuffer; -eda_global wxString ExtRetroBuffer +eda_global wxString ExtRetroBuffer #ifdef MAIN - ( wxT(".stf") ) +( wxT( ".stf" ) ) #endif ; // Variables generales */ // Unused, for pcbnew compatibility: -eda_global Ki_PageDescr * SheetList[] +eda_global Ki_PageDescr* SheetList[] #ifdef MAIN -= {NULL} += { NULL } #endif ; // Unused, for pcbnew compatibility: -void Plume(int state); +void Plume( int state ); diff --git a/cvpcb/cvstruct.h b/cvpcb/cvstruct.h index 8f331f992d..a011b5a47c 100644 --- a/cvpcb/cvstruct.h +++ b/cvpcb/cvstruct.h @@ -39,7 +39,8 @@ private: // Constructor and destructor public: - WinEDA_CvpcbFrame(WinEDA_App * parent, const wxString & title); + WinEDA_CvpcbFrame(WinEDA_App * parent, const wxString & title, + long style = KICAD_DEFAULT_DRAWFRAME_STYLE); ~WinEDA_CvpcbFrame(); void OnLeftClick(wxListEvent & event); @@ -180,7 +181,8 @@ public: public: WinEDA_DisplayFrame( wxWindow * father, WinEDA_App *parent, const wxString & title, - const wxPoint& pos, const wxSize& size); + const wxPoint& pos, const wxSize& size, + long style = KICAD_DEFAULT_DRAWFRAME_STYLE); ~WinEDA_DisplayFrame(); @@ -194,6 +196,7 @@ public: void OnLeftDClick(wxDC * DC, const wxPoint& MousePos); bool OnRightClick(const wxPoint& MousePos, wxMenu * PopMenu); void SetToolbars(); + void GeneralControle( wxDC* DC, wxPoint Mouse ); void InstallOptionsDisplay(wxCommandEvent& event); MODULE * Get_Module(const wxString & CmpName); diff --git a/cvpcb/dialog_cvpcb_config.cpp b/cvpcb/dialog_cvpcb_config.cpp index d64798d413..f23a752c07 100644 --- a/cvpcb/dialog_cvpcb_config.cpp +++ b/cvpcb/dialog_cvpcb_config.cpp @@ -96,12 +96,14 @@ bool KiConfigCvpcbFrame::Create( wxWindow* parent, wxWindowID id, const wxString ////@end KiConfigCvpcbFrame member initialisation ////@begin KiConfigCvpcbFrame creation - SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS); + SetExtraStyle(wxWS_EX_BLOCK_EVENTS); wxDialog::Create( parent, id, caption, pos, size, style ); CreateControls(); - GetSizer()->Fit(this); - GetSizer()->SetSizeHints(this); + if (GetSizer()) + { + GetSizer()->SetSizeHints(this); + } Centre(); ////@end KiConfigCvpcbFrame creation return true; @@ -116,7 +118,7 @@ void KiConfigCvpcbFrame::CreateControls() SetFont(*g_DialogFont); ////@begin KiConfigCvpcbFrame content construction - // Generated by DialogBlocks, 28/02/2006 16:11:39 (unregistered) + // Generated by DialogBlocks, 27/10/2007 10:35:43 (unregistered) KiConfigCvpcbFrame* itemDialog1 = this; @@ -128,7 +130,7 @@ void KiConfigCvpcbFrame::CreateControls() wxButton* itemButton4 = new wxButton( itemDialog1, SAVE_CFG, _("Save Cfg"), wxDefaultPosition, wxDefaultSize, 0 ); itemButton4->SetForegroundColour(wxColour(198, 0, 0)); - itemBoxSizer3->Add(itemButton4, 0, wxGROW|wxLEFT|wxRIGHT|wxTOP, 5); + itemBoxSizer3->Add(itemButton4, 0, wxGROW|wxALL, 5); wxButton* itemButton5 = new wxButton( itemDialog1, ID_READ_OLDCFG, _("Read Cfg"), wxDefaultPosition, wxDefaultSize, 0 ); itemButton5->SetForegroundColour(wxColour(0, 0, 255)); @@ -136,14 +138,14 @@ void KiConfigCvpcbFrame::CreateControls() wxButton* itemButton6 = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 ); itemButton6->SetForegroundColour(wxColour(0, 128, 0)); - itemBoxSizer3->Add(itemButton6, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5); + itemBoxSizer3->Add(itemButton6, 0, wxGROW|wxALL, 5); - wxString m_NetFormatBoxStrings[] = { - _("&PcbNew"), - _("&ViewLogic"), - _("View &Net + Pkg") - }; - m_NetFormatBox = new wxRadioBox( itemDialog1, FORMAT_NETLIST, _("NetList Formats:"), wxDefaultPosition, wxDefaultSize, 3, m_NetFormatBoxStrings, 1, wxRA_SPECIFY_COLS ); + wxArrayString m_NetFormatBoxStrings; + m_NetFormatBoxStrings.Add(_("&PcbNew")); + m_NetFormatBoxStrings.Add(_("&ViewLogic")); + m_NetFormatBoxStrings.Add(_("View &Net + Pkg")); + m_NetFormatBox = new wxRadioBox( itemDialog1, FORMAT_NETLIST, _("NetList Formats:"), wxDefaultPosition, wxDefaultSize, m_NetFormatBoxStrings, 1, wxRA_SPECIFY_COLS ); + m_NetFormatBox->SetSelection(0); itemBoxSizer3->Add(m_NetFormatBox, 0, wxGROW|wxALL, 5); wxStaticBox* itemStaticBoxSizer8Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Files ext:")); @@ -154,71 +156,71 @@ void KiConfigCvpcbFrame::CreateControls() itemBoxSizer2->Add(m_RightBoxSizer, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5); wxBoxSizer* itemBoxSizer10 = new wxBoxSizer(wxHORIZONTAL); - m_RightBoxSizer->Add(itemBoxSizer10, 0, wxALIGN_CENTER_HORIZONTAL, 5); + m_RightBoxSizer->Add(itemBoxSizer10, 1, wxALIGN_CENTER_HORIZONTAL, 5); wxBoxSizer* itemBoxSizer11 = new wxBoxSizer(wxVERTICAL); itemBoxSizer10->Add(itemBoxSizer11, 0, wxGROW|wxLEFT|wxTOP|wxBOTTOM, 5); wxBoxSizer* itemBoxSizer12 = new wxBoxSizer(wxVERTICAL); - itemBoxSizer11->Add(itemBoxSizer12, 0, wxALIGN_CENTER_HORIZONTAL, 5); + itemBoxSizer11->Add(itemBoxSizer12, 1, wxALIGN_CENTER_HORIZONTAL, 5); wxBoxSizer* itemBoxSizer13 = new wxBoxSizer(wxHORIZONTAL); - itemBoxSizer12->Add(itemBoxSizer13, 0, wxALIGN_CENTER_HORIZONTAL, 5); + itemBoxSizer12->Add(itemBoxSizer13, 0, wxGROW, 5); - wxButton* itemButton14 = new wxButton( itemDialog1, DEL_LIB, _("Delete"), wxDefaultPosition, wxDefaultSize, 0 ); + wxButton* itemButton14 = new wxButton( itemDialog1, DEL_LIB, _("Del"), wxDefaultPosition, wxDefaultSize, 0 ); itemButton14->SetForegroundColour(wxColour(191, 0, 0)); itemBoxSizer13->Add(itemButton14, 0, wxGROW|wxLEFT|wxTOP|wxBOTTOM, 5); - wxButton* itemButton15 = new wxButton( itemDialog1, ADD_LIB, _("Add below"), wxDefaultPosition, wxDefaultSize, 0 ); + wxButton* itemButton15 = new wxButton( itemDialog1, ADD_LIB, _("Add"), wxDefaultPosition, wxDefaultSize, 0 ); itemButton15->SetForegroundColour(wxColour(0, 128, 0)); itemBoxSizer13->Add(itemButton15, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5); - wxButton* itemButton16 = new wxButton( itemDialog1, INSERT_LIB, _("Add above"), wxDefaultPosition, wxDefaultSize, 0 ); + wxButton* itemButton16 = new wxButton( itemDialog1, INSERT_LIB, _("Ins"), wxDefaultPosition, wxDefaultSize, 0 ); itemButton16->SetForegroundColour(wxColour(0, 0, 255)); itemBoxSizer13->Add(itemButton16, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxTOP|wxBOTTOM, 5); wxBoxSizer* itemBoxSizer17 = new wxBoxSizer(wxVERTICAL); - itemBoxSizer12->Add(itemBoxSizer17, 0, wxGROW|wxTOP, 5); + itemBoxSizer12->Add(itemBoxSizer17, 1, wxGROW|wxTOP, 5); wxStaticText* itemStaticText18 = new wxStaticText( itemDialog1, wxID_STATIC, _("Libraries"), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticText18->SetForegroundColour(wxColour(204, 0, 0)); itemBoxSizer17->Add(itemStaticText18, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); - wxString* m_ListLibrStrings = NULL; - m_ListLibr = new wxListBox( itemDialog1, ID_LISTBOX, wxDefaultPosition, wxSize(-1, 200), 0, m_ListLibrStrings, wxLB_SINGLE ); - itemBoxSizer17->Add(m_ListLibr, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5); + wxArrayString m_ListLibrStrings; + m_ListLibr = new wxListBox( itemDialog1, ID_LISTBOX, wxDefaultPosition, wxSize(-1, 200), m_ListLibrStrings, wxLB_SINGLE ); + itemBoxSizer17->Add(m_ListLibr, 1, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5); wxBoxSizer* itemBoxSizer20 = new wxBoxSizer(wxVERTICAL); itemBoxSizer10->Add(itemBoxSizer20, 0, wxGROW|wxTOP|wxBOTTOM, 5); wxBoxSizer* itemBoxSizer21 = new wxBoxSizer(wxVERTICAL); - itemBoxSizer20->Add(itemBoxSizer21, 0, wxALIGN_CENTER_HORIZONTAL, 5); + itemBoxSizer20->Add(itemBoxSizer21, 1, wxALIGN_CENTER_HORIZONTAL, 5); wxBoxSizer* itemBoxSizer22 = new wxBoxSizer(wxHORIZONTAL); - itemBoxSizer21->Add(itemBoxSizer22, 0, wxALIGN_CENTER_HORIZONTAL, 5); + itemBoxSizer21->Add(itemBoxSizer22, 0, wxGROW, 5); - wxButton* itemButton23 = new wxButton( itemDialog1, DEL_EQU, _("Delete"), wxDefaultPosition, wxDefaultSize, 0 ); + wxButton* itemButton23 = new wxButton( itemDialog1, DEL_EQU, _("Del"), wxDefaultPosition, wxDefaultSize, 0 ); itemButton23->SetForegroundColour(wxColour(196, 0, 0)); itemBoxSizer22->Add(itemButton23, 0, wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxBOTTOM, 5); - wxButton* itemButton24 = new wxButton( itemDialog1, ADD_EQU, _("Add below"), wxDefaultPosition, wxDefaultSize, 0 ); + wxButton* itemButton24 = new wxButton( itemDialog1, ADD_EQU, _("Add"), wxDefaultPosition, wxDefaultSize, 0 ); itemButton24->SetForegroundColour(wxColour(0, 128, 0)); itemBoxSizer22->Add(itemButton24, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5); - wxButton* itemButton25 = new wxButton( itemDialog1, INSERT_EQU, _("Add above"), wxDefaultPosition, wxDefaultSize, 0 ); + wxButton* itemButton25 = new wxButton( itemDialog1, INSERT_EQU, _("Ins"), wxDefaultPosition, wxDefaultSize, 0 ); itemButton25->SetForegroundColour(wxColour(0, 0, 255)); itemBoxSizer22->Add(itemButton25, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT|wxTOP|wxBOTTOM, 5); wxBoxSizer* itemBoxSizer26 = new wxBoxSizer(wxVERTICAL); - itemBoxSizer21->Add(itemBoxSizer26, 0, wxGROW|wxTOP, 5); + itemBoxSizer21->Add(itemBoxSizer26, 1, wxGROW|wxTOP, 5); wxStaticText* itemStaticText27 = new wxStaticText( itemDialog1, wxID_STATIC, _("Equiv"), wxDefaultPosition, wxDefaultSize, 0 ); itemStaticText27->SetForegroundColour(wxColour(204, 0, 0)); itemBoxSizer26->Add(itemStaticText27, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); - wxString* m_ListEquivStrings = NULL; - m_ListEquiv = new wxListBox( itemDialog1, ID_LISTBOX1, wxDefaultPosition, wxSize(-1, 200), 0, m_ListEquivStrings, wxLB_SINGLE ); - itemBoxSizer26->Add(m_ListEquiv, 0, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5); + wxArrayString m_ListEquivStrings; + m_ListEquiv = new wxListBox( itemDialog1, ID_LISTBOX1, wxDefaultPosition, wxSize(-1, 200), m_ListEquivStrings, wxLB_SINGLE ); + itemBoxSizer26->Add(m_ListEquiv, 1, wxGROW|wxLEFT|wxRIGHT|wxBOTTOM, 5); m_FileExtBoxSizerH = new wxBoxSizer(wxHORIZONTAL); m_RightBoxSizer->Add(m_FileExtBoxSizerH, 0, wxGROW, 5); diff --git a/cvpcb/dialog_cvpcb_config.h b/cvpcb/dialog_cvpcb_config.h index b27a919b9d..26bf6871dd 100644 --- a/cvpcb/dialog_cvpcb_config.h +++ b/cvpcb/dialog_cvpcb_config.h @@ -35,11 +35,6 @@ class wxBoxSizer; ////@begin control identifiers #define ID_DIALOG 10000 -#define SYMBOL_KICONFIGCVPCBFRAME_STYLE wxCAPTION|wxSYSTEM_MENU|wxCLOSE_BOX|MAYBE_RESIZE_BORDER -#define SYMBOL_KICONFIGCVPCBFRAME_TITLE _("Dialog") -#define SYMBOL_KICONFIGCVPCBFRAME_IDNAME ID_DIALOG -#define SYMBOL_KICONFIGCVPCBFRAME_SIZE wxSize(400, 300) -#define SYMBOL_KICONFIGCVPCBFRAME_POSITION wxDefaultPosition #define SAVE_CFG 10001 #define ID_READ_OLDCFG 10002 #define FORMAT_NETLIST 10003 @@ -51,6 +46,11 @@ class wxBoxSizer; #define ADD_EQU 10008 #define INSERT_EQU 10009 #define ID_LISTBOX1 10011 +#define SYMBOL_KICONFIGCVPCBFRAME_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX +#define SYMBOL_KICONFIGCVPCBFRAME_TITLE _("Cvpcb Configuration") +#define SYMBOL_KICONFIGCVPCBFRAME_IDNAME ID_DIALOG +#define SYMBOL_KICONFIGCVPCBFRAME_SIZE wxSize(400, 300) +#define SYMBOL_KICONFIGCVPCBFRAME_POSITION wxDefaultPosition ////@end control identifiers /*! diff --git a/cvpcb/dialog_cvpcb_config.pjd b/cvpcb/dialog_cvpcb_config.pjd index b7d19e42ad..5e67f92ee9 100644 --- a/cvpcb/dialog_cvpcb_config.pjd +++ b/cvpcb/dialog_cvpcb_config.pjd @@ -221,7 +221,7 @@ "dialog_cvpcb_config.cpp" "dialog_cvpcb_config.h" "" - "Dialog" + "Cvpcb Configuration" 1 "" 0 @@ -360,7 +360,7 @@ 1 1 1 - 0 + 1 0 0 0 @@ -477,7 +477,7 @@ 5 1 1 - 0 + 1 1 0 0 @@ -620,7 +620,7 @@ "" "Centre" "Centre" - 0 + 1 5 0 0 @@ -670,7 +670,7 @@ "" "Centre" "Centre" - 0 + 1 5 0 0 @@ -693,7 +693,7 @@ "wbBoxSizerProxy" "Horizontal" "" - "Centre" + "Expand" "Centre" 0 5 @@ -898,7 +898,7 @@ "" "Expand" "Centre" - 0 + 1 5 0 0 @@ -1027,7 +1027,7 @@ 200 "Expand" "Centre" - 0 + 1 5 1 1 @@ -1082,7 +1082,7 @@ "" "Centre" "Centre" - 0 + 1 5 0 0 @@ -1105,7 +1105,7 @@ "wbBoxSizerProxy" "Horizontal" "" - "Centre" + "Expand" "Centre" 0 5 @@ -1310,7 +1310,7 @@ "" "Expand" "Centre" - 0 + 1 5 0 0 @@ -1439,7 +1439,7 @@ 200 "Expand" "Centre" - 0 + 1 5 1 1 diff --git a/cvpcb/dialog_display_options.cpp b/cvpcb/dialog_display_options.cpp index 91de3e4dd7..c89441b8d6 100644 --- a/cvpcb/dialog_display_options.cpp +++ b/cvpcb/dialog_display_options.cpp @@ -133,7 +133,7 @@ void WinEDA_FootprintDisplayOptionsFrame::CreateControls() SetFont(*g_DialogFont); ////@begin WinEDA_FootprintDisplayOptionsFrame content construction - // Generated by DialogBlocks, 25/10/2007 10:39:07 (unregistered) + // Generated by DialogBlocks, 27/10/2007 09:57:04 (unregistered) WinEDA_FootprintDisplayOptionsFrame* itemDialog1 = this; @@ -149,7 +149,7 @@ void WinEDA_FootprintDisplayOptionsFrame::CreateControls() m_EdgesDisplayOptionStrings.Add(_("&Sketch")); m_EdgesDisplayOption = new wxRadioBox( itemDialog1, EDGE_SELECT, _("Edges:"), wxDefaultPosition, wxDefaultSize, m_EdgesDisplayOptionStrings, 1, wxRA_SPECIFY_COLS ); m_EdgesDisplayOption->SetSelection(0); - MainBoxSizer->Add(m_EdgesDisplayOption, 1, wxALIGN_TOP|wxALL, 5); + MainBoxSizer->Add(m_EdgesDisplayOption, 0, wxALIGN_TOP|wxALL, 5); wxArrayString m_TextDisplayOptionStrings; m_TextDisplayOptionStrings.Add(_("&Line")); @@ -157,7 +157,7 @@ void WinEDA_FootprintDisplayOptionsFrame::CreateControls() m_TextDisplayOptionStrings.Add(_("&Sketch")); m_TextDisplayOption = new wxRadioBox( itemDialog1, TEXT_SELECT, _("Texts:"), wxDefaultPosition, wxDefaultSize, m_TextDisplayOptionStrings, 1, wxRA_SPECIFY_COLS ); m_TextDisplayOption->SetSelection(0); - MainBoxSizer->Add(m_TextDisplayOption, 1, wxALIGN_TOP|wxALL, 5); + MainBoxSizer->Add(m_TextDisplayOption, 0, wxALIGN_TOP|wxALL, 5); ColumnBoxSizer = new wxBoxSizer(wxVERTICAL); MainBoxSizer->Add(ColumnBoxSizer, 1, wxALIGN_TOP|wxLEFT|wxRIGHT|wxTOP, 5); @@ -168,14 +168,14 @@ void WinEDA_FootprintDisplayOptionsFrame::CreateControls() m_IsShowPadNum = new wxCheckBox( itemDialog1, PADNUM_OPT, _("Display Pad &Num"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE ); m_IsShowPadNum->SetValue(false); - if (WinEDA_FootprintDisplayOptionsFrame::ShowToolTips()) + if (ShowToolTips()) m_IsShowPadNum->SetToolTip(_("Display pad number")); ColumnBoxSizer->Add(m_IsShowPadNum, 1, wxGROW|wxALL, 5); ColumnBoxSizer->Add(5, 5, 0, wxGROW|wxTOP, 5); wxButton* itemButton10 = new wxButton( itemDialog1, ID_SAVE_CONFIG, _("Save Cfg"), wxDefaultPosition, wxDefaultSize, 0 ); - ColumnBoxSizer->Add(itemButton10, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP, 5); + ColumnBoxSizer->Add(itemButton10, 0, wxALIGN_LEFT|wxALL, 5); wxStaticLine* itemStaticLine11 = new wxStaticLine( itemDialog1, ID_STATICLINE1, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL ); OuterBoxSizer->Add(itemStaticLine11, 0, wxGROW|wxALL, 5); diff --git a/cvpcb/dialog_display_options.pjd b/cvpcb/dialog_display_options.pjd index 2dc7033cc5..976f8614e9 100644 --- a/cvpcb/dialog_display_options.pjd +++ b/cvpcb/dialog_display_options.pjd @@ -10,10 +10,8 @@ 0 0 0 - 1 1 1 - 1 0 "jean-pierre Charras" "License GNU" @@ -215,7 +213,6 @@ 0 "" 0 - 0 "ID_DIALOG" 10000 "WinEDA_FootprintDisplayOptionsFrame" @@ -236,13 +233,6 @@ 0 1 "<Any platform>" - "" - "" - "" - "" - "" - "" - "Tiled" 1 0 0 @@ -353,11 +343,6 @@ "<Any platform>" "DisplayOpt.DisplayModEdge" "wxGenericValidator(& %VARIABLE%)" - "" - "" - "" - "" - "" 0 1 0 @@ -370,7 +355,7 @@ -1 "Centre" "Top" - 1 + 0 5 1 1 @@ -416,11 +401,6 @@ "<Any platform>" "DisplayOpt.DisplayModText" "wxGenericValidator(& %VARIABLE%)" - "" - "" - "" - "" - "" 0 1 0 @@ -433,7 +413,7 @@ -1 "Centre" "Top" - 1 + 0 5 1 1 @@ -496,11 +476,6 @@ "" "DisplayOpt.DisplayPadFill" "wxGenericValidator(& %VARIABLE%)" - "" - "" - "" - "" - "" "" "" "" @@ -559,11 +534,6 @@ "Display pad number" "DisplayOpt.DisplayPadNum" "wxGenericValidator(& %VARIABLE%)" - "" - "" - "" - "" - "" "" "" "" @@ -647,13 +617,6 @@ 0 "" "" - "" - "" - "" - "" - "" - "" - "" "" "" "" @@ -681,7 +644,7 @@ 1 1 1 - 0 + 1 0 0 0 @@ -794,13 +757,6 @@ 1 "" "" - "" - "" - "" - "" - "" - "" - "" "" "FF0000" "" @@ -860,13 +816,6 @@ 0 "" "" - "" - "" - "" - "" - "" - "" - "" "" "0000FF" "" @@ -926,13 +875,6 @@ 0 "" "" - "" - "" - "" - "" - "" - "" - "" "" "" "" diff --git a/cvpcb/displayframe.cpp b/cvpcb/displayframe.cpp index 50b67902cb..1069aae048 100644 --- a/cvpcb/displayframe.cpp +++ b/cvpcb/displayframe.cpp @@ -29,21 +29,26 @@ EVT_TOOL( ID_CVPCB_SHOW3D_FRAME, WinEDA_BasePcbFrame::Show3D_Frame ) END_EVENT_TABLE() -/*********************************************************************/ -/* Constructeur de WinEDA_DisplayFrame: la fenetre de visu du composant */ -/*********************************************************************/ +/***************************************************************************/ +/* WinEDA_DisplayFrame: the frame to display the current focused footprint */ +/***************************************************************************/ WinEDA_DisplayFrame::WinEDA_DisplayFrame( wxWindow* father, WinEDA_App* parent, const wxString& title, - const wxPoint& pos, const wxSize& size ) : - WinEDA_BasePcbFrame( father, parent, CVPCB_DISPLAY_FRAME, title, pos, size ) + const wxPoint& pos, const wxSize& size, long style ) : + WinEDA_BasePcbFrame( father, parent, CVPCB_DISPLAY_FRAME, title, pos, size, style ) { m_FrameName = wxT( "CmpFrame" ); - m_Draw_Axis = TRUE; // TRUE pour avoir les axes dessines - m_Draw_Grid = TRUE; // TRUE pour avoir la axes dessinee - m_Draw_Sheet_Ref = FALSE; // TRUE pour avoir le cartouche dessiné + m_Draw_Axis = TRUE; // TRUE if we want the axis + m_Draw_Grid = TRUE; // TRUE if we want the grid + m_Draw_Sheet_Ref = FALSE; // TRUE if we want the sheet references - SetIcon( wxIcon( wxT( "icon_cvpcb" ) ) ); // Give an icon + // Give an icon + #ifdef __WINDOWS__ + SetIcon( wxICON( a_icon_cvpcb ) ); + #else + SetIcon( wxICON( icon_cvpcb ) ); + #endif SetTitle( title ); m_Pcb = new BOARD( NULL, this ); @@ -58,17 +63,16 @@ WinEDA_DisplayFrame::WinEDA_DisplayFrame( wxWindow* father, WinEDA_App* parent, } -/*****************************************/ -/* Fonctions de base de WinEDA_DisplayFrame */ -/*****************************************/ - -// Destructeur +/******************************************/ WinEDA_DisplayFrame::~WinEDA_DisplayFrame() +/******************************************/ + +// Destructor { delete m_CurrentScreen; - + delete m_Pcb; - + m_Parent->m_CvpcbFrame->DrawFrame = NULL; } @@ -77,7 +81,8 @@ WinEDA_DisplayFrame::~WinEDA_DisplayFrame() void WinEDA_DisplayFrame::OnCloseWindow( wxCloseEvent& event ) /************************************************************/ -/* Fermeture par icone ou systeme +/* Called when the frame is closed + * Save current settings (frame position and size */ { wxPoint pos; @@ -162,12 +167,12 @@ void WinEDA_DisplayFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) bool WinEDA_DisplayFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) /*********************************************************************************/ { - return true; + return true; } /****************************************************************/ -void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) +void WinEDA_DisplayFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) /****************************************************************/ { wxSize delta; @@ -216,28 +221,28 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) m_CurrentScreen->m_O_Curseur = m_CurrentScreen->m_Curseur; break; - case WXK_NUMPAD8: /* Deplacement curseur vers le haut */ + case WXK_NUMPAD8: /* cursor moved up */ case WXK_UP: DrawPanel->CalcScrolledPosition( Mouse.x, Mouse.y - delta.y, &Mouse.x, &Mouse.y ); GRMouseWarp( DrawPanel, Mouse ); break; - case WXK_NUMPAD2: /* Deplacement curseur vers le bas */ + case WXK_NUMPAD2: /* cursor moved down */ case WXK_DOWN: DrawPanel->CalcScrolledPosition( Mouse.x, Mouse.y + delta.y, &Mouse.x, &Mouse.y ); GRMouseWarp( DrawPanel, Mouse ); break; - case WXK_NUMPAD4: /* Deplacement curseur vers la gauche */ + case WXK_NUMPAD4: /* cursor moved left */ case WXK_LEFT: DrawPanel->CalcScrolledPosition( Mouse.x - delta.x, Mouse.y, &Mouse.x, &Mouse.y ); GRMouseWarp( DrawPanel, Mouse ); break; - case WXK_NUMPAD6: /* Deplacement curseur vers la droite */ + case WXK_NUMPAD6: /* cursor moved right */ case WXK_RIGHT: DrawPanel->CalcScrolledPosition( Mouse.x + delta.x, Mouse.y, &Mouse.x, &Mouse.y ); @@ -246,9 +251,8 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) } } - /* Recalcul de la position du curseur schema */ m_CurrentScreen->m_Curseur = curpos; - /* Placement sur la grille generale */ + /* Put cursor on grid */ PutOnGrid( &m_CurrentScreen->m_Curseur ); if( m_CurrentScreen->IsRefreshReq() ) @@ -276,7 +280,7 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) } } - Affiche_Status_Box(); /* Affichage des coord curseur */ + Affiche_Status_Box(); /* Display new cursor coordinates */ } @@ -284,10 +288,11 @@ void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) void WinEDA_DisplayFrame::Process_Special_Functions( wxCommandEvent& event ) /*************************************************************************/ -/* Traite les selections d'outils et les commandes appelees du menu POPUP +/* Called when a tool is selected, or when a popup menu is clicked + * Currently : no action exists */ { - int id = event.GetId(); + int id = event.GetId(); wxClientDC dc( DrawPanel ); diff --git a/cvpcb/makefile.include b/cvpcb/makefile.include index 1de52de6f1..4197a1ed82 100644 --- a/cvpcb/makefile.include +++ b/cvpcb/makefile.include @@ -33,7 +33,6 @@ OBJECTS = $(TARGET).o \ setvisu.o\ dialog_display_options.o\ zoom.o \ - visumod.o\ tracemod.o \ classpcb.o \ class_board.o \ @@ -136,8 +135,6 @@ setvisu.o: setvisu.cpp $(DEPEND) zoom.o: ../share/zoom.cpp $(DEPEND) $(CC) -c $(EDACPPFLAGS) -o $@ ../share/$*.cpp -visumod.o: visumod.cpp $(DEPEND) - tracemod.o: ../pcbnew/tracemod.cpp ../include/gr_basic.h $(DEPEND) $(CC) -c $(EDACPPFLAGS) -o $@ ../pcbnew/$*.cpp diff --git a/cvpcb/setvisu.cpp b/cvpcb/setvisu.cpp index 78b2c123e5..043f31eaa2 100644 --- a/cvpcb/setvisu.cpp +++ b/cvpcb/setvisu.cpp @@ -17,7 +17,8 @@ void WinEDA_CvpcbFrame::CreateScreenCmp() /*******************************************/ -/* Creation de la fenetre d'affichage du composant +/* Create or Update the frame showing the current highlighted footprint + * and (if showed) the 3D display frame */ { wxString msg, FootprintName; @@ -28,15 +29,13 @@ void WinEDA_CvpcbFrame::CreateScreenCmp() if( DrawFrame == NULL ) { DrawFrame = new WinEDA_DisplayFrame( this, m_Parent, _( "Module" ), - wxPoint( 0, 0 ), wxSize( 600, 400 ) ); - + wxPoint( 0, 0 ), wxSize( 600, + 400 ), + KICAD_DEFAULT_DRAWFRAME_STYLE | + wxFRAME_FLOAT_ON_PARENT ); IsNew = TRUE; + DrawFrame->Show( TRUE ); } - else - DrawFrame->Maximize( FALSE ); - - DrawFrame->SetFocus(); /* Active entree clavier */ - DrawFrame->Show( TRUE ); if( !FootprintName.IsEmpty() ) { @@ -44,19 +43,19 @@ void WinEDA_CvpcbFrame::CreateScreenCmp() DrawFrame->SetTitle( msg ); STOREMOD* Module = GetModuleDescrByName( FootprintName ); msg = _( "Lib: " ); - + if( Module ) msg += Module->m_LibName; else msg += wxT( "???" ); - + DrawFrame->SetStatusText( msg, 0 ); if( DrawFrame->m_Pcb->m_Modules ) { // there is only one module in the list DrawFrame->m_Pcb->m_Modules->DeleteStructure(); - + DrawFrame->m_Pcb->m_Modules = NULL; } @@ -73,3 +72,32 @@ void WinEDA_CvpcbFrame::CreateScreenCmp() DrawFrame->m_Draw3DFrame->NewDisplay(); } } + + + +/*******************************************************************/ +void WinEDA_DisplayFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) +/*******************************************************************/ +/* Draws the current highlighted footprint */ +{ + if( !m_Pcb ) + return; + + MODULE* Module = m_Pcb->m_Modules; + + ActiveScreen = (PCB_SCREEN*) GetScreen(); + + if( EraseBg ) + DrawPanel->EraseScreen( DC ); + + DrawPanel->DrawBackGround( DC ); + + if( Module ) + { + Module->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_COPY ); + Module->Display_Infos( this ); + } + + Affiche_Status_Box(); + DrawPanel->Trace_Curseur( DC ); +} diff --git a/cvpcb/visumod.cpp b/cvpcb/visumod.cpp deleted file mode 100644 index cf6cde017d..0000000000 --- a/cvpcb/visumod.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/************************************************/ -/* Routines de visualisation du module courant */ -/************************************************/ - - -#include "fctsys.h" -#include "common.h" -#include "cvpcb.h" -#include "macros.h" -#include "pcbnew.h" - -#include "protos.h" - -/* defines locaux */ - -/* Variables locales */ - - -/*******************************************************************/ -void WinEDA_DisplayFrame::RedrawActiveWindow( wxDC* DC, bool EraseBg ) -/*******************************************************************/ -/* Affiche le module courant */ -{ - if( !m_Pcb ) - return; - - MODULE* Module = m_Pcb->m_Modules; - - ActiveScreen = (PCB_SCREEN*) GetScreen(); - - if( EraseBg ) - DrawPanel->EraseScreen( DC ); - - DrawPanel->DrawBackGround( DC ); - - if( Module ) - { - Module->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_COPY ); - Module->Display_Infos( this ); - } - - Affiche_Status_Box(); - DrawPanel->Trace_Curseur( DC ); -} diff --git a/eeschema/dialog_set_status.cpp.notused b/eeschema/dialog_set_status.cpp.notused deleted file mode 100644 index d23603b6d6..0000000000 --- a/eeschema/dialog_set_status.cpp.notused +++ /dev/null @@ -1,282 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: dialog_set_status.cpp -// Purpose: -// Author: jean-pierre Charras -// Modified by: -// Created: 11/02/2006 21:42:23 -// RCS-ID: -// Copyright: License GNU -// Licence: -///////////////////////////////////////////////////////////////////////////// - -// Generated by DialogBlocks (unregistered), 11/02/2006 21:42:23 - -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma implementation "dialog_set_status.h" -#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 - -////@begin includes -////@end includes - -#include "dialog_set_status.h" - -////@begin XPM images -////@end XPM images - -/*! - * WinEDA_ConfigFrame type definition - */ - -IMPLEMENT_DYNAMIC_CLASS( WinEDA_ConfigFrame, wxDialog ) - -/*! - * WinEDA_ConfigFrame event table definition - */ - -BEGIN_EVENT_TABLE( WinEDA_ConfigFrame, wxDialog ) - -////@begin WinEDA_ConfigFrame event table entries - EVT_BUTTON( ID_BUTTON, WinEDA_ConfigFrame::OnButtonClick ) - - EVT_BUTTON( ID_BUTTON1, WinEDA_ConfigFrame::OnButton1Click ) - - EVT_BUTTON( ID_BUTTON2, WinEDA_ConfigFrame::OnButton2Click ) - - EVT_BUTTON( ID_BUTTON3, WinEDA_ConfigFrame::OnButton3Click ) - -////@end WinEDA_ConfigFrame event table entries - -END_EVENT_TABLE() - -/*! - * WinEDA_ConfigFrame constructors - */ - -WinEDA_ConfigFrame::WinEDA_ConfigFrame( ) -{ -} - -WinEDA_ConfigFrame::WinEDA_ConfigFrame( WinEDA_SchematicFrame* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) -{ - m_Parent = parent; - m_LibListChanged = FALSE; - - msg = _("from ") + EDA_Appl->m_CurrentOptionFile; - SetTitle(msg); - Create(parent, id, caption, pos, size, style); -} - -/*! - * WinEDA_ConfigFrame creator - */ - -bool WinEDA_ConfigFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) -{ -////@begin WinEDA_ConfigFrame member initialisation - m_CmpfileExtText = NULL; - m_NetfileExtText = NULL; - m_LibfileExtText = NULL; - m_SymbolfileExtText = NULL; - m_SchfileExtText = NULL; - m_ListLibr = NULL; - m_CmpfileExtText = NULL; - m_LibDirCtrl = NULL; -////@end WinEDA_ConfigFrame member initialisation - -////@begin WinEDA_ConfigFrame creation - SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS); - wxDialog::Create( parent, id, caption, pos, size, style ); - - CreateControls(); - GetSizer()->Fit(this); - GetSizer()->SetSizeHints(this); - Centre(); -////@end WinEDA_ConfigFrame creation - return true; -} - -/*! - * Control creation for WinEDA_ConfigFrame - */ - -void WinEDA_ConfigFrame::CreateControls() -{ - SetFont(*g_DialogFont); -////@begin WinEDA_ConfigFrame content construction - // Generated by DialogBlocks, 11/02/2006 22:06:21 (unregistered) - - WinEDA_ConfigFrame* itemDialog1 = this; - - wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL); - itemDialog1->SetSizer(itemBoxSizer2); - - wxBoxSizer* itemBoxSizer3 = new wxBoxSizer(wxHORIZONTAL); - itemBoxSizer2->Add(itemBoxSizer3, 0, 0, 0); - - wxBoxSizer* itemBoxSizer4 = new wxBoxSizer(wxVERTICAL); - itemBoxSizer3->Add(itemBoxSizer4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); - - wxButton* itemButton5 = new wxButton( itemDialog1, ID_BUTTON, _("Save Cfg"), wxDefaultPosition, wxDefaultSize, 0 ); - itemButton5->SetForegroundColour(wxColour(204, 0, 0)); - itemBoxSizer4->Add(itemButton5, 0, wxGROW|wxALL, 5); - - wxString itemRadioBox6Strings[] = { - _("&PcbNew"), - _("&OrcadPcb2"), - _("&CadStar"), - _("&Spice"), - _("Other") - }; - wxRadioBox* itemRadioBox6 = new wxRadioBox( itemDialog1, ID_RADIOBOX, _("NetList Formats:"), wxDefaultPosition, wxDefaultSize, 5, itemRadioBox6Strings, 1, wxRA_SPECIFY_COLS ); - itemBoxSizer4->Add(itemRadioBox6, 0, wxGROW|wxALL, 5); - - wxStaticBox* itemStaticBoxSizer7Static = new wxStaticBox(itemDialog1, wxID_ANY, _("Files ext:")); - wxStaticBoxSizer* itemStaticBoxSizer7 = new wxStaticBoxSizer(itemStaticBoxSizer7Static, wxVERTICAL); - itemBoxSizer4->Add(itemStaticBoxSizer7, 0, wxGROW|wxALL, 5); - - m_CmpfileExtText = new wxStaticText( itemDialog1, wxID_STATIC, _("Cmp file Ext: "), wxDefaultPosition, wxDefaultSize, 0 ); - itemStaticBoxSizer7->Add(m_CmpfileExtText, 0, wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE, 5); - - m_NetfileExtText = new wxStaticText( itemDialog1, wxID_STATIC, _("Net file Ext: "), wxDefaultPosition, wxDefaultSize, 0 ); - itemStaticBoxSizer7->Add(m_NetfileExtText, 0, wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE, 5); - - m_LibfileExtText = new wxStaticText( itemDialog1, wxID_STATIC, _("Library file Ext: "), wxDefaultPosition, wxDefaultSize, 0 ); - itemStaticBoxSizer7->Add(m_LibfileExtText, 0, wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE, 5); - - m_SymbolfileExtText = new wxStaticText( itemDialog1, wxID_STATIC, _("Symbol file Ext: "), wxDefaultPosition, wxDefaultSize, 0 ); - itemStaticBoxSizer7->Add(m_SymbolfileExtText, 0, wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE, 5); - - m_SchfileExtText = new wxStaticText( itemDialog1, wxID_STATIC, _("Schematic file Ext: "), wxDefaultPosition, wxDefaultSize, 0 ); - m_SchfileExtText->Enable(false); - itemStaticBoxSizer7->Add(m_SchfileExtText, 0, wxALIGN_LEFT|wxALL|wxADJUST_MINSIZE, 5); - - wxBoxSizer* itemBoxSizer13 = new wxBoxSizer(wxVERTICAL); - itemBoxSizer3->Add(itemBoxSizer13, 0, wxGROW|wxALL, 5); - - wxBoxSizer* itemBoxSizer14 = new wxBoxSizer(wxHORIZONTAL); - itemBoxSizer13->Add(itemBoxSizer14, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); - - wxButton* itemButton15 = new wxButton( itemDialog1, ID_BUTTON1, _("Del"), wxDefaultPosition, wxDefaultSize, 0 ); - itemButton15->SetForegroundColour(wxColour(204, 0, 0)); - itemBoxSizer14->Add(itemButton15, 0, wxGROW|wxALL, 5); - - wxButton* itemButton16 = new wxButton( itemDialog1, ID_BUTTON2, _("Add"), wxDefaultPosition, wxDefaultSize, 0 ); - itemButton16->SetForegroundColour(wxColour(0, 128, 0)); - itemBoxSizer14->Add(itemButton16, 0, wxGROW|wxALL, 5); - - wxButton* itemButton17 = new wxButton( itemDialog1, ID_BUTTON3, _("Ins"), wxDefaultPosition, wxDefaultSize, 0 ); - itemButton17->SetForegroundColour(wxColour(0, 0, 255)); - itemBoxSizer14->Add(itemButton17, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); - - wxStaticText* itemStaticText18 = new wxStaticText( itemDialog1, wxID_STATIC, _("Libraries:"), wxDefaultPosition, wxDefaultSize, 0 ); - itemStaticText18->SetForegroundColour(wxColour(196, 0, 0)); - itemBoxSizer13->Add(itemStaticText18, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); - - wxString* m_ListLibrStrings = NULL; - m_ListLibr = new wxListBox( itemDialog1, ID_LISTBOX, wxDefaultPosition, wxSize(-1, 250), 0, m_ListLibrStrings, wxLB_SINGLE ); - itemBoxSizer13->Add(m_ListLibr, 0, wxGROW|wxALL, 5); - - m_CmpfileExtText = new wxStaticText( itemDialog1, wxID_STATIC, _("Library files path:"), wxDefaultPosition, wxDefaultSize, 0 ); - m_CmpfileExtText->SetForegroundColour(wxColour(198, 0, 0)); - itemBoxSizer2->Add(m_CmpfileExtText, 0, wxALIGN_LEFT|wxLEFT|wxRIGHT|wxTOP|wxADJUST_MINSIZE, 5); - - m_LibDirCtrl = new wxTextCtrl( itemDialog1, ID_TEXTCTRL, _T(""), wxDefaultPosition, wxDefaultSize, 0 ); - itemBoxSizer2->Add(m_LibDirCtrl, 0, wxGROW|wxALL, 5); - -////@end WinEDA_ConfigFrame content construction -} - -/*! - * Should we show tooltips? - */ - -bool WinEDA_ConfigFrame::ShowToolTips() -{ - return true; -} - -/*! - * Get bitmap resources - */ - -wxBitmap WinEDA_ConfigFrame::GetBitmapResource( const wxString& name ) -{ - // Bitmap retrieval -////@begin WinEDA_ConfigFrame bitmap retrieval - wxUnusedVar(name); - return wxNullBitmap; -////@end WinEDA_ConfigFrame bitmap retrieval -} - -/*! - * Get icon resources - */ - -wxIcon WinEDA_ConfigFrame::GetIconResource( const wxString& name ) -{ - // Icon retrieval -////@begin WinEDA_ConfigFrame icon retrieval - wxUnusedVar(name); - return wxNullIcon; -////@end WinEDA_ConfigFrame icon retrieval -} -/*! - * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON - */ - -void WinEDA_ConfigFrame::OnButtonClick( wxCommandEvent& event ) -{ -////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON in WinEDA_ConfigFrame. - // Before editing this code, remove the block markers. - event.Skip(); -////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON in WinEDA_ConfigFrame. -} - -/*! - * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON1 - */ - -void WinEDA_ConfigFrame::OnButton1Click( wxCommandEvent& event ) -{ -////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON1 in WinEDA_ConfigFrame. - // Before editing this code, remove the block markers. - event.Skip(); -////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON1 in WinEDA_ConfigFrame. -} - -/*! - * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON2 - */ - -void WinEDA_ConfigFrame::OnButton2Click( wxCommandEvent& event ) -{ -////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON2 in WinEDA_ConfigFrame. - // Before editing this code, remove the block markers. - event.Skip(); -////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON2 in WinEDA_ConfigFrame. -} - -/*! - * wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON3 - */ - -void WinEDA_ConfigFrame::OnButton3Click( wxCommandEvent& event ) -{ -////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON3 in WinEDA_ConfigFrame. - // Before editing this code, remove the block markers. - event.Skip(); -////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON3 in WinEDA_ConfigFrame. -} - - diff --git a/eeschema/dialog_set_status.h.notused b/eeschema/dialog_set_status.h.notused deleted file mode 100644 index 0c69be52b7..0000000000 --- a/eeschema/dialog_set_status.h.notused +++ /dev/null @@ -1,124 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: dialog_set_status.h -// Purpose: -// Author: jean-pierre Charras -// Modified by: -// Created: 11/02/2006 21:42:23 -// RCS-ID: -// Copyright: License GNU -// Licence: -///////////////////////////////////////////////////////////////////////////// - -// Generated by DialogBlocks (unregistered), 11/02/2006 21:42:23 - -#ifndef _DIALOG_SET_STATUS_H_ -#define _DIALOG_SET_STATUS_H_ - -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) -#pragma interface "dialog_set_status.h" -#endif - -/*! - * Includes - */ - -////@begin includes -////@end includes - -/*! - * Forward declarations - */ - -////@begin forward declarations -////@end forward declarations - -/*! - * Control identifiers - */ - -////@begin control identifiers -#define ID_DIALOG 10000 -#define SYMBOL_WINEDA_CONFIGFRAME_STYLE wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU|wxCLOSE_BOX -#define SYMBOL_WINEDA_CONFIGFRAME_TITLE _("from ") -#define SYMBOL_WINEDA_CONFIGFRAME_IDNAME ID_DIALOG -#define SYMBOL_WINEDA_CONFIGFRAME_SIZE wxSize(400, 300) -#define SYMBOL_WINEDA_CONFIGFRAME_POSITION wxDefaultPosition -#define ID_BUTTON 10001 -#define ID_RADIOBOX 10006 -#define ID_BUTTON1 10002 -#define ID_BUTTON2 10003 -#define ID_BUTTON3 10004 -#define ID_LISTBOX 10005 -#define ID_TEXTCTRL 10007 -////@end control identifiers - -/*! - * Compatibility - */ - -#ifndef wxCLOSE_BOX -#define wxCLOSE_BOX 0x1000 -#endif - -/*! - * WinEDA_ConfigFrame class declaration - */ - -class WinEDA_ConfigFrame: public wxDialog -{ - DECLARE_DYNAMIC_CLASS( WinEDA_ConfigFrame ) - DECLARE_EVENT_TABLE() - -public: - /// Constructors - WinEDA_ConfigFrame( ); - WinEDA_ConfigFrame( WinEDA_SchematicFrame* parent, wxWindowID id = SYMBOL_WINEDA_CONFIGFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_CONFIGFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_CONFIGFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_CONFIGFRAME_SIZE, long style = SYMBOL_WINEDA_CONFIGFRAME_STYLE ); - - /// Creation - bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WINEDA_CONFIGFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_CONFIGFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_CONFIGFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_CONFIGFRAME_SIZE, long style = SYMBOL_WINEDA_CONFIGFRAME_STYLE ); - - /// Creates the controls and sizers - void CreateControls(); - -////@begin WinEDA_ConfigFrame event handler declarations - - /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON - void OnButtonClick( wxCommandEvent& event ); - - /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON1 - void OnButton1Click( wxCommandEvent& event ); - - /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON2 - void OnButton2Click( wxCommandEvent& event ); - - /// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_BUTTON3 - void OnButton3Click( wxCommandEvent& event ); - -////@end WinEDA_ConfigFrame event handler declarations - -////@begin WinEDA_ConfigFrame member function declarations - - /// Retrieves bitmap resources - wxBitmap GetBitmapResource( const wxString& name ); - - /// Retrieves icon resources - wxIcon GetIconResource( const wxString& name ); -////@end WinEDA_ConfigFrame member function declarations - - /// Should we show tooltips? - static bool ShowToolTips(); - -////@begin WinEDA_ConfigFrame member variables - wxStaticText* m_CmpfileExtText; - wxStaticText* m_NetfileExtText; - wxStaticText* m_LibfileExtText; - wxStaticText* m_SymbolfileExtText; - wxStaticText* m_SchfileExtText; - wxListBox* m_ListLibr; - wxStaticText* m_CmpfileExtText; - wxTextCtrl* m_LibDirCtrl; -////@end WinEDA_ConfigFrame member variables -}; - -#endif - // _DIALOG_SET_STATUS_H_ diff --git a/eeschema/editpart.cpp.notused b/eeschema/editpart.cpp.notused deleted file mode 100644 index 34aa383d81..0000000000 --- a/eeschema/editpart.cpp.notused +++ /dev/null @@ -1,840 +0,0 @@ -/***************************************************/ -/* EESchema: */ -/* Edition des textes sur Composants en Schematique */ -/****************************************************/ - -#include "fctsys.h" -#include "gr_basic.h" - -#include "common.h" -#include "program.h" -#include "libcmp.h" -#include "general.h" - -#include "wx/checklst.h" - -#include "protos.h" - - -/* Fonctions exportees */ - -/* Fonctions locales */ -static void AbortMoveCmpField( WinEDA_DrawFrame* frame, wxDC* DC ); -static void MoveCmpField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); - -/* variables locales */ -static PartTextStruct* CurrentField; -static int Multiflag; -static int TextFieldSize = DEFAULT_SIZE_TEXT; -static wxPoint OldPos; - -/* Classe de la frame des propriétés d'un composant en librairie */ - -enum id_cmpedit { - ID_SCHEDIT_NOTEBOOK = 3200, - ID_PANEL_BASIC, - ID_PANEL_REFERENCE, - ID_PANEL_VALUE, - ID_PANEL_FIELD1, - ID_PANEL_FIELD2, - ID_PANEL_FIELD3, - ID_PANEL_FIELD4, - ID_PANEL_FIELD5, - ID_PANEL_FIELD6, - ID_PANEL_FIELD7, - ID_PANEL_FIELD8, - ID_PANEL_MODULEPCB, - ID_PANEL_SUBSCHEMATIC, - ID_CLOSE_CMP_PROPERTIES, - ID_ACCEPT_CMP_PROPERTIES, - ID_RESTORE_CMP_DEFAULTS -}; - - -/************************************/ -/* class WinEDA_PartPropertiesFrame */ -/************************************/ - -class WinEDA_ComponentPropertiesFrame : public wxDialog -{ -private: - - WinEDA_SchematicFrame* m_Parent; - EDA_SchComponentStruct* m_Cmp; - EDA_LibComponentStruct* m_LibEntry; - - wxCheckBox* m_ConvertButt; - wxRadioBox* m_SelectUnit; - wxRadioBox* m_MirrorUnit; - wxRadioBox* m_OrientUnit; - wxNotebook* m_NoteBook; - WinEDA_EnterText* m_RefInLib; - wxPanel* m_PanelBasic; - - wxPanel* m_PanelField[NUMBER_OF_FIELDS]; - - wxCheckBox* ShowFieldText[NUMBER_OF_FIELDS]; - wxCheckBox* VorientFieldText[NUMBER_OF_FIELDS]; - - WinEDA_GraphicTextCtrl* FieldTextCtrl[NUMBER_OF_FIELDS]; - WinEDA_PositionCtrl* FieldPosition[NUMBER_OF_FIELDS]; - int FieldFlags[NUMBER_OF_FIELDS]; - int FieldOrient[NUMBER_OF_FIELDS]; - -public: - - // Constructor and destructor - WinEDA_ComponentPropertiesFrame( WinEDA_SchematicFrame* parent, wxPoint& pos, - EDA_SchComponentStruct* cmp ); - ~WinEDA_ComponentPropertiesFrame() - { - } - - -private: - void BuildPanelBasic(); - void ComponentPropertiesAccept( wxCommandEvent& event ); - void SetInitCmp( wxCommandEvent& event ); - void OnQuit( wxCommandEvent& event ); - - DECLARE_EVENT_TABLE() -}; - -BEGIN_EVENT_TABLE( WinEDA_ComponentPropertiesFrame, wxDialog ) -EVT_BUTTON( ID_ACCEPT_CMP_PROPERTIES, WinEDA_ComponentPropertiesFrame::ComponentPropertiesAccept ) -EVT_BUTTON( ID_CLOSE_CMP_PROPERTIES, WinEDA_ComponentPropertiesFrame::OnQuit ) -EVT_BUTTON( ID_RESTORE_CMP_DEFAULTS, WinEDA_ComponentPropertiesFrame::SetInitCmp ) -END_EVENT_TABLE() - - -/**********************************************************************/ -void InstallCmpeditFrame( WinEDA_SchematicFrame* parent, wxPoint& pos, - EDA_SchComponentStruct* cmp ) -/*********************************************************************/ - -/* Create the dialog box for the current component edition - */ -{ - parent->DrawPanel->m_IgnoreMouseEvents = TRUE; - if( cmp->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) - { - DisplayError( parent, - wxT( "InstallCmpeditFrame() error: This struct is not a component" ) ); - } - else - { - WinEDA_ComponentPropertiesFrame* frame = - new WinEDA_ComponentPropertiesFrame( parent, pos, cmp ); - frame->ShowModal(); - frame->Destroy(); - } - parent->DrawPanel->m_IgnoreMouseEvents = FALSE; -} - - -#define XSIZE 370 -#define YSIZE 300 -/***********************************************************************************/ -WinEDA_ComponentPropertiesFrame::WinEDA_ComponentPropertiesFrame( - WinEDA_SchematicFrame* parent, wxPoint& framepos, EDA_SchComponentStruct* cmp ) : - wxDialog( parent, -1, _( "Component properties" ), framepos, - wxSize( XSIZE, YSIZE ), DIALOG_STYLE ) -/***********************************************************************************/ -{ - wxPoint pos, postmp; - wxLayoutConstraints* c; - wxPoint cmp_pos; - int ii; - - Centre(); - m_Parent = parent; - m_Cmp = cmp; - cmp_pos = m_Cmp->m_Pos; - m_LibEntry = FindLibPart( m_Cmp->m_ChipName.GetData(), wxEmptyString, FIND_ROOT ); - - if( m_LibEntry == NULL ) - { - SetTitle( _( "Component properties (Not found in lib)" ) ); - } - - SetAutoLayout( TRUE ); - - m_NoteBook = new wxNotebook( this, ID_SCHEDIT_NOTEBOOK, - wxDefaultPosition, wxSize( XSIZE - 6, YSIZE - 70 ) ); - c = new wxLayoutConstraints; - c->left.SameAs( this, wxLeft, 4 ); - c->right.SameAs( this, wxRight, 4 ); - c->top.SameAs( this, wxTop, 4 ); - c->bottom.SameAs( this, wxBottom, 40 ); - m_NoteBook->SetConstraints( c ); - m_NoteBook->SetAutoLayout( TRUE ); - - /* Creation des boutons de commande */ - pos.x = 40; pos.y = YSIZE - 60; - wxButton* GButton = new wxButton( this, ID_CLOSE_CMP_PROPERTIES, - _( "Close" ), pos ); - GButton->SetForegroundColour( *wxBLUE ); - c = new wxLayoutConstraints; - c->left.SameAs( this, wxLeft, 20 ); - c->height.AsIs(); - c->width.AsIs(); - c->bottom.SameAs( this, wxBottom, 5 ); - GButton->SetConstraints( c ); - - pos.x += GButton->GetDefaultSize().x + 10; - wxButton* MButton = new wxButton( this, ID_RESTORE_CMP_DEFAULTS, - _( "Defaults" ), pos ); - MButton->SetForegroundColour( *wxRED ); - c = new wxLayoutConstraints; - c->left.SameAs( GButton, wxRight, 20 ); - c->height.AsIs(); - c->width.AsIs(); - c->bottom.SameAs( this, wxBottom, 5 ); - MButton->SetConstraints( c ); - - pos.x += MButton->GetDefaultSize().x + 10; - wxButton* Button = new wxButton( this, ID_ACCEPT_CMP_PROPERTIES, - _( "OK" ), pos ); - Button->SetForegroundColour( *wxBLUE ); - c = new wxLayoutConstraints; - c->left.SameAs( MButton, wxRight, 20 ); - c->height.AsIs(); - c->width.AsIs(); - c->bottom.SameAs( this, wxBottom, 5 ); - Button->SetConstraints( c ); - - // Add panel Basic - BuildPanelBasic(); - m_NoteBook->AddPage( m_PanelBasic, _( "Options" ), TRUE ); - - // Add panel Fields - for( ii = 0; ii < NUMBER_OF_FIELDS; ii++ ) - { - m_PanelField[ii] = new wxPanel( m_NoteBook, ID_PANEL_REFERENCE + ii ); - c = new wxLayoutConstraints; - c->left.SameAs( m_NoteBook, wxLeft ); - c->right.SameAs( m_NoteBook, wxRight ); - c->bottom.SameAs( m_NoteBook, wxBottom ); - m_PanelField[ii]->SetConstraints( c ); - m_NoteBook->AddPage( m_PanelField[ii], - DrawPartStruct::ReturnFieldName( ii ), FALSE ); - - pos.x = 10; pos.y = 20; - ShowFieldText[ii] = new wxCheckBox( m_PanelField[ii], -1, - _( "Show Text" ), pos ); - if( (m_Cmp->m_Field[ii].m_Attributs & TEXT_NO_VISIBLE ) == 0 ) - ShowFieldText[ii]->SetValue( TRUE ); - - pos.x += 150; - VorientFieldText[ii] = new wxCheckBox( m_PanelField[ii], -1, - _( "Vertical" ), pos ); - if( m_Cmp->m_Field[ii].m_Orient ) - VorientFieldText[ii]->SetValue( TRUE ); - - pos.x = 10; pos.y += 50; - - wxPoint field_pos; - FieldTextCtrl[ii] = new WinEDA_GraphicTextCtrl( m_PanelField[ii], - DrawPartStruct::ReturnFieldName( ii ), - m_Cmp->m_Field[ii].m_Text, - m_Cmp->m_Field[ii].m_Size.x, - g_UnitMetric, - pos, 200, TRUE ); - field_pos.x = m_Cmp->m_Field[ii].m_Pos.x - cmp_pos.x; - field_pos.y = m_Cmp->m_Field[ii].m_Pos.y - cmp_pos.y; - if( m_Cmp->m_Field[ii].m_Text == wxEmptyString ) // Field non initialisé, set pos a 0,0) - field_pos = wxPoint( 0, 0 ); - FieldPosition[ii] = new WinEDA_PositionCtrl( m_PanelField[ii], _( "Pos" ), - field_pos, - g_UnitMetric, - wxPoint( pos.x + 150, pos.y + 32 ), - m_Parent->m_InternalUnits ); - } - - if( m_LibEntry && m_LibEntry->m_Options == ENTRY_POWER ) - FieldTextCtrl[VALUE]->Enable( FALSE ); -} - - -/************************************************************************/ -void WinEDA_ComponentPropertiesFrame::OnQuit( wxCommandEvent& WXUNUSED (event) ) -/************************************************************************/ -{ - // true is to force the frame to close - Close( true ); -} - - -/**********************************************************/ -void WinEDA_ComponentPropertiesFrame::BuildPanelBasic() -/**********************************************************/ - -/* create the basic panel for component properties editing - */ -{ - wxPoint pos, postmp; - int ii, jj; - - m_PanelBasic = new wxPanel( m_NoteBook, ID_PANEL_BASIC ); - wxLayoutConstraints* c = new wxLayoutConstraints; - c->left.SameAs( m_NoteBook, wxLeft ); - c->right.SameAs( m_NoteBook, wxRight ); - c->bottom.SameAs( m_NoteBook, wxBottom ); - m_PanelBasic->SetConstraints( c ); - - pos.x = 5; pos.y = 15; - -#define NB_MAX_UNIT 16 - int nb_units = m_LibEntry ? MAX( m_LibEntry->m_UnitCount, 1 ) : 0; - wxString list_units[NB_MAX_UNIT]; - - if( nb_units > 16 ) - nb_units = 16; - for( ii = 0; ii < NB_MAX_UNIT; ii++ ) - list_units[ii] << _( "Unit" ) << (ii + 1); - - m_SelectUnit = new wxRadioBox( m_PanelBasic, -1, _( "Unit:" ), - pos, wxSize( -1, -1 ), - (nb_units < 8 ) ? 8 : nb_units, list_units, 1 ); - for( ii = nb_units; ii < 8; ii++ ) - { - m_SelectUnit->Enable( ii, FALSE ); // Disable non existant units - } - - m_SelectUnit->SetSelection( m_Cmp->m_Multi - 1 ); - - m_SelectUnit->GetSize( &ii, &jj ); - pos.x += ii + 5; postmp = pos; - - wxString list_orient[4] = { wxT( "0" ), wxT( "+90" ), wxT( "180" ), wxT( "-90" ) }; - pos.x += 45; pos.y = 15; - m_OrientUnit = new wxRadioBox( m_PanelBasic, -1, _( "Orient:" ), - pos, wxSize( -1, -1 ), 4, list_orient, 1 ); - ii = m_Cmp->GetRotationMiroir() & ~(CMP_MIROIR_X | CMP_MIROIR_Y); - - if( ii == CMP_ORIENT_90 ) - m_OrientUnit->SetSelection( 1 ); - else if( ii == CMP_ORIENT_180 ) - m_OrientUnit->SetSelection( 2 ); - else if( ii == CMP_ORIENT_270 ) - m_OrientUnit->SetSelection( 3 ); - - m_OrientUnit->GetSize( &ii, &jj ); - pos.x += ii + 30; - wxString list_mirror[3] = { _( "Normal" ), _( "Mirror --" ), _( "Mirror |" ) }; - m_MirrorUnit = new wxRadioBox( m_PanelBasic, -1, _( "Mirror:" ), - pos, wxSize( -1, -1 ), 3, list_mirror, 1 ); - ii = m_Cmp->GetRotationMiroir() & (CMP_MIROIR_X | CMP_MIROIR_Y); - if( ii == CMP_MIROIR_X ) - m_MirrorUnit->SetSelection( 1 ); - else if( ii == CMP_MIROIR_Y ) - m_MirrorUnit->SetSelection( 2 ); - - // Positionnement de la selection normal/convert - m_OrientUnit->GetSize( &ii, &jj ); - pos = postmp; - pos.y += jj + 10; - m_ConvertButt = new wxCheckBox( m_PanelBasic, -1, _( "Convert" ), pos ); - if( m_Cmp->m_Convert > 1 ) - m_ConvertButt->SetValue( TRUE ); - - if( (m_LibEntry == NULL) || LookForConvertPart( m_LibEntry ) <= 1 ) - { - m_ConvertButt->Enable( FALSE ); - } - - // Show the "Parts Locked" option: - if( m_LibEntry && m_LibEntry->m_UnitSelectionLocked ) - { - new wxStaticText( m_PanelBasic, -1, _( "Parts are locked" ), - wxPoint( m_MirrorUnit->GetRect().x, pos.y ) ); - } - - // Positionnement de la reference en librairie - m_ConvertButt->GetSize( &ii, &jj ); - pos.y += jj + 20; - m_RefInLib = new WinEDA_EnterText( m_PanelBasic, _( "Chip Name:" ), - m_Cmp->m_ChipName, - pos, wxSize( XSIZE - pos.x - 30, -1 ) ); -} - - -/***********************************************************************************/ -void WinEDA_ComponentPropertiesFrame::ComponentPropertiesAccept( wxCommandEvent& event ) -/***********************************************************************************/ - -/* Update the new parameters for the current edited component - */ -{ - wxPoint cmp_pos = m_Cmp->m_Pos; - wxClientDC dc( m_Parent->DrawPanel ); - wxString newname; - - m_Parent->DrawPanel->PrepareGraphicContext( &dc ); - - RedrawOneStruct( m_Parent->DrawPanel, &dc, m_Cmp, g_XorMode ); - - newname = m_RefInLib->GetValue(); - newname.MakeUpper(); - newname.Replace( wxT( " " ), wxT( "_" ) ); - - if( newname.IsEmpty() ) - DisplayError( this, _( "No Component Name!" ) ); - else if( newname.CmpNoCase( m_Cmp->m_ChipName ) ) - { - if( FindLibPart( newname.GetData(), wxEmptyString, FIND_ALIAS ) == NULL ) - { - wxString msg; - msg.Printf( _( "Component [%s] not found!" ), newname.GetData() ); - DisplayError( this, msg ); - } - else // Changement de composant! - { - m_Cmp->m_ChipName = newname; - } - } - - // Mise a jour de la representation: - if( m_ConvertButt->IsEnabled() ) - (m_ConvertButt->GetValue() == TRUE) ? - m_Cmp->m_Convert = 2 : m_Cmp->m_Convert = 1; - - //Mise a jour de la selection de l'élément dans le boitier - if( m_Cmp->m_Multi ) - m_Cmp->m_Multi = m_SelectUnit->GetSelection() + 1; - - //Mise a jour de l'orientation: - switch( m_OrientUnit->GetSelection() ) - { - case 0: - m_Cmp->SetRotationMiroir( CMP_ORIENT_0 ); - break; - - case 1: - m_Cmp->SetRotationMiroir( CMP_ORIENT_90 ); - break; - - case 2: - m_Cmp->SetRotationMiroir( CMP_ORIENT_180 ); - break; - - case 3: - m_Cmp->SetRotationMiroir( CMP_ORIENT_270 ); - break; - } - - switch( m_MirrorUnit->GetSelection() ) - { - case 0: - break; - - case 1: - m_Cmp->SetRotationMiroir( CMP_MIROIR_X ); - break; - - case 2: - m_Cmp->SetRotationMiroir( CMP_MIROIR_Y ); - break; - } - - - // Mise a jour des textes - for( int ii = REFERENCE; ii < NUMBER_OF_FIELDS; ii++ ) - { - if( ii == REFERENCE ) // la reference ne peut etre vide - { - if( !FieldTextCtrl[ii]->GetText().IsEmpty() ) - m_Cmp->m_Field[ii].m_Text = FieldTextCtrl[ii]->GetText(); - } - else if( ii == VALUE ) // la valeur ne peut etre vide et ne peut etre change sur un POWER - { - EDA_LibComponentStruct* Entry = FindLibPart( m_Cmp->m_ChipName.GetData( - ), wxEmptyString, FIND_ROOT ); - if( Entry && (Entry->m_Options == ENTRY_POWER) ) - m_Cmp->m_Field[ii].m_Text = m_Cmp->m_ChipName; - else if( !FieldTextCtrl[ii]->GetText().IsEmpty() ) - { - m_Cmp->m_Field[ii].m_Text = FieldTextCtrl[ii]->GetText(); - } - } - else - m_Cmp->m_Field[ii].m_Text = FieldTextCtrl[ii]->GetText(); - - m_Cmp->m_Field[ii].m_Size.x = - m_Cmp->m_Field[ii].m_Size.y = FieldTextCtrl[ii]->GetTextSize(); - if( ShowFieldText[ii]->GetValue() ) - m_Cmp->m_Field[ii].m_Attributs &= ~TEXT_NO_VISIBLE; - else - m_Cmp->m_Field[ii].m_Attributs |= TEXT_NO_VISIBLE; - m_Cmp->m_Field[ii].m_Orient = VorientFieldText[ii]->GetValue() ? 1 : 0; - m_Cmp->m_Field[ii].m_Pos = FieldPosition[ii]->GetValue(); - m_Cmp->m_Field[ii].m_Pos.x += cmp_pos.x; - m_Cmp->m_Field[ii].m_Pos.y += cmp_pos.y; - } - - m_Parent->m_CurrentScreen->SetModify(); - - RedrawOneStruct( m_Parent->DrawPanel, &dc, m_Cmp, GR_DEFAULT_DRAWMODE ); - m_Parent->TestDanglingEnds( m_Parent->m_CurrentScreen->EEDrawList, &dc ); - - Close(); -} - - -/************************************************************************************/ -void WinEDA_SchematicFrame::StartMoveCmpField( PartTextStruct* Field, wxDC* DC ) -/************************************************************************************/ - -/* Prepare le deplacement du texte en cours d'edition - */ -{ - EDA_LibComponentStruct* Entry; - - CurrentField = Field; - if( Field == NULL ) - return; - - if( Field->m_Text == wxEmptyString ) - { - DisplayError( this, _( "No Field to move" ), 10 ); - return; - } - - OldPos = Field->m_Pos; - Multiflag = 0; - if( Field->m_FieldId == REFERENCE ) - { - Entry = FindLibPart( ( (EDA_SchComponentStruct*) Field->m_Parent )->m_ChipName.GetData(), - wxEmptyString, FIND_ROOT ); - if( Entry != NULL ) - { - if( Entry->m_UnitCount > 1 ) - Multiflag = 1; - } - } - - DrawPanel->ForceCloseManageCurseur = AbortMoveCmpField; - DrawPanel->ManageCurseur = MoveCmpField; - Field->m_Flags = IS_MOVED; -} - - -/**********************************************************************************/ -void WinEDA_SchematicFrame::EditCmpFieldText( PartTextStruct* Field, wxDC* DC ) -/**********************************************************************************/ -/* Routine de changement du texte selectionne */ -{ - int FieldNumber, flag; - EDA_LibComponentStruct* Entry; - - if( Field == NULL ) - { - DisplayError( this, _( "No Field To Edit" ), 10 ); - return; - } - - FieldNumber = Field->m_FieldId; - if( FieldNumber == VALUE ) - { - Entry = FindLibPart( ( (EDA_SchComponentStruct*) Field->m_Parent )->m_ChipName.GetData(), - wxEmptyString, FIND_ROOT ); - if( Entry && (Entry->m_Options == ENTRY_POWER) ) - { - DisplayInfo( this, - _( - "Part is a POWER, value cannot be modified!\nYou must create a new power" ) - ); - return; - } - } - - flag = 0; - if( FieldNumber == REFERENCE ) - { - Entry = FindLibPart( ( (EDA_SchComponentStruct*) Field->m_Parent )->m_ChipName.GetData(), - wxEmptyString, FIND_ROOT ); - if( Entry != NULL ) - { - if( Entry->m_UnitCount > 1 ) - flag = 1; - } - } - - - wxString newtext = Field->m_Text; - Get_Message( DrawPartStruct::ReturnFieldName( FieldNumber ), newtext, this ); - - DrawTextField( DrawPanel, DC, Field, flag, g_XorMode ); - - if( !newtext.IsEmpty() ) - { - if( Field->m_Text.IsEmpty() ) - { - Field->m_Pos = ( (EDA_SchComponentStruct*) Field->m_Parent )->m_Pos; - Field->m_Size.x = Field->m_Size.y = TextFieldSize; - } - Field->m_Text = newtext; - } - else /* Nouveau texte NULL */ - { - if( FieldNumber == REFERENCE ) - { - DisplayError( this, _( "Reference needed !, No change" ) ); - } - else if( FieldNumber == VALUE ) - { - DisplayError( this, _( "Value needed !, No change" ) ); - } - else - { - Field->m_Text = wxT( "~" ); - } - } - - DrawTextField( DrawPanel, DC, Field, flag, g_XorMode ); - ( (EDA_SchComponentStruct*) Field->m_Parent )->Display_Infos( this ); - m_CurrentScreen->SetModify(); -} - - -/************************************************************************/ -static void MoveCmpField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) -/************************************************************************/ - -/* Routine de deplacement d'un texte type Field. - * Celle routine est normalement attachee au deplacement du curseur - */ -{ -#define TRF ( (EDA_SchComponentStruct*) CurrentField->m_Parent )->m_Transform - wxPoint pos; - int x1, y1; - int FieldNumber; - - if( CurrentField == NULL ) - return; - - FieldNumber = CurrentField->m_FieldId; - - /* Effacement: */ - if( erase ) - DrawTextField( panel, DC, CurrentField, Multiflag, g_XorMode ); - - pos = ( (EDA_SchComponentStruct*) CurrentField->m_Parent )->m_Pos; - - /* Les positions sont caculees par la matrice TRANSPOSEE de la matrice - * de rotation-miroir */ - x1 = panel->GetScreen()->m_Curseur.x - pos.x; - y1 = panel->GetScreen()->m_Curseur.y - pos.y; - CurrentField->m_Pos.x = pos.x + TRF[0][0] * x1 + TRF[1][0] * y1; - CurrentField->m_Pos.y = pos.y + TRF[0][1] * x1 + TRF[1][1] * y1; - - DrawTextField( panel, DC, CurrentField, Multiflag, g_XorMode ); -} - - -/******************************************************************/ -static void AbortMoveCmpField( WinEDA_DrawFrame* frame, wxDC* DC ) -/******************************************************************/ -{ - frame->DrawPanel->ForceCloseManageCurseur = NULL; - frame->DrawPanel->ManageCurseur = NULL; - if( CurrentField ) - { - DrawTextField( frame->DrawPanel, DC, CurrentField, Multiflag, g_XorMode ); - CurrentField->m_Flags = 0; - CurrentField->m_Pos = OldPos; - DrawTextField( frame->DrawPanel, DC, CurrentField, Multiflag, GR_DEFAULT_DRAWMODE ); - } - CurrentField = NULL; -} - - -/*********************************************************************************/ -void WinEDA_SchematicFrame::RotateCmpField( PartTextStruct* Field, wxDC* DC ) -/*********************************************************************************/ -{ - int FieldNumber, flag; - EDA_LibComponentStruct* Entry; - - if( Field == NULL ) - return; - if( Field->m_Text == wxEmptyString ) - return; - - FieldNumber = Field->m_FieldId; - flag = 0; - if( FieldNumber == REFERENCE ) - { - Entry = FindLibPart( ( (EDA_SchComponentStruct*) Field->m_Parent )->m_ChipName.GetData(), - wxEmptyString, FIND_ROOT ); - if( Entry != NULL ) - { - if( Entry->m_UnitCount > 1 ) - flag = 1; - } - } - - DrawTextField( DrawPanel, DC, Field, flag, g_XorMode ); - - if( Field->m_Orient == TEXT_ORIENT_HORIZ ) - Field->m_Orient = TEXT_ORIENT_VERT; - else - Field->m_Orient = TEXT_ORIENT_HORIZ; - DrawTextField( DrawPanel, DC, Field, flag, g_XorMode ); - - GetScreen()->SetModify(); -} - - -/***************************************************************/ -void PartTextStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC ) -/***************************************************************/ -{ - int FieldNumber, flag; - EDA_LibComponentStruct* Entry; - - frame->DrawPanel->ManageCurseur = NULL; - frame->DrawPanel->ForceCloseManageCurseur = NULL; - - FieldNumber = m_FieldId; - flag = 0; - if( FieldNumber == REFERENCE ) - { - Entry = FindLibPart( ( (EDA_SchComponentStruct*) m_Parent )->m_ChipName.GetData(), - wxEmptyString, FIND_ROOT ); - if( Entry != NULL ) - { - if( Entry->m_UnitCount > 1 ) - flag = 1; - } - } - - DrawTextField( frame->DrawPanel, DC, this, flag, GR_DEFAULT_DRAWMODE ); - m_Flags = 0; - frame->GetScreen()->SetCurItem( NULL ); - frame->GetScreen()->SetModify(); - CurrentField = NULL; -} - - -/**************************************************************************************************/ -void WinEDA_SchematicFrame::EditComponentReference( EDA_SchComponentStruct* DrawLibItem, wxDC* DC ) -/**************************************************************************************************/ -/* Edit the component text reference*/ -{ - wxString msg; - EDA_LibComponentStruct* Entry; - int flag = 0; - - if( DrawLibItem == NULL ) - return; - - Entry = FindLibPart( DrawLibItem->m_ChipName.GetData(), wxEmptyString, FIND_ROOT ); - if( Entry == NULL ) - return; - - if( Entry->m_UnitCount > 1 ) - flag = 1; - - PartTextStruct* TextField = &DrawLibItem->m_Field[REFERENCE]; - - msg = TextField->m_Text; - Get_Message( _( "Reference" ), msg, this ); - - if( !msg.IsEmpty() ) // New text entered - { - DrawTextField( DrawPanel, DC, &DrawLibItem->m_Field[REFERENCE], flag, g_XorMode ); - TextField->m_Text = msg; - DrawTextField( DrawPanel, DC, &DrawLibItem->m_Field[REFERENCE], flag, - DrawLibItem->m_Flags ? g_XorMode : GR_DEFAULT_DRAWMODE ); - GetScreen()->SetModify(); - } - DrawLibItem->Display_Infos( this ); -} - - -/*****************************************************************************************/ -void WinEDA_SchematicFrame::EditComponentValue( EDA_SchComponentStruct* DrawLibItem, wxDC* DC ) -/*****************************************************************************************/ -/* Routine de changement du texte selectionne */ -{ - wxString msg; - EDA_LibComponentStruct* Entry; - int flag = 0; - - if( DrawLibItem == NULL ) - return; - - Entry = FindLibPart( DrawLibItem->m_ChipName.GetData(), wxEmptyString, FIND_ROOT ); - if( Entry == NULL ) - return; - if( Entry->m_UnitCount > 1 ) - flag = 1; - - PartTextStruct* TextField = &DrawLibItem->m_Field[VALUE]; - - msg = TextField->m_Text; - Get_Message( _( "Value" ), msg, this ); - - if( !msg.IsEmpty() ) - { - DrawTextField( DrawPanel, DC, &DrawLibItem->m_Field[VALUE], flag, g_XorMode ); - TextField->m_Text = msg; - DrawTextField( DrawPanel, DC, &DrawLibItem->m_Field[VALUE], flag, - DrawLibItem->m_Flags ? g_XorMode : GR_DEFAULT_DRAWMODE ); - m_CurrentScreen->SetModify(); - } - - DrawLibItem->Display_Infos( this ); -} - - -/*****************************************************************************/ -void WinEDA_ComponentPropertiesFrame::SetInitCmp( wxCommandEvent& event ) -/*****************************************************************************/ - -/* Replace le composant en position normale, dimensions et positions - * fields comme definies en librairie - */ -{ - EDA_LibComponentStruct* Entry; - - if( m_Cmp == NULL ) - return; - - Entry = FindLibPart( m_Cmp->m_ChipName.GetData(), wxEmptyString, FIND_ROOT ); - - if( Entry == NULL ) - return; - - wxClientDC dc( m_Parent->DrawPanel ); - m_Parent->DrawPanel->PrepareGraphicContext( &dc ); - - RedrawOneStruct( m_Parent->DrawPanel, &dc, m_Cmp, g_XorMode ); - - /* Mise aux valeurs par defaut des champs et orientation */ - m_Cmp->m_Field[REFERENCE].m_Pos.x = - Entry->m_Prefix.m_Pos.x + m_Cmp->m_Pos.x; - m_Cmp->m_Field[REFERENCE].m_Pos.y = - Entry->m_Prefix.m_Pos.y + m_Cmp->m_Pos.y; - m_Cmp->m_Field[REFERENCE].m_Orient = Entry->m_Prefix.m_Orient; - m_Cmp->m_Field[REFERENCE].m_Size = Entry->m_Prefix.m_Size; - m_Cmp->m_Field[REFERENCE].m_HJustify = Entry->m_Prefix.m_HJustify; - m_Cmp->m_Field[REFERENCE].m_VJustify = Entry->m_Prefix.m_VJustify; - - m_Cmp->m_Field[VALUE].m_Pos.x = - Entry->m_Name.m_Pos.x + m_Cmp->m_Pos.x; - m_Cmp->m_Field[VALUE].m_Pos.y = - Entry->m_Name.m_Pos.y + m_Cmp->m_Pos.y; - m_Cmp->m_Field[VALUE].m_Orient = Entry->m_Name.m_Orient; - m_Cmp->m_Field[VALUE].m_Size = Entry->m_Name.m_Size; - m_Cmp->m_Field[VALUE].m_HJustify = Entry->m_Name.m_HJustify; - m_Cmp->m_Field[VALUE].m_VJustify = Entry->m_Name.m_VJustify; - - m_Cmp->SetRotationMiroir( CMP_NORMAL ); - - m_Parent->m_CurrentScreen->SetModify(); - - RedrawOneStruct( m_Parent->DrawPanel, &dc, m_Cmp, GR_DEFAULT_DRAWMODE ); - Close(); -} diff --git a/eeschema/eeclass.cpp.notused b/eeschema/eeclass.cpp.notused deleted file mode 100644 index d91dc81474..0000000000 --- a/eeschema/eeclass.cpp.notused +++ /dev/null @@ -1,121 +0,0 @@ -/**********************************************************/ -/* EECLASS.CPP */ -/* fonctions relatives aux classes definies dans EESCHEMA */ -/**********************************************************/ - -#include "fctsys.h" -#include "gr_basic.h" - -#include "common.h" -#include "program.h" -#include "libcmp.h" -#include "general.h" - -#include "protos.h" - - -/************************************************************/ -void SetStructFather( EDA_BaseStruct* Struct, BASE_SCREEN* Screen ) -/************************************************************/ -{ - switch( Struct->Type() ) - { - case DRAW_POLYLINE_STRUCT_TYPE: - case DRAW_JUNCTION_STRUCT_TYPE: - case DRAW_TEXT_STRUCT_TYPE: - case DRAW_LABEL_STRUCT_TYPE: - case DRAW_GLOBAL_LABEL_STRUCT_TYPE: - case DRAW_LIB_ITEM_STRUCT_TYPE: - case DRAW_SEGMENT_STRUCT_TYPE: - case DRAW_BUSENTRY_STRUCT_TYPE: - case DRAW_SHEET_STRUCT_TYPE: - case DRAW_MARKER_STRUCT_TYPE: - case DRAW_NOCONNECT_STRUCT_TYPE: - Struct->m_Parent = Screen; - break; - - case DRAW_SHEETLABEL_STRUCT_TYPE: - case DRAW_PICK_ITEM_STRUCT_TYPE: - break; - - default: - break; - } -} - - -/*************************************************************/ -void EDA_BaseStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC ) -/*************************************************************/ -{ - if( m_Flags & IS_NEW ) - { - Pnext = frame->m_CurrentScreen->EEDrawList; - frame->m_CurrentScreen->EEDrawList = this; - g_ItemToRepeat = this; - } - - m_Flags = 0; - SetFlagModify( frame->GetScreen() ); - frame->GetScreen()->SetCurItem( NULL ); - frame->DrawPanel->ManageCurseur = NULL; - frame->DrawPanel->ForceCloseManageCurseur = NULL; - - frame->DrawPanel->CursorOff( DC ); // Erase schematic cursor - RedrawOneStruct( frame->DrawPanel, DC, this, GR_DEFAULT_DRAWMODE ); - frame->DrawPanel->CursorOn( DC ); // Display schematic cursor -} - - -/**************************************************/ -/* Class SCH_SCREEN: classe de gestion d'un affichage pour schematique */ -/***************************************************/ -static int table_zoom[] = { 1, 2, 4, 8, 16, 32, 64, 128, 0 }; /* Valeurs standards du zoom */ - -/* Constructeur de SCREEN */ -SCH_SCREEN::SCH_SCREEN( EDA_BaseStruct* parent, WinEDA_DrawFrame* frame_source, int idtype ) : - BASE_SCREEN( parent, frame_source, idtype ) -{ - EEDrawList = NULL; /* Schematic items list */ - m_Zoom = 32; - m_Grid = wxSize( 50, 50 ); /* pas de la grille */ - SetZoomList( table_zoom ); - SetGridList( g_GridList ); - m_UndoRedoCountMax = 10; -} - - -/****************************/ -SCH_SCREEN::~SCH_SCREEN() -/****************************/ -{ - ClearUndoRedoList(); - FreeDrawList(); -} - - -/*************************************/ -SCH_SCREEN* SCH_SCREEN::GenCopy() -/*************************************/ -{ -// TODO - return NULL; -} - - -/***********************************/ -void SCH_SCREEN::FreeDrawList() -/***********************************/ - -/* Routine to clear EESchema drawing list of a screen. - */ -{ - EDA_BaseStruct* DrawStruct; - - while( EEDrawList != NULL ) - { - DrawStruct = EEDrawList; - EEDrawList = EEDrawList->Pnext; - delete DrawStruct; - } -} diff --git a/eeschema/fieldedi.cpp.notused b/eeschema/fieldedi.cpp.notused deleted file mode 100644 index 033477fc5d..0000000000 --- a/eeschema/fieldedi.cpp.notused +++ /dev/null @@ -1,1230 +0,0 @@ -/*********************************************************************/ -/* EESchema - edition des librairies: Edition des champs ( Fields ) */ -/*********************************************************************/ - -/* Fichier fieldedi.cpp */ - -#include "fctsys.h" -#include "gr_basic.h" - -#include "common.h" -#include "program.h" -#include "libcmp.h" -#include "general.h" - -#include "protos.h" - -#include "wx/spinctrl.h" - -static char* PanelText[] = -{ - "Ref", /* Champ Reference of part, i.e. "IC21" */ - "Name", /* Champ Value of part, i.e. "3.3K" */ - "Fld1", - "Fld2", - "Fld3", - "Fld4", - "Fld5", - "Fld6", - "Fld7", - "Fld8", - "Pcb", /* Champ Name Module PCB, i.e. "16DIP300" */ - "Sheet" /* Champ Name Schema component, i.e. "cnt16.sch" */ -}; - - -/* Routines locales */ -static void MoveField( wxDC* DC, int flag ); -static char* PrefixText( LibraryEntryStruct* LibEntry, int Unit ); - -/* Variables locales */ - -extern int CurrentUnit; -static wxPoint StartCursor; - -/* Classe de la frame des propriétés d'un composant en librairie */ - -enum id_libedit { - ID_LIBEDIT_NOTEBOOK = 3200, - ID_PANEL_BASIC, - ID_PANEL_ALIAS, - ID_PANEL_REFERENCE, - ID_PANEL_VALUE, - ID_PANEL_FIELD1, - ID_PANEL_FIELD2, - ID_PANEL_FIELD3, - ID_PANEL_FIELD4, - ID_PANEL_FIELD5, - ID_PANEL_FIELD6, - ID_PANEL_FIELD7, - ID_PANEL_FIELD8, - ID_PANEL_MODULEPCB, - ID_PANEL_SUBSCHEMATIC, - ID_CLOSE_PART_PROPERTIES, - ID_ACCEPT_PART_PROPERTIES, - ID_ADD_ALIAS, - ID_DELETE_ONE_ALIAS, - ID_DELETE_ALL_ALIAS -}; - - -/************************************/ -/* class WinEDA_PartPropertiesFrame */ -/************************************/ - -class WinEDA_PartPropertiesFrame : public wxDialog -{ -private: - - WinEDA_LibeditFrame* m_Parent; - wxNotebook* m_NoteBook; - wxListBox* PartAliasList; - wxPanel* PanelBasic; - wxPanel* PanelAlias; - wxPanel* PanelDoc; - wxPanel* PanelField[NUMBER_OF_FIELDS]; - - wxCheckBox* AsConvertButt; - - wxCheckBox* ShowFieldText[NUMBER_OF_FIELDS]; - wxCheckBox* VorientFieldText[NUMBER_OF_FIELDS]; - wxCheckBox* ShowPinNumButt; - wxCheckBox* ShowPinNameButt; - wxCheckBox* PinsNameInsideButt; - wxSpinCtrl* SelNumberOfUnits; - wxSpinCtrl* m_SetSkew; - - WinEDA_GraphicTextCtrl* FieldTextCtrl[NUMBER_OF_FIELDS]; - WinEDA_PositionCtrl* FieldPosition[NUMBER_OF_FIELDS]; - int FieldFlags[NUMBER_OF_FIELDS]; - int FieldOrient[NUMBER_OF_FIELDS]; - WinEDA_EnterText* NewDoc; - WinEDA_EnterText* NewDocfile; - WinEDA_EnterText* NewKeywords; - ListOfAliasStruct* AliasListCopy; - - -public: - - // Constructor and destructor - WinEDA_PartPropertiesFrame( WinEDA_LibeditFrame * parent, wxPoint & pos ); - ~WinEDA_PartPropertiesFrame() - { - if( AliasListCopy ) - AliasListCopy->FreeList(); - }; - -private: - void PartPropertiesAccept( wxCommandEvent& event ); - void DeleteAllAliasOfPart(); - void DeleteAliasOfPart(); - void AddAliasOfPart(); - bool ChangeNbUnitsPerPackage( int newUnit ); - bool SetUnsetConvert(); - - DECLARE_EVENT_TABLE() -}; - -BEGIN_EVENT_TABLE( WinEDA_PartPropertiesFrame, wxDialog ) -EVT_BUTTON( ID_ACCEPT_PART_PROPERTIES, WinEDA_PartPropertiesFrame::PartPropertiesAccept ) -EVT_BUTTON( ID_CLOSE_PART_PROPERTIES, WinEDA_PartPropertiesFrame::Close ) -EVT_BUTTON( ID_ADD_ALIAS, WinEDA_PartPropertiesFrame::AddAliasOfPart ) -EVT_BUTTON( ID_DELETE_ONE_ALIAS, WinEDA_PartPropertiesFrame::DeleteAliasOfPart ) -EVT_BUTTON( ID_DELETE_ALL_ALIAS, WinEDA_PartPropertiesFrame::DeleteAllAliasOfPart ) -END_EVENT_TABLE() - - -void InstallLibeditFrame( WinEDA_LibeditFrame* parent, wxPoint& pos ) -{ - WinEDA_PartPropertiesFrame* frame = new WinEDA_PartPropertiesFrame( parent, pos ); - - frame->ShowModal(); frame->Destroy(); -} - - -WinEDA_PartPropertiesFrame::WinEDA_PartPropertiesFrame( WinEDA_LibeditFrame* parent, - wxPoint& framepos ) : - wxDialog( parent, -1, _( "Componant properties" ), framepos, wxSize( 320, 300 ), - wxDEFAULT_DIALOG_STYLE | FLOAT_ON_PARENT ) -{ - wxPoint pos; - wxLayoutConstraints* c; - - m_Parent = parent; - - SetAutoLayout( TRUE ); - - Doc[0] = 0; Docfile[0] = 0; Keywords[0] = 0; - AliasListCopy = NULL; - - for( int ii = 0; ii < NUMBER_OF_FIELDS; ii++ ) - { - FieldFlags[ii] = 0; - } - - if( CurrentLibEntry ) - { - if( ListAlias ) - AliasListCopy = ListAlias->DupList(); - - if( CurrentLibEntry->Doc ) - strncpy( Doc, CurrentLibEntry->Doc, 256 ); - if( CurrentLibEntry->KeyWord ) - strncpy( Keywords, CurrentLibEntry->KeyWord, 256 ); - if( CurrentLibEntry->DocFile ) - strncpy( Docfile, CurrentLibEntry->DocFile, 256 ); - - FieldFlags[REFERENCE] = CurrentLibEntry->m_Prefix.m_Attributs; - FieldOrient[REFERENCE] = CurrentLibEntry->m_Prefix.m_Orient; - - FieldFlags[VALUE] = CurrentLibEntry->m_Name.m_Attributs; - FieldOrient[VALUE] = CurrentLibEntry->m_Name.m_Orient; - - LibDrawField* Field = CurrentLibEntry->Fields; - while( Field ) - { - FieldFlags[Field->m_FieldId] = Field->m_Attributs; - FieldOrient[Field->m_FieldId] = Field->m_Orient; - Field = (LibDrawField*) Field->Pnext; - } - } - - m_NoteBook = new wxNotebook( this, ID_LIBEDIT_NOTEBOOK ); - - c = new wxLayoutConstraints; - c->left.SameAs( this, wxLeft, 4 ); - c->right.SameAs( this, wxRight, 4 ); - c->top.SameAs( this, wxTop, 4 ); - c->bottom.SameAs( this, wxBottom, 40 ); - m_NoteBook->SetConstraints( c ); - m_NoteBook->SetAutoLayout( TRUE ); - - /* Creation des boutons de commande */ - pos.x = 80; pos.y = 240; - wxButton* Button = new wxButton( this, ID_CLOSE_PART_PROPERTIES, - _( "Close" ), pos ); - - c = new wxLayoutConstraints; - c->left.SameAs( this, wxLeft, 20 ); - c->height.AsIs(); - c->width.AsIs(); - c->bottom.SameAs( this, wxBottom, 5 ); - Button->SetConstraints( c ); - - pos.x += Button->GetDefaultSize().x + 10; - Button = new wxButton( this, ID_ACCEPT_PART_PROPERTIES, - _( "Ok" ), pos ); - - c = new wxLayoutConstraints; - c->right.SameAs( this, wxRight, 20 ); - c->height.AsIs(); - c->width.AsIs(); - c->bottom.SameAs( this, wxBottom, 5 ); - Button->SetConstraints( c ); - - // Add panel Basic - PanelBasic = new wxPanel( m_NoteBook, ID_PANEL_BASIC ); - - c = new wxLayoutConstraints; - c->left.SameAs( m_NoteBook, wxLeft ); - c->right.SameAs( m_NoteBook, wxRight ); - c->bottom.SameAs( m_NoteBook, wxBottom ); - PanelBasic->SetConstraints( c ); - m_NoteBook->AddPage( PanelBasic, _( "Options" ), TRUE ); - - pos.x = 5; pos.y = 25; - new wxStaticBox( PanelBasic, -1, _( " General : " ), pos, wxSize( 150, 120 ) ); - - pos.x = 10; pos.y += 22; - AsConvertButt = new wxCheckBox( PanelBasic, -1, _( "As Convert" ), pos ); - - if( g_AsDeMorgan ) - AsConvertButt->SetValue( TRUE ); - - pos.y += 20; - ShowPinNumButt = new wxCheckBox( PanelBasic, -1, _( "Show Pin Num" ), pos ); - - if( CurrentLibEntry ) - { - if( CurrentLibEntry->DrawPinNum ) - ShowPinNumButt->SetValue( TRUE ); - } - else - ShowPinNumButt->SetValue( TRUE ); - - pos.y += 20; - ShowPinNameButt = new wxCheckBox( PanelBasic, -1, _( "Show Pin Name" ), pos ); - - if( CurrentLibEntry ) - { - if( CurrentLibEntry->DrawPinName ) - ShowPinNameButt->SetValue( TRUE ); - } - else - ShowPinNameButt->SetValue( TRUE ); - - pos.y += 20; - PinsNameInsideButt = new wxCheckBox( PanelBasic, -1, _( "Pin Name Inside" ), pos ); - - if( CurrentLibEntry ) - { - if( CurrentLibEntry->TextInside ) - PinsNameInsideButt->SetValue( TRUE ); - } - else - PinsNameInsideButt->SetValue( TRUE ); - - pos.y += 40; - new wxStaticText( PanelBasic, -1, _( "Number of Units:" ), pos ); - - pos.y += 15; - wxString number; - if( CurrentLibEntry ) - number.Printf( "%d", CurrentLibEntry->NumOfUnits ); - else - number = "1"; - SelNumberOfUnits = new wxSpinCtrl( PanelBasic, -1, number, pos, - wxDefaultSize, wxSP_ARROW_KEYS | wxSP_WRAP, - 1, 16 ); - - pos.y -= 15; pos.x += 140; - new wxStaticText( PanelBasic, -1, _( "Skew:" ), pos ); - - pos.y += 15; - if( CurrentLibEntry && CurrentLibEntry->TextInside ) - number.Printf( "%d", CurrentLibEntry->TextInside ); - else - number = "40"; - m_SetSkew = new wxSpinCtrl( PanelBasic, -1, number, pos, - wxDefaultSize, wxSP_ARROW_KEYS | wxSP_WRAP, - 1, 100 ); - - // Add Panel Documentation - PanelDoc = new wxPanel( m_NoteBook, -1 ); - - c = new wxLayoutConstraints; - c->left.SameAs( m_NoteBook, wxLeft ); - c->right.SameAs( m_NoteBook, wxRight ); - c->bottom.SameAs( m_NoteBook, wxBottom ); - PanelDoc->SetConstraints( c ); - m_NoteBook->AddPage( PanelDoc, _( "Doc" ), FALSE ); - pos.x = 5; pos.y = 40; - NewDoc = new WinEDA_EnterText( PanelDoc, - _( "Doc:" ), Doc, - pos, wxSize( 285, -1 ) ); - - pos.y += 50; - NewKeywoed = new WinEDA_EnterText( PanelDoc, - _( "Keywords:" ), Keywords, - pos, wxSize( 285, -1 ) ); - - pos.y += 50; - NewDocFile = new WinEDA_EnterText( PanelDoc, - _( "DocFileName:" ), Docfile, - pos, wxSize( 285, -1 ) ); - - // Add Panel Alias List - PanelAlias = new wxPanel( m_NoteBook, -1 ); - - c = new wxLayoutConstraints; - c->left.SameAs( m_NoteBook, wxLeft ); - c->right.SameAs( m_NoteBook, wxRight ); - c->bottom.SameAs( m_NoteBook, wxBottom ); - PanelAlias->SetConstraints( c ); - m_NoteBook->AddPage( PanelAlias, _( "Alias" ), FALSE ); - - pos.x = 200; pos.y = 70; - new wxButton( PanelAlias, ID_ADD_ALIAS, - _( "Add" ), pos ); - - pos.y += Button->GetDefaultSize().y + 10; - new wxButton( PanelAlias, ID_DELETE_ONE_ALIAS, - _( "Delete" ), pos ); - - pos.y += Button->GetDefaultSize().y + 10; - new wxButton( PanelAlias, ID_DELETE_ALL_ALIAS, - _( "Delete All" ), pos ); - - pos.x = 5; pos.y = 30; - PartAliasList = new wxListBox( PanelAlias, - -1, - pos, wxSize( 160, 170 ), - 0, NULL, - wxLB_ALWAYS_SB | wxLB_SINGLE ); - - wxStaticText* Msg = new wxStaticText( PanelAlias, -1, _( "Alias" ), - wxPoint (pos.x, pos.y - 20) ); - - Msg->SetForegroundColour( wxColour( 200, 0, 0 ) ); - /* lecture des alias */ - ListOfAliasStruct* Alias = AliasListCopy; - while( Alias ) - { - PartAliasList->Append( Alias->m_Name.m_Text ); - Alias = Alias->Next; - } - - // Add panel Fields - for( int ii = 0; ii < NUMBER_OF_FIELDS; ii++ ) - { - PanelField[ii] = new wxPanel( m_NoteBook, ID_PANEL_REFERENCE + ii ); - - c = new wxLayoutConstraints; - c->left.SameAs( m_NoteBook, wxLeft ); - c->right.SameAs( m_NoteBook, wxRight ); - c->bottom.SameAs( m_NoteBook, wxBottom ); - PanelField[ii]->SetConstraints( c ); - m_NoteBook->AddPage( PanelField[ii], PanelText[ii], FALSE ); - - pos.x = 10; pos.y = 20; - ShowFieldText[ii] = new wxCheckBox( PanelField[ii], -1, - _( "Show Text" ), pos ); - - if( (FieldFlags[ii] & TEXT_NO_VISIBLE ) == 0 ) - ShowFieldText[ii]->SetValue( TRUE ); - - pos.x += 150; - VorientFieldText[ii] = new wxCheckBox( PanelField[ii], -1, - _( "Vertical" ), pos ); - - if( FieldOrient[ii] ) - VorientFieldText[ii]->SetValue( TRUE ); - - pos.x = 10; pos.y += 50; - wxPoint txtpos; - - switch( ii ) - { - case REFERENCE: - if( CurrentLibEntry ) - txtpos = CurrentLibEntry->m_Prefix.m_Pos; - else - txtpos = wxPoint( 0, 0 ); - FieldTextCtrl[ii] = new WinEDA_GraphicTextCtrl( - PanelField[ii], - PanelText[ii], - CurrentLibEntry ? CurrentLibEntry-> - m_Prefix.m_Text : (char*) "U", - CurrentLibEntry ? CurrentLibEntry-> - m_Prefix.m_Size : 50, - UnitMetric, - pos, - 200, - TRUE ); - - FieldPosition[ii] = new WinEDA_PositionCtrl( PanelField[ii], - txtpos, - UnitMetric, wxPoint (pos.x + 150, - pos.y + 32) ); - - break; - - case VALUE: - if( CurrentLibEntry ) - txtpos = CurrentLibEntry->m_Name.m_Pos; - else - txtpos = wxPoint( 0, 0 ); - FieldTextCtrl[ii] = new WinEDA_GraphicTextCtrl( - PanelField[ii], - PanelText[ii], - CurrentLibEntry ? CurrentLibEntry-> - m_Name.m_Text : NULL, - CurrentLibEntry ? CurrentLibEntry-> - m_Name.m_Size : 50, - UnitMetric, - pos, - 200, - TRUE ); - - FieldPosition[ii] = new WinEDA_PositionCtrl( PanelField[ii], - txtpos, - UnitMetric, wxPoint (pos.x + 150, - pos.y + 32) ); - - break; - - default: - int fsize; char* ftext; wxPoint fpos; - fsize = 50; ftext = NULL; - LibDrawField* Field = NULL; - fpos = wxPoint( 0, 0 ); - - //recherche du Field de FieldId correspondant, s'il existe - if( CurrentLibEntry ) - { - Field = CurrentLibEntry->Fields; - while( Field ) - { - if( Field->m_FieldId == ii ) - { - fsize = Field->m_Size; ftext = Field->m_Text; - fpos = Field->m_Pos; - break; - } - Field = (LibDrawField*) Field->Pnext; - } - } - - FieldTextCtrl[ii] = new WinEDA_GraphicTextCtrl( PanelField[ii], - PanelText[ii], - ftext, fsize, - UnitMetric, - pos, 200, TRUE ); - - FieldPosition[ii] = new WinEDA_PositionCtrl( PanelField[ii], - fpos, - UnitMetric, wxPoint (pos.x + 150, - pos.y + 32) ); - - break; - } - } - - SetModal( TRUE ); -} - - -/***************************************************************************/ -/* WinEDA_PartPropertiesFrame::PartPropertiesAccept(wxCommandEvent& event) */ -/***************************************************************************/ - -/* Met a jour les differents parametres pour le composant en cours d'édition - */ - -void WinEDA_PartPropertiesFrame::PartPropertiesAccept( wxCommandEvent& event ) -{ - bool recreateTB = FALSE; - - if( CurrentLibEntry == NULL ) - { - Close(); return; - } - - m_Parent->CurrentScreen->SetModify(); - m_Parent->CurrentScreen->SetRefreshReq(); - - if( ListAlias ) - ListAlias->FreeList(); - if( AliasListCopy ) - ListAlias = AliasListCopy->DupList(); - - if( CurrentLibEntry->Doc && strcmp( Doc, CurrentLibEntry->Doc ) ) - { - free( CurrentLibEntry->Doc ); CurrentLibEntry->Doc = NULL; - } - if( strlen( Doc ) ) - CurrentLibEntry->Doc = strdup( Doc ); - - if( CurrentLibEntry->KeyWord && strcmp( Keywords, CurrentLibEntry->KeyWord ) ) - { - free( CurrentLibEntry->KeyWord ); CurrentLibEntry->KeyWord = NULL; - } - if( strlen( Keywords ) ) - CurrentLibEntry->KeyWord = strdup( Keywords ); - - if( CurrentLibEntry->DocFile && strcmp( Docfile, CurrentLibEntry->DocFile ) ) - { - free( CurrentLibEntry->DocFile ); CurrentLibEntry->DocFile = NULL; - } - if( strlen( Docfile ) ) - CurrentLibEntry->DocFile = strdup( Docfile ); - - - CurrentLibEntry->m_Prefix.SetText( (char*) FieldTextCtrl[REFERENCE]->GetText() ); - CurrentLibEntry->m_Name.SetText( (char*) FieldTextCtrl[VALUE]->GetText() ); - - CurrentLibEntry->m_Prefix.m_Size = FieldTextCtrl[REFERENCE]->GetTextSize(); - CurrentLibEntry->m_Name.m_Size = FieldTextCtrl[VALUE]->GetTextSize(); - - CurrentLibEntry->m_Prefix.m_Pos = FieldPosition[REFERENCE]->GetCoord(); - CurrentLibEntry->m_Name.m_Pos = FieldPosition[VALUE]->GetCoord(); - - CurrentLibEntry->m_Prefix.m_Orient = VorientFieldText[REFERENCE]->GetValue() ? 1 : 0; - CurrentLibEntry->m_Name.m_Orient = VorientFieldText[VALUE]->GetValue() ? 1 : 0; - - if( ShowFieldText[REFERENCE]->GetValue() ) - CurrentLibEntry->m_Prefix.m_Attributs &= ~TEXT_NO_VISIBLE; - else - CurrentLibEntry->m_Prefix.m_Attributs |= TEXT_NO_VISIBLE; - - if( ShowFieldText[VALUE]->GetValue() ) - CurrentLibEntry->m_Name.m_Attributs &= ~TEXT_NO_VISIBLE; - else - CurrentLibEntry->m_Name.m_Attributs |= TEXT_NO_VISIBLE; - - for( int ii = FIELD1; ii < NUMBER_OF_FIELDS; ii++ ) - { - LibDrawField* Field = CurrentLibEntry->Fields; - LibDrawField* NextField, * previousField = NULL; - while( Field ) - { - NextField = (LibDrawField*) Field->Pnext; - if( Field->m_FieldId == ii ) - { - Field->SetText( (char*) FieldTextCtrl[ii]->GetText() ); - Field->m_Size = FieldTextCtrl[ii]->GetTextSize(); - if( ShowFieldText[ii]->GetValue() ) - Field->m_Attributs &= ~TEXT_NO_VISIBLE; - else - Field->m_Attributs |= TEXT_NO_VISIBLE; - Field->m_Orient = VorientFieldText[ii]->GetValue() ? 1 : 0; - Field->m_Pos = FieldPosition[Field->m_FieldId]->GetCoord(); - if( Field->m_Text == NULL ) - { - delete Field; - if( previousField ) - previousField->Pnext = NextField; - else - CurrentLibEntry->Fields = NextField; - } - break; - } - - previousField = Field; - Field = NextField; - } - - if( (Field == NULL) && strlen( FieldTextCtrl[ii]->GetText() ) ) - { // N'existe pas: a creer - Field = new LibDrawField( ii ); - - Field->SetText( (char*) FieldTextCtrl[ii]->GetText() ); - Field->m_Size = FieldTextCtrl[ii]->GetTextSize(); - Field->Pnext = CurrentLibEntry->Fields; - if( ShowFieldText[Field->m_FieldId]->GetValue() ) - Field->m_Attributs &= ~TEXT_NO_VISIBLE; - else - Field->m_Attributs |= TEXT_NO_VISIBLE; - Field->m_Orient = VorientFieldText[Field->m_FieldId]->GetValue() ? 1 : 0; - Field->m_Pos = FieldPosition[Field->m_FieldId]->GetCoord(); - CurrentLibEntry->Fields = Field; - } - } - - int ii = SelNumberOfUnits->GetValue(); - if( ChangeNbUnitsPerPackage( ii ) ) - recreateTB = TRUE; - - if( AsConvertButt->GetValue() ) - { - if( !g_AsDeMorgan ) - { - g_AsDeMorgan = 1; - if( SetUnsetConvert() ) - recreateTB = TRUE; - } - } - else - { - if( g_AsDeMorgan ) - { - g_AsDeMorgan = 0; - if( SetUnsetConvert() ) - recreateTB = TRUE; - } - } - - CurrentLibEntry->DrawPinNum = ShowPinNumButt->GetValue() ? 1 : 0; - CurrentLibEntry->DrawPinName = ShowPinNameButt->GetValue() ? 1 : 0; - - if( PinsNameInsideButt->GetValue() == FALSE ) - CurrentLibEntry->TextInside = 0; - else - CurrentLibEntry->TextInside = m_SetSkew->GetValue(); - - if( recreateTB ) - m_Parent->ReCreateHToolbar(); - - Close(); -} - - -/***************************************************************/ -/* void WinEDA_PartPropertiesFrame::DeleteAllAliasOfPart() */ -/***************************************************************/ - -void WinEDA_PartPropertiesFrame::DeleteAllAliasOfPart() -{ - if( CurrentLibEntry && AliasListCopy ) - { - if( confirmation( _( "Ok to Delete Alias LIST" ) ) == YES ) - { - if( AliasListCopy ) - AliasListCopy->FreeList(); - AliasListCopy = NULL; - PartAliasList->Clear(); - } - } -} - - -/*********************************************************/ -/* void WinEDA_PartPropertiesFrame::AddAliasOfPart() */ -/*********************************************************/ - -void WinEDA_PartPropertiesFrame::AddAliasOfPart() -{ - char Line[LINE_LEN]; - int llen; - ListOfAliasStruct* NewAlias; - - if( CurrentLibEntry == NULL ) - return; - - *Line = 0; - if( Get_Message( _( "Alias:" ), Line, this ) != 0 ) - return; - - ChangeSpaces( Line, '_' ); - llen = strlen( Line ) + 1; - - NewAlias = LocateAlias( AliasListCopy, Line ); - if( NewAlias ) - { - DisplayError( _( "Already in use" ), 10 ); return; - } - NewAlias = new ListOfAliasStruct( Line ); - - NewAlias->Next = AliasListCopy; - AliasListCopy = NewAlias; - - /* affichage des alias */ - PartAliasList->Clear(); - ListOfAliasStruct* Alias = AliasListCopy; - while( Alias ) - { - PartAliasList->Append( Alias->m_Name.m_Text ); - Alias = Alias->Next; - } -} - - -/********************************/ -/* void DeleteAliasOfPart() */ -/********************************/ - -void WinEDA_PartPropertiesFrame::DeleteAliasOfPart() -{ - ListOfAliasStruct* Alias; - wxString aliasname; - - if( CurrentLibEntry == NULL ) - return; - if( AliasListCopy == NULL ) - return; - - aliasname = PartAliasList->GetStringSelection(); - if( aliasname == "" ) - return; - - Alias = AliasListCopy; - ListOfAliasStruct* Previous = NULL; - while( Alias ) - { - if( stricmp( aliasname.GetData(), Alias->m_Name.m_Text ) == 0 ) - { - if( Previous ) - Previous->Next = Alias->Next; - else - AliasListCopy = Alias->Next; - delete Alias; - break; - } - Previous = Alias; - Alias = Alias->Next; - } - - /* affichage des alias */ - PartAliasList->Clear(); - Alias = AliasListCopy; - while( Alias ) - { - PartAliasList->Append( Alias->m_Name.m_Text ); - Alias = Alias->Next; - } -} - - -/************************************************************/ -static void ExitMoveField( WinEDA_DrawFrame* frame, wxDC* DC ) -/************************************************************/ -{ - frame->CurrentScreen->ManageCurseur = NULL; - frame->CurrentScreen->ForceCloseManageCurseur = NULL; - if( CurrentDrawItem == NULL ) - return; - - wxPoint curpos; - curpos = frame->CurrentScreen->Curseur; - frame->CurrentScreen->Curseur = StartCursor; - MoveField( DC, 1 ); - frame->CurrentScreen->Curseur = curpos; - CurrentDrawItem->m_Flags = 0; - - CurrentDrawItem = NULL; -} - - -/*********************************************/ -/* static void StartMoveField(COMMAND * Cmd) */ -/*********************************************/ -/* Initialise le deplacement d'un champ ( ref ou Name) */ -void WinEDA_LibeditFrame::StartMoveField( wxDC* DC, LibDrawField* field ) -{ - if( (CurrentLibEntry == NULL) || ( field == NULL ) ) - return; - CurrentDrawItem = field; - CurrentDrawItem->m_Flags |= IS_MOVED; - CurrentScreen->ManageCurseur = MoveField; - CurrentScreen->ForceCloseManageCurseur = ExitMoveField; - CurrentScreen->ManageCurseur( DC, 1 ); - StartCursor = CurrentScreen->Curseur; -} - - -/*****************************************************************/ -/* Routine d'affichage du texte 'Field' en cours de deplacement. */ -/* Routine normalement attachee au curseur */ -/*****************************************************************/ -static void MoveField( wxDC* DC, int flag ) -{ - int color; - LibDrawField* Field = (LibDrawField*) CurrentDrawItem; - - if( (CurrentLibEntry == NULL) || (Field == NULL) ) - return; - - GRSetDrawMode( DC, XOR_MODE ); - - switch( Field->m_FieldId ) - { - case VALUE: - color = ReturnLayerColor( LAYER_VALUEPART ); - break; - - case REFERENCE: - color = ReturnLayerColor( LAYER_REFERENCEPART ); - break; - - default: - color = ReturnLayerColor( LAYER_FIELDS ); - break; - } - - if( Field->m_Attributs & TEXT_NO_VISIBLE ) - color = DARKGRAY; - if( flag >= 0 ) - Gr_E_texte( DC, Field->m_Pos.x, -Field->m_Pos.y, - color, Field->m_Text, - Field->m_Orient, Field->m_Size, - GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER ); - - Field->m_Pos.x = ActiveScreen->Curseur.x; - Field->m_Pos.y = -ActiveScreen->Curseur.y; - - Gr_E_texte( DC, Field->m_Pos.x, -Field->m_Pos.y, - color, Field->m_Text, - Field->m_Orient, Field->m_Size, - GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER ); -} - - -/********************************/ -/* static void PlaceField() */ -/********************************/ - -void WinEDA_LibeditFrame::PlaceField( wxDC* DC, LibDrawField* Field ) -{ - int color; - - if( Field == NULL ) - return; - - GRSetDrawMode( DC, GR_DEFAULT_DRAWMODE ); - - switch( Field->m_FieldId ) - { - case REFERENCE: - color = ReturnLayerColor( LAYER_REFERENCEPART ); - break; - - case VALUE: - color = ReturnLayerColor( LAYER_VALUEPART ); - break; - - default: - color = ReturnLayerColor( LAYER_FIELDS ); - break; - } - - if( Field->m_Attributs & TEXT_NO_VISIBLE ) - color = DARKGRAY; - Gr_E_texte( DC, Field->m_Pos.x, -Field->m_Pos.y, - color, Field->m_Text, - Field->m_Orient, Field->m_Size, - GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER ); - - Field->m_Flags = 0; - - CurrentScreen->SetModify(); - CurrentScreen->ManageCurseur = NULL; - CurrentScreen->ForceCloseManageCurseur = NULL; - CurrentDrawItem = NULL; -} - - -/****************************************/ -/* static void EditField(COMMAND * Cmd) */ -/****************************************/ - -void WinEDA_LibeditFrame::EditField( wxDC* DC, LibDrawField* Field ) -{ - char Text[LINE_LEN]; - int color; - - wxClientDC dc( DrawPanel ); - - if( Field== NULL ) - return; - - switch( Field->m_FieldId ) - { - case REFERENCE: - color = ReturnLayerColor( LAYER_REFERENCEPART ); - break; - - case VALUE: - color = ReturnLayerColor( LAYER_VALUEPART ); - break; - - default: - color = ReturnLayerColor( LAYER_FIELDS ); - break; - } - - *Text = 0; - if( Field->m_Attributs & TEXT_NO_VISIBLE ) - color = DARKGRAY; - - if( Field->m_Text ) - strcpy( Text, Field->m_Text ); - Get_Message( _( "Text: " ), Text, this ); - ChangeSpaces( Text, '_' ); - - GRSetDrawMode( &dc, XOR_MODE ); - Gr_E_texte( DC, Field->m_Pos.x, -Field->m_Pos.y, - color, Field->m_Text, - Field->m_Orient, Field->m_Size, - GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER ); - - Field->SetText( Text ); - - if( Field->m_Flags == 0 ) - GRSetDrawMode( &dc, GR_DEFAULT_DRAWMODE ); - - Gr_E_texte( DC, Field->m_Pos.x, -Field->m_Pos.y, - color, Field->m_Text, - Field->m_Orient, Field->m_Size, - GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER ); - - CurrentScreen->SetModify(); -} - - -/*******************************************************************/ -void WinEDA_LibeditFrame::RotateField( wxDC* DC, LibDrawField* Field ) -/*******************************************************************/ - -/* - * Routine de modification de l'orientation ( Horiz ou Vert. ) du champ. - * si un champ est en cours d'edition, modif de celui ci. - * sinon Modif du champ pointe par la souris - */ -{ - int color; - - if( Field == NULL ) - return; - - CurrentScreen->SetModify(); - - switch( Field->m_FieldId ) - { - case REFERENCE: - color = ReturnLayerColor( LAYER_REFERENCEPART ); - break; - - case VALUE: - color = ReturnLayerColor( LAYER_VALUEPART ); - break; - - default: - color = ReturnLayerColor( LAYER_FIELDS ); - break; - } - - if( Field->m_Attributs & TEXT_NO_VISIBLE ) - color = DARKGRAY; - - GRSetDrawMode( DC, XOR_MODE ); - Gr_E_texte( DC, Field->m_Pos.x, -Field->m_Pos.y, - color, Field->m_Text, - Field->m_Orient, Field->m_Size, - GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER ); - - if( Field->m_Orient ) - Field->m_Orient = 0; - else - Field->m_Orient = 1; - - if( Field->m_Flags == 0 ) - GRSetDrawMode( DC, GR_DEFAULT_DRAWMODE ); - - Gr_E_texte( DC, Field->m_Pos.x, -Field->m_Pos.y, - color, Field->m_Text, - Field->m_Orient, Field->m_Size, - GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER ); -} - - -/********************************************************/ -/* static int LocateField(LibraryEntryStruct *LibEntry) */ -/********************************************************/ - -/* Localise le champ (ref ou name) pointe par la souris - * retourne: - * < 0: Pas de champ - * 0: Ref - * 1: Name(s) - * > 2 = Num Field - */ -LibDrawField* WinEDA_LibeditFrame::LocateField( LibraryEntryStruct* LibEntry ) -{ - int x0, y0, x1, y1; /* Rectangle d'encadrement des textes a localiser */ - int dx, dy; /* Dimensions du texte */ - LibDrawField* Field; - - /* Localisation du Nom */ - x0 = LibEntry->m_Name.m_Pos.x; - y0 = -LibEntry->m_Name.m_Pos.y; - dx = LibEntry->m_Name.m_Size * strlen( LibEntry->m_Name.m_Text ), - dy = LibEntry->m_Name.m_Size; - if( LibEntry->m_Name.m_Orient ) - EXCHG( dx, dy ); - x0 -= dx / 2; y0 -= dy / 2; - x1 = x0 + dx; y1 = y0 + dy; - - if( (CurrentScreen->Curseur.x >= x0) && ( CurrentScreen->Curseur.x <= x1) - && (CurrentScreen->Curseur.y >= y0) && ( CurrentScreen->Curseur.y <= y1) ) - return &LibEntry->m_Name; - - /* Localisation du Prefix */ - x0 = LibEntry->m_Prefix.m_Pos.x; - y0 = -LibEntry->m_Prefix.m_Pos.y; - dx = LibEntry->m_Prefix.m_Size * strlen( LibEntry->m_Prefix.m_Text ), - dy = LibEntry->m_Prefix.m_Size; - if( LibEntry->m_Prefix.m_Orient ) - EXCHG( dx, dy ); - x0 -= dx / 2; y0 -= dy / 2; - x1 = x0 + dx; y1 = y0 + dy; - - if( (CurrentScreen->Curseur.x >= x0) && ( CurrentScreen->Curseur.x <= x1) - && (CurrentScreen->Curseur.y >= y0) && ( CurrentScreen->Curseur.y <= y1) ) - return &LibEntry->m_Prefix; - - /* Localisation des autres fields */ - for( Field = LibEntry->Fields; Field != NULL; - Field = (LibDrawField*) Field->Pnext ) - { - if( Field->m_Text == NULL ) - continue; - x0 = Field->m_Pos.x; y0 = -Field->m_Pos.y; - dx = Field->m_Size * strlen( Field->m_Text ), - dy = Field->m_Size; - if( Field->m_Orient ) - EXCHG( dx, dy ); - x0 -= dx / 2; y0 -= dy / 2; - x1 = x0 + dx; y1 = y0 + dy; - if( (CurrentScreen->Curseur.x >= x0) && ( CurrentScreen->Curseur.x <= x1) - && (CurrentScreen->Curseur.y >= y0) && ( CurrentScreen->Curseur.y <= y1) ) - return Field; - } - - return NULL; -} - - -/*********************************************************************/ -/* static char * PrefixText(LibraryEntryStruct * LibEntry, int Unit) */ -/*********************************************************************/ - -/* Calcule l'affichage complet du prefixe ( texte + '?' + ident unit ) - * Retourne un pointeur sur le nouveau texte (allocation statique) - */ -static char* PrefixText( LibraryEntryStruct* LibEntry, int Unit ) -{ - static char Text[LINE_LEN]; - - if( LibEntry->NumOfUnits > 1 ) - sprintf( Text, "%s?%c", LibEntry->m_Prefix.m_Text, Unit + 'A' - 1 ); - else - sprintf( Text, "%s?", LibEntry->m_Prefix.m_Text ); - return Text; -} - - -/*****************************************************************/ -/* void WinEDA_PartPropertiesFrame::ChangeNbUnitsPerPackagevoid) */ -/*****************************************************************/ - -/* Routine de modification du nombre d'unites par package pour le - * composant courant; - */ -bool WinEDA_PartPropertiesFrame::ChangeNbUnitsPerPackage( int MaxUnit ) -{ - int OldNumUnits, ii, FlagDel = -1; - LibEDA_BaseStruct* DrawItem, * NextDrawItem; - - if( CurrentLibEntry == NULL ) - return FALSE; - - /* Si pas de changement: termine */ - if( CurrentLibEntry->NumOfUnits == MaxUnit ) - return FALSE; - - OldNumUnits = CurrentLibEntry->NumOfUnits; - if( OldNumUnits < 1 ) - OldNumUnits = 1; - - CurrentLibEntry->NumOfUnits = MaxUnit; - - - /* Traitement des unites enlevees ou rajoutees */ - if( OldNumUnits > CurrentLibEntry->NumOfUnits ) - { - DrawItem = CurrentLibEntry->Drawings; - for( ; DrawItem != NULL; DrawItem = NextDrawItem ) - { - NextDrawItem = DrawItem->Pnext; - if( DrawItem->m_Unit > MaxUnit ) /* Item a effacer */ - { - if( FlagDel < 0 ) - { - if( confirmation( _( "Delete units" ) ) == YES ) - { - /* Si part selectee n'existe plus: selection 1ere unit */ - if( CurrentUnit > MaxUnit ) - CurrentUnit = 1; - FlagDel = 1; - } - else - { - FlagDel = 0; - MaxUnit = OldNumUnits; - CurrentLibEntry->NumOfUnits = MaxUnit; - return FALSE; - } - } - DeleteOneLibraryDrawStruct( NULL, CurrentLibEntry, - DrawItem, 0 ); - } - } - - return TRUE; - } - - if( OldNumUnits < CurrentLibEntry->NumOfUnits ) - { - DrawItem = CurrentLibEntry->Drawings; - for( ; DrawItem != NULL; DrawItem = DrawItem->Pnext ) - { - /* Duplication des items pour autres elements */ - if( DrawItem->m_Unit == 1 ) - { - for( ii = OldNumUnits + 1; ii <= MaxUnit; ii++ ) - { - NextDrawItem = CopyDrawEntryStruct( DrawItem ); - NextDrawItem->Pnext = CurrentLibEntry->Drawings; - CurrentLibEntry->Drawings = NextDrawItem; - NextDrawItem->m_Unit = ii; - } - } - } - } - return TRUE; -} - - -/**********************************************************/ -/* void WinEDA_PartPropertiesFrame::SetUnsetConvert() */ -/**********************************************************/ - -/* crée ou efface (selon option AsConvert) les éléments - * de la représentation convertie d'un composant - */ -bool WinEDA_PartPropertiesFrame::SetUnsetConvert() -{ - int FlagDel = 0; - LibEDA_BaseStruct* DrawItem = NULL, * NextDrawItem; - - if( g_AsDeMorgan ) /* Representation convertie a creer */ - { - /* Traitement des elements a ajouter ( pins seulement ) */ - if( CurrentLibEntry ) - DrawItem = CurrentLibEntry->Drawings; - for( ; DrawItem != NULL; DrawItem = DrawItem->Pnext ) - { - /* Duplication des items pour autres elements */ - if( DrawItem->Type() != PIN_DRAW_TYPE ) - continue; - if( DrawItem->m_Convert == 1 ) - { - if( FlagDel == 0 ) - { - if( confirmation( _( "Create pins for Convert items" ) ) == YES ) - FlagDel = 1; - else - { - if( confirmation( _( "Part as \"De Morgan\" anymore" ) ) == YES ) - return TRUE; - - g_AsDeMorgan = 0; return FALSE; - } - } - NextDrawItem = CopyDrawEntryStruct( DrawItem ); - NextDrawItem->Pnext = CurrentLibEntry->Drawings; - CurrentLibEntry->Drawings = NextDrawItem; - NextDrawItem->m_Convert = 2; - } - } - } - else /* Representation convertie a supprimer */ - { - /* Traitement des elements à supprimer */ - if( CurrentLibEntry ) - DrawItem = CurrentLibEntry->Drawings; - for( ; DrawItem != NULL; DrawItem = NextDrawItem ) - { - NextDrawItem = DrawItem->Pnext; - if( DrawItem->m_Convert > 1 ) /* Item a effacer */ - { - if( FlagDel == 0 ) - { - if( confirmation( _( "Delete Convert items" ) ) == YES ) - { - CurrentConvert = 1; - FlagDel = 1; - } - else - { - g_AsDeMorgan = 1; - return FALSE; - } - } - ActiveScreen->SetModify(); - DeleteOneLibraryDrawStruct( NULL, CurrentLibEntry, DrawItem, 0 ); - } - } - } - return TRUE; -} diff --git a/eeschema/genliste.cpp.notused b/eeschema/genliste.cpp.notused deleted file mode 100644 index 5e7aa7cf53..0000000000 --- a/eeschema/genliste.cpp.notused +++ /dev/null @@ -1,730 +0,0 @@ - /***********************************************************/ - /* genliste.cpp */ - /* Module de generation de listing de composants, labels.. */ - /***********************************************************/ - -#include "fctsys.h" -#include "gr_basic.h" - -#include "common.h" -#include "program.h" -#include "libcmp.h" -#include "general.h" -#include "netlist.h" - -#include "protos.h" - -/* Structures pour memo et liste des elements */ -typedef struct ListLabel -{ - int Type(); - void * m_Label; - int m_SheetNumber; -} ListLabel; - - -/* fonctions locales */ -static void GenereListeOfItems(wxWindow * frame, const wxString & FullFileName); -static int GenListeGLabels( ListLabel * List ); -static int ListTriComposantByRef(EDA_SchComponentStruct **Objet1, - EDA_SchComponentStruct **Objet2); -static int ListTriComposantByVal(EDA_SchComponentStruct **Objet1, - EDA_SchComponentStruct **Objet2); -static int ListTriGLabelBySheet(ListLabel *Objet1, ListLabel *Objet2); -static int ListTriGLabelByVal(ListLabel *Objet1, ListLabel *Objet2); -static void DeleteSubCmp( EDA_BaseStruct ** List , int NbItems); - -static int PrintListeCmpByRef( FILE *f, EDA_BaseStruct **List, int NbItems); -static int PrintListeCmpByVal( FILE *f, EDA_BaseStruct **List, int NbItems); - -static int PrintListeGLabel( FILE *f, ListLabel *List, int NbItems); - -// Constantes: -#define LISTCMP_BY_REF 1 -#define LISTCMP_BY_VAL 2 -#define LIST_SUBCMP 4 -#define LIST_HPINS_BY_NAME 8 -#define LIST_HPINS_BY_SHEET 0x10 - -/* Variable locales */ -int ItemsToList = LISTCMP_BY_REF | LISTCMP_BY_VAL; - -enum id_tools { - ID_TOOLS_GEN_LIST = 1500, - ID_EXIT_TOOLS, - ID_SET_FILENAME_LIST -}; - -/* Classe de la frame de gestion de l'annotation */ -class WinEDA_GenCmpListFrame: public wxDialog -{ -public: - WinEDA_DrawFrame * m_Parent; - - wxCheckBox * m_ListCmpbyRefItems; - wxCheckBox * m_ListCmpbyValItems; - wxCheckBox * m_ListSubCmpItems; - wxCheckBox * m_GenListLabelsbyVal; - wxCheckBox * m_GenListLabelsbySheet; - wxString m_LibArchiveFileName; - wxString m_ListFileName; - - // Constructor and destructor - WinEDA_GenCmpListFrame(WinEDA_DrawFrame *parent, wxPoint& pos); - ~WinEDA_GenCmpListFrame() {}; - - void GenList(wxCommandEvent& event); - void GenListUpdateOpt(); - void ToolsExit(wxCommandEvent& event); - - DECLARE_EVENT_TABLE() -}; - -BEGIN_EVENT_TABLE(WinEDA_GenCmpListFrame, wxDialog) - EVT_BUTTON(ID_EXIT_TOOLS, WinEDA_GenCmpListFrame::ToolsExit) - EVT_BUTTON(ID_TOOLS_GEN_LIST, WinEDA_GenCmpListFrame::GenList) -END_EVENT_TABLE() - - -/***************************************************************/ -void InstallToolsFrame(WinEDA_DrawFrame *parent, wxPoint & pos) -/***************************************************************/ -{ - WinEDA_GenCmpListFrame * frame = new WinEDA_GenCmpListFrame(parent, pos); - frame->ShowModal(); frame->Destroy(); -} - - -/*****************************************************************************/ -WinEDA_GenCmpListFrame::WinEDA_GenCmpListFrame(WinEDA_DrawFrame *parent, - wxPoint& framepos): - wxDialog(parent, -1, _("List of Material"), framepos, wxSize(360, 200), - DIALOG_STYLE) -/*****************************************************************************/ -{ -wxPoint pos; - - m_Parent = parent; - SetFont(*g_DialogFont); - - if ( (framepos.x == -1) && (framepos.x == -1) ) Centre(); - - /* Calcul du nom du fichier d'archivage */ - m_LibArchiveFileName = MakeFileName(wxEmptyString,ScreenSch->m_FileName,wxEmptyString); - /* mise a jour extension */ - ChangeFileNameExt(m_LibArchiveFileName, g_LibExtBuffer); - - /* Calcul du nom du fichier de listage */ - m_ListFileName = MakeFileName(wxEmptyString,ScreenSch->m_FileName,wxEmptyString); - /* mise a jour extension */ - ChangeFileNameExt(m_ListFileName, wxT(".lst")); - - pos.x = 5; pos.y = 15; - new wxStaticBox(this, -1,_(" List items: "), pos, wxSize(230, 120)); - - pos.x = 10; pos.y += 22; - m_ListCmpbyRefItems = new wxCheckBox(this,-1, _("Components by Reference"), pos); - if ( ItemsToList & LISTCMP_BY_REF ) m_ListCmpbyRefItems->SetValue(TRUE); - pos.y += 17; - m_ListCmpbyValItems = new wxCheckBox(this,-1, _("Components by Value"), pos); - if ( ItemsToList & LISTCMP_BY_VAL ) m_ListCmpbyValItems->SetValue(TRUE); - pos.y += 17; - m_ListSubCmpItems = new wxCheckBox(this,-1, _("Sub Components (i.e U2A, U2B..)"), pos); - if ( ItemsToList & LIST_SUBCMP ) m_ListSubCmpItems->SetValue(TRUE); - pos.y += 17; - m_GenListLabelsbyVal = new wxCheckBox(this,-1, _("Hierachy Pins by name"), pos); - if ( ItemsToList & LIST_HPINS_BY_NAME ) m_GenListLabelsbyVal->SetValue(TRUE); - pos.y += 17; - m_GenListLabelsbySheet = new wxCheckBox(this,-1, _("Hierachy Pins by Sheets"), pos); - if ( ItemsToList & LIST_HPINS_BY_SHEET ) m_GenListLabelsbySheet->SetValue(TRUE); - - /* Creation des boutons de commande */ - pos.x = 260; pos.y = 40; - wxButton * Button = new wxButton(this, ID_TOOLS_GEN_LIST, - _("&Create List"), pos); - Button->SetForegroundColour(*wxRED); - - pos.y += Button->GetSize().y + 5; - Button = new wxButton(this, ID_EXIT_TOOLS, - _("&Exit"), pos); - Button->SetForegroundColour(*wxBLUE); -} - -// Fonctions de positionnement des variables d'option -void WinEDA_GenCmpListFrame::GenListUpdateOpt() -{ - ItemsToList = 0; - if ( m_ListCmpbyRefItems->GetValue() ) ItemsToList |= LISTCMP_BY_REF; - if ( m_ListCmpbyValItems->GetValue() ) ItemsToList |= LISTCMP_BY_VAL; - if ( m_ListSubCmpItems->GetValue() ) ItemsToList |= LIST_SUBCMP; - if ( m_GenListLabelsbyVal->GetValue() ) ItemsToList |= LIST_HPINS_BY_NAME; - if ( m_GenListLabelsbySheet->GetValue() ) ItemsToList |= LIST_HPINS_BY_SHEET; -} - -void WinEDA_GenCmpListFrame::GenList(wxCommandEvent& event) -{ -#define EXT_LIST wxT(".lst") -wxString mask, filename; - - GenListUpdateOpt(); - - mask = wxT("*"); mask += EXT_LIST; - filename = EDA_FileSelector(_("List of material:"), - wxEmptyString, /* Chemin par defaut (ici dir courante) */ - m_ListFileName, /* nom fichier par defaut, et resultat */ - EXT_LIST, /* extension par defaut */ - mask, /* Masque d'affichage */ - this, - wxSAVE, - TRUE - ); - if ( filename.IsEmpty() ) return; - else m_ListFileName = filename; - - GenereListeOfItems(this, m_ListFileName); - Close(); -} - -void WinEDA_GenCmpListFrame::ToolsExit(wxCommandEvent& event) -{ - GenListUpdateOpt(); - Close(); -} - - - -/***************************************************************************/ -static void GenereListeOfItems(wxWindow * frame, const wxString & FullFileName) -/***************************************************************************/ -/* - Routine principale pour la creation des listings ( composants et/ou labels - globaux et "sheet labels" ) -*/ -{ -FILE *f; -EDA_BaseStruct ** List; -ListLabel * ListOfLabels; -int NbItems; -char Line[1024]; -wxString msg; - - /* Creation de la liste des elements */ - if ((f = wxFopen(FullFileName, wxT("wt"))) == NULL) - { - msg = _("Failed to open file "); msg << FullFileName; - DisplayError(frame, msg); - return; - } - - NbItems = GenListeCmp(NULL ); - if ( NbItems ) - { - List = (EDA_BaseStruct **) - MyZMalloc( NbItems * sizeof(EDA_BaseStruct **) ); - if (List == NULL ) - { - fclose(f); return; - } - - GenListeCmp(List); - - /* generation du fichier listing */ - DateAndTime(Line); - fprintf( f, "%s >> Creation date: %s\n", CONV_TO_UTF8(Main_Title), Line ); - - /* Tri et impression de la liste des composants */ - - qsort( List, NbItems, sizeof( EDA_BaseStruct * ), - (int(*)(const void*, const void*))ListTriComposantByRef); - - if( (ItemsToList & LIST_SUBCMP) == 0 ) DeleteSubCmp(List, NbItems); - - if( (ItemsToList & LISTCMP_BY_REF) ) - { - PrintListeCmpByRef(f, List, NbItems); - } - - if( (ItemsToList & LISTCMP_BY_VAL) ) - { - qsort( List, NbItems, sizeof( EDA_BaseStruct * ), - (int(*)(const void*, const void*))ListTriComposantByVal); - PrintListeCmpByVal(f, List, NbItems); - } - MyFree( List ); - } - - /***************************************/ - /* Generation liste des Labels globaux */ - /***************************************/ - - NbItems = GenListeGLabels( NULL ); - if ( NbItems ) - { - ListOfLabels = (ListLabel *) MyZMalloc( NbItems * sizeof(ListLabel) ); - if (ListOfLabels == NULL ) - { - fclose(f); return; - } - - GenListeGLabels(ListOfLabels); - - /* Tri de la liste */ - if( (ItemsToList & LIST_HPINS_BY_SHEET) ) - { - qsort( ListOfLabels, NbItems, sizeof( ListLabel ), - (int(*)(const void*, const void*))ListTriGLabelBySheet); - - msg = _("\n#Glob labels ( order = Sheet Number )\n"); - fprintf( f, "%s", CONV_TO_UTF8(msg)); - PrintListeGLabel(f, ListOfLabels, NbItems); - } - - if( (ItemsToList & LIST_HPINS_BY_NAME) ) - { - qsort( ListOfLabels, NbItems, sizeof( ListLabel ), - (int(*)(const void*, const void*))ListTriGLabelByVal); - - msg = _("\n#Glob labels ( order = Alphab. )\n"); - fprintf( f, "%s", CONV_TO_UTF8(msg)); - PrintListeGLabel(f, ListOfLabels, NbItems); - } - MyFree( ListOfLabels ); - } - - msg = _("\n#End List\n"); - fprintf( f, "%s", CONV_TO_UTF8(msg)); - fclose(f); -} - - - -/****************************************/ -int GenListeCmp( EDA_BaseStruct ** List ) -/****************************************/ -/* Routine de generation de la liste des elements utiles du dessin - Si List == NULL: comptage des elements - Sinon remplissage de la liste - Initialise "FlagControlMulti" a SheetNumber pour la sortie des listes - et m_Father comme pointeur sur la sheet d'appartenance -*/ -{ -int ii = 0; -EDA_BaseStruct *DrawList; -EDA_SchComponentStruct *DrawLibItem; -BASE_SCREEN * screen = ScreenSch; - - for( ; screen != NULL ; screen = (BASE_SCREEN*)screen->Pnext ) - { - DrawList = screen->EEDrawList; - while ( DrawList ) - { - switch( DrawList->Type() ) - { - - case DRAW_LIB_ITEM_STRUCT_TYPE : - ii++; - DrawLibItem = (EDA_SchComponentStruct *) DrawList; - DrawLibItem->m_FlagControlMulti = screen->m_SheetNumber; - DrawLibItem->m_Parent = screen; - if( List ) - { - *List = DrawList; List++; - } - break; - - - default: break; - } - DrawList = DrawList->Pnext; - } - } - return ( ii ); -} - -/*********************************************/ -static int GenListeGLabels( ListLabel * List ) -/*********************************************/ -/* Count the Glabels, or fill the list Listwith Glabel pointers - If List == NULL: Item count only - Else fill list of Glabels -*/ -{ -int ii = 0; -EDA_BaseStruct *DrawList; -DrawSheetLabelStruct *SheetLabel; -BASE_SCREEN * screen = ScreenSch; - - for( ; screen != NULL ; screen = (BASE_SCREEN*)screen->Pnext ) - { - DrawList = screen->EEDrawList; - while ( DrawList ) - { - switch( DrawList->Type() ) - { - case DRAW_GLOBAL_LABEL_STRUCT_TYPE : - if( List ) - { - List->Type() = DRAW_TEXT_STRUCT_TYPE; - List->m_SheetNumber = screen->m_SheetNumber; - List->m_Label = DrawList; List++; - } - ii++; - break; - - case DRAW_SHEET_STRUCT_TYPE : - { - #define Sheet ((DrawSheetStruct * ) DrawList) - SheetLabel= Sheet->m_Label; - while( SheetLabel != NULL ) - { - if ( List ) - { - List->Type() = DRAW_SHEETLABEL_STRUCT_TYPE; - List->m_SheetNumber = screen->m_SheetNumber; - List->m_Label = SheetLabel; - List++; - } - ii++; - SheetLabel = (DrawSheetLabelStruct*)(SheetLabel->Pnext); - } - break; - } - - default: break; - } - DrawList = DrawList->Pnext; - } - } - return ( ii ); -} - -/**********************************************************/ -static int ListTriComposantByVal(EDA_SchComponentStruct **Objet1, - EDA_SchComponentStruct **Objet2) -/**********************************************************/ - /* Routine de comparaison pour le tri du Tableau par qsort() - Les composants sont tries - par valeur - si meme valeur: par reference - si meme valeur: par numero d'unite - -*/ -{ -int ii; -const wxString * Text1, *Text2; - - if( (*Objet1 == NULL) && (*Objet2 == NULL ) ) return(0); - if( *Objet1 == NULL) return(-1); - if( *Objet2 == NULL) return(1); - - Text1 = &(*Objet1)->m_Field[VALUE].m_Text; - Text2 = &(*Objet2)->m_Field[VALUE].m_Text; - ii = Text1->CmpNoCase(*Text2); - - if( ii == 0 ) - { - Text1 = &(*Objet1)->m_Field[REFERENCE].m_Text; - Text2 = &(*Objet2)->m_Field[REFERENCE].m_Text; - ii = Text1->CmpNoCase(*Text2); - } - - if ( ii == 0 ) - { - ii = (*Objet1)->m_Multi - (*Objet2)->m_Multi; - } - - return(ii); -} - -/**********************************************************/ -static int ListTriComposantByRef(EDA_SchComponentStruct **Objet1, - EDA_SchComponentStruct **Objet2) -/**********************************************************/ - /* Routine de comparaison pour le tri du Tableau par qsort() - Les composants sont tries - par reference - si meme referenece: par valeur - si meme valeur: par numero d'unite - -*/ -{ -int ii; -const wxString * Text1, *Text2; - - if( (*Objet1 == NULL) && (*Objet2 == NULL ) ) return(0); - if( *Objet1 == NULL) return(-1); - if( *Objet2 == NULL) return(1); - - Text1 = &(*Objet1)->m_Field[REFERENCE].m_Text; - Text2 = &(*Objet2)->m_Field[REFERENCE].m_Text; - ii = Text1->CmpNoCase(*Text2); - - if( ii == 0 ) - { - Text1 = &(*Objet1)->m_Field[VALUE].m_Text; - Text2 = &(*Objet2)->m_Field[VALUE].m_Text; - ii = Text1->CmpNoCase(*Text2); - } - - if ( ii == 0 ) - { - ii = (*Objet1)->m_Multi - (*Objet2)->m_Multi; - } - - return(ii); -} - -/******************************************************************/ -static int ListTriGLabelByVal(ListLabel *Objet1, ListLabel *Objet2) -/*******************************************************************/ -/* Routine de comparaison pour le tri du Tableau par qsort() - Les labels sont tries - par comparaison ascii - si meme valeur: par numero de sheet - -*/ -{ -int ii; -const wxString * Text1, *Text2; - - if( Objet1->Type() == DRAW_SHEETLABEL_STRUCT_TYPE ) - Text1 = &((DrawSheetLabelStruct *)Objet1->m_Label)->m_Text; - else - Text1 = &((DrawTextStruct *)Objet1->m_Label)->m_Text; - - if( Objet2->Type() == DRAW_SHEETLABEL_STRUCT_TYPE ) - Text2 = &((DrawSheetLabelStruct *)Objet2->m_Label)->m_Text; - else - Text2 = &((DrawTextStruct *)Objet2->m_Label)->m_Text; - ii = Text1->CmpNoCase(*Text2); - - if ( ii == 0 ) - { - ii = Objet1->m_SheetNumber - Objet2->m_SheetNumber; - } - - return(ii); -} - -/*******************************************************************/ -static int ListTriGLabelBySheet(ListLabel *Objet1, ListLabel *Objet2) -/*******************************************************************/ -/* Routine de comparaison pour le tri du Tableau par qsort() - Les labels sont tries - par sheet number - si meme valeur, par ordre alphabetique - -*/ -{ -int ii; -const wxString * Text1, *Text2; - - ii = Objet1->m_SheetNumber - Objet2->m_SheetNumber; - - if ( ii == 0 ) - { - if( Objet1->Type() == DRAW_SHEETLABEL_STRUCT_TYPE ) - Text1 = &((DrawSheetLabelStruct *)Objet1->m_Label)->m_Text; - else - Text1 = &((DrawTextStruct *)Objet1->m_Label)->m_Text; - - if( Objet2->Type() == DRAW_SHEETLABEL_STRUCT_TYPE ) - Text2 = &((DrawSheetLabelStruct *)Objet2->m_Label)->m_Text; - else - Text2 = &((DrawTextStruct *)Objet2->m_Label)->m_Text; - ii = Text1->CmpNoCase(*Text2); - } - - return(ii); -} - - - -/**************************************************************/ -static void DeleteSubCmp( EDA_BaseStruct ** List, int NbItems ) -/**************************************************************/ -/* Supprime les sous-composants, c'est a dire les descriptions redonnantes des -boitiers multiples - La liste des composant doit etre triee par reference et par num d'unite -*/ -{ -int ii; -EDA_SchComponentStruct * LibItem; -const wxString * OldName = NULL; - - for( ii = 0; ii < NbItems ; ii++ ) - { - LibItem = (EDA_SchComponentStruct *) List[ii]; - if ( LibItem == NULL ) continue; - if( OldName ) - { - if ( OldName->CmpNoCase( LibItem->m_Field[REFERENCE].m_Text ) == 0 ) - { - List[ii] = NULL; - } - } - OldName = &LibItem->m_Field[REFERENCE].m_Text; - } -} - - -/**********************************************************************/ -int PrintListeCmpByRef( FILE * f, EDA_BaseStruct ** List, int NbItems ) -/**********************************************************************/ -/* Impression de la liste des composants tries par reference -*/ -{ -int ii, Multi, Unit; -EDA_BaseStruct *DrawList; -EDA_SchComponentStruct *DrawLibItem; -EDA_LibComponentStruct *Entry; -char NameCmp[80]; -wxString msg; - - msg = _("\n#Cmp ( order = Reference )"); - if ( (ItemsToList & LIST_SUBCMP) ) msg << _(" (with SubCmp)"); - fprintf( f, "%s\n", CONV_TO_UTF8(msg)); - - for ( ii = 0; ii < NbItems; ii++ ) - { - DrawList = List[ii]; - - if( DrawList == NULL ) continue; - if( DrawList->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) continue; - - DrawLibItem = (EDA_SchComponentStruct *) DrawList; - if( DrawLibItem->m_Field[REFERENCE].m_Text[0] == '#' ) continue; - - Multi = 0; Unit = ' '; - Entry = FindLibPart(DrawLibItem->m_ChipName.GetData(), wxEmptyString, FIND_ROOT); - if( Entry ) Multi = Entry->m_UnitCount; - if( (Multi > 1 ) && ( ItemsToList & LIST_SUBCMP ) ) - Unit = DrawLibItem->m_Multi + 'A' - 1; - - sprintf( NameCmp,"%s%c", CONV_TO_UTF8(DrawLibItem->m_Field[REFERENCE].m_Text), - Unit); - fprintf(f, "| %-10.10s %-12.12s", - NameCmp, - CONV_TO_UTF8(DrawLibItem->m_Field[VALUE].m_Text)); - - if ( (ItemsToList & LIST_SUBCMP) ) - { - BASE_SCREEN * screen = (BASE_SCREEN *)(DrawLibItem->m_Parent); - wxString sheetname; - if( screen->m_Parent ) - sheetname = ((DrawSheetStruct*)screen->m_Parent)->m_Field[VALUE].m_Text.GetData(); - else sheetname = _("Root"); - fprintf(f, " (Sheet %.2d: \"%s\")", DrawLibItem->m_FlagControlMulti, - CONV_TO_UTF8(sheetname)); - } - - fprintf(f,"\n"); - } - msg = _("#End Cmp\n"); - fprintf(f, CONV_TO_UTF8(msg)); - return(0); -} - -/***********************************************************************/ -int PrintListeCmpByVal( FILE * f, EDA_BaseStruct ** List, int NbItems ) -/**********************************************************************/ -{ -int ii, Multi; -wxChar Unit; -EDA_BaseStruct *DrawList; -EDA_SchComponentStruct *DrawLibItem; -EDA_LibComponentStruct *Entry; -wxString msg; - - msg = _("\n#Cmp ( order = Value )"); - if ( (ItemsToList & LIST_SUBCMP) ) msg << _(" (with SubCmp)"); - msg << wxT("\n"); - fprintf(f, CONV_TO_UTF8(msg)); - - for ( ii = 0; ii < NbItems; ii++ ) - { - DrawList = List[ii]; - - if( DrawList == NULL ) continue; - if( DrawList->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) continue; - - DrawLibItem = (EDA_SchComponentStruct *) DrawList; - if( DrawLibItem->m_Field[REFERENCE].m_Text[0] == '#' ) continue; - - Multi = 0; Unit = ' '; - Entry = FindLibPart(DrawLibItem->m_ChipName.GetData(), wxEmptyString, FIND_ROOT); - if( Entry ) Multi = Entry->m_UnitCount; - if( (Multi > 1 ) && ( ItemsToList & LIST_SUBCMP ) ) - Unit = DrawLibItem->m_Multi + 'A' - 1; - msg = DrawLibItem->m_Field[REFERENCE].m_Text; - msg.Append(Unit); - - fprintf(f, "| %-12.12s %-10.10s", - CONV_TO_UTF8(DrawLibItem->m_Field[VALUE].m_Text), - CONV_TO_UTF8(msg) ); - if ( (ItemsToList & LIST_SUBCMP) ) - { - fprintf(f, " (Sheet %.2d)", DrawLibItem->m_FlagControlMulti); - } - - fprintf(f,"\n"); - } - msg = _("#End Cmp\n"); - fprintf(f, CONV_TO_UTF8(msg)); - return(0); -} - - -/******************************************************************/ -static int PrintListeGLabel( FILE *f, ListLabel *List, int NbItems) -/******************************************************************/ -{ -int ii, jj; -DrawGlobalLabelStruct *DrawTextItem; -DrawSheetLabelStruct * DrawSheetLabel; -ListLabel * LabelItem; -wxString msg; - - for ( ii = 0; ii < NbItems; ii++ ) - { - LabelItem = & List[ii]; - - switch( LabelItem->Type() ) - { - case DRAW_GLOBAL_LABEL_STRUCT_TYPE : - DrawTextItem = (DrawGlobalLabelStruct *)(LabelItem->m_Label); - msg.Printf( - _("> %-28.28s Global (Sheet %.2d) pos: %3.3f, %3.3f\n"), - DrawTextItem->m_Text.GetData(), - LabelItem->m_SheetNumber, - (float)DrawTextItem->m_Pos.x / 1000, - (float)DrawTextItem->m_Pos.y / 1000); - - fprintf(f, CONV_TO_UTF8(msg)); - break; - - case DRAW_SHEETLABEL_STRUCT_TYPE : - { - DrawSheetLabel = (DrawSheetLabelStruct *) LabelItem->m_Label; - jj = DrawSheetLabel->m_Shape; - if ( jj < 0 ) jj = NET_TMAX; if ( jj > NET_TMAX ) jj = 4; - wxString labtype = CONV_FROM_UTF8(SheetLabelType[jj]); - msg.Printf( - _("> %-28.28s Sheet %-7.7s (Sheet %.2d) pos: %3.3f, %3.3f\n"), - DrawSheetLabel->m_Text.GetData(), - labtype.GetData(), - LabelItem->m_SheetNumber, - (float)DrawSheetLabel->m_Pos.x / 1000, - (float)DrawSheetLabel->m_Pos.y / 1000); - fprintf(f, CONV_TO_UTF8(msg)); - } - break; - - default: break; - } - } - msg = _("#End labels\n"); - fprintf(f, CONV_TO_UTF8(msg)); - return(0); -} - diff --git a/eeschema/libedpart.cpp.notused b/eeschema/libedpart.cpp.notused deleted file mode 100644 index 2f045f9638..0000000000 --- a/eeschema/libedpart.cpp.notused +++ /dev/null @@ -1,1237 +0,0 @@ -/**************************************************************/ -/* librairy editor: edition of component general properties */ -/**************************************************************/ - -#include "fctsys.h" -#include "gr_basic.h" - -#include "common.h" -#include "program.h" -#include "libcmp.h" -#include "general.h" - -#include "protos.h" - -#include "wx/spinctrl.h" - - -/* Routines locales */ - -/* Variables locales */ - -extern int CurrentUnit; - -/* Classe de la frame des propriétés d'un composant en librairie */ - -enum id_libedit { - ID_LIBEDIT_NOTEBOOK = 3200, - ID_PANEL_BASIC, - ID_PANEL_ALIAS, - ID_PANEL_REFERENCE, - ID_PANEL_VALUE, - ID_PANEL_FOOTPRINT, - ID_PANEL_SUBSCHEMATIC, - ID_PANEL_FIELD1, - ID_PANEL_FIELD2, - ID_PANEL_FIELD3, - ID_PANEL_FIELD4, - ID_PANEL_FIELD5, - ID_PANEL_FIELD6, - ID_PANEL_FIELD7, - ID_PANEL_FIELD8, - ID_CLOSE_PART_PROPERTIES, - ID_ACCEPT_PART_PROPERTIES, - ID_COPY_DOC_TO_ALIAS, - ID_BROWSE_DOC_FILES, - ID_ADD_ALIAS, - ID_DELETE_ONE_ALIAS, - ID_DELETE_ALL_ALIAS -}; - - -/************************************************/ -class WinEDA_PartPropertiesFrame : public wxDialog -/************************************************/ - -/* Cette classe genere une fenetre type NoteBook, pour l'edition des propriétés - * d'un composant le librairie. - * On peut éditer: - * Texte dimensions et justification de tous les champs (Ref, Val, et autres champs) - * Documentation et mots clefs - * Nombre de part par boitier - * et autres propriérés générales - */ -{ -private: - - WinEDA_LibeditFrame* m_Parent; - wxNotebook* m_NoteBook; - wxListBox* m_PartAliasList; - wxPanel* m_PanelBasic; - wxPanel* m_PanelAlias; - wxPanel* m_PanelDoc; - wxPanel* PanelField[NUMBER_OF_FIELDS]; - - wxCheckBox* AsConvertButt; - - wxCheckBox* ShowFieldText[NUMBER_OF_FIELDS]; - wxCheckBox* VorientFieldText[NUMBER_OF_FIELDS]; - wxCheckBox* ShowPinNumButt; - wxCheckBox* ShowPinNameButt; - wxCheckBox* m_PinsNameInsideButt; - wxSpinCtrl* SelNumberOfUnits; - wxSpinCtrl* m_SetSkew; - wxCheckBox* m_OptionPower; - wxCheckBox* m_OptionPartsLocked; - - WinEDA_GraphicTextCtrl* FieldTextCtrl[NUMBER_OF_FIELDS]; - WinEDA_PositionCtrl* FieldPosition[NUMBER_OF_FIELDS]; - int FieldFlags[NUMBER_OF_FIELDS]; - int FieldOrient[NUMBER_OF_FIELDS]; - wxRadioBox* FieldHJustify[NUMBER_OF_FIELDS]; - wxRadioBox* FieldVJustify[NUMBER_OF_FIELDS]; - WinEDA_EnterText* m_Doc; - WinEDA_EnterText* m_Docfile; - WinEDA_EnterText* m_Keywords; - bool m_RecreateToolbar; - int m_AliasLocation; - - -public: - - // Constructor and destructor - WinEDA_PartPropertiesFrame( WinEDA_LibeditFrame * parent, wxPoint & pos ); - ~WinEDA_PartPropertiesFrame() - { - }; - -private: - void BuildPanelBasic(); - void BuildPanelDoc(); - void BuildPanelAlias(); - void BuildPanelEditField( int fieldId ); - void PartPropertiesAccept( wxCommandEvent& event ); - void OnQuit( wxCommandEvent& event ); - void DeleteAllAliasOfPart( wxCommandEvent& event ); - void DeleteAliasOfPart( wxCommandEvent& event ); - void AddAliasOfPart( wxCommandEvent& event ); - bool ChangeNbUnitsPerPackage( int newUnit ); - bool SetUnsetConvert(); - void CopyDocToAlias( wxCommandEvent& event ); - void BrowseAndSelectDocFile( wxCommandEvent& event ); - - DECLARE_EVENT_TABLE() -}; - -BEGIN_EVENT_TABLE( WinEDA_PartPropertiesFrame, wxDialog ) -EVT_BUTTON( ID_ACCEPT_PART_PROPERTIES, WinEDA_PartPropertiesFrame::PartPropertiesAccept ) -EVT_BUTTON( ID_CLOSE_PART_PROPERTIES, WinEDA_PartPropertiesFrame::OnQuit ) -EVT_BUTTON( ID_ADD_ALIAS, WinEDA_PartPropertiesFrame::AddAliasOfPart ) -EVT_BUTTON( ID_DELETE_ONE_ALIAS, WinEDA_PartPropertiesFrame::DeleteAliasOfPart ) -EVT_BUTTON( ID_DELETE_ALL_ALIAS, WinEDA_PartPropertiesFrame::DeleteAllAliasOfPart ) -EVT_BUTTON( ID_COPY_DOC_TO_ALIAS, WinEDA_PartPropertiesFrame::CopyDocToAlias ) -EVT_BUTTON( ID_BROWSE_DOC_FILES, WinEDA_PartPropertiesFrame::BrowseAndSelectDocFile ) -END_EVENT_TABLE() - -/*****************************************************************/ -void WinEDA_LibeditFrame::InstallLibeditFrame( const wxPoint& pos ) -/*****************************************************************/ -{ - wxPoint fpos = pos; - - WinEDA_PartPropertiesFrame* frame = - new WinEDA_PartPropertiesFrame( this, fpos ); - - frame->ShowModal(); frame->Destroy(); -} - - -#define XSIZE 370 -#define YSIZE 385 -/**********************************************************************************/ -WinEDA_PartPropertiesFrame::WinEDA_PartPropertiesFrame( WinEDA_LibeditFrame* parent, - wxPoint& framepos ) : - wxDialog( parent, -1, wxEmptyString, framepos, wxSize( XSIZE, YSIZE ), - DIALOG_STYLE ) -/**********************************************************************************/ -{ - wxPoint pos; - wxLayoutConstraints* c; - wxString msg_text; - wxButton* Button; - int ii; - - m_Parent = parent; - m_RecreateToolbar = FALSE; - SetFont( *g_DialogFont ); - - SetAutoLayout( TRUE ); - - for( ii = 0; ii < NUMBER_OF_FIELDS; ii++ ) - FieldFlags[ii] = 0; - - m_AliasLocation = -1; - if( CurrentLibEntry ) - { - msg_text = _( "Properties for " ); - if( !CurrentAliasName.IsEmpty() ) - { - m_AliasLocation = LocateAlias( CurrentLibEntry->m_AliasList, CurrentAliasName ); - SetTitle( msg_text + CurrentAliasName + - _( "(alias of " ) + - wxString( CurrentLibEntry->m_Name.m_Text ) - + wxT( ")" ) ); - } - else - { - SetTitle( msg_text + CurrentLibEntry->m_Name.m_Text ); - CurrentAliasName.Empty(); - } - - FieldFlags[REFERENCE] = CurrentLibEntry->m_Prefix.m_Attributs; - FieldOrient[REFERENCE] = CurrentLibEntry->m_Prefix.m_Orient; - - FieldFlags[VALUE] = CurrentLibEntry->m_Name.m_Attributs; - FieldOrient[VALUE] = CurrentLibEntry->m_Name.m_Orient; - - LibDrawField* Field = CurrentLibEntry->Fields; - while( Field ) - { - FieldFlags[Field->m_FieldId] = Field->m_Attributs; - FieldOrient[Field->m_FieldId] = Field->m_Orient; - Field = (LibDrawField*) Field->Pnext; - } - } - else - SetTitle( _( "Lib Component Properties" ) ); - - m_NoteBook = new wxNotebook( this, ID_LIBEDIT_NOTEBOOK, - wxDefaultPosition, wxSize (XSIZE - 6, YSIZE - 70) ); - - SetFont( *g_DialogFont ); - m_NoteBook->SetAutoLayout( TRUE ); - c = new wxLayoutConstraints; - c->left.SameAs( this, wxLeft, 4 ); - c->right.SameAs( this, wxRight, 4 ); - c->top.SameAs( this, wxTop, 4 ); - c->bottom.SameAs( this, wxBottom, 40 ); - m_NoteBook->SetConstraints( c ); - - /* Creation des boutons de commande */ - pos.x = 50; pos.y = YSIZE - 60; - Button = new wxButton( this, ID_CLOSE_PART_PROPERTIES, - _( "Cancel" ), pos ); - - Button->SetForegroundColour( *wxBLUE ); - c = new wxLayoutConstraints; - c->left.SameAs( this, wxLeft, 20 ); - c->height.AsIs(); - c->width.AsIs(); - c->bottom.SameAs( this, wxBottom, 5 ); - Button->SetConstraints( c ); - - pos.x += Button->GetDefaultSize().x + 70; - Button = new wxButton( this, ID_ACCEPT_PART_PROPERTIES, - _( "OK" ), pos ); - - Button->SetForegroundColour( *wxRED ); - c = new wxLayoutConstraints; - c->right.SameAs( this, wxRight, 20 ); - c->height.AsIs(); - c->width.AsIs(); - c->bottom.SameAs( this, wxBottom, 5 ); - Button->SetConstraints( c ); - - // Add panel Basic - BuildPanelBasic(); - m_NoteBook->AddPage( m_PanelBasic, _( "Options" ), TRUE ); - - - // Add Panel Documentation - BuildPanelDoc(); - m_NoteBook->AddPage( m_PanelDoc, _( "Doc" ), FALSE ); - - // Add Panel Alias List - BuildPanelAlias(); - m_NoteBook->AddPage( m_PanelAlias, _( "Alias" ), FALSE ); - - // Add panel Fields - for( ii = 0; ii < NUMBER_OF_FIELDS; ii++ ) - BuildPanelEditField( ii ); -} - - -/*****************************************************/ -void WinEDA_PartPropertiesFrame::BuildPanelAlias() -/*****************************************************/ - -/* create the panel for component alias list editing - */ -{ - wxPoint pos; - wxButton* Button; - - m_PanelAlias = new wxPanel( m_NoteBook, -1 ); - - m_PanelAlias->SetFont( *g_DialogFont ); - wxLayoutConstraints* c = new wxLayoutConstraints; - c->left.SameAs( m_NoteBook, wxLeft ); - c->right.SameAs( m_NoteBook, wxRight ); - c->bottom.SameAs( m_NoteBook, wxBottom ); - m_PanelAlias->SetConstraints( c ); - - pos.x = 200; pos.y = 70; - Button = new wxButton( m_PanelAlias, ID_ADD_ALIAS, _( "Add" ), pos ); - - Button->SetForegroundColour( *wxBLUE ); - - pos.y += Button->GetSize().y + 10; - Button = new wxButton( m_PanelAlias, ID_DELETE_ONE_ALIAS, - _( "Delete" ), pos ); - - Button->SetForegroundColour( *wxRED ); - - pos.y += Button->GetSize().y + 10; - Button = new wxButton( m_PanelAlias, ID_DELETE_ALL_ALIAS, - _( "Delete All" ), pos ); - - Button->SetForegroundColour( *wxRED ); - if( !CurrentAliasName.IsEmpty() ) - Button->Enable( FALSE ); - - pos.x = 5; pos.y = 30; - m_PartAliasList = new wxListBox( m_PanelAlias, - -1, - pos, wxSize( 160, 170 ), - 0, NULL, - wxLB_ALWAYS_SB | wxLB_SINGLE ); - - wxStaticText* Msg = new wxStaticText( m_PanelAlias, -1, _( "Alias" ), - wxPoint (pos.x, pos.y - 20) ); - - Msg->SetForegroundColour( wxColour( 200, 0, 0 ) ); - - /* lecture des noms des alias */ - if( CurrentLibEntry ) - { - for( unsigned ii = 0; ii < CurrentLibEntry->m_AliasList.GetCount(); ii += ALIAS_NEXT ) - m_PartAliasList->Append( CurrentLibEntry->m_AliasList[ii + ALIAS_NAME] ); - } -} - - -/*****************************************************/ -void WinEDA_PartPropertiesFrame::BuildPanelDoc() -/*****************************************************/ - -/* create the panel for component doc editing - */ -{ - wxPoint pos; - wxButton* Button; - wxString msg_text; - - m_PanelDoc = new wxPanel( m_NoteBook, -1 ); - - m_PanelDoc->SetFont( *g_DialogFont ); - wxLayoutConstraints* c = new wxLayoutConstraints; - c->left.SameAs( m_NoteBook, wxLeft ); - c->right.SameAs( m_NoteBook, wxRight ); - c->bottom.SameAs( m_NoteBook, wxBottom ); - m_PanelDoc->SetConstraints( c ); - - pos.x = 5; pos.y = 15; - - if( CurrentLibEntry ) - { - msg_text = _( "Properties for " ); - if( !CurrentAliasName.IsEmpty() ) - { - msg_text += _( "alias " ); - msg_text += CurrentAliasName; - } - else - { - msg_text += CurrentLibEntry->m_Name.m_Text; - } - wxStaticText* text = new wxStaticText( m_PanelDoc, -1, msg_text, pos ); - - text->SetForegroundColour( *wxBLUE ); - } - - pos.y += 30; - if( m_AliasLocation >= 0 ) - msg_text = CurrentLibEntry->m_AliasList[m_AliasLocation + ALIAS_DOC]; - else - { - if( CurrentLibEntry && CurrentLibEntry->m_Doc ) - msg_text = CurrentLibEntry->m_Doc; - } - m_Doc = new WinEDA_EnterText( m_PanelDoc, - _( "Doc:" ), msg_text, - pos, wxSize( 285, -1 ) ); - - pos.y += 40; - msg_text.Empty(); - if( m_AliasLocation >= 0 ) - msg_text = CurrentLibEntry->m_AliasList[m_AliasLocation + ALIAS_KEYWORD]; - else - { - if( CurrentLibEntry ) - msg_text = CurrentLibEntry->m_KeyWord; - } - m_Keywords = new WinEDA_EnterText( m_PanelDoc, - _( "Keywords:" ), msg_text, - pos, wxSize( 285, -1 ) ); - - pos.y += 40; - msg_text.Empty(); - if( m_AliasLocation >= 0 ) - msg_text = CurrentLibEntry->m_AliasList[m_AliasLocation + ALIAS_DOC_FILENAME]; - else - { - if( CurrentLibEntry ) - msg_text = CurrentLibEntry->m_DocFile; - } - m_Docfile = new WinEDA_EnterText( m_PanelDoc, - _( "DocFileName:" ), msg_text, - pos, wxSize( 285, -1 ) ); - - pos.y += 40; - Button = new wxButton( m_PanelDoc, ID_COPY_DOC_TO_ALIAS, - _( "Copy Doc" ), pos ); - - Button->SetForegroundColour( *wxRED ); - if( m_AliasLocation < 0 ) - Button->Enable( FALSE ); - - Button = new wxButton( m_PanelDoc, ID_BROWSE_DOC_FILES, - _( "Browse DocFiles" ), wxPoint (pos.x + 140, pos.y) ); - - Button->SetForegroundColour( *wxBLUE ); -} - - -/*****************************************************/ -void WinEDA_PartPropertiesFrame::BuildPanelBasic() -/*****************************************************/ - -/* create the basic panel for component properties editing - */ -{ - wxPoint pos; - - m_PanelBasic = new wxPanel( m_NoteBook, ID_PANEL_BASIC ); - - m_PanelBasic->SetFont( *g_DialogFont ); - wxLayoutConstraints* c = new wxLayoutConstraints; - c->left.SameAs( m_NoteBook, wxLeft ); - c->right.SameAs( m_NoteBook, wxRight ); - c->bottom.SameAs( m_NoteBook, wxBottom ); - m_PanelBasic->SetConstraints( c ); - - pos.x = 5; pos.y = 25; - new wxStaticBox( m_PanelBasic, -1, _( "General :" ), pos, wxSize( 250, 120 ) ); - - pos.x = 10; pos.y += 22; - AsConvertButt = new wxCheckBox( m_PanelBasic, -1, _( "As Convert" ), pos ); - - if( g_AsDeMorgan ) - AsConvertButt->SetValue( TRUE ); - - pos.y += 20; - ShowPinNumButt = new wxCheckBox( m_PanelBasic, -1, _( "Show Pin Num" ), pos ); - - if( CurrentLibEntry ) - { - if( CurrentLibEntry->m_DrawPinNum ) - ShowPinNumButt->SetValue( TRUE ); - } - else - ShowPinNumButt->SetValue( TRUE ); - - pos.y += 20; - ShowPinNameButt = new wxCheckBox( m_PanelBasic, -1, _( "Show Pin Name" ), pos ); - - if( CurrentLibEntry ) - { - if( CurrentLibEntry->m_DrawPinName ) - ShowPinNameButt->SetValue( TRUE ); - } - else - ShowPinNameButt->SetValue( TRUE ); - - pos.y += 20; - m_PinsNameInsideButt = new wxCheckBox( m_PanelBasic, -1, _( "Pin Name Inside" ), pos ); - - if( CurrentLibEntry ) - { - if( CurrentLibEntry->m_TextInside ) - m_PinsNameInsideButt->SetValue( TRUE ); - } - else - m_PinsNameInsideButt->SetValue( TRUE ); - - pos.y += 40; - new wxStaticText( m_PanelBasic, -1, _( "Number of Units:" ), pos ); - - pos.y += 15; - wxString number; - if( CurrentLibEntry ) - number.Printf( wxT( "%d" ), CurrentLibEntry->m_UnitCount ); - else - number = wxT( "1" ); - SelNumberOfUnits = new wxSpinCtrl( m_PanelBasic, -1, number, pos, - wxDefaultSize, wxSP_ARROW_KEYS | wxSP_WRAP, - 1, 16 ); - - pos.y -= 15; pos.x += 180; - new wxStaticText( m_PanelBasic, -1, _( "Skew:" ), pos ); - - pos.y += 15; - if( CurrentLibEntry && CurrentLibEntry->m_TextInside ) - number.Printf( wxT( "%d" ), CurrentLibEntry->m_TextInside ); - else - number = wxT( "40" ); - m_SetSkew = new wxSpinCtrl( m_PanelBasic, -1, number, pos, - wxDefaultSize, wxSP_ARROW_KEYS | wxSP_WRAP, - 1, 100 ); - - pos.x = 5; pos.y += 40; - m_OptionPower = new wxCheckBox( m_PanelBasic, -1, _( "Power Symbol" ), pos ); - - if( CurrentLibEntry ) - { - if( CurrentLibEntry->m_Options == ENTRY_POWER ) - m_OptionPower->SetValue( TRUE ); - } - - pos.y = m_OptionPower->GetRect().GetBottom() + 10; - m_OptionPartsLocked = new wxCheckBox( m_PanelBasic, -1, _( "Parts are locked" ), pos ); - - if( CurrentLibEntry ) - { - if( CurrentLibEntry->m_UnitSelectionLocked ) - m_OptionPartsLocked->SetValue( TRUE ); - } - if( number == wxT( "1" ) ) - m_OptionPartsLocked->Enable( FALSE ); -} - - -/****************************************************************/ -void WinEDA_PartPropertiesFrame::BuildPanelEditField( int fieldId ) -/****************************************************************/ -{ - wxPoint pos; - int xx, yy; - LibDrawField* Field; - wxString Hjustify_list[] = - { _( "Left justify" ), _( "Center" ), _( "Right justify" ) }; - wxString Vjustify_list[] = - { _( "Bottom justify" ), _( "Center" ), _( "Top justify" ) }; - int ii = fieldId; - - PanelField[ii] = new wxPanel( m_NoteBook, ID_PANEL_REFERENCE + ii ); - - PanelField[ii]->SetFont( *g_DialogFont ); - wxLayoutConstraints* c = new wxLayoutConstraints; - c->left.SameAs( m_NoteBook, wxLeft ); - c->right.SameAs( m_NoteBook, wxRight ); - c->bottom.SameAs( m_NoteBook, wxBottom ); - PanelField[ii]->SetConstraints( c ); - m_NoteBook->AddPage( PanelField[ii], DrawPartStruct::ReturnFieldName( ii ), FALSE ); - - pos.x = 10; pos.y = 10; - ShowFieldText[ii] = new wxCheckBox( PanelField[ii], -1, - _( "Show Text" ), pos ); - - if( (FieldFlags[ii] & TEXT_NO_VISIBLE ) == 0 ) - ShowFieldText[ii]->SetValue( TRUE ); - - ShowFieldText[ii]->GetSize( &xx, &yy ); - pos.y += yy + 5; - VorientFieldText[ii] = new wxCheckBox( PanelField[ii], -1, - _( "Vertical" ), pos ); - - if( FieldOrient[ii] ) - VorientFieldText[ii]->SetValue( TRUE ); - - pos.x = 150; pos.y = 5; - FieldHJustify[ii] = new wxRadioBox( PanelField[ii], -1, - _( "Hor Justify" ), pos, wxDefaultSize, - 3, Hjustify_list, 1, wxRA_SPECIFY_COLS ); - - FieldHJustify[ii]->GetSize( &xx, &yy ); - FieldHJustify[ii]->SetSelection( 1 ); - - pos.y += yy + 5; - FieldVJustify[ii] = new wxRadioBox( PanelField[ii], -1, - _( "Vert Justify" ), pos, wxDefaultSize, - 3, Vjustify_list, 1, wxRA_SPECIFY_COLS ); - - FieldVJustify[ii]->SetSelection( 1 ); - - wxPoint txtpos; - pos.x = 10; pos.y = 70; -#define POSY_OFFSET 70 - - switch( ii ) - { - case REFERENCE: - if( CurrentLibEntry ) - { - Field = &CurrentLibEntry->m_Prefix; - txtpos = Field->m_Pos; - if( Field->m_HJustify == GR_TEXT_HJUSTIFY_LEFT ) - FieldHJustify[ii]->SetSelection( 0 ); - else if( Field->m_HJustify == GR_TEXT_HJUSTIFY_RIGHT ) - FieldHJustify[ii]->SetSelection( 2 ); - if( Field->m_VJustify == GR_TEXT_VJUSTIFY_BOTTOM ) - FieldVJustify[ii]->SetSelection( 0 ); - else if( Field->m_VJustify == GR_TEXT_VJUSTIFY_TOP ) - FieldVJustify[ii]->SetSelection( 2 ); - } - else - txtpos = wxPoint( 0, 0 ); - FieldPosition[ii] = new WinEDA_PositionCtrl( PanelField[ii], - _( "Pos" ), txtpos, - g_UnitMetric, pos ); - - FieldTextCtrl[ii] = new WinEDA_GraphicTextCtrl( - PanelField[ii], - DrawPartStruct::ReturnFieldName (ii), - CurrentLibEntry ? - CurrentLibEntry->m_Prefix.m_Text.GetData () - : wxT( - "U" ), - CurrentLibEntry ? CurrentLibEntry-> - m_Prefix.m_Size.x : DEFAULT_TEXT_SIZE, - g_UnitMetric, - wxPoint (pos.x, pos.y + - FieldPosition[ii]->GetDimension ().y + POSY_OFFSET), - 200, - TRUE ); - - break; - - case VALUE: - if( CurrentLibEntry ) - { - Field = &CurrentLibEntry->m_Name; - txtpos = Field->m_Pos; - if( Field->m_HJustify == GR_TEXT_HJUSTIFY_LEFT ) - FieldHJustify[ii]->SetSelection( 0 ); - else if( Field->m_HJustify == GR_TEXT_HJUSTIFY_RIGHT ) - FieldHJustify[ii]->SetSelection( 2 ); - if( Field->m_VJustify == GR_TEXT_VJUSTIFY_BOTTOM ) - FieldVJustify[ii]->SetSelection( 0 ); - else if( Field->m_VJustify == GR_TEXT_VJUSTIFY_TOP ) - FieldVJustify[ii]->SetSelection( 2 ); - } - else - txtpos = wxPoint( 0, 0 ); - FieldPosition[ii] = new WinEDA_PositionCtrl( PanelField[ii], - _( "Pos" ), txtpos, - g_UnitMetric, pos ); - - FieldTextCtrl[ii] = new WinEDA_GraphicTextCtrl( - PanelField[ii], - DrawPartStruct::ReturnFieldName (ii), - CurrentLibEntry ? CurrentLibEntry->m_Name. - m_Text.GetData () : NULL, - CurrentLibEntry ? CurrentLibEntry->m_Name. - m_Size.x : DEFAULT_TEXT_SIZE, - g_UnitMetric, - wxPoint (pos.x, pos.y + - FieldPosition[ii]->GetDimension ().y + POSY_OFFSET), - 200, - TRUE ); - - break; - - default: - int fsize; - wxString ftext; - wxPoint fpos; - fsize = DEFAULT_TEXT_SIZE;; - Field = NULL; - fpos = wxPoint( 0, 0 ); - - //recherche du Field de FieldId correspondant, s'il existe - if( CurrentLibEntry ) - { - Field = CurrentLibEntry->Fields; - while( Field ) - { - if( Field->m_FieldId == ii ) - { - fsize = Field->m_Size.x; - ftext = Field->m_Text; - fpos = Field->m_Pos; - if( Field->m_HJustify == GR_TEXT_HJUSTIFY_LEFT ) - FieldHJustify[ii]->SetSelection( 0 ); - else if( Field->m_HJustify == GR_TEXT_HJUSTIFY_RIGHT ) - FieldHJustify[ii]->SetSelection( 2 ); - if( Field->m_VJustify == GR_TEXT_VJUSTIFY_BOTTOM ) - FieldVJustify[ii]->SetSelection( 0 ); - else if( Field->m_VJustify == GR_TEXT_VJUSTIFY_TOP ) - FieldVJustify[ii]->SetSelection( 2 ); - break; - } - Field = (LibDrawField*) Field->Pnext; - } - } - - FieldPosition[ii] = new WinEDA_PositionCtrl( PanelField[ii], - _( "Pos" ), fpos, - g_UnitMetric, pos ); - - FieldTextCtrl[ii] = new WinEDA_GraphicTextCtrl( - PanelField[ii], - DrawPartStruct::ReturnFieldName (ii), - ftext, - fsize, - g_UnitMetric, - wxPoint (pos.x, pos.y + - FieldPosition[ii]->GetDimension ().y + POSY_OFFSET), - 200, - TRUE ); - - break; - } -} - - -/************************************************************************/ -void WinEDA_PartPropertiesFrame::OnQuit( wxCommandEvent& WXUNUSED (event) ) -/************************************************************************/ -{ - // true is to force the frame to close - Close( true ); -} - - -/**************************************************************************/ -void WinEDA_PartPropertiesFrame::PartPropertiesAccept( wxCommandEvent& event ) -/**************************************************************************/ - -/* Met a jour les differents parametres pour le composant en cours d'édition - */ -{ - int ii, jj; - int hjustify[3] = { - GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_HJUSTIFY_CENTER, - GR_TEXT_HJUSTIFY_RIGHT - }; - int vjustify[3] = { - GR_TEXT_VJUSTIFY_BOTTOM, GR_TEXT_VJUSTIFY_CENTER, - GR_TEXT_VJUSTIFY_TOP - }; - - if( CurrentLibEntry == NULL ) - { - Close(); return; - } - - m_Parent->m_CurrentScreen->SetModify(); - m_Parent->m_CurrentScreen->SetRefreshReq(); - m_Parent->SaveCopyInUndoList(); - - /* A new name could be entered in VALUE field. - * Must not be an existing alias name in alias list box */ - jj = m_PartAliasList->GetCount(); - wxString newvalue = FieldTextCtrl[VALUE]->GetText(); - for( ii = 0; ii < jj; ii++ ) - { - if( newvalue.CmpNoCase( m_PartAliasList->GetString( ii ).GetData() ) == 0 ) - { - wxString msg; - msg.Printf( wxT( "Alias %s exists!" ), newvalue.GetData() ); - DisplayError( this, msg ); - return; - } - } - - /* Update the doc, keyword and doc filename strings */ - if( m_AliasLocation < 0 ) - { - CurrentLibEntry->m_Doc = m_Doc->GetValue(); - CurrentLibEntry->m_KeyWord = m_Keywords->GetValue(); - CurrentLibEntry->m_DocFile = m_Docfile->GetValue(); - } - else - { - CurrentLibEntry->m_AliasList[m_AliasLocation + ALIAS_DOC] = m_Doc->GetValue(); - CurrentLibEntry->m_AliasList[m_AliasLocation + ALIAS_KEYWORD] = m_Keywords->GetValue(); - CurrentLibEntry->m_AliasList[m_AliasLocation + ALIAS_DOC_FILENAME] = m_Docfile->GetValue(); - } - - /* Update the alias list */ - /* 1 - Add names: test for a not existing name in old alias list: */ - jj = m_PartAliasList->GetCount(); - for( ii = 0; ii < jj; ii++ ) - { - if( LocateAlias( CurrentLibEntry->m_AliasList, m_PartAliasList->GetString( ii ) ) < 0 ) - { // new alias must be created - CurrentLibEntry->m_AliasList.Add( m_PartAliasList->GetString( ii ) ); - CurrentLibEntry->m_AliasList.Add( wxEmptyString ); // Add a void doc string - CurrentLibEntry->m_AliasList.Add( wxEmptyString ); // Add a void keyword list string - CurrentLibEntry->m_AliasList.Add( wxEmptyString ); // Add a void doc filename string - } - } - - /* 2 - Remove delete names: test for an non existing name in new alias list: */ - int kk, kkmax = CurrentLibEntry->m_AliasList.GetCount(); - for( kk = 0; kk < kkmax; ) - { - jj = m_PartAliasList->GetCount(); - wxString aliasname = CurrentLibEntry->m_AliasList[kk]; - for( ii = 0; ii < jj; ii++ ) - { - if( aliasname.CmpNoCase( m_PartAliasList->GetString( ii ).GetData() ) == 0 ) - { - kk += ALIAS_NEXT; // Alias exist in new list. keep it and test next old name - break; - } - } - - if( ii == jj ) // Alias not found in new list, remove it (4 strings in kk position) - { - for( ii = 0; ii < ALIAS_NEXT; ii++ ) - CurrentLibEntry->m_AliasList.RemoveAt( kk ); - - kkmax = CurrentLibEntry->m_AliasList.GetCount(); - } - } - - if( !FieldTextCtrl[REFERENCE]->GetText().IsEmpty() ) - { - CurrentLibEntry->m_Prefix.m_Text = FieldTextCtrl[REFERENCE]->GetText(); - } - - if( !FieldTextCtrl[VALUE]->GetText().IsEmpty() ) - { - if( CurrentLibEntry->m_Name.m_Text != FieldTextCtrl[VALUE]->GetText() ) - { - m_RecreateToolbar = TRUE; - CurrentLibEntry->m_Name.m_Text = FieldTextCtrl[VALUE]->GetText(); - } - } - - CurrentLibEntry->m_Prefix.m_Size.x = - CurrentLibEntry->m_Prefix.m_Size.y = FieldTextCtrl[REFERENCE]->GetTextSize(); - CurrentLibEntry->m_Name.m_Size.x = - CurrentLibEntry->m_Name.m_Size.y = FieldTextCtrl[VALUE]->GetTextSize(); - - CurrentLibEntry->m_Prefix.m_Pos = FieldPosition[REFERENCE]->GetValue(); - CurrentLibEntry->m_Name.m_Pos = FieldPosition[VALUE]->GetValue(); - - CurrentLibEntry->m_Prefix.m_Orient = VorientFieldText[REFERENCE]->GetValue() ? 1 : 0; - CurrentLibEntry->m_Name.m_Orient = VorientFieldText[VALUE]->GetValue() ? 1 : 0; - - CurrentLibEntry->m_Prefix.m_HJustify = - hjustify[FieldHJustify[REFERENCE]->GetSelection()]; - CurrentLibEntry->m_Prefix.m_VJustify = - vjustify[FieldVJustify[REFERENCE]->GetSelection()]; - CurrentLibEntry->m_Name.m_HJustify = - hjustify[FieldHJustify[VALUE]->GetSelection()]; - CurrentLibEntry->m_Name.m_VJustify = - vjustify[FieldVJustify[VALUE]->GetSelection()]; - - if( ShowFieldText[REFERENCE]->GetValue() ) - CurrentLibEntry->m_Prefix.m_Attributs &= ~TEXT_NO_VISIBLE; - else - CurrentLibEntry->m_Prefix.m_Attributs |= TEXT_NO_VISIBLE; - - if( ShowFieldText[VALUE]->GetValue() ) - CurrentLibEntry->m_Name.m_Attributs &= ~TEXT_NO_VISIBLE; - else - CurrentLibEntry->m_Name.m_Attributs |= TEXT_NO_VISIBLE; - - for( ii = FOOTPRINT; ii < NUMBER_OF_FIELDS; ii++ ) - { - LibDrawField* Field = CurrentLibEntry->Fields; - LibDrawField* NextField, * previousField = NULL; - while( Field ) - { - NextField = (LibDrawField*) Field->Pnext; - if( Field->m_FieldId == ii ) - { - Field->m_Text = FieldTextCtrl[ii]->GetText(); - Field->m_Size.x = Field->m_Size.y = FieldTextCtrl[ii]->GetTextSize(); - Field->m_HJustify = FieldHJustify[ii]->GetSelection(); - Field->m_VJustify = FieldVJustify[ii]->GetSelection(); - if( ShowFieldText[ii]->GetValue() ) - Field->m_Attributs &= ~TEXT_NO_VISIBLE; - else - Field->m_Attributs |= TEXT_NO_VISIBLE; - Field->m_Orient = VorientFieldText[ii]->GetValue() ? 1 : 0; - Field->m_Pos = FieldPosition[ii]->GetValue(); - if( Field->m_Text.IsEmpty() ) // An old field exists; new is void, delete it - { - delete Field; - if( previousField ) - previousField->Pnext = NextField; - else - CurrentLibEntry->Fields = NextField; - } - break; - } - - previousField = Field; - Field = NextField; - } - - if( (Field == NULL) && ( !FieldTextCtrl[ii]->GetText().IsEmpty() ) ) - { // Do not exists: must be created - Field = new LibDrawField( ii ); - - Field->m_Text = FieldTextCtrl[ii]->GetText(); - Field->m_Size.x = Field->m_Size.y = FieldTextCtrl[ii]->GetTextSize(); - if( ShowFieldText[Field->m_FieldId]->GetValue() ) - Field->m_Attributs &= ~TEXT_NO_VISIBLE; - else - Field->m_Attributs |= TEXT_NO_VISIBLE; - Field->m_Orient = VorientFieldText[Field->m_FieldId]->GetValue() ? 1 : 0; - Field->m_Pos = FieldPosition[Field->m_FieldId]->GetValue(); - Field->m_HJustify = hjustify[FieldHJustify[Field->m_FieldId]->GetSelection()]; - Field->m_VJustify = vjustify[FieldVJustify[Field->m_FieldId]->GetSelection()]; - Field->Pnext = CurrentLibEntry->Fields; - CurrentLibEntry->Fields = Field; - } - } - - ii = SelNumberOfUnits->GetValue(); - if( ChangeNbUnitsPerPackage( ii ) ) - m_RecreateToolbar = TRUE; - - if( AsConvertButt->GetValue() ) - { - if( !g_AsDeMorgan ) - { - g_AsDeMorgan = 1; - if( SetUnsetConvert() ) - m_RecreateToolbar = TRUE; - } - } - else - { - if( g_AsDeMorgan ) - { - g_AsDeMorgan = 0; - if( SetUnsetConvert() ) - m_RecreateToolbar = TRUE; - } - } - - CurrentLibEntry->m_DrawPinNum = ShowPinNumButt->GetValue() ? 1 : 0; - CurrentLibEntry->m_DrawPinName = ShowPinNameButt->GetValue() ? 1 : 0; - - if( m_PinsNameInsideButt->GetValue() == FALSE ) - CurrentLibEntry->m_TextInside = 0; - else - CurrentLibEntry->m_TextInside = m_SetSkew->GetValue(); - - if( m_OptionPower->GetValue() == TRUE ) - CurrentLibEntry->m_Options = ENTRY_POWER; - else - CurrentLibEntry->m_Options = ENTRY_NORMAL; - - /* Set the option "Units locked". - * Obviously, cannot be TRUE if there is only one part */ - CurrentLibEntry->m_UnitSelectionLocked = m_OptionPartsLocked->GetValue(); - if( CurrentLibEntry->m_UnitCount <= 1 ) - CurrentLibEntry->m_UnitSelectionLocked = FALSE; - - if( m_RecreateToolbar ) - m_Parent->ReCreateHToolbar(); - - m_Parent->DisplayLibInfos(); - - Close(); -} - - -/*******************************************************************************/ -void WinEDA_PartPropertiesFrame::CopyDocToAlias( wxCommandEvent& WXUNUSED (event) ) -/******************************************************************************/ -{ - if( CurrentLibEntry == NULL ) - return; - if( CurrentAliasName.IsEmpty() ) - return; - - m_Doc->SetValue( CurrentLibEntry->m_Doc ); - m_Docfile->SetValue( CurrentLibEntry->m_DocFile ); - m_Keywords->SetValue( CurrentLibEntry->m_KeyWord ); -} - - -/**********************************************************/ -void WinEDA_PartPropertiesFrame::DeleteAllAliasOfPart( - wxCommandEvent& WXUNUSED (event) ) -/**********************************************************/ -{ - CurrentAliasName.Empty(); - if( CurrentLibEntry ) - { - if( IsOK( this, _( "Ok to Delete Alias LIST" ) ) ) - { - m_PartAliasList->Clear(); - m_RecreateToolbar = TRUE; - } - } -} - - -/*******************************************************************************/ -void WinEDA_PartPropertiesFrame::AddAliasOfPart( wxCommandEvent& WXUNUSED (event) ) -/*******************************************************************************/ - -/* Add a new name to the alias list box - * New name cannot be the root name, and must not exists - */ -{ - wxString Line; - wxString aliasname; - - if( CurrentLibEntry == NULL ) - return; - - if( Get_Message( _( "New alias:" ), Line, this ) != 0 ) - return; - - Line.Replace( wxT( " " ), wxT( "_" ) ); - aliasname = Line; - - if( CurrentLibEntry->m_Name.m_Text.CmpNoCase( Line ) == 0 ) - { - DisplayError( this, _( "This is the Root Part" ), 10 ); return; - } - - /* test for an existing name: */ - int ii, jj = m_PartAliasList->GetCount(); - for( ii = 0; ii < jj; ii++ ) - { - if( aliasname.CmpNoCase( m_PartAliasList->GetString( ii ) ) == 0 ) - { - DisplayError( this, _( "Already in use" ), 10 ); - return; - } - } - - m_PartAliasList->Append( aliasname ); - - m_RecreateToolbar = TRUE; -} - - -/********************************************************/ -void WinEDA_PartPropertiesFrame::DeleteAliasOfPart( - wxCommandEvent& WXUNUSED (event) ) -/********************************************************/ -{ - wxString aliasname = m_PartAliasList->GetStringSelection(); - - if( aliasname.IsEmpty() ) - return; - if( aliasname == CurrentAliasName ) - { - wxString msg = CurrentAliasName + _( " is Current Selected Alias!" ); - DisplayError( this, msg ); - return; - } - - int ii = m_PartAliasList->GetSelection(); - m_PartAliasList->Delete( ii ); - - m_RecreateToolbar = TRUE; -} - - -/********************************************************************/ -bool WinEDA_PartPropertiesFrame::ChangeNbUnitsPerPackage( int MaxUnit ) -/********************************************************************/ - -/* Routine de modification du nombre d'unites par package pour le - * composant courant; - */ -{ - int OldNumUnits, ii, FlagDel = -1; - LibEDA_BaseStruct* DrawItem, * NextDrawItem; - - if( CurrentLibEntry == NULL ) - return FALSE; - - /* Si pas de changement: termine */ - if( CurrentLibEntry->m_UnitCount == MaxUnit ) - return FALSE; - - OldNumUnits = CurrentLibEntry->m_UnitCount; - if( OldNumUnits < 1 ) - OldNumUnits = 1; - - CurrentLibEntry->m_UnitCount = MaxUnit; - - - /* Traitement des unites enlevees ou rajoutees */ - if( OldNumUnits > CurrentLibEntry->m_UnitCount ) - { - DrawItem = CurrentLibEntry->m_Drawings; - for( ; DrawItem != NULL; DrawItem = NextDrawItem ) - { - NextDrawItem = DrawItem->Next(); - if( DrawItem->m_Unit > MaxUnit ) /* Item a effacer */ - { - if( FlagDel < 0 ) - { - if( IsOK( this, _( "Delete units" ) ) ) - { - /* Si part selectee n'existe plus: selection 1ere unit */ - if( CurrentUnit > MaxUnit ) - CurrentUnit = 1; - FlagDel = 1; - } - else - { - FlagDel = 0; - MaxUnit = OldNumUnits; - CurrentLibEntry->m_UnitCount = MaxUnit; - return FALSE; - } - } - DeleteOneLibraryDrawStruct( m_Parent->DrawPanel, NULL, CurrentLibEntry, - DrawItem, 0 ); - } - } - - return TRUE; - } - - if( OldNumUnits < CurrentLibEntry->m_UnitCount ) - { - DrawItem = CurrentLibEntry->m_Drawings; - for( ; DrawItem != NULL; DrawItem = DrawItem->Next() ) - { - /* Duplication des items pour autres elements */ - if( DrawItem->m_Unit == 1 ) - { - for( ii = OldNumUnits + 1; ii <= MaxUnit; ii++ ) - { - NextDrawItem = CopyDrawEntryStruct( this, DrawItem ); - NextDrawItem->Pnext = CurrentLibEntry->m_Drawings; - CurrentLibEntry->m_Drawings = NextDrawItem; - NextDrawItem->m_Unit = ii; - } - } - } - } - return TRUE; -} - - -/*****************************************************/ -bool WinEDA_PartPropertiesFrame::SetUnsetConvert() -/*****************************************************/ - -/* crée ou efface (selon option AsConvert) les éléments - * de la représentation convertie d'un composant - */ -{ - int FlagDel = 0; - LibEDA_BaseStruct* DrawItem = NULL, * NextDrawItem; - - if( g_AsDeMorgan ) /* Representation convertie a creer */ - { - /* Traitement des elements a ajouter ( pins seulement ) */ - if( CurrentLibEntry ) - DrawItem = CurrentLibEntry->m_Drawings; - for( ; DrawItem != NULL; DrawItem = DrawItem->Next() ) - { - /* Duplication des items pour autres elements */ - if( DrawItem->Type() != COMPONENT_PIN_DRAW_TYPE ) - continue; - if( DrawItem->m_Convert == 1 ) - { - if( FlagDel == 0 ) - { - if( IsOK( this, _( "Create pins for Convert items" ) ) ) - FlagDel = 1; - else - { - if( IsOK( this, _( "Part as \"De Morgan\" anymore" ) ) ) - return TRUE; - - g_AsDeMorgan = 0; return FALSE; - } - } - NextDrawItem = CopyDrawEntryStruct( this, DrawItem ); - NextDrawItem->Pnext = CurrentLibEntry->m_Drawings; - CurrentLibEntry->m_Drawings = NextDrawItem; - NextDrawItem->m_Convert = 2; - } - } - } - else /* Representation convertie a supprimer */ - { - /* Traitement des elements à supprimer */ - if( CurrentLibEntry ) - DrawItem = CurrentLibEntry->m_Drawings; - for( ; DrawItem != NULL; DrawItem = NextDrawItem ) - { - NextDrawItem = DrawItem->Next(); - if( DrawItem->m_Convert > 1 ) /* Item a effacer */ - { - if( FlagDel == 0 ) - { - if( IsOK( this, _( "Delete Convert items" ) ) ) - { - CurrentConvert = 1; - FlagDel = 1; - } - else - { - g_AsDeMorgan = 1; - return FALSE; - } - } - m_Parent->GetScreen()->SetModify(); - DeleteOneLibraryDrawStruct( m_Parent->DrawPanel, - NULL, - CurrentLibEntry, - DrawItem, - 0 ); - } - } - } - return TRUE; -} - - -/****************************************************************************/ -void WinEDA_PartPropertiesFrame::BrowseAndSelectDocFile( wxCommandEvent& event ) -/****************************************************************************/ -{ - wxString FullFileName; - - wxString docpath( g_RealLibDirBuffer ), filename; - - docpath += wxT( "doc" ); - docpath += STRING_DIR_SEP; - FullFileName = EDA_FileSelector( _( "Doc Files" ), - docpath, /* Chemin par defaut */ - wxEmptyString, /* nom fichier par defaut */ - wxEmptyString, /* extension par defaut */ - wxEmptyString, /* Masque d'affichage */ - this, - wxFD_OPEN, - TRUE - ); - if( FullFileName.IsEmpty() ) - return; - - // Suppression du chemin par defaut pour le fichier de doc: - filename = MakeReducedFileName( FullFileName, docpath, wxEmptyString ); - m_Docfile->SetValue( filename ); -} diff --git a/eeschema/libframe.cpp b/eeschema/libframe.cpp index cb25887b3f..f6283be6fa 100644 --- a/eeschema/libframe.cpp +++ b/eeschema/libframe.cpp @@ -63,8 +63,9 @@ WinEDA_LibeditFrame::WinEDA_LibeditFrame( wxWindow* father, WinEDA_App* parent, const wxString& title, const wxPoint& pos, - const wxSize& size ) : - WinEDA_DrawFrame( father, LIBEDITOR_FRAME, parent, title, pos, size ) + const wxSize& size, + long style ) : + WinEDA_DrawFrame( father, LIBEDITOR_FRAME, parent, title, pos, size, style ) { m_FrameName = wxT( "LibeditFrame" ); m_Draw_Axis = TRUE; // TRUE pour avoir les axes dessines diff --git a/eeschema/options.cpp.notused b/eeschema/options.cpp.notused deleted file mode 100644 index 0b3dff07d5..0000000000 --- a/eeschema/options.cpp.notused +++ /dev/null @@ -1,285 +0,0 @@ - /*************************/ - /* eeschema: options.cpp */ - /*************************/ - -/* -Gestion de la fenetre des options generales: - Grille - Unites d'affichage - options complementaires (increments X, Y et label pour la fct de repetition -*/ - -#include "fctsys.h" -#include "gr_basic.h" - -#include "common.h" -#include "program.h" -#include "libcmp.h" -#include "general.h" - -#include "id.h" -#include "wx/spinctrl.h" - -#include "protos.h" - - -/* Variables locales */ - -/* Fonctions locales: */ - -enum options_id { - ID_OPTION_ACCEPT = 3900, - ID_OPTION_CANCEL, - ID_GRID_SIZE, - ID_SHOW_GRID, - ID_GRID_NORMAL, - ID_GRID_SMALL, - ID_GRID_VERY_SMALL, - - ID_SEL_SHOW_PINS, - ID_SEL_HV_WIRE, - ID_SEL_SHOW_PAGE_LIMITS, - ID_SEL_METRIC -}; - -/*************************************************************/ -/* classe derivee pour la frame de Configuration des options*/ -/*************************************************************/ - -class WinEDA_SetOptionsFrame: public wxDialog -{ -private: - WinEDA_DrawFrame * m_Parent; - wxCheckBox * m_ShowGridButt; - wxCheckBox * m_AutoPANOpt; - wxRadioBox * m_SelGridSize; - wxRadioBox * m_SelShowPins; - wxRadioBox * m_Selunits; - wxRadioBox * m_SelDirWires; - wxRadioBox * m_Show_Page_Limits; - WinEDA_SizeCtrl * m_DeltaStepCtrl; - wxSpinCtrl * m_DeltaLabelCtrl; - -public: - - // Constructor and destructor - WinEDA_SetOptionsFrame(WinEDA_DrawFrame *parent, const wxPoint& framepos); - ~WinEDA_SetOptionsFrame() {}; - -private: - void Accept(wxCommandEvent& event); - void OnCancel(wxCommandEvent& event); - - DECLARE_EVENT_TABLE() - -}; -/* Table des evenements pour WinEDA_SetOptionsFrame */ -BEGIN_EVENT_TABLE(WinEDA_SetOptionsFrame, wxDialog) - EVT_BUTTON(ID_OPTION_ACCEPT, WinEDA_SetOptionsFrame::Accept) - EVT_BUTTON(ID_OPTION_CANCEL, WinEDA_SetOptionsFrame::OnCancel) -END_EVENT_TABLE() - -/**************************************************************************/ -void DisplayOptionFrame(WinEDA_DrawFrame * parent, const wxPoint & framepos) -/**************************************************************************/ -{ - WinEDA_SetOptionsFrame * frame = - new WinEDA_SetOptionsFrame(parent, framepos); - frame->ShowModal(); frame->Destroy(); -} - - - -/***********************************************************************/ -WinEDA_SetOptionsFrame::WinEDA_SetOptionsFrame(WinEDA_DrawFrame *parent, - const wxPoint& framepos): - wxDialog(parent, -1, _("EESchema Preferences"), framepos, - wxSize(450, 340), DIALOG_STYLE) -/***********************************************************************/ -{ -#define START_Y 10 -wxButton * Button; -wxPoint pos; -wxSize size; -int w, h; - - m_Parent = parent; - SetFont(*g_DialogFont); - - pos.x = 330; pos.y = START_Y; - Button = new wxButton(this, ID_OPTION_ACCEPT, _("OK"), pos); - Button->SetForegroundColour(*wxRED); - - pos.y += Button->GetDefaultSize().y + 5; - Button = new wxButton(this, ID_OPTION_CANCEL, _("Cancel"), pos); - Button->SetForegroundColour(*wxBLUE); - - - pos.x = 5; pos.y = START_Y; - m_ShowGridButt = new wxCheckBox( this, ID_SHOW_GRID, _("Show grid"), - pos); - m_ShowGridButt->SetValue(m_Parent->m_Draw_Grid); - - pos.x += 150; - m_AutoPANOpt = new wxCheckBox( this, ID_SHOW_GRID, _("Auto PAN"), - pos); - m_AutoPANOpt->SetValue(m_Parent->DrawPanel-> m_AutoPAN_Enable); - m_AutoPANOpt->SetForegroundColour(*wxBLUE); - - pos.x = 5; pos.y += 25; -wxString grid_choice[6] = { _("Normal (50 mils)"), - _("Small (25 mils)"), - _("Very small (10 mils)"), - _("Special (5 mils)"), - _("Special (2 mils)"), - _("Special (1 mil)"), }; - - m_SelGridSize = new wxRadioBox(this, ID_GRID_SIZE, - _("Grid Size"), pos, - wxDefaultSize, 6, grid_choice, 1, wxRA_SPECIFY_COLS); - if ( m_Parent->GetScreen() ) - { - switch( m_Parent->GetScreen()->GetGrid().x ) - { - case 50: - m_SelGridSize->SetSelection(0); - break; - - case 25: - m_SelGridSize->SetSelection(1); - break; - - case 10: - m_SelGridSize->SetSelection(2); - break; - - case 5: - m_SelGridSize->SetSelection(3); - break; - - case 2: - m_SelGridSize->SetSelection(4); - break; - - case 1: - m_SelGridSize->SetSelection(5); - break; - - default: - DisplayError(this, wxT("WinEDA_SetOptionsFrame: Grid value not handle")); - break; - } - } - - /* Choix d' l'affichage des pins invisibles */ - m_SelGridSize->GetSize(&w, &h); - pos.y += h + 20; -wxString pin_choice[2] = { _("Normal"), _("Show alls") }; - m_SelShowPins = new wxRadioBox(this, ID_SEL_SHOW_PINS, - _("Show pins"), pos, - wxDefaultSize, 2, pin_choice, 1, wxRA_SPECIFY_COLS); - m_SelShowPins->SetSelection( g_ShowAllPins ? TRUE : FALSE); - - /* Choix de l'affichage des unites */ - pos.x = 15 + w; pos.y = START_Y + 25; -wxString unit_choice[2] = { _("millimeters"), _("inches") }; - m_Selunits = new wxRadioBox(this, ID_SEL_METRIC, - _("Units"), pos, - wxDefaultSize, 2, unit_choice, 1, wxRA_SPECIFY_COLS); - m_Selunits->SetSelection( UnitMetric ? 0 : 1); - - /* Choix de l'orientation des bus et wires */ - m_Selunits->GetSize(&w, &h); - pos.y += h + 15; -wxString dir_choice[2] = { _("Horiz/Vertical"), _("Any") }; - m_SelDirWires = new wxRadioBox(this, ID_SEL_HV_WIRE, - _("Wires - Bus orient"), pos, - wxDefaultSize, 2, dir_choice, 1, wxRA_SPECIFY_COLS); - m_SelDirWires->SetSelection( g_HVLines ? 0 : 1); - - m_SelDirWires->GetSize(&w, &h); - pos.y += h + 15; -wxString show_page_limits_choice[2] = { _("Yes"), _("No") }; - m_Show_Page_Limits = new wxRadioBox(this, ID_SEL_SHOW_PAGE_LIMITS, - _("Show page limits"), pos, - wxDefaultSize, 2, show_page_limits_choice, 1, wxRA_SPECIFY_COLS); - m_Show_Page_Limits->SetSelection( g_ShowPageLimits ? 0 : 1); - - /* Choix des parametres pour la fonction de repetition */ - size.x = 100; size.y = -1; - pos.y = 90; pos.x = 320; - m_DeltaStepCtrl = new WinEDA_SizeCtrl(this, _("Delta Step"), - g_RepeatStep, - UnitMetric, pos, m_Parent->m_InternalUnits); - - pos.y += 10 + m_DeltaStepCtrl->GetDimension().y; - new wxStaticText(this, -1, _("Delta Label:"), - wxPoint(pos.x, pos.y ), - wxSize(-1,-1), 0 ); -wxString val; - pos.y += 14; - val << g_RepeatDeltaLabel; - m_DeltaLabelCtrl = new wxSpinCtrl(this, -1, val, pos); - m_DeltaLabelCtrl->SetRange(-16, +16); -} - -/**************************************************************************/ -void WinEDA_SetOptionsFrame::OnCancel(wxCommandEvent& event) -/**************************************************************************/ -{ - Close(TRUE); -} -/**************************************************************************/ -void WinEDA_SetOptionsFrame::Accept(wxCommandEvent& event) -/**************************************************************************/ -{ -wxSize grid; -bool setgrid = TRUE; - - g_RepeatStep = m_DeltaStepCtrl->GetCoord(); - - g_RepeatDeltaLabel = m_DeltaLabelCtrl->GetValue(); - - if ( m_Show_Page_Limits->GetSelection() == 0 ) g_ShowPageLimits = TRUE; - else g_ShowPageLimits = FALSE; - - if ( m_SelDirWires->GetSelection() == 0 ) g_HVLines = 1; - else g_HVLines = 0; - - if ( m_Selunits->GetSelection() == 0 ) UnitMetric = 1; - else UnitMetric = 0; - - if ( m_SelShowPins->GetSelection() == 0 ) g_ShowAllPins = FALSE; - else g_ShowAllPins = TRUE; - - g_ShowGrid = m_Parent->m_Draw_Grid = m_ShowGridButt->GetValue(); - m_Parent->DrawPanel->m_AutoPAN_Enable = m_AutoPANOpt->GetValue(); - - switch( m_SelGridSize->GetSelection() ) - { - default: - setgrid = FALSE; - break; - - case 0: - grid = wxSize(50,50); - break; - case 1: - grid = wxSize(25,25); - break; - - case 2: - grid = wxSize(10,10); - break; - } - - if ( m_Parent->m_CurrentScreen ) - { - if ( setgrid ) m_Parent->m_CurrentScreen->SetGrid(grid); - m_Parent->m_CurrentScreen->SetRefreshReq(); - } - - Close(TRUE); -} - - diff --git a/eeschema/optionsframe.cpp.notused b/eeschema/optionsframe.cpp.notused deleted file mode 100644 index 794b6e7864..0000000000 --- a/eeschema/optionsframe.cpp.notused +++ /dev/null @@ -1,172 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: optionsframe.cpp -// Purpose: -// Author: jean-pierre charras -// Modified by: -// Created: 01/27/04 14:48:57 -// RCS-ID: -// Copyright: suite kicad -// Licence: -///////////////////////////////////////////////////////////////////////////// - -#ifdef __GNUG__ -#pragma implementation "optionsframe.cpp" -#endif - -// For compilers that support precompilation, includes "wx/wx.h". -#include "wx/wxprec.h" - -#ifdef __BORLANDC__ -#pragma hdrstop -#endif - -////@begin includes -#include "wx/wx.h" -#include "wx/valgen.h" -////@end includes - -#include "optionsframe.h" - -////@begin XPM images -////@end XPM images - -/*! - * DisplayOptionFrame type definition - */ - -IMPLEMENT_CLASS( DisplayOptionFrame, wxDialog ) - -/*! - * DisplayOptionFrame event table definition - */ - -BEGIN_EVENT_TABLE( DisplayOptionFrame, wxDialog ) - -////@begin DisplayOptionFrame event table entries -////@end DisplayOptionFrame event table entries - -END_EVENT_TABLE() - -/*! - * DisplayOptionFrame constructors - */ - -DisplayOptionFrame::DisplayOptionFrame( ) -{ -} - -DisplayOptionFrame::DisplayOptionFrame( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) -{ - Create(parent, id, caption, pos, size, style); -} - -/*! - * optionsframe creator - */ - -bool DisplayOptionFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) -{ -////@begin DisplayOptionFrame member initialisation -////@end DisplayOptionFrame member initialisation - -////@begin DisplayOptionFrame creation - wxDialog::Create( parent, id, caption, pos, size, style ); - - CreateControls(); - GetSizer()->Fit(this); - GetSizer()->SetSizeHints(this); - Centre(); -////@end DisplayOptionFrame creation - return TRUE; -} - -/*! - * Control creation for optionsframe - */ - -void DisplayOptionFrame::CreateControls() -{ -////@begin DisplayOptionFrame content construction - - DisplayOptionFrame* item1 = this; - - wxBoxSizer* item2 = new wxBoxSizer(wxVERTICAL); - item1->SetSizer(item2); - item1->SetAutoLayout(TRUE); - - wxBoxSizer* item3 = new wxBoxSizer(wxHORIZONTAL); - item2->Add(item3, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); - - wxBoxSizer* item4 = new wxBoxSizer(wxHORIZONTAL); - item3->Add(item4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); - - wxBoxSizer* item5 = new wxBoxSizer(wxVERTICAL); - item4->Add(item5, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); - - wxCheckBox* item6 = new wxCheckBox( item1, ID_CHECKBOX, _("Show grid"), wxDefaultPosition, wxDefaultSize, 0 ); - m_ShowGridButt = item6; - item6->SetValue(FALSE); - item5->Add(item6, 0, wxALIGN_LEFT|wxALL, 5); - - wxString item7Strings[] = { - _("&Normal (50 mils)"), - _("&Small (20 mils)"), - _("&Very small (10 mils)") - }; - wxRadioBox* item7 = new wxRadioBox( item1, ID_RADIOBOX, _("Grid Size"), wxDefaultPosition, wxDefaultSize, 3, item7Strings, 1, 0 ); - m_SelGridSize = item7; - item5->Add(item7, 0, wxALIGN_LEFT|wxALL, 5); - - wxString item8Strings[] = { - _("&Normal"), - _("&inches") - }; - wxRadioBox* item8 = new wxRadioBox( item1, ID_RADIOBOX1, _("Show pins"), wxDefaultPosition, wxDefaultSize, 2, item8Strings, 1, 0 ); - m_SelShowPins = item8; - item5->Add(item8, 0, wxALIGN_LEFT|wxALL, 5); - - wxBoxSizer* item9 = new wxBoxSizer(wxVERTICAL); - item4->Add(item9, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); - - wxString item10Strings[] = { - _("&millimeters"), - _("&inches") - }; - wxRadioBox* item10 = new wxRadioBox( item1, ID_RADIOBOX3, _("Units"), wxDefaultPosition, wxDefaultSize, 2, item10Strings, 1, wxRA_SPECIFY_COLS ); - m_Selunits = item10; - item9->Add(item10, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); - - item9->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); - - wxString item12Strings[] = { - _("&Horiz/Vertical"), - _("&Any") - }; - wxRadioBox* item12 = new wxRadioBox( item1, ID_RADIOBOX2, _("Wire - Bus orient"), wxDefaultPosition, wxDefaultSize, 2, item12Strings, 1, wxRA_SPECIFY_COLS ); - item9->Add(item12, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); - - wxBoxSizer* item13 = new wxBoxSizer(wxVERTICAL); - item4->Add(item13, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5); - - wxButton* item14 = new wxButton( item1, ID_BUTTON, _("OK"), wxDefaultPosition, wxDefaultSize, 0 ); - item14->SetForegroundColour(wxColour(255, 0, 0)); - item13->Add(item14, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); - - wxButton* item15 = new wxButton( item1, ID_BUTTON1, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); - item15->SetForegroundColour(wxColour(0, 0, 255)); - item13->Add(item15, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5); - - - // Set validators - item6->SetValidator( wxGenericValidator(& ShowGrid ) ); -////@end DisplayOptionFrame content construction -} - -/*! - * Should we show tooltips? - */ - -bool DisplayOptionFrame::ShowToolTips() -{ - return TRUE; -} diff --git a/eeschema/optionsframe.h.notused b/eeschema/optionsframe.h.notused deleted file mode 100644 index bd5b5fd9c8..0000000000 --- a/eeschema/optionsframe.h.notused +++ /dev/null @@ -1,89 +0,0 @@ -///////////////////////////////////////////////////////////////////////////// -// Name: optionsframe.h -// Purpose: -// Author: jean-pierre charras -// Modified by: -// Created: 01/27/04 14:48:57 -// RCS-ID: -// Copyright: suite kicad -// Licence: -///////////////////////////////////////////////////////////////////////////// - -#ifndef _OPTIONSFRAME_H_ -#define _OPTIONSFRAME_H_ - -#ifdef __GNUG__ -#pragma interface "optionsframe.h" -#endif - -/*! - * Includes - */ - -////@begin includes -////@end includes - -/*! - * Forward declarations - */ - -////@begin forward declarations -////@end forward declarations - -/*! - * Control identifiers - */ - -////@begin control identifiers -#define ID_DIALOG 10000 -#define ID_CHECKBOX 10001 -#define ID_RADIOBOX 10002 -#define ID_RADIOBOX1 10003 -#define ID_RADIOBOX3 10005 -#define ID_RADIOBOX2 10004 -#define ID_BUTTON 10006 -#define ID_BUTTON1 10007 -////@end control identifiers - -/*! - * DisplayOptionFrame class declaration - */ - -class DisplayOptionFrame: public wxDialog -{ - DECLARE_CLASS( DisplayOptionFrame ) - DECLARE_EVENT_TABLE() - -public: - /// Constructors - DisplayOptionFrame( ); - DisplayOptionFrame( wxWindow* parent, wxWindowID id = -1, const wxString& caption = _("optionsframe"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU ); - - /// Creation - bool Create( wxWindow* parent, wxWindowID id = -1, const wxString& caption = _("optionsframe"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU ); - - /// Creates the controls and sizers - void CreateControls(); - -////@begin DisplayOptionFrame event handler declarations - -////@end DisplayOptionFrame event handler declarations - -////@begin DisplayOptionFrame member function declarations - -////@end DisplayOptionFrame member function declarations - - /// Should we show tooltips? - static bool ShowToolTips(); - -////@begin DisplayOptionFrame member variables - wxCheckBox* m_ShowGridButt; - wxRadioBox* m_SelGridSize; - wxRadioBox* m_SelShowPins; - wxRadioBox* m_Selunits; - WinEDA_DrawFrame * m_Parent; -////@end DisplayOptionFrame member variables -}; - -#endif - // _OPTIONSFRAME_H_ diff --git a/eeschema/schframe.cpp b/eeschema/schframe.cpp index c25e92eac6..e0ba7251b4 100644 --- a/eeschema/schframe.cpp +++ b/eeschema/schframe.cpp @@ -116,8 +116,8 @@ END_EVENT_TABLE() /****************/ WinEDA_SchematicFrame:: WinEDA_SchematicFrame(wxWindow * father, WinEDA_App *parent, - const wxString & title, const wxPoint& pos, const wxSize& size) : - WinEDA_DrawFrame(father, SCHEMATIC_FRAME, parent, title, pos, size) + const wxString & title, const wxPoint& pos, const wxSize& size, long style) : + WinEDA_DrawFrame(father, SCHEMATIC_FRAME, parent, title, pos, size, style) { m_FrameName = wxT("SchematicFrame"); m_Draw_Axis = FALSE; // TRUE pour avoir les axes dessines diff --git a/gerbview/gerberframe.cpp b/gerbview/gerberframe.cpp index f01df40255..fb2b872f88 100644 --- a/gerbview/gerberframe.cpp +++ b/gerbview/gerberframe.cpp @@ -124,8 +124,8 @@ END_EVENT_TABLE() /****************/ WinEDA_GerberFrame::WinEDA_GerberFrame(wxWindow * father, WinEDA_App *parent, - const wxString & title, const wxPoint& pos, const wxSize& size) : - WinEDA_BasePcbFrame(father, parent, GERBER_FRAME, title, pos, size) + const wxString & title, const wxPoint& pos, const wxSize& size, long style) : + WinEDA_BasePcbFrame(father, parent, GERBER_FRAME, title, pos, size, style) { m_FrameName = wxT("GerberFrame"); m_Draw_Axis = TRUE; // TRUE pour avoir les axes dessines diff --git a/include/wxstruct.h b/include/wxstruct.h index 5047bc259a..025d8968a8 100644 --- a/include/wxstruct.h +++ b/include/wxstruct.h @@ -35,6 +35,7 @@ // #define DIALOG_STYLE wxDEFAULT_DIALOG_STYLE|wxFRAME_FLOAT_ON_PARENT|wxSTAY_ON_TOP #define DIALOG_STYLE wxDEFAULT_DIALOG_STYLE | wxFRAME_FLOAT_ON_PARENT | MAYBE_RESIZE_BORDER +#define KICAD_DEFAULT_DRAWFRAME_STYLE wxDEFAULT_FRAME_STYLE|wxWANTS_CHARS #define EDA_DRAW_PANEL wxScrolledWindow class wxMyDialogModalData; @@ -168,7 +169,8 @@ public: // Constructor and destructor WinEDA_BasicFrame( wxWindow* father, int idtype, WinEDA_App* parent, const wxString& title, - const wxPoint& pos, const wxSize& size ); + const wxPoint& pos, const wxSize& size, + long style = KICAD_DEFAULT_DRAWFRAME_STYLE); #ifdef KICAD_PYTHON WinEDA_BasicFrame( const WinEDA_BasicFrame& ) { } // Should throw!! WinEDA_BasicFrame() { } // Should throw!! @@ -239,7 +241,8 @@ public: // Constructor and destructor WinEDA_DrawFrame( wxWindow* father, int idtype, WinEDA_App* parent, const wxString& title, - const wxPoint& pos, const wxSize& size ); + const wxPoint& pos, const wxSize& size, + long style = KICAD_DEFAULT_DRAWFRAME_STYLE ); ~WinEDA_DrawFrame(); @@ -352,7 +355,8 @@ protected: public: WinEDA_BasePcbFrame( wxWindow* father, WinEDA_App* parent, int idtype, const wxString& title, - const wxPoint& pos, const wxSize& size ); + const wxPoint& pos, const wxSize& size, + long style = KICAD_DEFAULT_DRAWFRAME_STYLE ); ~WinEDA_BasePcbFrame(); @@ -574,7 +578,8 @@ private: public: WinEDA_PcbFrame( wxWindow* father, WinEDA_App* parent, const wxString& title, - const wxPoint& pos, const wxSize& size ); + const wxPoint& pos, const wxSize& size, + long style = KICAD_DEFAULT_DRAWFRAME_STYLE ); ~WinEDA_PcbFrame(); @@ -803,7 +808,8 @@ private: public: WinEDA_GerberFrame( wxWindow* father, WinEDA_App* parent, const wxString& title, - const wxPoint& pos, const wxSize& size ); + const wxPoint& pos, const wxSize& size, + long style = KICAD_DEFAULT_DRAWFRAME_STYLE ); ~WinEDA_GerberFrame(); @@ -908,7 +914,8 @@ public: public: WinEDA_ModuleEditFrame( wxWindow* father, WinEDA_App* parent, const wxString& title, - const wxPoint& pos, const wxSize& size ); + const wxPoint& pos, const wxSize& size, + long style = KICAD_DEFAULT_DRAWFRAME_STYLE ); ~WinEDA_ModuleEditFrame(); @@ -1003,7 +1010,8 @@ private: public: WinEDA_SchematicFrame( wxWindow* father, WinEDA_App* parent, const wxString& title, - const wxPoint& pos, const wxSize& size ); + const wxPoint& pos, const wxSize& size, + long style = KICAD_DEFAULT_DRAWFRAME_STYLE ); ~WinEDA_SchematicFrame(); @@ -1212,7 +1220,8 @@ public: public: WinEDA_LibeditFrame( wxWindow* father, WinEDA_App* parent, const wxString& title, - const wxPoint& pos, const wxSize& size ); + const wxPoint& pos, const wxSize& size, + long style = KICAD_DEFAULT_DRAWFRAME_STYLE ); ~WinEDA_LibeditFrame(); @@ -1357,9 +1366,10 @@ private: #include "drawpanel_wxstruct.h" -/*********************************************************/ -/* classe representant un ecran d'affichage des messages */ -/*********************************************************/ +/********************************************************* +class WinEDA_MsgPanel : this is a panel to display various infos +and messages on items in eeschema an pcbnew +*********************************************************/ /** * Struct MsgItem @@ -1422,9 +1432,9 @@ public: }; -/******************************************************************/ -/* Classe pour editer une ligne de texte dans les menus de config */ -/******************************************************************/ +/************************************************/ +/* Class to enter a line, is some dialog frames */ +/************************************************/ class WinEDA_EnterText { public: @@ -1460,9 +1470,9 @@ public: } }; -/*********************************************************************/ -/* Classe pour editer un texte graphique + dimension en INCHES ou MM */ -/*********************************************************************/ +/************************************************************************/ +/* Class to edit/enter a graphic text and its dimension ( INCHES or MM )*/ +/************************************************************************/ class WinEDA_GraphicTextCtrl { public: @@ -1494,9 +1504,9 @@ public: }; -/*****************************************************************/ -/* Classe pour afficher et editer une coordonn�e en INCHES ou MM */ -/*****************************************************************/ +/*************************************************************************************/ +/*Class to edit/enter a coordinate (pair of values) ( INCHES or MM ) in dialog boxes */ +/*************************************************************************************/ class WinEDA_PositionCtrl { public: @@ -1523,9 +1533,10 @@ public: wxPoint GetValue(); }; -/*****************************************************************/ -/* Classe pour afficher et editer une coordonn�e en INCHES ou MM */ -/*****************************************************************/ +/************************************************************* +Class to edit/enter a size (pair of values for X and Y size) +( INCHES or MM ) in dialog boxes +***************************************************************/ class WinEDA_SizeCtrl : public WinEDA_PositionCtrl { public: @@ -1541,9 +1552,9 @@ public: }; -/*****************************************************************/ -/* Classe pour afficher et editer une valeur en INCHES ou MM */ -/*****************************************************************/ +/****************************************************************/ +/* Class to edit/enter a value ( INCHES or MM ) in dialog boxes */ +/****************************************************************/ /* internal_unit est le nombre d'unites internes par inch * - 1000 sur EESchema @@ -1578,9 +1589,9 @@ public: } }; -/*****************************************************************/ -/* Classe pour afficher et editer une valeur double flottant */ -/*****************************************************************/ +/************************************************************************/ +/* Class to edit/enter a pair of float (double) values in dialog boxes */ +/************************************************************************/ class WinEDA_DFloatValueCtrl { public: diff --git a/pcbnew/basepcbframe.cpp b/pcbnew/basepcbframe.cpp index f1747a636f..27f7f9d7be 100644 --- a/pcbnew/basepcbframe.cpp +++ b/pcbnew/basepcbframe.cpp @@ -40,8 +40,9 @@ WinEDA_BasePcbFrame::WinEDA_BasePcbFrame( wxWindow* father, int idtype, const wxString& title, const wxPoint& pos, - const wxSize& size ) : - WinEDA_DrawFrame( father, idtype, parent, title, pos, size ) + const wxSize& size, + long style) : + WinEDA_DrawFrame( father, idtype, parent, title, pos, size, style ) { m_InternalUnits = 10000; // Internal unit = 1/10000 inch m_CurrentScreen = NULL; @@ -101,6 +102,15 @@ void WinEDA_BasePcbFrame::ReCreateMenuBar( void ) { } +#ifdef CVPCB +/********************************************************************/ +void WinEDA_BasePcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse ) +/********************************************************************/ + +// Virtual function +{ +} +#endif #include "3d_viewer.h" @@ -119,8 +129,13 @@ void WinEDA_BasePcbFrame::Show3D_Frame( wxCommandEvent& event ) DisplayInfo( this, _( "3D Frame already opened" ) ); return; } + +#ifdef CVPCB + m_Draw3DFrame = new WinEDA3D_DrawFrame( this, m_Parent, _( "3D Viewer" ), + KICAD_DEFAULT_3D_DRAWFRAME_STYLE | wxFRAME_FLOAT_ON_PARENT ); +#else m_Draw3DFrame = new WinEDA3D_DrawFrame( this, m_Parent, _( "3D Viewer" ) ); - +#endif // Show the frame m_Draw3DFrame->Show( TRUE ); #endif diff --git a/pcbnew/clean.cpp b/pcbnew/clean.cpp index 1646dc69fd..856c74b800 100644 --- a/pcbnew/clean.cpp +++ b/pcbnew/clean.cpp @@ -23,7 +23,7 @@ /* Routines locales : */ static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC ); -static void suppression_piste_non_connectee( WinEDA_PcbFrame* frame, wxDC* DC ); +static void DeleteUnconnectedTracks( WinEDA_PcbFrame* frame, wxDC* DC ); static TRACK* AlignSegment( BOARD* Pcb, TRACK* pt_ref, TRACK* pt_segm, int extremite ); static void Clean_Pcb_Items( WinEDA_PcbFrame* frame, wxDC* DC ); @@ -71,7 +71,7 @@ void Clean_Pcb_Items( WinEDA_PcbFrame* frame, wxDC* DC ) frame->MsgPanel->EraseMsgBox(); frame->m_Pcb->GetNumSegmTrack(); // update the count - /* construction de la liste des coordonn�s des pastilles */ + /* Rebuild the pad infos (pad list and netcodes) to ensure an up to date info */ frame->m_Pcb->m_Status_Pcb = 0; frame->build_liste_pads(); frame->recalcule_pad_net_code(); @@ -120,26 +120,28 @@ void Clean_Pcb_Items( WinEDA_PcbFrame* frame, wxDC* DC ) } #ifdef CONN2PAD_ENBL - if( s_ConnectToPads ) /* Creation de points de connexion */ + /* Create missing segments when a track end covers a pad or a via, + but is not on the pad or the via center */ + if( s_ConnectToPads ) { - /* Raccordement des extremites de piste au centre des pastilles : */ - ConnectDanglingEndToPad( frame, DC ); + /* Create missing segments when a track end covers a pad, but is not on the pad center */ if( s_ConnectToPads ) + ConnectDanglingEndToPad( frame, DC ); // creation of points of connections at the intersection of tracks // Gen_Raccord_Track(frame, DC); + /* Create missing segments when a track end covers a via, but is not on the via center */ if( s_ConnectToPads ) ConnectDanglingEndToVia( frame->m_Pcb ); } #endif - /* suppression des segments de longueur nulle et des points intermediaires - * alignes */ + /* Remove null segments and intermediate points on aligned segments */ if( s_MergeSegments ) clean_segments( frame, DC ); - /* suppression des pistes non connectees ( c.a.d dont 1 extremite est en l'air) */ + /* Delete dangling tracks */ if( s_DeleteUnconnectedSegm ) - suppression_piste_non_connectee( frame, DC ); + DeleteUnconnectedTracks( frame, DC ); frame->Compile_Ratsnest( DC, AFFICHE ); @@ -148,14 +150,13 @@ void Clean_Pcb_Items( WinEDA_PcbFrame* frame, wxDC* DC ) /*****************************************************************************/ -static void suppression_piste_non_connectee( WinEDA_PcbFrame* frame, wxDC* DC ) +static void DeleteUnconnectedTracks( WinEDA_PcbFrame* frame, wxDC* DC ) /*****************************************************************************/ /* - * Supprime les segments de piste ayant 1 ou 2 extremites non connectees - * Cas des vias: - * si une extremite de segment est connectee uniquement a une via, la via - * et le segment seront supprimes + * Delete dangling tracks + * Vias: + * If a via is only connected to a dangling track, it also will be removed */ { TRACK* segment; @@ -229,7 +230,8 @@ static void suppression_piste_non_connectee( WinEDA_PcbFrame* frame, wxDC* DC ) flag_erase = 0; type_end = 0; - /* y a t-il une pastille sur chaque extremite */ + + /* Is a pad found on a track end ? */ masklayer = segment->ReturnMaskLayer(); @@ -339,7 +341,7 @@ static void suppression_piste_non_connectee( WinEDA_PcbFrame* frame, wxDC* DC ) /************************************************************/ static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC ) /************************************************************/ -/* Supprime segments nulls, points inutiles .. */ +/* Delete null lenght segments, and intermediate points .. */ { TRACK* segment; TRACK* other; @@ -350,7 +352,7 @@ static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC ) frame->DrawPanel->m_AbortRequest = FALSE; /**********************************************/ - /* suppression des segments de longueur nulle */ + /* Delete null segments */ /**********************************************/ a_color = GREEN; @@ -378,7 +380,7 @@ static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC ) } /**************************************/ - /* suppression des segments confondus */ + /* Delete redundant segments */ /**************************************/ Affiche_1_Parametre( frame, POS_AFF_VAR, wxT( "Ident" ), wxT( "0" ), a_color ); @@ -388,7 +390,7 @@ static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC ) for( segment = frame->m_Pcb->m_Track, ii = 0; segment; segment = segment->Next(), ii++ ) { - /* affichage activite */ + /* Display activity */ percent = (100 * ii) / frame->m_Pcb->m_NbSegmTrack; if( percent != oldpercent ) { @@ -430,7 +432,7 @@ static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC ) erase = 1; } - /* suppression du point en trop */ + /* Delete redundant point */ if( erase ) { ii--; @@ -444,9 +446,9 @@ static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC ) } } - /**************************************************************/ - /* suppression des points intermediaires ( segments alignes ) */ - /**************************************************************/ + /****************************/ + /* delete intermediate points */ + /****************************/ nbpoints_supprimes = 0; percent = 0; @@ -465,7 +467,6 @@ static int clean_segments( WinEDA_PcbFrame* frame, wxDC* DC ) next = segment->Next(); - /* affichage activite */ ii++; percent = (100 * ii) / frame->m_Pcb->m_NbSegmTrack; if( percent != oldpercent ) diff --git a/pcbnew/moduleframe.cpp b/pcbnew/moduleframe.cpp index 54c3883092..7ffd9def37 100644 --- a/pcbnew/moduleframe.cpp +++ b/pcbnew/moduleframe.cpp @@ -104,8 +104,9 @@ END_EVENT_TABLE() WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father, WinEDA_App* parent, const wxString& title, - const wxPoint& pos, const wxSize& size ) : - WinEDA_BasePcbFrame( father, parent, MODULE_EDITOR_FRAME, wxEmptyString, pos, size ) + const wxPoint& pos, const wxSize& size, + long style ) : + WinEDA_BasePcbFrame( father, parent, MODULE_EDITOR_FRAME, wxEmptyString, pos, size, style ) { m_FrameName = wxT( "ModEditFrame" ); m_Draw_Axis = TRUE; // TRUE pour avoir les axes dessines diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index 36d2d21a87..34417e8f2b 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -176,8 +176,9 @@ END_EVENT_TABLE() WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, WinEDA_App* parent, const wxString& title, - const wxPoint& pos, const wxSize& size ) : - WinEDA_BasePcbFrame( father, parent, PCB_FRAME, title, pos, size ) + const wxPoint& pos, const wxSize& size, + long style) : + WinEDA_BasePcbFrame( father, parent, PCB_FRAME, title, pos, size, style ) { m_FrameName = wxT( "PcbFrame" ); m_Draw_Axis = TRUE; // TRUE pour avoir les axes dessines diff --git a/share/drawframe.cpp b/share/drawframe.cpp index eeca44815e..bb546d8716 100644 --- a/share/drawframe.cpp +++ b/share/drawframe.cpp @@ -40,8 +40,8 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype, WinEDA_App* parent, const wxString& title, - const wxPoint& pos, const wxSize& size ) : - WinEDA_BasicFrame( father, idtype, parent, title, pos, size ) + const wxPoint& pos, const wxSize& size, long style ) : + WinEDA_BasicFrame( father, idtype, parent, title, pos, size, style ) { wxSize minsize; diff --git a/share/selcolor.cpp.notused b/share/selcolor.cpp.notused deleted file mode 100644 index 6c6f567559..0000000000 --- a/share/selcolor.cpp.notused +++ /dev/null @@ -1,166 +0,0 @@ -/************************/ -/* SETCOLOR.CPP */ -/************************/ - -/* Affichage et selection de la palette des couleurs disponibles - * dans une frame - */ - -#include "fctsys.h" -#include "gr_basic.h" - -#include "common.h" -#include "colors.h" - - -enum colors_id { - ID_COLOR_BLACK = 2000, // ID_COLOR_ = ID_COLOR_BLACK a ID_COLOR_BLACK + 31 -}; - - -/*******************************************/ -class WinEDA_SelColorFrame : public wxDialog -/*******************************************/ - -/* Frame d'affichage de la palette des couleurs disponibles - */ -{ -private: -public: - - // Constructor and destructor - WinEDA_SelColorFrame( wxWindow * parent, const wxPoint &framepos ); - ~WinEDA_SelColorFrame( void ) { }; - -private: - void SelColor( wxCommandEvent& event ); - - DECLARE_EVENT_TABLE() -}; - - -/* Construction de la table des evenements pour FrameClassMain */ -BEGIN_EVENT_TABLE( WinEDA_SelColorFrame, wxDialog ) -EVT_BUTTON( ID_COLOR_BLACK, WinEDA_SelColorFrame::SelColor ) -EVT_BUTTON( ID_COLOR_BLACK + 1, WinEDA_SelColorFrame::SelColor ) -EVT_BUTTON( ID_COLOR_BLACK + 2, WinEDA_SelColorFrame::SelColor ) -EVT_BUTTON( ID_COLOR_BLACK + 3, WinEDA_SelColorFrame::SelColor ) -EVT_BUTTON( ID_COLOR_BLACK + 4, WinEDA_SelColorFrame::SelColor ) -EVT_BUTTON( ID_COLOR_BLACK + 5, WinEDA_SelColorFrame::SelColor ) -EVT_BUTTON( ID_COLOR_BLACK + 6, WinEDA_SelColorFrame::SelColor ) -EVT_BUTTON( ID_COLOR_BLACK + 7, WinEDA_SelColorFrame::SelColor ) -EVT_BUTTON( ID_COLOR_BLACK + 8, WinEDA_SelColorFrame::SelColor ) -EVT_BUTTON( ID_COLOR_BLACK + 9, WinEDA_SelColorFrame::SelColor ) -EVT_BUTTON( ID_COLOR_BLACK + 10, WinEDA_SelColorFrame::SelColor ) -EVT_BUTTON( ID_COLOR_BLACK + 11, WinEDA_SelColorFrame::SelColor ) -EVT_BUTTON( ID_COLOR_BLACK + 12, WinEDA_SelColorFrame::SelColor ) -EVT_BUTTON( ID_COLOR_BLACK + 13, WinEDA_SelColorFrame::SelColor ) -EVT_BUTTON( ID_COLOR_BLACK + 14, WinEDA_SelColorFrame::SelColor ) -EVT_BUTTON( ID_COLOR_BLACK + 15, WinEDA_SelColorFrame::SelColor ) -EVT_BUTTON( ID_COLOR_BLACK + 16, WinEDA_SelColorFrame::SelColor ) -EVT_BUTTON( ID_COLOR_BLACK + 17, WinEDA_SelColorFrame::SelColor ) -EVT_BUTTON( ID_COLOR_BLACK + 18, WinEDA_SelColorFrame::SelColor ) -EVT_BUTTON( ID_COLOR_BLACK + 19, WinEDA_SelColorFrame::SelColor ) -EVT_BUTTON( ID_COLOR_BLACK + 20, WinEDA_SelColorFrame::SelColor ) -EVT_BUTTON( ID_COLOR_BLACK + 21, WinEDA_SelColorFrame::SelColor ) -EVT_BUTTON( ID_COLOR_BLACK + 22, WinEDA_SelColorFrame::SelColor ) -EVT_BUTTON( ID_COLOR_BLACK + 23, WinEDA_SelColorFrame::SelColor ) -EVT_BUTTON( ID_COLOR_BLACK + 24, WinEDA_SelColorFrame::SelColor ) -EVT_BUTTON( ID_COLOR_BLACK + 25, WinEDA_SelColorFrame::SelColor ) -EVT_BUTTON( ID_COLOR_BLACK + 26, WinEDA_SelColorFrame::SelColor ) -EVT_BUTTON( ID_COLOR_BLACK + 27, WinEDA_SelColorFrame::SelColor ) -EVT_BUTTON( ID_COLOR_BLACK + 28, WinEDA_SelColorFrame::SelColor ) -EVT_BUTTON( ID_COLOR_BLACK + 29, WinEDA_SelColorFrame::SelColor ) -EVT_BUTTON( ID_COLOR_BLACK + 30, WinEDA_SelColorFrame::SelColor ) -EVT_BUTTON( ID_COLOR_BLACK + 31, WinEDA_SelColorFrame::SelColor ) -END_EVENT_TABLE() - -/***************************************/ -int DisplayColorFrame( wxWindow* parent ) -/***************************************/ -{ - wxPoint framepos; - int color; - - wxGetMousePosition( &framepos.x, &framepos.y ); - - WinEDA_SelColorFrame* frame = new WinEDA_SelColorFrame( parent, framepos ); - - color = frame->ShowModal(); frame->Destroy(); - if( color > NBCOLOR ) - color = -1; - return color; -} - - -/*******************************************************************/ -WinEDA_SelColorFrame::WinEDA_SelColorFrame( wxWindow* parent, - const wxPoint& framepos ) : - wxDialog( parent, -1, _( "Colors" ), framepos, wxSize( 375, 240 ), - DIALOG_STYLE ) -/*******************************************************************/ -{ -#define START_Y 10 - wxBitmapButton* Button; - int ii, yy, butt_ID, buttcolor; - wxPoint pos; - int w = 20, h = 20; - - SetFont( *g_DialogFont ); - - SetReturnCode( -1 ); - - pos.x = 5; pos.y = START_Y; - for( ii = 0; ColorRefs[ii].m_Name != NULL; ii++ ) - { - butt_ID = ID_COLOR_BLACK + ii; - wxMemoryDC iconDC; - wxBitmap ButtBitmap( w, h ); - - wxBrush Brush; - iconDC.SelectObject( ButtBitmap ); - buttcolor = ColorRefs[ii].m_Numcolor; - iconDC.SetPen( *wxBLACK_PEN ); - Brush.SetColour( - ColorRefs[buttcolor].m_Red, - ColorRefs[buttcolor].m_Green, - ColorRefs[buttcolor].m_Blue - ); - Brush.SetStyle( wxSOLID ); - - iconDC.SetBrush( Brush ); - iconDC.SetBackground( *wxGREY_BRUSH ); - iconDC.Clear(); - iconDC.DrawRoundedRectangle( 0, 0, w, h, (double) h / 3 ); - - Button = new wxBitmapButton( this, butt_ID, - ButtBitmap, - wxPoint (pos.x, pos.y), wxSize (w, h) ); - - new wxStaticText( this, -1, - ColorRefs[ii].m_Name, - wxPoint (pos.x + 2 + w, pos.y + 4 ), - wxSize( -1, -1 ), 0 ); - - yy = h + 5; - pos.y += yy; - if( ii == 7 ) - { - pos.x += w + 80; pos.y = START_Y; - } - else if( (ii == 15) || (ii == 23) ) - { - pos.x += w + 110; pos.y = START_Y; - } - } -} - - -/*********************************************************/ -void WinEDA_SelColorFrame::SelColor( wxCommandEvent& event ) -/*********************************************************/ -{ - int id = event.GetId(); - - EndModal( id - ID_COLOR_BLACK ); -}