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
e4825ee2
Commit
e4825ee2
authored
Oct 30, 2013
by
Dick Hollenbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more fp_lib_table dialog work
parent
07d31b9c
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
222 additions
and
102 deletions
+222
-102
TODO.txt
TODO.txt
+0
-1
dialog_fp_lib_table.cpp
pcbnew/dialogs/dialog_fp_lib_table.cpp
+101
-100
dialog_fp_plugin_options.cpp
pcbnew/dialogs/dialog_fp_plugin_options.cpp
+121
-1
No files found.
TODO.txt
View file @
e4825ee2
...
...
@@ -154,6 +154,5 @@ Dick's Final TODO List:
*) Apply Fabrizio and Alexander's linux desktop patches after unifying them.
*) Get licensing cleaned up.
*) Re-arrange the repo architecture.
*) Merge KiCad GAL/TOM/ORSON if nobody else does.
*) DLL-ization of pcbnew & eeschema
http://www.eevblog.com/forum/open-source-kicad-geda/seriously-irritated-with-the-library-editor!/
pcbnew/dialogs/dialog_fp_lib_table.cpp
View file @
e4825ee2
This diff is collapsed.
Click to expand it.
pcbnew/dialogs/dialog_fp_plugin_options.cpp
View file @
e4825ee2
...
...
@@ -24,6 +24,7 @@
*/
#include <fctsys.h>
#include <invoke_pcb_dialog.h>
#include <dialog_fp_plugin_options_base.h>
#include <fp_lib_table.h>
...
...
@@ -36,6 +37,12 @@ static int col_width_option;
static
int
col_width_value
;
/**
* Class DIALOG_FP_PLUGIN_OPTIONS
* is an options editor in the form of a two column name/value
* spreadsheet like (table) UI. It takes hints from a pcbnew PLUGIN as to
* supported options.
*/
class
DIALOG_FP_PLUGIN_OPTIONS
:
public
DIALOG_FP_PLUGIN_OPTIONS_BASE
{
...
...
@@ -60,7 +67,7 @@ public:
if
(
props
)
{
if
(
props
->
size
()
>
m_grid
->
GetNumberRows
()
)
if
(
(
int
)
props
->
size
()
>
m_grid
->
GetNumberRows
()
)
m_grid
->
AppendRows
(
props
->
size
()
-
m_grid
->
GetNumberRows
()
);
int
row
=
0
;
...
...
@@ -98,6 +105,42 @@ private:
const
wxString
&
m_callers_options
;
wxString
*
m_result
;
/// If the cursor is not on a valid cell, because there are no rows at all, return -1,
/// else return a 0 based column index.
int
getCursorCol
()
const
{
return
m_grid
->
GetGridCursorCol
();
}
/// If the cursor is not on a valid cell, because there are no rows at all, return -1,
/// else return a 0 based row index.
int
getCursorRow
()
const
{
return
m_grid
->
GetGridCursorRow
();
}
wxArrayString
getRow
(
int
aRow
)
{
wxArrayString
row
;
const
int
col_count
=
m_grid
->
GetNumberCols
();
for
(
int
col
=
0
;
col
<
col_count
;
++
col
)
{
row
.
Add
(
m_grid
->
GetCellValue
(
aRow
,
col
)
);
}
return
row
;
}
void
setRow
(
int
aRow
,
const
wxArrayString
&
aPair
)
{
const
int
col_count
=
m_grid
->
GetNumberCols
();
for
(
int
col
=
0
;
col
<
col_count
;
++
col
)
{
m_grid
->
SetCellValue
(
aRow
,
col
,
aPair
[
col
]
);
}
}
wxString
makeResult
()
{
PROPERTIES
props
;
...
...
@@ -133,21 +176,98 @@ private:
EndModal
(
0
);
}
//-----<event handlers>------------------------------------------------------
void
onAddRow
(
wxCommandEvent
&
event
)
{
if
(
m_grid
->
AppendRows
(
1
)
)
{
int
last_row
=
m_grid
->
GetNumberRows
()
-
1
;
// wx documentation is wrong, SetGridCursor does not make visible.
m_grid
->
MakeCellVisible
(
last_row
,
0
);
m_grid
->
SetGridCursor
(
last_row
,
0
);
}
}
void
onDeleteRow
(
wxCommandEvent
&
event
)
{
int
rowCount
=
m_grid
->
GetNumberRows
();
int
curRow
=
getCursorRow
();
m_grid
->
DeleteRows
(
curRow
);
if
(
curRow
&&
curRow
==
rowCount
-
1
)
{
m_grid
->
MakeCellVisible
(
curRow
-
1
,
getCursorCol
()
);
m_grid
->
SetGridCursor
(
curRow
-
1
,
getCursorCol
()
);
}
}
void
onMoveUp
(
wxCommandEvent
&
event
)
{
int
curRow
=
getCursorRow
();
if
(
curRow
>=
1
)
{
int
curCol
=
getCursorCol
();
wxArrayString
move_me
=
getRow
(
curRow
);
m_grid
->
DeleteRows
(
curRow
);
--
curRow
;
m_grid
->
InsertRows
(
curRow
);
setRow
(
curRow
,
move_me
);
wxGridTableBase
*
tbl
=
m_grid
->
GetTable
();
if
(
tbl
->
GetView
()
)
{
// fire a msg to cause redrawing
wxGridTableMessage
msg
(
tbl
,
wxGRIDTABLE_NOTIFY_ROWS_INSERTED
,
curRow
,
0
);
tbl
->
GetView
()
->
ProcessTableMessage
(
msg
);
}
m_grid
->
MakeCellVisible
(
curRow
,
curCol
);
m_grid
->
SetGridCursor
(
curRow
,
curCol
);
}
}
void
onMoveDown
(
wxCommandEvent
&
event
)
{
int
curRow
=
getCursorRow
();
if
(
curRow
+
1
<
m_grid
->
GetNumberRows
()
)
{
int
curCol
=
getCursorCol
();
wxArrayString
move_me
=
getRow
(
curRow
);
m_grid
->
DeleteRows
(
curRow
);
++
curRow
;
m_grid
->
InsertRows
(
curRow
);
setRow
(
curRow
,
move_me
);
wxGridTableBase
*
tbl
=
m_grid
->
GetTable
();
if
(
tbl
->
GetView
()
)
{
// fire a msg to cause redrawing
wxGridTableMessage
msg
(
tbl
,
wxGRIDTABLE_NOTIFY_ROWS_INSERTED
,
curRow
-
1
,
0
);
tbl
->
GetView
()
->
ProcessTableMessage
(
msg
);
}
m_grid
->
MakeCellVisible
(
curRow
,
curCol
);
m_grid
->
SetGridCursor
(
curRow
,
curCol
);
}
}
void
onCancelButtonClick
(
wxCommandEvent
&
event
)
...
...
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