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
e0cc8a2f
Commit
e0cc8a2f
authored
Oct 31, 2012
by
Dick Hollenbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement move up, move down in lib table editor
parent
9e41a812
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
13 deletions
+37
-13
dialog_fp_lib_table.cpp
pcbnew/dialogs/dialog_fp_lib_table.cpp
+35
-12
kicad_plugin.cpp
pcbnew/kicad_plugin.cpp
+2
-1
No files found.
pcbnew/dialogs/dialog_fp_lib_table.cpp
View file @
e0cc8a2f
...
@@ -231,7 +231,6 @@ class DIALOG_FP_LIB_TABLE : public DIALOG_FP_LIB_TABLE_BASE
...
@@ -231,7 +231,6 @@ class DIALOG_FP_LIB_TABLE : public DIALOG_FP_LIB_TABLE_BASE
void
pageChangedHandler
(
wxAuiNotebookEvent
&
event
)
void
pageChangedHandler
(
wxAuiNotebookEvent
&
event
)
{
{
int
pageNdx
=
m_auinotebook
->
GetSelection
();
int
pageNdx
=
m_auinotebook
->
GetSelection
();
m_cur_grid
=
pageNdx
==
0
?
m_global_grid
:
m_project_grid
;
m_cur_grid
=
pageNdx
==
0
?
m_global_grid
:
m_project_grid
;
D
(
printf
(
"%s cur_grid is %s
\n
"
,
__func__
,
pageNdx
==
0
?
"global"
:
"project"
);)
D
(
printf
(
"%s cur_grid is %s
\n
"
,
__func__
,
pageNdx
==
0
?
"global"
:
"project"
);)
...
@@ -239,37 +238,33 @@ class DIALOG_FP_LIB_TABLE : public DIALOG_FP_LIB_TABLE_BASE
...
@@ -239,37 +238,33 @@ class DIALOG_FP_LIB_TABLE : public DIALOG_FP_LIB_TABLE_BASE
void
appendRowHandler
(
wxMouseEvent
&
event
)
void
appendRowHandler
(
wxMouseEvent
&
event
)
{
{
D
(
printf
(
"%s
\n
"
,
__func__
);)
m_cur_grid
->
AppendRows
(
1
);
m_cur_grid
->
AppendRows
(
1
);
}
}
void
deleteRowHandler
(
wxMouseEvent
&
event
)
void
deleteRowHandler
(
wxMouseEvent
&
event
)
{
{
D
(
printf
(
"%s
\n
"
,
__func__
);)
int
curRow
=
m_cur_grid
->
GetGridCursorRow
();
int
curRow
=
m_cur_grid
->
GetGridCursorRow
();
m_cur_grid
->
DeleteRows
(
curRow
);
m_cur_grid
->
DeleteRows
(
curRow
);
}
}
void
moveUpHandler
(
wxMouseEvent
&
event
)
void
moveUpHandler
(
wxMouseEvent
&
event
)
{
{
D
(
printf
(
"%s
\n
"
,
__func__
);)
int
curRow
=
m_cur_grid
->
GetGridCursorRow
();
int
curRow
=
m_cur_grid
->
GetGridCursorRow
();
if
(
curRow
>=
1
)
if
(
curRow
>=
1
)
{
{
FP_TBL_MODEL
*
tbl
=
(
FP_TBL_MODEL
*
)
m_cur_grid
->
GetTable
();
int
curCol
=
m_cur_grid
->
GetGridCursorCol
();
ROW
save
=
tbl
->
rows
[
curRow
]
;
FP_TBL_MODEL
*
tbl
=
(
FP_TBL_MODEL
*
)
m_cur_grid
->
GetTable
()
;
tbl
->
DeleteRows
(
curRow
,
1
);
ROW
move_me
=
tbl
->
rows
[
curRow
];
tbl
->
InsertRows
(
--
curRow
,
1
);
tbl
->
rows
[
curRow
]
=
save
;
tbl
->
rows
.
erase
(
tbl
->
rows
.
begin
()
+
curRow
);
--
curRow
;
tbl
->
rows
.
insert
(
tbl
->
rows
.
begin
()
+
curRow
,
move_me
);
if
(
tbl
->
GetView
()
)
if
(
tbl
->
GetView
()
)
{
{
// fire a msg to cause redrawing
wxGridTableMessage
msg
(
tbl
,
wxGridTableMessage
msg
(
tbl
,
wxGRIDTABLE_NOTIFY_ROWS_INSERTED
,
wxGRIDTABLE_NOTIFY_ROWS_INSERTED
,
curRow
,
curRow
,
...
@@ -277,11 +272,39 @@ class DIALOG_FP_LIB_TABLE : public DIALOG_FP_LIB_TABLE_BASE
...
@@ -277,11 +272,39 @@ class DIALOG_FP_LIB_TABLE : public DIALOG_FP_LIB_TABLE_BASE
tbl
->
GetView
()
->
ProcessTableMessage
(
msg
);
tbl
->
GetView
()
->
ProcessTableMessage
(
msg
);
}
}
m_cur_grid
->
SetGridCursor
(
curRow
,
curCol
);
}
}
}
}
void
moveDownHandler
(
wxMouseEvent
&
event
)
void
moveDownHandler
(
wxMouseEvent
&
event
)
{
{
FP_TBL_MODEL
*
tbl
=
(
FP_TBL_MODEL
*
)
m_cur_grid
->
GetTable
();
int
curRow
=
m_cur_grid
->
GetGridCursorRow
();
if
(
unsigned
(
curRow
+
1
)
<
tbl
->
rows
.
size
()
)
{
int
curCol
=
m_cur_grid
->
GetGridCursorCol
();
ROW
move_me
=
tbl
->
rows
[
curRow
];
tbl
->
rows
.
erase
(
tbl
->
rows
.
begin
()
+
curRow
);
++
curRow
;
tbl
->
rows
.
insert
(
tbl
->
rows
.
begin
()
+
curRow
,
move_me
);
if
(
tbl
->
GetView
()
)
{
// fire a msg to cause redrawing
wxGridTableMessage
msg
(
tbl
,
wxGRIDTABLE_NOTIFY_ROWS_INSERTED
,
curRow
-
1
,
0
);
tbl
->
GetView
()
->
ProcessTableMessage
(
msg
);
}
m_cur_grid
->
SetGridCursor
(
curRow
,
curCol
);
}
D
(
printf
(
"%s
\n
"
,
__func__
);)
D
(
printf
(
"%s
\n
"
,
__func__
);)
}
}
...
...
pcbnew/kicad_plugin.cpp
View file @
e0cc8a2f
...
@@ -240,7 +240,8 @@ void FP_CACHE::Load()
...
@@ -240,7 +240,8 @@ void FP_CACHE::Load()
}
}
// reader now owns fp, will close on exception or return
// reader now owns fp, will close on exception or return
PCB_PARSER
parser
(
new
FILE_LINE_READER
(
fp
,
fpFileName
)
);
FILE_LINE_READER
reader
(
fp
,
fpFileName
);
PCB_PARSER
parser
(
&
reader
);
std
::
string
name
=
TO_UTF8
(
fpFileName
);
std
::
string
name
=
TO_UTF8
(
fpFileName
);
...
...
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