Commit 26b20cad authored by charras's avatar charras

Better label dialog editor. Libedit: now, cannot change the component name to...

Better label dialog editor. Libedit: now, cannot change the component name to an existing alias name (eeschema crashes when happens)
parent 07ddb9cb
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#define BUILD_VERSION wxT("(20090504-unstable)") #define BUILD_VERSION wxT("(20090513-unstable)")
wxString g_BuildVersion wxString g_BuildVersion
......
...@@ -21,9 +21,8 @@ ...@@ -21,9 +21,8 @@
int DialogLabelEditor::ShowModally( WinEDA_SchematicFrame* parent, SCH_TEXT * CurrentText ) int DialogLabelEditor::ShowModally( WinEDA_SchematicFrame* parent, SCH_TEXT * CurrentText )
{ {
int ret; int ret;
bool multiline = CurrentText->m_MultilineAllowed;
DialogLabelEditor* dialog = new DialogLabelEditor( parent, CurrentText, multiline ); DialogLabelEditor* dialog = new DialogLabelEditor( parent, CurrentText );
// doing any post construction resizing is better done here than in // doing any post construction resizing is better done here than in
// OnInitDialog() since it tends to flash/redraw the dialog less. // OnInitDialog() since it tends to flash/redraw the dialog less.
...@@ -36,11 +35,12 @@ int DialogLabelEditor::ShowModally( WinEDA_SchematicFrame* parent, SCH_TEXT * C ...@@ -36,11 +35,12 @@ int DialogLabelEditor::ShowModally( WinEDA_SchematicFrame* parent, SCH_TEXT * C
DialogLabelEditor::DialogLabelEditor( WinEDA_SchematicFrame* parent, SCH_TEXT* CurrentText,bool multiline ) : DialogLabelEditor::DialogLabelEditor( WinEDA_SchematicFrame* parent, SCH_TEXT* CurrentText ) :
DialogLabelEditor_Base( parent,wxID_ANY,multiline ) DialogLabelEditor_Base( parent )
{ {
m_Parent = parent; m_Parent = parent;
m_CurrentText = CurrentText; m_CurrentText = CurrentText;
init();
} }
...@@ -48,6 +48,17 @@ void DialogLabelEditor::init() ...@@ -48,6 +48,17 @@ void DialogLabelEditor::init()
{ {
wxString msg; wxString msg;
if( m_CurrentText->m_MultilineAllowed )
{
m_TextLabel = m_textCtrlMultiline;
m_TextLabelSingleline->Show(false);
}
else
{
m_TextLabel = m_TextLabelSingleline;
m_textCtrlMultiline->Show(false);
}
m_TextLabel->SetValue( m_CurrentText->m_Text ); m_TextLabel->SetValue( m_CurrentText->m_Text );
m_TextLabel->SetFocus(); m_TextLabel->SetFocus();
......
...@@ -15,10 +15,11 @@ class DialogLabelEditor : public DialogLabelEditor_Base ...@@ -15,10 +15,11 @@ class DialogLabelEditor : public DialogLabelEditor_Base
private: private:
WinEDA_SchematicFrame * m_Parent; WinEDA_SchematicFrame * m_Parent;
SCH_TEXT * m_CurrentText; SCH_TEXT * m_CurrentText;
wxTextCtrl* m_TextLabel;
protected: protected:
// these are protected so that the static ShowModally() gets used. // these are protected so that the static ShowModally() gets used.
DialogLabelEditor( WinEDA_SchematicFrame* parent, SCH_TEXT * CurrentText, bool multiline); DialogLabelEditor( WinEDA_SchematicFrame* parent, SCH_TEXT * CurrentText);
~DialogLabelEditor(){}; ~DialogLabelEditor(){};
......
...@@ -9,26 +9,27 @@ ...@@ -9,26 +9,27 @@
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
DialogLabelEditor_Base::DialogLabelEditor_Base( wxWindow* parent, wxWindowID id, bool multiline,const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style ) DialogLabelEditor_Base::DialogLabelEditor_Base( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{ {
this->SetSizeHints( wxDefaultSize, wxDefaultSize ); this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bMainSizer; wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxHORIZONTAL ); bMainSizer = new wxBoxSizer( wxVERTICAL );
bSizerTextCtrl = new wxBoxSizer( wxVERTICAL );
m_staticText1 = new wxStaticText( this, wxID_ANY, _("Text"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticText1 = new wxStaticText( this, wxID_ANY, _("Text"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText1->Wrap( -1 ); m_staticText1->Wrap( -1 );
bSizerTextCtrl->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); bMainSizer->Add( m_staticText1, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
m_TextLabelSingleline = new wxTextCtrl( this, wxID_VALUE, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
m_TextLabelSingleline->SetToolTip( _("Enter the text to be used within the schematic") );
bMainSizer->Add( m_TextLabelSingleline, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
if (multiline) m_textCtrlMultiline = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_PROCESS_ENTER );
m_TextLabel = new wxTextCtrl( this, wxID_VALUE, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER | wxTE_MULTILINE ); m_textCtrlMultiline->SetToolTip( _("Enter the text to be used within the schematic") );
else m_textCtrlMultiline->SetMinSize( wxSize( -1,60 ) );
m_TextLabel = new wxTextCtrl( this, wxID_VALUE, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER );
m_TextLabel->SetToolTip( _("Enter the text to be used within the schematic") );
bSizerTextCtrl->Add( m_TextLabel, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); bMainSizer->Add( m_textCtrlMultiline, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
wxBoxSizer* m_OptionsSizer; wxBoxSizer* m_OptionsSizer;
m_OptionsSizer = new wxBoxSizer( wxHORIZONTAL ); m_OptionsSizer = new wxBoxSizer( wxHORIZONTAL );
...@@ -51,10 +52,6 @@ DialogLabelEditor_Base::DialogLabelEditor_Base( wxWindow* parent, wxWindowID id, ...@@ -51,10 +52,6 @@ DialogLabelEditor_Base::DialogLabelEditor_Base( wxWindow* parent, wxWindowID id,
m_TextShape->SetSelection( 0 ); m_TextShape->SetSelection( 0 );
m_OptionsSizer->Add( m_TextShape, 1, wxALL, 5 ); m_OptionsSizer->Add( m_TextShape, 1, wxALL, 5 );
bSizerTextCtrl->Add( m_OptionsSizer, 1, wxEXPAND, 5 );
bMainSizer->Add( bSizerTextCtrl, 5, wxEXPAND, 5 );
wxBoxSizer* bSizer4; wxBoxSizer* bSizer4;
bSizer4 = new wxBoxSizer( wxVERTICAL ); bSizer4 = new wxBoxSizer( wxVERTICAL );
...@@ -66,7 +63,7 @@ DialogLabelEditor_Base::DialogLabelEditor_Base( wxWindow* parent, wxWindowID id, ...@@ -66,7 +63,7 @@ DialogLabelEditor_Base::DialogLabelEditor_Base( wxWindow* parent, wxWindowID id,
bSizer4->Add( m_TextSize, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 ); bSizer4->Add( m_TextSize, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND, 5 );
bSizer4->Add( 8, 8, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 ); bSizer4->Add( 8, 8, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND, 5 );
m_buttonOK = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonOK = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer4->Add( m_buttonOK, 1, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); bSizer4->Add( m_buttonOK, 1, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
...@@ -74,13 +71,15 @@ DialogLabelEditor_Base::DialogLabelEditor_Base( wxWindow* parent, wxWindowID id, ...@@ -74,13 +71,15 @@ DialogLabelEditor_Base::DialogLabelEditor_Base( wxWindow* parent, wxWindowID id,
m_buttonCANCEL = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonCANCEL = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer4->Add( m_buttonCANCEL, 1, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 ); bSizer4->Add( m_buttonCANCEL, 1, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
bMainSizer->Add( bSizer4, 1, 0, 5 ); m_OptionsSizer->Add( bSizer4, 1, 0, 5 );
bMainSizer->Add( m_OptionsSizer, 1, wxEXPAND, 5 );
this->SetSizer( bMainSizer ); this->SetSizer( bMainSizer );
this->Layout(); this->Layout();
// Connect Events // Connect Events
m_TextLabel->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DialogLabelEditor_Base::onEnterKey ), NULL, this ); m_TextLabelSingleline->Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DialogLabelEditor_Base::onEnterKey ), NULL, this );
m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnButtonOKClick ), NULL, this ); m_buttonOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnButtonOKClick ), NULL, this );
m_buttonCANCEL->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnButtonCANCEL_Click ), NULL, this ); m_buttonCANCEL->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnButtonCANCEL_Click ), NULL, this );
} }
...@@ -88,7 +87,7 @@ DialogLabelEditor_Base::DialogLabelEditor_Base( wxWindow* parent, wxWindowID id, ...@@ -88,7 +87,7 @@ DialogLabelEditor_Base::DialogLabelEditor_Base( wxWindow* parent, wxWindowID id,
DialogLabelEditor_Base::~DialogLabelEditor_Base() DialogLabelEditor_Base::~DialogLabelEditor_Base()
{ {
// Disconnect Events // Disconnect Events
m_TextLabel->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DialogLabelEditor_Base::onEnterKey ), NULL, this ); m_TextLabelSingleline->Disconnect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DialogLabelEditor_Base::onEnterKey ), NULL, this );
m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnButtonOKClick ), NULL, this ); m_buttonOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnButtonOKClick ), NULL, this );
m_buttonCANCEL->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnButtonCANCEL_Click ), NULL, this ); m_buttonCANCEL->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DialogLabelEditor_Base::OnButtonCANCEL_Click ), NULL, this );
} }
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">DialogLabelEditor_Base</property> <property name="name">DialogLabelEditor_Base</property>
<property name="pos"></property> <property name="pos"></property>
<property name="size">600,216</property> <property name="size">526,281</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property> <property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="title">Text Editor</property> <property name="title">Text Editor</property>
...@@ -73,17 +73,8 @@ ...@@ -73,17 +73,8 @@
<object class="wxBoxSizer" expanded="1"> <object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">bMainSizer</property> <property name="name">bMainSizer</property>
<property name="orient">wxHORIZONTAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">5</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerTextCtrl</property>
<property name="orient">wxVERTICAL</property> <property name="orient">wxVERTICAL</property>
<property name="permission">protected</property> <property name="permission">none</property>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxTOP|wxRIGHT|wxLEFT</property> <property name="flag">wxTOP|wxRIGHT|wxLEFT</property>
...@@ -150,7 +141,7 @@ ...@@ -150,7 +141,7 @@
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="maxlength">0</property> <property name="maxlength">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="name">m_TextLabel</property> <property name="name">m_TextLabelSingleline</property>
<property name="permission">protected</property> <property name="permission">protected</property>
<property name="pos"></property> <property name="pos"></property>
<property name="size"></property> <property name="size"></property>
...@@ -190,6 +181,61 @@ ...@@ -190,6 +181,61 @@
<event name="OnUpdateUI"></event> <event name="OnUpdateUI"></event>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxTextCtrl" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="font"></property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="maxlength">0</property>
<property name="minimum_size">-1,60</property>
<property name="name">m_textCtrlMultiline</property>
<property name="permission">protected</property>
<property name="pos"></property>
<property name="size"></property>
<property name="style">wxTE_MULTILINE|wxTE_PROCESS_ENTER</property>
<property name="subclass"></property>
<property name="tooltip">Enter the text to be used within the schematic</property>
<property name="value"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnText"></event>
<event name="OnTextEnter"></event>
<event name="OnTextMaxLen"></event>
<event name="OnTextURL"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND</property> <property name="flag">wxEXPAND</property>
...@@ -361,10 +407,6 @@ ...@@ -361,10 +407,6 @@
<event name="OnUpdateUI"></event> <event name="OnUpdateUI"></event>
</object> </object>
</object> </object>
</object>
</object>
</object>
</object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag"></property> <property name="flag"></property>
...@@ -482,7 +524,7 @@ ...@@ -482,7 +524,7 @@
</object> </object>
<object class="sizeritem" expanded="1"> <object class="sizeritem" expanded="1">
<property name="border">5</property> <property name="border">5</property>
<property name="flag">wxEXPAND|wxALIGN_CENTER_HORIZONTAL</property> <property name="flag">wxALIGN_CENTER_HORIZONTAL|wxEXPAND</property>
<property name="proportion">0</property> <property name="proportion">0</property>
<object class="spacer" expanded="1"> <object class="spacer" expanded="1">
<property name="height">8</property> <property name="height">8</property>
...@@ -599,4 +641,6 @@ ...@@ -599,4 +641,6 @@
</object> </object>
</object> </object>
</object> </object>
</object>
</object>
</wxFormBuilder_Project> </wxFormBuilder_Project>
...@@ -18,8 +18,8 @@ ...@@ -18,8 +18,8 @@
#include <wx/settings.h> #include <wx/settings.h>
#include <wx/textctrl.h> #include <wx/textctrl.h>
#include <wx/radiobox.h> #include <wx/radiobox.h>
#include <wx/sizer.h>
#include <wx/button.h> #include <wx/button.h>
#include <wx/sizer.h>
#include <wx/dialog.h> #include <wx/dialog.h>
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
...@@ -38,9 +38,9 @@ class DialogLabelEditor_Base : public wxDialog ...@@ -38,9 +38,9 @@ class DialogLabelEditor_Base : public wxDialog
wxID_SIZE, wxID_SIZE,
}; };
wxBoxSizer* bSizerTextCtrl;
wxStaticText* m_staticText1; wxStaticText* m_staticText1;
wxTextCtrl* m_TextLabel; wxTextCtrl* m_TextLabelSingleline;
wxTextCtrl* m_textCtrlMultiline;
wxRadioBox* m_TextOrient; wxRadioBox* m_TextOrient;
wxRadioBox* m_TextStyle; wxRadioBox* m_TextStyle;
wxRadioBox* m_TextShape; wxRadioBox* m_TextShape;
...@@ -57,7 +57,7 @@ class DialogLabelEditor_Base : public wxDialog ...@@ -57,7 +57,7 @@ class DialogLabelEditor_Base : public wxDialog
public: public:
DialogLabelEditor_Base( wxWindow* parent, wxWindowID id = wxID_ANY, bool multiline=false, const wxString& title = _("Text Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 600,216 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER ); DialogLabelEditor_Base( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Text Editor"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 526,281 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DialogLabelEditor_Base(); ~DialogLabelEditor_Base();
}; };
......
...@@ -21,10 +21,12 @@ ...@@ -21,10 +21,12 @@
/* Routines locales */ /* Routines locales */
static void ShowMoveField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); static void ShowMoveField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
/* if the field is the reference, return reference like schematic, i.e U -> U? or U?A /* if the field is the reference, return reference like schematic, i.e U -> U? or U?A
* or the field text for others * or the field text for others
*/ */
static wxString ReturnFieldFullText( LibDrawField* aField); static wxString ReturnFieldFullText( LibDrawField* aField );
/* Variables locales */ /* Variables locales */
extern int CurrentUnit; extern int CurrentUnit;
...@@ -82,9 +84,9 @@ void WinEDA_LibeditFrame::StartMoveField( wxDC* DC, LibDrawField* field ) ...@@ -82,9 +84,9 @@ void WinEDA_LibeditFrame::StartMoveField( wxDC* DC, LibDrawField* field )
/* if the field is the reference, return reference like schematic, i.e U -> U? or U?A /* if the field is the reference, return reference like schematic, i.e U -> U? or U?A
* or the field text for others * or the field text for others
*/ */
static wxString ReturnFieldFullText( LibDrawField* aField) static wxString ReturnFieldFullText( LibDrawField* aField )
{ {
if ( aField->m_FieldId != REFERENCE ) if( aField->m_FieldId != REFERENCE )
return aField->m_Text; return aField->m_Text;
wxString text = aField->m_Text; wxString text = aField->m_Text;
...@@ -106,6 +108,7 @@ static wxString ReturnFieldFullText( LibDrawField* aField) ...@@ -106,6 +108,7 @@ static wxString ReturnFieldFullText( LibDrawField* aField)
return text; return text;
} }
/*****************************************************************/ /*****************************************************************/
/* Routine d'affichage du texte 'Field' en cours de deplacement. */ /* Routine d'affichage du texte 'Field' en cours de deplacement. */
/* Routine normalement attachee au curseur */ /* Routine normalement attachee au curseur */
...@@ -228,7 +231,7 @@ void WinEDA_LibeditFrame::EditField( wxDC* DC, LibDrawField* Field ) ...@@ -228,7 +231,7 @@ void WinEDA_LibeditFrame::EditField( wxDC* DC, LibDrawField* Field )
break; break;
case VALUE: case VALUE:
title = wxT( "Value:" ); title = wxT( "Component Name / Value:" );
color = ReturnLayerColor( LAYER_VALUEPART ); color = ReturnLayerColor( LAYER_VALUEPART );
break; break;
...@@ -244,6 +247,26 @@ void WinEDA_LibeditFrame::EditField( wxDC* DC, LibDrawField* Field ) ...@@ -244,6 +247,26 @@ void WinEDA_LibeditFrame::EditField( wxDC* DC, LibDrawField* Field )
Get_Message( title, _( "Edit field" ), Text, this ); Get_Message( title, _( "Edit field" ), Text, this );
Text.Replace( wxT( " " ), wxT( "_" ) ); Text.Replace( wxT( " " ), wxT( "_" ) );
/* If the value is changed, this is equivalent to create a new component from the old one
* So we must check for an existing alias of this "new" component
* and change the value only if there is no existing alias with the same name
* for this component
*/
if( Field->m_FieldId == VALUE )
{
/* test for an existing name in alias list: */
for( unsigned ii = 0; ii < CurrentLibEntry->m_AliasList.GetCount(); ii += ALIAS_NEXT )
{
wxString aliasname = CurrentLibEntry->m_AliasList[ii + ALIAS_NAME];
if( Text.CmpNoCase( aliasname ) == 0 )
{
DisplayError( this,
_( "This name is an existing alias of the component\nAborting" ), 10 );
return;
}
}
}
GRSetDrawMode( DC, g_XorMode ); GRSetDrawMode( DC, g_XorMode );
DrawGraphicText( DrawPanel, DC, wxPoint( Field->m_Pos.x, -Field->m_Pos.y ), DrawGraphicText( DrawPanel, DC, wxPoint( Field->m_Pos.x, -Field->m_Pos.y ),
color, ReturnFieldFullText( Field ), color, ReturnFieldFullText( Field ),
...@@ -380,20 +403,22 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::LocateItemUsingCursor() ...@@ -380,20 +403,22 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::LocateItemUsingCursor()
if( CurrentLibEntry == NULL ) if( CurrentLibEntry == NULL )
return NULL; return NULL;
if( (DrawEntry == NULL) || (DrawEntry->m_Flags == 0) ) if( (DrawEntry == NULL) || (DrawEntry->m_Flags == 0) ) // Simple localisation des elements
{ // Simple localisation des elements {
DrawEntry = LocatePin( DrawEntry = LocatePin(
GetScreen()->m_Curseur, CurrentLibEntry, CurrentUnit, CurrentConvert ); GetScreen()->m_Curseur, CurrentLibEntry, CurrentUnit, CurrentConvert );
if( DrawEntry == NULL ) if( DrawEntry == NULL )
{ {
DrawEntry = CurrentDrawItem = LocateDrawItem( (SCH_SCREEN*) GetScreen(), DrawEntry = CurrentDrawItem = LocateDrawItem( (SCH_SCREEN*) GetScreen(),
GetScreen()->m_MousePosition, CurrentLibEntry, CurrentUnit, GetScreen()->m_MousePosition,
CurrentLibEntry, CurrentUnit,
CurrentConvert, LOCATE_ALL_DRAW_ITEM ); CurrentConvert, LOCATE_ALL_DRAW_ITEM );
} }
if( DrawEntry == NULL ) if( DrawEntry == NULL )
{ {
DrawEntry = CurrentDrawItem = LocateDrawItem( (SCH_SCREEN*) GetScreen(), DrawEntry = CurrentDrawItem = LocateDrawItem( (SCH_SCREEN*) GetScreen(),
GetScreen()->m_Curseur, CurrentLibEntry, CurrentUnit, GetScreen()->m_Curseur, CurrentLibEntry,
CurrentUnit,
CurrentConvert, LOCATE_ALL_DRAW_ITEM ); CurrentConvert, LOCATE_ALL_DRAW_ITEM );
} }
if( DrawEntry == NULL ) if( DrawEntry == NULL )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment