Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
718b2565
Commit
718b2565
authored
Feb 21, 2012
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Libedit: Add better dialog to edit an existing field of the current edited component.
parent
76e2efed
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
448 additions
and
76 deletions
+448
-76
CMakeLists.txt
eeschema/CMakeLists.txt
+1
-0
dialog_lib_edit_one_field.cpp
eeschema/dialogs/dialog_lib_edit_one_field.cpp
+208
-0
dialog_lib_edit_one_field.h
eeschema/dialogs/dialog_lib_edit_one_field.h
+32
-0
dialog_lib_edit_text.cpp
eeschema/dialogs/dialog_lib_edit_text.cpp
+49
-46
dialog_lib_edit_text.h
eeschema/dialogs/dialog_lib_edit_text.h
+2
-2
dialog_lib_edit_text_base.cpp
eeschema/dialogs/dialog_lib_edit_text_base.cpp
+4
-1
dialog_lib_edit_text_base.fbp
eeschema/dialogs/dialog_lib_edit_text_base.fbp
+131
-0
dialog_lib_edit_text_base.h
eeschema/dialogs/dialog_lib_edit_text_base.h
+7
-5
libedit_onleftclick.cpp
eeschema/libedit_onleftclick.cpp
+1
-1
libeditframe.cpp
eeschema/libeditframe.cpp
+2
-2
libeditframe.h
eeschema/libeditframe.h
+1
-1
libfield.cpp
eeschema/libfield.cpp
+10
-18
No files found.
eeschema/CMakeLists.txt
View file @
718b2565
...
...
@@ -50,6 +50,7 @@ set(EESCHEMA_SRCS
dialogs/dialog_edit_label_base.cpp
dialogs/dialog_edit_libentry_fields_in_lib.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_fbp.cpp
dialogs/dialog_eeschema_options_base.cpp
...
...
eeschema/dialogs/dialog_lib_edit_one_field.cpp
0 → 100644
View file @
718b2565
/**
* @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
;
}
}
}
eeschema/dialogs/dialog_lib_edit_one_field.h
0 → 100644
View file @
718b2565
#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_
eeschema/dialogs/dialog_lib_edit_text.cpp
View file @
718b2565
/**
* @file dialog_lib_edit_text.cpp
* @brief dialog to editing graphic texts (not fields) in bod
u
components.
* @brief dialog to editing graphic texts (not fields) in bod
y
components.
*/
/*
...
...
@@ -43,8 +43,8 @@
DIALOG_LIB_EDIT_TEXT
::
DIALOG_LIB_EDIT_TEXT
(
LIB_EDIT_FRAME
*
aParent
,
LIB_TEXT
*
aText
)
:
DIALOG_LIB_EDIT_TEXT_BASE
(
aParent
)
{
m_
P
arent
=
aParent
;
m_
G
raphicText
=
aText
;
m_
p
arent
=
aParent
;
m_
g
raphicText
=
aText
;
initDlg
();
GetSizer
()
->
SetSizeHints
(
this
);
...
...
@@ -58,29 +58,32 @@ void DIALOG_LIB_EDIT_TEXT::initDlg( )
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_
G
raphicText
->
m_Size
.
x
,
m_
P
arent
->
GetInternalUnits
()
);
msg
=
ReturnStringFromValue
(
g_UserUnit
,
m_
g
raphicText
->
m_Size
.
x
,
m_
p
arent
->
GetInternalUnits
()
);
m_TextSize
->
SetValue
(
msg
);
m_TextValue
->
SetValue
(
m_
G
raphicText
->
m_Text
);
m_TextValue
->
SetValue
(
m_
g
raphicText
->
m_Text
);
if
(
m_
G
raphicText
->
GetUnit
()
==
0
)
if
(
m_
g
raphicText
->
GetUnit
()
==
0
)
m_CommonUnit
->
SetValue
(
true
);
if
(
m_
G
raphicText
->
GetConvert
()
==
0
)
if
(
m_
g
raphicText
->
GetConvert
()
==
0
)
m_CommonConvert
->
SetValue
(
true
);
if
(
m_
G
raphicText
->
m_Orient
==
TEXT_ORIENT_VERT
)
if
(
m_
g
raphicText
->
m_Orient
==
TEXT_ORIENT_VERT
)
m_Orient
->
SetValue
(
true
);
int
shape
=
0
;
if
(
m_
G
raphicText
->
m_Italic
)
if
(
m_
g
raphicText
->
m_Italic
)
shape
=
1
;
if
(
m_
G
raphicText
->
m_Bold
)
if
(
m_
g
raphicText
->
m_Bold
)
shape
|=
2
;
m_TextShapeOpt
->
SetSelection
(
shape
);
switch
(
m_
G
raphicText
->
m_HJustify
)
switch
(
m_
g
raphicText
->
m_HJustify
)
{
case
GR_TEXT_HJUSTIFY_LEFT
:
m_TextHJustificationOpt
->
SetSelection
(
0
);
...
...
@@ -96,7 +99,7 @@ void DIALOG_LIB_EDIT_TEXT::initDlg( )
}
switch
(
m_
G
raphicText
->
m_VJustify
)
switch
(
m_
g
raphicText
->
m_VJustify
)
{
case
GR_TEXT_VJUSTIFY_BOTTOM
:
m_TextVJustificationOpt
->
SetSelection
(
0
);
...
...
@@ -113,15 +116,15 @@ void DIALOG_LIB_EDIT_TEXT::initDlg( )
}
else
{
msg
=
ReturnStringFromValue
(
g_UserUnit
,
m_
P
arent
->
m_textSize
,
m_
P
arent
->
GetInternalUnits
()
);
msg
=
ReturnStringFromValue
(
g_UserUnit
,
m_
p
arent
->
m_textSize
,
m_
p
arent
->
GetInternalUnits
()
);
m_TextSize
->
SetValue
(
msg
);
if
(
!
m_
P
arent
->
m_drawSpecificUnit
)
if
(
!
m_
p
arent
->
m_drawSpecificUnit
)
m_CommonUnit
->
SetValue
(
true
);
if
(
!
m_
P
arent
->
m_drawSpecificConvert
)
if
(
!
m_
p
arent
->
m_drawSpecificConvert
)
m_CommonConvert
->
SetValue
(
true
);
if
(
m_
P
arent
->
m_textOrientation
==
TEXT_ORIENT_VERT
)
if
(
m_
p
arent
->
m_textOrientation
==
TEXT_ORIENT_VERT
)
m_Orient
->
SetValue
(
true
);
}
...
...
@@ -144,75 +147,75 @@ void DIALOG_LIB_EDIT_TEXT::OnOkClick( wxCommandEvent& event )
wxString
Line
;
Line
=
m_TextValue
->
GetValue
();
m_
P
arent
->
m_textOrientation
=
m_Orient
->
GetValue
()
?
TEXT_ORIENT_VERT
:
TEXT_ORIENT_HORIZ
;
m_
p
arent
->
m_textOrientation
=
m_Orient
->
GetValue
()
?
TEXT_ORIENT_VERT
:
TEXT_ORIENT_HORIZ
;
wxString
msg
=
m_TextSize
->
GetValue
();
m_
Parent
->
m_textSize
=
ReturnValueFromString
(
g_UserUnit
,
msg
,
m_P
arent
->
GetInternalUnits
()
);
m_
P
arent
->
m_drawSpecificConvert
=
m_CommonConvert
->
GetValue
()
?
false
:
true
;
m_
P
arent
->
m_drawSpecificUnit
=
m_CommonUnit
->
GetValue
()
?
false
:
true
;
m_
parent
->
m_textSize
=
ReturnValueFromString
(
g_UserUnit
,
msg
,
m_p
arent
->
GetInternalUnits
()
);
m_
p
arent
->
m_drawSpecificConvert
=
m_CommonConvert
->
GetValue
()
?
false
:
true
;
m_
p
arent
->
m_drawSpecificUnit
=
m_CommonUnit
->
GetValue
()
?
false
:
true
;
if
(
m_
G
raphicText
)
if
(
m_
g
raphicText
)
{
if
(
!
Line
.
IsEmpty
()
)
m_
G
raphicText
->
SetText
(
Line
);
m_
g
raphicText
->
SetText
(
Line
);
else
m_
G
raphicText
->
SetText
(
wxT
(
"[null]"
)
);
m_
g
raphicText
->
SetText
(
wxT
(
"[null]"
)
);
m_
GraphicText
->
m_Size
.
x
=
m_GraphicText
->
m_Size
.
y
=
m_P
arent
->
m_textSize
;
m_
GraphicText
->
m_Orient
=
m_P
arent
->
m_textOrientation
;
m_
graphicText
->
m_Size
.
x
=
m_graphicText
->
m_Size
.
y
=
m_p
arent
->
m_textSize
;
m_
graphicText
->
m_Orient
=
m_p
arent
->
m_textOrientation
;
if
(
m_
P
arent
->
m_drawSpecificUnit
)
m_
GraphicText
->
SetUnit
(
m_P
arent
->
GetUnit
()
);
if
(
m_
p
arent
->
m_drawSpecificUnit
)
m_
graphicText
->
SetUnit
(
m_p
arent
->
GetUnit
()
);
else
m_
G
raphicText
->
SetUnit
(
0
);
m_
g
raphicText
->
SetUnit
(
0
);
if
(
m_
P
arent
->
m_drawSpecificConvert
)
m_
GraphicText
->
SetConvert
(
m_P
arent
->
GetConvert
()
);
if
(
m_
p
arent
->
m_drawSpecificConvert
)
m_
graphicText
->
SetConvert
(
m_p
arent
->
GetConvert
()
);
else
m_
G
raphicText
->
SetConvert
(
0
);
m_
g
raphicText
->
SetConvert
(
0
);
if
(
(
m_TextShapeOpt
->
GetSelection
()
&
1
)
!=
0
)
m_
G
raphicText
->
m_Italic
=
true
;
m_
g
raphicText
->
m_Italic
=
true
;
else
m_
G
raphicText
->
m_Italic
=
false
;
m_
g
raphicText
->
m_Italic
=
false
;
if
(
(
m_TextShapeOpt
->
GetSelection
()
&
2
)
!=
0
)
m_
G
raphicText
->
m_Bold
=
true
;
m_
g
raphicText
->
m_Bold
=
true
;
else
m_
G
raphicText
->
m_Bold
=
false
;
m_
g
raphicText
->
m_Bold
=
false
;
switch
(
m_TextHJustificationOpt
->
GetSelection
()
)
{
case
0
:
m_
G
raphicText
->
m_HJustify
=
GR_TEXT_HJUSTIFY_LEFT
;
m_
g
raphicText
->
m_HJustify
=
GR_TEXT_HJUSTIFY_LEFT
;
break
;
case
1
:
m_
G
raphicText
->
m_HJustify
=
GR_TEXT_HJUSTIFY_CENTER
;
m_
g
raphicText
->
m_HJustify
=
GR_TEXT_HJUSTIFY_CENTER
;
break
;
case
2
:
m_
G
raphicText
->
m_HJustify
=
GR_TEXT_HJUSTIFY_RIGHT
;
m_
g
raphicText
->
m_HJustify
=
GR_TEXT_HJUSTIFY_RIGHT
;
break
;
}
switch
(
m_TextVJustificationOpt
->
GetSelection
()
)
{
case
0
:
m_
G
raphicText
->
m_VJustify
=
GR_TEXT_VJUSTIFY_BOTTOM
;
m_
g
raphicText
->
m_VJustify
=
GR_TEXT_VJUSTIFY_BOTTOM
;
break
;
case
1
:
m_
G
raphicText
->
m_VJustify
=
GR_TEXT_VJUSTIFY_CENTER
;
m_
g
raphicText
->
m_VJustify
=
GR_TEXT_VJUSTIFY_CENTER
;
break
;
case
2
:
m_
G
raphicText
->
m_VJustify
=
GR_TEXT_VJUSTIFY_TOP
;
m_
g
raphicText
->
m_VJustify
=
GR_TEXT_VJUSTIFY_TOP
;
break
;
}
}
if
(
m_
P
arent
->
GetDrawItem
()
)
m_
Parent
->
GetDrawItem
()
->
DisplayInfo
(
m_P
arent
);
if
(
m_
p
arent
->
GetDrawItem
()
)
m_
parent
->
GetDrawItem
()
->
DisplayInfo
(
m_p
arent
);
EndModal
(
wxID_OK
);
}
eeschema/dialogs/dialog_lib_edit_text.h
View file @
718b2565
...
...
@@ -13,8 +13,8 @@ class LIB_TEXT;
class
DIALOG_LIB_EDIT_TEXT
:
public
DIALOG_LIB_EDIT_TEXT_BASE
{
private
:
LIB_EDIT_FRAME
*
m_
P
arent
;
LIB_TEXT
*
m_
G
raphicText
;
LIB_EDIT_FRAME
*
m_
p
arent
;
LIB_TEXT
*
m_
g
raphicText
;
public
:
DIALOG_LIB_EDIT_TEXT
(
LIB_EDIT_FRAME
*
aParent
,
LIB_TEXT
*
aText
);
...
...
eeschema/dialogs/dialog_lib_edit_text_base.cpp
View file @
718b2565
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version
Nov 17 2010
)
// C++ code generated with wxFormBuilder (version
Jun 30 2011
)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
...
...
@@ -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
);
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
);
wxString
m_TextShapeOptChoices
[]
=
{
_
(
"Normal"
),
_
(
"Italic"
),
_
(
"Bold"
),
_
(
"Bold Italic"
)
};
...
...
eeschema/dialogs/dialog_lib_edit_text_base.fbp
View file @
718b2565
This diff is collapsed.
Click to expand it.
eeschema/dialogs/dialog_lib_edit_text_base.h
View file @
718b2565
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version
Nov 17 2010
)
// C++ code generated with wxFormBuilder (version
Jun 30 2011
)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __
dialog_lib_edit_text_base
__
#define __
dialog_lib_edit_text_base
__
#ifndef __
DIALOG_LIB_EDIT_TEXT_BASE_H
__
#define __
DIALOG_LIB_EDIT_TEXT_BASE_H
__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
...
...
@@ -43,6 +44,7 @@ class DIALOG_LIB_EDIT_TEXT_BASE : public wxDialog
wxStaticLine
*
m_staticline1
;
wxCheckBox
*
m_CommonUnit
;
wxCheckBox
*
m_CommonConvert
;
wxCheckBox
*
m_Invisible
;
wxRadioBox
*
m_TextShapeOpt
;
wxRadioBox
*
m_TextHJustificationOpt
;
wxRadioBox
*
m_TextVJustificationOpt
;
...
...
@@ -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
__
eeschema/libedit_onleftclick.cpp
View file @
718b2565
...
...
@@ -206,7 +206,7 @@ void LIB_EDIT_FRAME::OnLeftDClick( wxDC* DC, const wxPoint& aPosition )
case
LIB_FIELD_T
:
if
(
m_drawItem
->
GetFlags
()
==
0
)
{
EditField
(
DC
,
(
LIB_FIELD
*
)
m_drawItem
);
EditField
(
(
LIB_FIELD
*
)
m_drawItem
);
}
break
;
...
...
eeschema/libeditframe.cpp
View file @
718b2565
...
...
@@ -775,7 +775,7 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
if
(
m_drawItem
->
Type
()
==
LIB_FIELD_T
)
{
EditField
(
&
dc
,
(
LIB_FIELD
*
)
m_drawItem
);
EditField
(
(
LIB_FIELD
*
)
m_drawItem
);
}
m_canvas
->
MoveCursorToCrossHair
();
...
...
@@ -992,7 +992,7 @@ void LIB_EDIT_FRAME::OnCreateNewPartFromExisting( wxCommandEvent& event )
INSTALL_UNBUFFERED_DC
(
dc
,
m_canvas
);
m_canvas
->
CrossHairOff
(
&
dc
);
EditField
(
&
dc
,
&
m_component
->
GetValueField
()
);
EditField
(
&
m_component
->
GetValueField
()
);
m_canvas
->
MoveCursorToCrossHair
();
m_canvas
->
CrossHairOn
(
&
dc
);
}
...
...
eeschema/libeditframe.h
View file @
718b2565
...
...
@@ -515,7 +515,7 @@ private:
void
EditSymbolText
(
wxDC
*
DC
,
LIB_ITEM
*
DrawItem
);
LIB_ITEM
*
LocateItemUsingCursor
(
const
wxPoint
&
aPosition
,
const
KICAD_T
aFilterList
[]
=
LIB_COLLECTOR
::
AllItems
);
void
EditField
(
wxDC
*
DC
,
LIB_FIELD
*
Field
);
void
EditField
(
LIB_FIELD
*
Field
);
public
:
/**
...
...
eeschema/libfield.cpp
View file @
718b2565
...
...
@@ -13,9 +13,10 @@
#include <libeditframe.h>
#include <class_library.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
title
;
...
...
@@ -36,19 +37,17 @@ void LIB_EDIT_FRAME::EditField( wxDC* DC, LIB_FIELD* aField )
}
else
{
caption
=
_
(
"Edit Field"
);
caption
.
Printf
(
_
(
"Edit Field %s"
),
GetChars
(
aField
->
GetName
()
)
);
title
.
Printf
(
_
(
"Enter a new value for the %s field."
),
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
;
text
=
dlg
.
GetValue
();
text
.
Replace
(
wxT
(
" "
),
wxT
(
"_"
)
);
text
=
dlg
.
GetTextField
();
// Perform some controls:
if
(
(
aField
->
GetId
()
==
REFERENCE
||
aField
->
GetId
()
==
VALUE
)
&&
text
.
IsEmpty
(
)
)
...
...
@@ -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
* errors when updating the library.
*/
if
(
aField
->
GetId
()
==
VALUE
)
if
(
(
aField
->
GetId
()
==
VALUE
)
&&
(
text
!=
aField
->
m_Text
)
)
{
wxString
msg
;
...
...
@@ -142,19 +141,12 @@ this component?" ),
}
if
(
!
aField
->
InEditMode
()
)
{
SaveCopyInUndoList
(
parent
);
(
(
LIB_ITEM
*
)
aField
)
->
Draw
(
m_canvas
,
DC
,
wxPoint
(
0
,
0
),
-
1
,
g_XorMode
,
&
fieldText
,
DefaultTransform
);
}
// Update field
dlg
.
TransfertDataToField
();
if
(
!
aField
->
InEditMode
()
)
{
fieldText
=
aField
->
GetFullText
(
m_unit
);
(
(
LIB_ITEM
*
)
aField
)
->
Draw
(
m_canvas
,
DC
,
wxPoint
(
0
,
0
),
-
1
,
g_XorMode
,
&
fieldText
,
DefaultTransform
);
}
m_canvas
->
Refresh
();
OnModify
();
UpdateAliasSelectList
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment