Commit 718b2565 authored by jean-pierre charras's avatar jean-pierre charras

Libedit: Add better dialog to edit an existing field of the current edited component.

parent 76e2efed
...@@ -50,6 +50,7 @@ set(EESCHEMA_SRCS ...@@ -50,6 +50,7 @@ set(EESCHEMA_SRCS
dialogs/dialog_edit_label_base.cpp dialogs/dialog_edit_label_base.cpp
dialogs/dialog_edit_libentry_fields_in_lib.cpp dialogs/dialog_edit_libentry_fields_in_lib.cpp
dialogs/dialog_edit_libentry_fields_in_lib_base.cpp dialogs/dialog_edit_libentry_fields_in_lib_base.cpp
dialogs/dialog_lib_edit_one_field.cpp
dialogs/dialog_eeschema_config.cpp dialogs/dialog_eeschema_config.cpp
dialogs/dialog_eeschema_config_fbp.cpp dialogs/dialog_eeschema_config_fbp.cpp
dialogs/dialog_eeschema_options_base.cpp dialogs/dialog_eeschema_options_base.cpp
......
/**
* @file dialog_lib_edit_one_field.cpp
* @brief dialog to editing fields ( not graphic texts) in components.
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2004-2012 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <fctsys.h>
#include <common.h>
#include <general.h>
#include <libeditframe.h>
#include <sch_component.h>
#include <template_fieldnames.h>
#include <class_libentry.h>
#include <lib_field.h>
#include <dialog_lib_edit_one_field.h>
DIALOG_LIB_EDIT_ONE_FIELD::DIALOG_LIB_EDIT_ONE_FIELD( LIB_EDIT_FRAME* aParent,
const wxString& aTitle,
LIB_FIELD* aField ) :
DIALOG_LIB_EDIT_TEXT_BASE( aParent )
{
m_parent = aParent;
m_field = aField;
SetTitle( aTitle );
initDlg();
GetSizer()->SetSizeHints(this);
Centre();
}
void DIALOG_LIB_EDIT_ONE_FIELD::initDlg( )
{
wxString msg;
m_TextValue->SetFocus();
// Disable options for graphic text edition, not existing in fields
m_CommonConvert->Show(false);
m_CommonUnit->Show(false);
if ( m_field )
{
msg = ReturnStringFromValue( g_UserUnit, m_field->m_Size.x,
m_parent->GetInternalUnits() );
m_TextSize->SetValue( msg );
m_TextValue->SetValue( m_field->m_Text );
if( m_field->GetOrientation() == TEXT_ORIENT_VERT )
m_Orient->SetValue( true );
if( m_field->GetOrientation() == TEXT_ORIENT_VERT )
m_Orient->SetValue( true );
m_Invisible->SetValue( m_field->IsVisible() ? false : true);
int shape = 0;
if( m_field->m_Italic )
shape = 1;
if( m_field->m_Bold )
shape |= 2;
m_TextShapeOpt->SetSelection( shape );
switch ( m_field->m_HJustify )
{
case GR_TEXT_HJUSTIFY_LEFT:
m_TextHJustificationOpt->SetSelection( 0 );
break;
case GR_TEXT_HJUSTIFY_CENTER:
m_TextHJustificationOpt->SetSelection( 1 );
break;
case GR_TEXT_HJUSTIFY_RIGHT:
m_TextHJustificationOpt->SetSelection( 2 );
break;
}
switch ( m_field->m_VJustify )
{
case GR_TEXT_VJUSTIFY_BOTTOM:
m_TextVJustificationOpt->SetSelection( 0 );
break;
case GR_TEXT_VJUSTIFY_CENTER:
m_TextVJustificationOpt->SetSelection( 1 );
break;
case GR_TEXT_VJUSTIFY_TOP:
m_TextVJustificationOpt->SetSelection( 2 );
break;
}
}
msg = m_TextSizeText->GetLabel() + ReturnUnitSymbol();
m_TextSizeText->SetLabel( msg );
m_sdbSizerButtonsOK->SetDefault();
}
void DIALOG_LIB_EDIT_ONE_FIELD::OnCancelClick( wxCommandEvent& event )
{
EndModal(wxID_CANCEL);
}
/* Updates the different parameters for the component being edited */
void DIALOG_LIB_EDIT_ONE_FIELD::OnOkClick( wxCommandEvent& event )
{
EndModal(wxID_OK);
}
wxString DIALOG_LIB_EDIT_ONE_FIELD::GetTextField()
{
wxString line = m_TextValue->GetValue();
line.Replace( wxT( " " ), wxT( "_" ) );
return line;
};
void DIALOG_LIB_EDIT_ONE_FIELD::TransfertDataToField()
{
int orientation = m_Orient->GetValue() ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ;
wxString msg = m_TextSize->GetValue();
int textSize = ReturnValueFromString( g_UserUnit, msg, m_parent->GetInternalUnits() );
if( m_field )
{
m_field->SetText( GetTextField() );
m_field->m_Size.x = m_field->m_Size.y = textSize;
m_field->m_Orient = orientation;
if( m_Invisible->GetValue() )
m_field->m_Attributs |= TEXT_NO_VISIBLE;
else
m_field->m_Attributs &= ~TEXT_NO_VISIBLE;
if( ( m_TextShapeOpt->GetSelection() & 1 ) != 0 )
m_field->m_Italic = true;
else
m_field->m_Italic = false;
if( ( m_TextShapeOpt->GetSelection() & 2 ) != 0 )
m_field->m_Bold = true;
else
m_field->m_Bold = false;
switch( m_TextHJustificationOpt->GetSelection() )
{
case 0:
m_field->m_HJustify = GR_TEXT_HJUSTIFY_LEFT;
break;
case 1:
m_field->m_HJustify = GR_TEXT_HJUSTIFY_CENTER;
break;
case 2:
m_field->m_HJustify = GR_TEXT_HJUSTIFY_RIGHT;
break;
}
switch( m_TextVJustificationOpt->GetSelection() )
{
case 0:
m_field->m_VJustify = GR_TEXT_VJUSTIFY_BOTTOM;
break;
case 1:
m_field->m_VJustify = GR_TEXT_VJUSTIFY_CENTER;
break;
case 2:
m_field->m_VJustify = GR_TEXT_VJUSTIFY_TOP;
break;
}
}
}
#ifndef _DIALOG_LIB_EDIT_ONE_FIELD_H_
#define _DIALOG_LIB_EDIT_ONE_FIELD_H_
#include <dialog_lib_edit_text_base.h>
class LIB_EDIT_FRAME;
class LIB_FIELD;
class DIALOG_LIB_EDIT_ONE_FIELD : public DIALOG_LIB_EDIT_TEXT_BASE
{
private:
LIB_EDIT_FRAME* m_parent;
LIB_FIELD* m_field;
public:
DIALOG_LIB_EDIT_ONE_FIELD( LIB_EDIT_FRAME* aParent, const wxString& aTitle, LIB_FIELD* aField );
~DIALOG_LIB_EDIT_ONE_FIELD() {};
void TransfertDataToField();
wxString GetTextField();
private:
void initDlg( );
void OnOkClick( wxCommandEvent& aEvent );
void OnCancelClick( wxCommandEvent& aEvent );
};
#endif // _DIALOG_LIB_EDIT_ONE_FIELD_H_
/** /**
* @file dialog_lib_edit_text.cpp * @file dialog_lib_edit_text.cpp
* @brief dialog to editing graphic texts (not fields) in bodu components. * @brief dialog to editing graphic texts (not fields) in body components.
*/ */
/* /*
...@@ -43,8 +43,8 @@ ...@@ -43,8 +43,8 @@
DIALOG_LIB_EDIT_TEXT::DIALOG_LIB_EDIT_TEXT( LIB_EDIT_FRAME* aParent, LIB_TEXT* aText ) : DIALOG_LIB_EDIT_TEXT::DIALOG_LIB_EDIT_TEXT( LIB_EDIT_FRAME* aParent, LIB_TEXT* aText ) :
DIALOG_LIB_EDIT_TEXT_BASE( aParent ) DIALOG_LIB_EDIT_TEXT_BASE( aParent )
{ {
m_Parent = aParent; m_parent = aParent;
m_GraphicText = aText; m_graphicText = aText;
initDlg(); initDlg();
GetSizer()->SetSizeHints(this); GetSizer()->SetSizeHints(this);
...@@ -58,29 +58,32 @@ void DIALOG_LIB_EDIT_TEXT::initDlg( ) ...@@ -58,29 +58,32 @@ void DIALOG_LIB_EDIT_TEXT::initDlg( )
m_TextValue->SetFocus(); m_TextValue->SetFocus();
if ( m_GraphicText ) // Disable options for fieldedition, not existing in graphic text
m_Invisible->Show(false);
if ( m_graphicText )
{ {
msg = ReturnStringFromValue( g_UserUnit, m_GraphicText->m_Size.x, msg = ReturnStringFromValue( g_UserUnit, m_graphicText->m_Size.x,
m_Parent->GetInternalUnits() ); m_parent->GetInternalUnits() );
m_TextSize->SetValue( msg ); m_TextSize->SetValue( msg );
m_TextValue->SetValue( m_GraphicText->m_Text ); m_TextValue->SetValue( m_graphicText->m_Text );
if ( m_GraphicText->GetUnit() == 0 ) if ( m_graphicText->GetUnit() == 0 )
m_CommonUnit->SetValue( true ); m_CommonUnit->SetValue( true );
if ( m_GraphicText->GetConvert() == 0 ) if ( m_graphicText->GetConvert() == 0 )
m_CommonConvert->SetValue( true ); m_CommonConvert->SetValue( true );
if ( m_GraphicText->m_Orient == TEXT_ORIENT_VERT ) if ( m_graphicText->m_Orient == TEXT_ORIENT_VERT )
m_Orient->SetValue( true ); m_Orient->SetValue( true );
int shape = 0; int shape = 0;
if ( m_GraphicText->m_Italic ) if ( m_graphicText->m_Italic )
shape = 1; shape = 1;
if ( m_GraphicText->m_Bold ) if ( m_graphicText->m_Bold )
shape |= 2; shape |= 2;
m_TextShapeOpt->SetSelection( shape ); m_TextShapeOpt->SetSelection( shape );
switch ( m_GraphicText->m_HJustify ) switch ( m_graphicText->m_HJustify )
{ {
case GR_TEXT_HJUSTIFY_LEFT: case GR_TEXT_HJUSTIFY_LEFT:
m_TextHJustificationOpt->SetSelection( 0 ); m_TextHJustificationOpt->SetSelection( 0 );
...@@ -96,7 +99,7 @@ void DIALOG_LIB_EDIT_TEXT::initDlg( ) ...@@ -96,7 +99,7 @@ void DIALOG_LIB_EDIT_TEXT::initDlg( )
} }
switch ( m_GraphicText->m_VJustify ) switch ( m_graphicText->m_VJustify )
{ {
case GR_TEXT_VJUSTIFY_BOTTOM: case GR_TEXT_VJUSTIFY_BOTTOM:
m_TextVJustificationOpt->SetSelection( 0 ); m_TextVJustificationOpt->SetSelection( 0 );
...@@ -113,15 +116,15 @@ void DIALOG_LIB_EDIT_TEXT::initDlg( ) ...@@ -113,15 +116,15 @@ void DIALOG_LIB_EDIT_TEXT::initDlg( )
} }
else else
{ {
msg = ReturnStringFromValue( g_UserUnit, m_Parent->m_textSize, msg = ReturnStringFromValue( g_UserUnit, m_parent->m_textSize,
m_Parent->GetInternalUnits() ); m_parent->GetInternalUnits() );
m_TextSize->SetValue( msg ); m_TextSize->SetValue( msg );
if ( ! m_Parent->m_drawSpecificUnit ) if ( ! m_parent->m_drawSpecificUnit )
m_CommonUnit->SetValue( true ); m_CommonUnit->SetValue( true );
if ( ! m_Parent->m_drawSpecificConvert ) if ( ! m_parent->m_drawSpecificConvert )
m_CommonConvert->SetValue( true ); m_CommonConvert->SetValue( true );
if ( m_Parent->m_textOrientation == TEXT_ORIENT_VERT ) if ( m_parent->m_textOrientation == TEXT_ORIENT_VERT )
m_Orient->SetValue( true ); m_Orient->SetValue( true );
} }
...@@ -144,75 +147,75 @@ void DIALOG_LIB_EDIT_TEXT::OnOkClick( wxCommandEvent& event ) ...@@ -144,75 +147,75 @@ void DIALOG_LIB_EDIT_TEXT::OnOkClick( wxCommandEvent& event )
wxString Line; wxString Line;
Line = m_TextValue->GetValue(); Line = m_TextValue->GetValue();
m_Parent->m_textOrientation = m_Orient->GetValue() ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ; m_parent->m_textOrientation = m_Orient->GetValue() ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ;
wxString msg = m_TextSize->GetValue(); wxString msg = m_TextSize->GetValue();
m_Parent->m_textSize = ReturnValueFromString( g_UserUnit, msg, m_Parent->GetInternalUnits() ); m_parent->m_textSize = ReturnValueFromString( g_UserUnit, msg, m_parent->GetInternalUnits() );
m_Parent->m_drawSpecificConvert = m_CommonConvert->GetValue() ? false : true; m_parent->m_drawSpecificConvert = m_CommonConvert->GetValue() ? false : true;
m_Parent->m_drawSpecificUnit = m_CommonUnit->GetValue() ? false : true; m_parent->m_drawSpecificUnit = m_CommonUnit->GetValue() ? false : true;
if( m_GraphicText ) if( m_graphicText )
{ {
if( ! Line.IsEmpty() ) if( ! Line.IsEmpty() )
m_GraphicText->SetText( Line ); m_graphicText->SetText( Line );
else else
m_GraphicText->SetText( wxT( "[null]" ) ); m_graphicText->SetText( wxT( "[null]" ) );
m_GraphicText->m_Size.x = m_GraphicText->m_Size.y = m_Parent->m_textSize; m_graphicText->m_Size.x = m_graphicText->m_Size.y = m_parent->m_textSize;
m_GraphicText->m_Orient = m_Parent->m_textOrientation; m_graphicText->m_Orient = m_parent->m_textOrientation;
if( m_Parent->m_drawSpecificUnit ) if( m_parent->m_drawSpecificUnit )
m_GraphicText->SetUnit( m_Parent->GetUnit() ); m_graphicText->SetUnit( m_parent->GetUnit() );
else else
m_GraphicText->SetUnit( 0 ); m_graphicText->SetUnit( 0 );
if( m_Parent->m_drawSpecificConvert ) if( m_parent->m_drawSpecificConvert )
m_GraphicText->SetConvert( m_Parent->GetConvert() ); m_graphicText->SetConvert( m_parent->GetConvert() );
else else
m_GraphicText->SetConvert( 0 ); m_graphicText->SetConvert( 0 );
if( ( m_TextShapeOpt->GetSelection() & 1 ) != 0 ) if( ( m_TextShapeOpt->GetSelection() & 1 ) != 0 )
m_GraphicText->m_Italic = true; m_graphicText->m_Italic = true;
else else
m_GraphicText->m_Italic = false; m_graphicText->m_Italic = false;
if( ( m_TextShapeOpt->GetSelection() & 2 ) != 0 ) if( ( m_TextShapeOpt->GetSelection() & 2 ) != 0 )
m_GraphicText->m_Bold = true; m_graphicText->m_Bold = true;
else else
m_GraphicText->m_Bold = false; m_graphicText->m_Bold = false;
switch( m_TextHJustificationOpt->GetSelection() ) switch( m_TextHJustificationOpt->GetSelection() )
{ {
case 0: case 0:
m_GraphicText->m_HJustify = GR_TEXT_HJUSTIFY_LEFT; m_graphicText->m_HJustify = GR_TEXT_HJUSTIFY_LEFT;
break; break;
case 1: case 1:
m_GraphicText->m_HJustify = GR_TEXT_HJUSTIFY_CENTER; m_graphicText->m_HJustify = GR_TEXT_HJUSTIFY_CENTER;
break; break;
case 2: case 2:
m_GraphicText->m_HJustify = GR_TEXT_HJUSTIFY_RIGHT; m_graphicText->m_HJustify = GR_TEXT_HJUSTIFY_RIGHT;
break; break;
} }
switch( m_TextVJustificationOpt->GetSelection() ) switch( m_TextVJustificationOpt->GetSelection() )
{ {
case 0: case 0:
m_GraphicText->m_VJustify = GR_TEXT_VJUSTIFY_BOTTOM; m_graphicText->m_VJustify = GR_TEXT_VJUSTIFY_BOTTOM;
break; break;
case 1: case 1:
m_GraphicText->m_VJustify = GR_TEXT_VJUSTIFY_CENTER; m_graphicText->m_VJustify = GR_TEXT_VJUSTIFY_CENTER;
break; break;
case 2: case 2:
m_GraphicText->m_VJustify = GR_TEXT_VJUSTIFY_TOP; m_graphicText->m_VJustify = GR_TEXT_VJUSTIFY_TOP;
break; break;
} }
} }
if( m_Parent->GetDrawItem() ) if( m_parent->GetDrawItem() )
m_Parent->GetDrawItem()->DisplayInfo( m_Parent ); m_parent->GetDrawItem()->DisplayInfo( m_parent );
EndModal(wxID_OK); EndModal(wxID_OK);
} }
...@@ -13,8 +13,8 @@ class LIB_TEXT; ...@@ -13,8 +13,8 @@ class LIB_TEXT;
class DIALOG_LIB_EDIT_TEXT : public DIALOG_LIB_EDIT_TEXT_BASE class DIALOG_LIB_EDIT_TEXT : public DIALOG_LIB_EDIT_TEXT_BASE
{ {
private: private:
LIB_EDIT_FRAME* m_Parent; LIB_EDIT_FRAME* m_parent;
LIB_TEXT* m_GraphicText; LIB_TEXT* m_graphicText;
public: public:
DIALOG_LIB_EDIT_TEXT( LIB_EDIT_FRAME* aParent, LIB_TEXT* aText ); DIALOG_LIB_EDIT_TEXT( LIB_EDIT_FRAME* aParent, LIB_TEXT* aText );
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 17 2010) // C++ code generated with wxFormBuilder (version Jun 30 2011)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -68,6 +68,9 @@ DIALOG_LIB_EDIT_TEXT_BASE::DIALOG_LIB_EDIT_TEXT_BASE( wxWindow* parent, wxWindow ...@@ -68,6 +68,9 @@ DIALOG_LIB_EDIT_TEXT_BASE::DIALOG_LIB_EDIT_TEXT_BASE( wxWindow* parent, wxWindow
m_CommonConvert = new wxCheckBox( this, wxID_ANY, _("Common to convert"), wxDefaultPosition, wxDefaultSize, 0 ); m_CommonConvert = new wxCheckBox( this, wxID_ANY, _("Common to convert"), wxDefaultPosition, wxDefaultSize, 0 );
sOptionsSizer->Add( m_CommonConvert, 0, wxALL|wxEXPAND, 5 ); sOptionsSizer->Add( m_CommonConvert, 0, wxALL|wxEXPAND, 5 );
m_Invisible = new wxCheckBox( this, wxID_ANY, _("Invisible"), wxDefaultPosition, wxDefaultSize, 0 );
sOptionsSizer->Add( m_Invisible, 0, wxALL, 5 );
bBottomtBoxSizer->Add( sOptionsSizer, 0, wxALL|wxEXPAND, 5 ); bBottomtBoxSizer->Add( sOptionsSizer, 0, wxALL|wxEXPAND, 5 );
wxString m_TextShapeOptChoices[] = { _("Normal"), _("Italic"), _("Bold"), _("Bold Italic") }; wxString m_TextShapeOptChoices[] = { _("Normal"), _("Italic"), _("Bold"), _("Bold Italic") };
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
<property name="disconnect_events">1</property> <property name="disconnect_events">1</property>
<property name="disconnect_mode">source_name</property> <property name="disconnect_mode">source_name</property>
<property name="disconnect_python_events">0</property> <property name="disconnect_python_events">0</property>
<property name="embedded_files_path">res</property>
<property name="encoding">UTF-8</property> <property name="encoding">UTF-8</property>
<property name="event_generation">connect</property> <property name="event_generation">connect</property>
<property name="file">dialog_lib_edit_text_base</property> <property name="file">dialog_lib_edit_text_base</property>
...@@ -28,6 +29,7 @@ ...@@ -28,6 +29,7 @@
<property name="TopDockable">1</property> <property name="TopDockable">1</property>
<property name="aui_managed">0</property> <property name="aui_managed">0</property>
<property name="aui_name"></property> <property name="aui_name"></property>
<property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="caption"></property> <property name="caption"></property>
<property name="caption_visible">1</property> <property name="caption_visible">1</property>
...@@ -50,8 +52,10 @@ ...@@ -50,8 +52,10 @@
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="layer"></property> <property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property> <property name="maximize_button">0</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property> <property name="minimize_button">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="moveable">1</property> <property name="moveable">1</property>
...@@ -80,6 +84,12 @@ ...@@ -80,6 +84,12 @@
<property name="window_style"></property> <property name="window_style"></property>
<event name="OnActivate"></event> <event name="OnActivate"></event>
<event name="OnActivateApp"></event> <event name="OnActivateApp"></event>
<event name="OnAuiFindManager"></event>
<event name="OnAuiPaneButton"></event>
<event name="OnAuiPaneClose"></event>
<event name="OnAuiPaneMaximize"></event>
<event name="OnAuiPaneRestore"></event>
<event name="OnAuiRender"></event>
<event name="OnChar"></event> <event name="OnChar"></event>
<event name="OnClose"></event> <event name="OnClose"></event>
<event name="OnEnterWindow"></event> <event name="OnEnterWindow"></event>
...@@ -150,6 +160,7 @@ ...@@ -150,6 +160,7 @@
<property name="RightDockable">1</property> <property name="RightDockable">1</property>
<property name="TopDockable">1</property> <property name="TopDockable">1</property>
<property name="aui_name"></property> <property name="aui_name"></property>
<property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="caption"></property> <property name="caption"></property>
<property name="caption_visible">1</property> <property name="caption_visible">1</property>
...@@ -170,8 +181,10 @@ ...@@ -170,8 +181,10 @@
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Text:</property> <property name="label">Text:</property>
<property name="layer"></property> <property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property> <property name="maximize_button">0</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property> <property name="minimize_button">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="moveable">1</property> <property name="moveable">1</property>
...@@ -234,6 +247,7 @@ ...@@ -234,6 +247,7 @@
<property name="RightDockable">1</property> <property name="RightDockable">1</property>
<property name="TopDockable">1</property> <property name="TopDockable">1</property>
<property name="aui_name"></property> <property name="aui_name"></property>
<property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="caption"></property> <property name="caption"></property>
<property name="caption_visible">1</property> <property name="caption_visible">1</property>
...@@ -253,9 +267,11 @@ ...@@ -253,9 +267,11 @@
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="layer"></property> <property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property> <property name="maximize_button">0</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="maxlength">0</property> <property name="maxlength">0</property>
<property name="min_size"></property>
<property name="minimize_button">0</property> <property name="minimize_button">0</property>
<property name="minimum_size">200,-1</property> <property name="minimum_size">200,-1</property>
<property name="moveable">1</property> <property name="moveable">1</property>
...@@ -333,6 +349,7 @@ ...@@ -333,6 +349,7 @@
<property name="RightDockable">1</property> <property name="RightDockable">1</property>
<property name="TopDockable">1</property> <property name="TopDockable">1</property>
<property name="aui_name"></property> <property name="aui_name"></property>
<property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="caption"></property> <property name="caption"></property>
<property name="caption_visible">1</property> <property name="caption_visible">1</property>
...@@ -353,8 +370,10 @@ ...@@ -353,8 +370,10 @@
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Size</property> <property name="label">Size</property>
<property name="layer"></property> <property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property> <property name="maximize_button">0</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property> <property name="minimize_button">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="moveable">1</property> <property name="moveable">1</property>
...@@ -417,6 +436,7 @@ ...@@ -417,6 +436,7 @@
<property name="RightDockable">1</property> <property name="RightDockable">1</property>
<property name="TopDockable">1</property> <property name="TopDockable">1</property>
<property name="aui_name"></property> <property name="aui_name"></property>
<property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="caption"></property> <property name="caption"></property>
<property name="caption_visible">1</property> <property name="caption_visible">1</property>
...@@ -436,9 +456,11 @@ ...@@ -436,9 +456,11 @@
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="layer"></property> <property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property> <property name="maximize_button">0</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="maxlength">0</property> <property name="maxlength">0</property>
<property name="min_size"></property>
<property name="minimize_button">0</property> <property name="minimize_button">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="moveable">1</property> <property name="moveable">1</property>
...@@ -530,6 +552,7 @@ ...@@ -530,6 +552,7 @@
<property name="RightDockable">1</property> <property name="RightDockable">1</property>
<property name="TopDockable">1</property> <property name="TopDockable">1</property>
<property name="aui_name"></property> <property name="aui_name"></property>
<property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="caption"></property> <property name="caption"></property>
<property name="caption_visible">1</property> <property name="caption_visible">1</property>
...@@ -551,8 +574,10 @@ ...@@ -551,8 +574,10 @@
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Vertical</property> <property name="label">Vertical</property>
<property name="layer"></property> <property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property> <property name="maximize_button">0</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property> <property name="minimize_button">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="moveable">1</property> <property name="moveable">1</property>
...@@ -615,6 +640,7 @@ ...@@ -615,6 +640,7 @@
<property name="RightDockable">1</property> <property name="RightDockable">1</property>
<property name="TopDockable">1</property> <property name="TopDockable">1</property>
<property name="aui_name"></property> <property name="aui_name"></property>
<property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="caption"></property> <property name="caption"></property>
<property name="caption_visible">1</property> <property name="caption_visible">1</property>
...@@ -634,8 +660,10 @@ ...@@ -634,8 +660,10 @@
<property name="hidden">0</property> <property name="hidden">0</property>
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="layer"></property> <property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property> <property name="maximize_button">0</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property> <property name="minimize_button">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="moveable">1</property> <property name="moveable">1</property>
...@@ -697,6 +725,7 @@ ...@@ -697,6 +725,7 @@
<property name="RightDockable">1</property> <property name="RightDockable">1</property>
<property name="TopDockable">1</property> <property name="TopDockable">1</property>
<property name="aui_name"></property> <property name="aui_name"></property>
<property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="caption"></property> <property name="caption"></property>
<property name="caption_visible">1</property> <property name="caption_visible">1</property>
...@@ -718,8 +747,10 @@ ...@@ -718,8 +747,10 @@
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Common to Units</property> <property name="label">Common to Units</property>
<property name="layer"></property> <property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property> <property name="maximize_button">0</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property> <property name="minimize_button">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="moveable">1</property> <property name="moveable">1</property>
...@@ -782,6 +813,7 @@ ...@@ -782,6 +813,7 @@
<property name="RightDockable">1</property> <property name="RightDockable">1</property>
<property name="TopDockable">1</property> <property name="TopDockable">1</property>
<property name="aui_name"></property> <property name="aui_name"></property>
<property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="caption"></property> <property name="caption"></property>
<property name="caption_visible">1</property> <property name="caption_visible">1</property>
...@@ -803,8 +835,10 @@ ...@@ -803,8 +835,10 @@
<property name="id">wxID_ANY</property> <property name="id">wxID_ANY</property>
<property name="label">Common to convert</property> <property name="label">Common to convert</property>
<property name="layer"></property> <property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property> <property name="maximize_button">0</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property> <property name="minimize_button">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="moveable">1</property> <property name="moveable">1</property>
...@@ -857,6 +891,94 @@ ...@@ -857,6 +891,94 @@
<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">wxALL</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_name"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="checked">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Invisible</property>
<property name="layer"></property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_Invisible</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="position"></property>
<property name="resize">Resizable</property>
<property name="row"></property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnCheckBox"></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="OnUpdateUI"></event>
</object>
</object>
</object> </object>
</object> </object>
<object class="sizeritem" expanded="0"> <object class="sizeritem" expanded="0">
...@@ -869,6 +991,7 @@ ...@@ -869,6 +991,7 @@
<property name="RightDockable">1</property> <property name="RightDockable">1</property>
<property name="TopDockable">1</property> <property name="TopDockable">1</property>
<property name="aui_name"></property> <property name="aui_name"></property>
<property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="caption"></property> <property name="caption"></property>
<property name="caption_visible">1</property> <property name="caption_visible">1</property>
...@@ -891,8 +1014,10 @@ ...@@ -891,8 +1014,10 @@
<property name="label">Text Shape:</property> <property name="label">Text Shape:</property>
<property name="layer"></property> <property name="layer"></property>
<property name="majorDimension">1</property> <property name="majorDimension">1</property>
<property name="max_size"></property>
<property name="maximize_button">0</property> <property name="maximize_button">0</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property> <property name="minimize_button">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="moveable">1</property> <property name="moveable">1</property>
...@@ -956,6 +1081,7 @@ ...@@ -956,6 +1081,7 @@
<property name="RightDockable">1</property> <property name="RightDockable">1</property>
<property name="TopDockable">1</property> <property name="TopDockable">1</property>
<property name="aui_name"></property> <property name="aui_name"></property>
<property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="caption"></property> <property name="caption"></property>
<property name="caption_visible">1</property> <property name="caption_visible">1</property>
...@@ -978,8 +1104,10 @@ ...@@ -978,8 +1104,10 @@
<property name="label">Horiz. Justify</property> <property name="label">Horiz. Justify</property>
<property name="layer"></property> <property name="layer"></property>
<property name="majorDimension">1</property> <property name="majorDimension">1</property>
<property name="max_size"></property>
<property name="maximize_button">0</property> <property name="maximize_button">0</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property> <property name="minimize_button">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="moveable">1</property> <property name="moveable">1</property>
...@@ -1043,6 +1171,7 @@ ...@@ -1043,6 +1171,7 @@
<property name="RightDockable">1</property> <property name="RightDockable">1</property>
<property name="TopDockable">1</property> <property name="TopDockable">1</property>
<property name="aui_name"></property> <property name="aui_name"></property>
<property name="best_size"></property>
<property name="bg"></property> <property name="bg"></property>
<property name="caption"></property> <property name="caption"></property>
<property name="caption_visible">1</property> <property name="caption_visible">1</property>
...@@ -1065,8 +1194,10 @@ ...@@ -1065,8 +1194,10 @@
<property name="label">Vert. Justify</property> <property name="label">Vert. Justify</property>
<property name="layer"></property> <property name="layer"></property>
<property name="majorDimension">1</property> <property name="majorDimension">1</property>
<property name="max_size"></property>
<property name="maximize_button">0</property> <property name="maximize_button">0</property>
<property name="maximum_size"></property> <property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property> <property name="minimize_button">0</property>
<property name="minimum_size"></property> <property name="minimum_size"></property>
<property name="moveable">1</property> <property name="moveable">1</property>
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Nov 17 2010) // C++ code generated with wxFormBuilder (version Jun 30 2011)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_lib_edit_text_base__ #ifndef __DIALOG_LIB_EDIT_TEXT_BASE_H__
#define __dialog_lib_edit_text_base__ #define __DIALOG_LIB_EDIT_TEXT_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h> #include <wx/intl.h>
#include <wx/string.h> #include <wx/string.h>
#include <wx/stattext.h> #include <wx/stattext.h>
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
...@@ -43,6 +44,7 @@ class DIALOG_LIB_EDIT_TEXT_BASE : public wxDialog ...@@ -43,6 +44,7 @@ class DIALOG_LIB_EDIT_TEXT_BASE : public wxDialog
wxStaticLine* m_staticline1; wxStaticLine* m_staticline1;
wxCheckBox* m_CommonUnit; wxCheckBox* m_CommonUnit;
wxCheckBox* m_CommonConvert; wxCheckBox* m_CommonConvert;
wxCheckBox* m_Invisible;
wxRadioBox* m_TextShapeOpt; wxRadioBox* m_TextShapeOpt;
wxRadioBox* m_TextHJustificationOpt; wxRadioBox* m_TextHJustificationOpt;
wxRadioBox* m_TextVJustificationOpt; wxRadioBox* m_TextVJustificationOpt;
...@@ -62,4 +64,4 @@ class DIALOG_LIB_EDIT_TEXT_BASE : public wxDialog ...@@ -62,4 +64,4 @@ class DIALOG_LIB_EDIT_TEXT_BASE : public wxDialog
}; };
#endif //__dialog_lib_edit_text_base__ #endif //__DIALOG_LIB_EDIT_TEXT_BASE_H__
...@@ -206,7 +206,7 @@ void LIB_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& aPosition ) ...@@ -206,7 +206,7 @@ void LIB_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& aPosition )
case LIB_FIELD_T: case LIB_FIELD_T:
if( m_drawItem->GetFlags() == 0 ) if( m_drawItem->GetFlags() == 0 )
{ {
EditField( DC, (LIB_FIELD*) m_drawItem ); EditField( (LIB_FIELD*) m_drawItem );
} }
break; break;
......
...@@ -775,7 +775,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -775,7 +775,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
if( m_drawItem->Type() == LIB_FIELD_T ) if( m_drawItem->Type() == LIB_FIELD_T )
{ {
EditField( &dc, (LIB_FIELD*) m_drawItem ); EditField( (LIB_FIELD*) m_drawItem );
} }
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
...@@ -992,7 +992,7 @@ void LIB_EDIT_FRAME::OnCreateNewPartFromExisting( wxCommandEvent& event ) ...@@ -992,7 +992,7 @@ void LIB_EDIT_FRAME::OnCreateNewPartFromExisting( wxCommandEvent& event )
INSTALL_UNBUFFERED_DC( dc, m_canvas ); INSTALL_UNBUFFERED_DC( dc, m_canvas );
m_canvas->CrossHairOff( &dc ); m_canvas->CrossHairOff( &dc );
EditField( &dc, &m_component->GetValueField() ); EditField( &m_component->GetValueField() );
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
m_canvas->CrossHairOn( &dc ); m_canvas->CrossHairOn( &dc );
} }
......
...@@ -515,7 +515,7 @@ private: ...@@ -515,7 +515,7 @@ private:
void EditSymbolText( wxDC* DC, LIB_ITEM* DrawItem ); void EditSymbolText( wxDC* DC, LIB_ITEM* DrawItem );
LIB_ITEM* LocateItemUsingCursor( const wxPoint& aPosition, LIB_ITEM* LocateItemUsingCursor( const wxPoint& aPosition,
const KICAD_T aFilterList[] = LIB_COLLECTOR::AllItems ); const KICAD_T aFilterList[] = LIB_COLLECTOR::AllItems );
void EditField( wxDC* DC, LIB_FIELD* Field ); void EditField( LIB_FIELD* Field );
public: public:
/** /**
......
...@@ -13,9 +13,10 @@ ...@@ -13,9 +13,10 @@
#include <libeditframe.h> #include <libeditframe.h>
#include <class_library.h> #include <class_library.h>
#include <template_fieldnames.h> #include <template_fieldnames.h>
#include <dialog_lib_edit_one_field.h>
void LIB_EDIT_FRAME::EditField( wxDC* DC, LIB_FIELD* aField ) void LIB_EDIT_FRAME::EditField( LIB_FIELD* aField )
{ {
wxString text; wxString text;
wxString title; wxString title;
...@@ -36,19 +37,17 @@ void LIB_EDIT_FRAME::EditField( wxDC* DC, LIB_FIELD* aField ) ...@@ -36,19 +37,17 @@ void LIB_EDIT_FRAME::EditField( wxDC* DC, LIB_FIELD* aField )
} }
else else
{ {
caption = _( "Edit Field" ); caption.Printf( _( "Edit Field %s" ), GetChars( aField->GetName() ) );
title.Printf( _( "Enter a new value for the %s field." ), title.Printf( _( "Enter a new value for the %s field." ),
GetChars( aField->GetName().Lower() ) ); GetChars( aField->GetName().Lower() ) );
} }
wxTextEntryDialog dlg( this, title, caption, aField->m_Text ); DIALOG_LIB_EDIT_ONE_FIELD dlg( this, caption, aField );
if( dlg.ShowModal() != wxID_OK || dlg.GetValue() == aField->m_Text ) if( dlg.ShowModal() != wxID_OK )
return; return;
text = dlg.GetValue(); text = dlg.GetTextField();
text.Replace( wxT( " " ), wxT( "_" ) );
// Perform some controls: // Perform some controls:
if( ( aField->GetId() == REFERENCE || aField->GetId() == VALUE ) && text.IsEmpty ( ) ) if( ( aField->GetId() == REFERENCE || aField->GetId() == VALUE ) && text.IsEmpty ( ) )
...@@ -72,7 +71,7 @@ void LIB_EDIT_FRAME::EditField( wxDC* DC, LIB_FIELD* aField ) ...@@ -72,7 +71,7 @@ void LIB_EDIT_FRAME::EditField( wxDC* DC, LIB_FIELD* aField )
* the old one. Rename the component and remove any conflicting aliases to prevent name * the old one. Rename the component and remove any conflicting aliases to prevent name
* errors when updating the library. * errors when updating the library.
*/ */
if( aField->GetId() == VALUE ) if( (aField->GetId() == VALUE) && ( text != aField->m_Text ) )
{ {
wxString msg; wxString msg;
...@@ -142,19 +141,12 @@ this component?" ), ...@@ -142,19 +141,12 @@ this component?" ),
} }
if( !aField->InEditMode() ) if( !aField->InEditMode() )
{
SaveCopyInUndoList( parent ); SaveCopyInUndoList( parent );
( (LIB_ITEM*) aField )->Draw( m_canvas, DC, wxPoint( 0, 0 ), -1, g_XorMode,
&fieldText, DefaultTransform );
}
// Update field
dlg.TransfertDataToField();
if( !aField->InEditMode() ) m_canvas->Refresh();
{
fieldText = aField->GetFullText( m_unit );
( (LIB_ITEM*) aField )->Draw( m_canvas, DC, wxPoint( 0, 0 ), -1, g_XorMode,
&fieldText, DefaultTransform );
}
OnModify(); OnModify();
UpdateAliasSelectList(); UpdateAliasSelectList();
......
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