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
1f7fc494
Commit
1f7fc494
authored
May 09, 2009
by
drannou
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
multiline feature for eeschema with 'save schematic' bug fix
parent
4757c175
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
74 additions
and
17 deletions
+74
-17
class_text-label.cpp
eeschema/class_text-label.cpp
+19
-6
class_text-label.h
eeschema/class_text-label.h
+5
-2
dialog_edit_label.cpp
eeschema/dialog_edit_label.cpp
+18
-3
dialog_edit_label.h
eeschema/dialog_edit_label.h
+1
-1
dialog_edit_label_base.cpp
eeschema/dialog_edit_label_base.cpp
+5
-2
dialog_edit_label_base.h
eeschema/dialog_edit_label_base.h
+1
-1
load_one_schematic_file.cpp
eeschema/load_one_schematic_file.cpp
+14
-0
read_from_file_schematic_items_descriptions.cpp
eeschema/read_from_file_schematic_items_descriptions.cpp
+11
-2
No files found.
eeschema/class_text-label.cpp
View file @
1f7fc494
...
...
@@ -84,6 +84,7 @@ SCH_TEXT::SCH_TEXT( const wxPoint& pos, const wxString& text, KICAD_T aType ) :
m_Pos
=
pos
;
m_Shape
=
0
;
m_IsDangling
=
FALSE
;
m_MultilineAllowed
=
true
;
}
...
...
@@ -243,7 +244,6 @@ void SCH_TEXT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& aOffset,
DrawDanglingSymbol
(
panel
,
DC
,
m_Pos
+
aOffset
,
color
);
}
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
...
...
@@ -257,11 +257,24 @@ bool SCH_TEXT::Save( FILE* aFile ) const
if
(
m_Italic
)
shape
=
"Italic"
;
wxString
text
=
m_Text
;
for
(;;)
{
int
i
=
text
.
find
(
'\n'
);
if
(
i
==
wxNOT_FOUND
)
break
;
text
.
erase
(
i
,
1
);
text
.
insert
(
i
,
_
(
"
\\
n"
));
}
if
(
fprintf
(
aFile
,
"Text Notes %-4d %-4d %-4d %-4d %s %d
\n
%s
\n
"
,
m_Pos
.
x
,
m_Pos
.
y
,
m_Orient
,
m_Size
.
x
,
shape
,
m_Width
,
CONV_TO_UTF8
(
m_T
ext
)
)
==
EOF
)
CONV_TO_UTF8
(
t
ext
)
)
==
EOF
)
{
success
=
false
;
}
...
...
eeschema/class_text-label.h
View file @
1f7fc494
...
...
@@ -22,15 +22,16 @@ typedef enum {
extern
const
char
*
SheetLabelType
[];
extern
int
*
TemplateShape
[
5
][
4
];
class
SCH_TEXT
:
public
SCH_ITEM
,
public
EDA_TextStruct
{
public
:
int
m_Layer
;
int
m_Shape
;
bool
m_IsDangling
;
// TRUE if not connected
public
:
SCH_TEXT
(
const
wxPoint
&
pos
=
wxPoint
(
0
,
0
),
const
wxString
&
text
=
wxEmptyString
,
KICAD_T
aType
=
TYPE_SCH_TEXT
);
...
...
@@ -71,6 +72,8 @@ public:
#endif
};
...
...
eeschema/dialog_edit_label.cpp
View file @
1f7fc494
...
...
@@ -21,7 +21,22 @@
int
DialogLabelEditor
::
ShowModally
(
WinEDA_SchematicFrame
*
parent
,
SCH_TEXT
*
CurrentText
)
{
int
ret
;
DialogLabelEditor
*
dialog
=
new
DialogLabelEditor
(
parent
,
CurrentText
);
bool
multiline
;
switch
(
CurrentText
->
Type
()
)
{
case
TYPE_SCH_GLOBALLABEL
:
case
TYPE_SCH_HIERLABEL
:
case
TYPE_SCH_LABEL
:
multiline
=
false
;
break
;
default
:
multiline
=
true
;
break
;
}
DialogLabelEditor
*
dialog
=
new
DialogLabelEditor
(
parent
,
CurrentText
,
multiline
);
// doing any post construction resizing is better done here than in
// OnInitDialog() since it tends to flash/redraw the dialog less.
...
...
@@ -34,8 +49,8 @@ int DialogLabelEditor::ShowModally( WinEDA_SchematicFrame* parent, SCH_TEXT * C
DialogLabelEditor
::
DialogLabelEditor
(
WinEDA_SchematicFrame
*
parent
,
SCH_TEXT
*
CurrentText
)
:
DialogLabelEditor_Base
(
parent
)
DialogLabelEditor
::
DialogLabelEditor
(
WinEDA_SchematicFrame
*
parent
,
SCH_TEXT
*
CurrentText
,
bool
multiline
)
:
DialogLabelEditor_Base
(
parent
,
wxID_ANY
,
multiline
)
{
m_Parent
=
parent
;
m_CurrentText
=
CurrentText
;
...
...
eeschema/dialog_edit_label.h
View file @
1f7fc494
...
...
@@ -18,7 +18,7 @@ private:
protected
:
// these are protected so that the static ShowModally() gets used.
DialogLabelEditor
(
WinEDA_SchematicFrame
*
parent
,
SCH_TEXT
*
CurrentText
);
DialogLabelEditor
(
WinEDA_SchematicFrame
*
parent
,
SCH_TEXT
*
CurrentText
,
bool
multiline
);
~
DialogLabelEditor
(){};
...
...
eeschema/dialog_edit_label_base.cpp
View file @
1f7fc494
...
...
@@ -9,7 +9,7 @@
///////////////////////////////////////////////////////////////////////////
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
)
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
)
{
this
->
SetSizeHints
(
wxDefaultSize
,
wxDefaultSize
);
...
...
@@ -22,6 +22,9 @@ DialogLabelEditor_Base::DialogLabelEditor_Base( wxWindow* parent, wxWindowID id,
m_staticText1
->
Wrap
(
-
1
);
bSizerTextCtrl
->
Add
(
m_staticText1
,
0
,
wxTOP
|
wxRIGHT
|
wxLEFT
,
5
);
if
(
multiline
)
m_TextLabel
=
new
wxTextCtrl
(
this
,
wxID_VALUE
,
wxEmptyString
,
wxDefaultPosition
,
wxDefaultSize
,
wxTE_PROCESS_ENTER
|
wxTE_MULTILINE
);
else
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"
)
);
...
...
eeschema/dialog_edit_label_base.h
View file @
1f7fc494
...
...
@@ -57,7 +57,7 @@ class DialogLabelEditor_Base : public wxDialog
public
:
DialogLabelEditor_Base
(
wxWindow
*
parent
,
wxWindowID
id
=
wxID_ANY
,
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
,
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
();
};
...
...
eeschema/load_one_schematic_file.cpp
View file @
1f7fc494
...
...
@@ -148,6 +148,20 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen,
else
if
(
Line
[
1
]
==
'D'
)
Failed
=
ReadSchemaDescr
(
this
,
Line
,
f
,
MsgDiag
,
&
LineCount
,
screen
);
else
if
(
Line
[
1
]
==
'T'
)
//text part
{
printf
(
"**** TEXT PART
\n
"
);
SCH_ITEM
*
Struct
;
Struct
=
ReadTextDescr
(
f
,
MsgDiag
,
Line
,
sizeof
(
Line
),
&
LineCount
,
version
);
if
(
Struct
)
{
Struct
->
SetNext
(
screen
->
EEDrawList
);
screen
->
EEDrawList
=
Struct
;
}
else
Failed
=
true
;
}
break
;
...
...
eeschema/read_from_file_schematic_items_descriptions.cpp
View file @
1f7fc494
...
...
@@ -132,8 +132,17 @@ SCH_ITEM* ReadTextDescr( FILE* aFile,
}
else
{
SCH_TEXT
*
TextStruct
=
new
SCH_TEXT
(
pos
,
CONV_FROM_UTF8
(
text
)
);
wxString
val
=
CONV_FROM_UTF8
(
text
);
for
(;;)
{
int
i
=
val
.
find
(
_
(
"
\\
n"
));
if
(
i
==
wxNOT_FOUND
)
break
;
val
.
erase
(
i
,
2
);
val
.
insert
(
i
,
_
(
"
\n
"
));
}
SCH_TEXT
*
TextStruct
=
new
SCH_TEXT
(
pos
,
val
);
TextStruct
->
m_Size
.
x
=
TextStruct
->
m_Size
.
y
=
size
;
TextStruct
->
m_Orient
=
orient
;
...
...
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