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
1385e39d
Commit
1385e39d
authored
Jun 11, 2014
by
Dick Hollenbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Save the footprint editor's last footprint in the PROJECT RString facility.
parent
3d311f83
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
91 additions
and
49 deletions
+91
-49
project.h
include/project.h
+1
-5
librairi.cpp
pcbnew/librairi.cpp
+1
-1
modedit.cpp
pcbnew/modedit.cpp
+5
-5
module_editor_frame.h
pcbnew/module_editor_frame.h
+8
-12
moduleframe.cpp
pcbnew/moduleframe.cpp
+62
-17
tool_pcb.cpp
pcbnew/tool_pcb.cpp
+14
-9
No files found.
include/project.h
View file @
1385e39d
...
@@ -134,9 +134,6 @@ public:
...
@@ -134,9 +134,6 @@ public:
/// Accessor for Eeschema search stack.
/// Accessor for Eeschema search stack.
VTBL_ENTRY
SEARCH_STACK
&
SchSearchS
()
{
return
m_sch_search
;
}
VTBL_ENTRY
SEARCH_STACK
&
SchSearchS
()
{
return
m_sch_search
;
}
VTBL_ENTRY
wxString
GetModuleLibraryNickname
()
{
return
m_module_library_nickname
;
}
VTBL_ENTRY
void
SetModuleLibraryNickname
(
const
wxString
&
aNickName
)
{
m_module_library_nickname
=
aNickName
;
}
/// Retain a number of project specific wxStrings, enumerated here:
/// Retain a number of project specific wxStrings, enumerated here:
enum
RSTRING_T
enum
RSTRING_T
{
{
...
@@ -144,6 +141,7 @@ public:
...
@@ -144,6 +141,7 @@ public:
SCH_LIB_PATH
,
SCH_LIB_PATH
,
PCB_LIB_NICKNAME
,
PCB_LIB_NICKNAME
,
VIEWER_3D_PATH
,
VIEWER_3D_PATH
,
PCB_FOOTPRINT
,
RSTRING_COUNT
RSTRING_COUNT
};
};
...
@@ -252,8 +250,6 @@ private:
...
@@ -252,8 +250,6 @@ private:
wxFileName
m_project_name
;
///< <fullpath>/<basename>.pro
wxFileName
m_project_name
;
///< <fullpath>/<basename>.pro
wxString
m_pro_date_and_time
;
wxString
m_pro_date_and_time
;
wxString
m_module_library_nickname
;
///< @todo move this into m_rpaths[]
/// @see this::SetRString(), GetRString(), and enum RSTRING_T.
/// @see this::SetRString(), GetRString(), and enum RSTRING_T.
wxString
m_rstrings
[
RSTRING_COUNT
];
wxString
m_rstrings
[
RSTRING_COUNT
];
...
...
pcbnew/librairi.cpp
View file @
1385e39d
...
@@ -467,7 +467,7 @@ wxString FOOTPRINT_EDIT_FRAME::CreateNewLibrary()
...
@@ -467,7 +467,7 @@ wxString FOOTPRINT_EDIT_FRAME::CreateNewLibrary()
bool
FOOTPRINT_EDIT_FRAME
::
DeleteModuleFromCurrentLibrary
()
bool
FOOTPRINT_EDIT_FRAME
::
DeleteModuleFromCurrentLibrary
()
{
{
wxString
nickname
=
getLibNickName
();
wxString
nickname
=
GetCurrentLib
();
if
(
!
Prj
().
PcbFootprintLibs
()
->
IsFootprintLibWritable
(
nickname
)
)
if
(
!
Prj
().
PcbFootprintLibs
()
->
IsFootprintLibWritable
(
nickname
)
)
{
{
...
...
pcbnew/modedit.cpp
View file @
1385e39d
...
@@ -251,11 +251,11 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
...
@@ -251,11 +251,11 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case
ID_MODEDIT_SELECT_CURRENT_LIB
:
case
ID_MODEDIT_SELECT_CURRENT_LIB
:
{
{
wxString
library
=
SelectLibrary
(
getLibNickName
()
);
wxString
library
=
SelectLibrary
(
GetCurrentLib
()
);
if
(
library
.
size
()
)
if
(
library
.
size
()
)
{
{
setLibNickName
(
library
);
Prj
().
SetRString
(
PROJECT
::
PCB_LIB_NICKNAME
,
library
);
updateTitle
();
updateTitle
();
}
}
}
}
...
@@ -364,9 +364,9 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
...
@@ -364,9 +364,9 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break
;
break
;
case
ID_MODEDIT_SAVE_LIBMODULE
:
case
ID_MODEDIT_SAVE_LIBMODULE
:
if
(
GetBoard
()
->
m_Modules
&&
getLibNickName
().
size
()
)
if
(
GetBoard
()
->
m_Modules
&&
GetCurrentLib
().
size
()
)
{
{
Save_Module_In_Library
(
getLibNickName
(),
GetBoard
()
->
m_Modules
,
true
,
true
);
Save_Module_In_Library
(
GetCurrentLib
(),
GetBoard
()
->
m_Modules
,
true
,
true
);
GetScreen
()
->
ClrModify
();
GetScreen
()
->
ClrModify
();
}
}
break
;
break
;
...
@@ -506,7 +506,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
...
@@ -506,7 +506,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
SetCrossHairPosition
(
wxPoint
(
0
,
0
)
);
SetCrossHairPosition
(
wxPoint
(
0
,
0
)
);
LoadModuleFromLibrary
(
getLibNickName
(),
Prj
().
PcbFootprintLibs
(),
true
);
LoadModuleFromLibrary
(
GetCurrentLib
(),
Prj
().
PcbFootprintLibs
(),
true
);
redraw
=
true
;
redraw
=
true
;
if
(
GetBoard
()
->
m_Modules
)
if
(
GetBoard
()
->
m_Modules
)
...
...
pcbnew/module_editor_frame.h
View file @
1385e39d
...
@@ -245,8 +245,8 @@ public:
...
@@ -245,8 +245,8 @@ public:
UNDO_REDO_T
aTypeCommand
,
UNDO_REDO_T
aTypeCommand
,
const
wxPoint
&
aTransformPoint
=
wxPoint
(
0
,
0
)
);
const
wxPoint
&
aTransformPoint
=
wxPoint
(
0
,
0
)
);
wxString
GetCurrentLib
()
const
{
return
getLibNickName
();
};
/// Return the current library nickname.
const
wxString
GetCurrentLib
()
const
;
// Footprint edition
// Footprint edition
void
RemoveStruct
(
EDA_ITEM
*
Item
);
void
RemoveStruct
(
EDA_ITEM
*
Item
);
...
@@ -380,7 +380,7 @@ public:
...
@@ -380,7 +380,7 @@ public:
* Install a dialog to edit a graphic item of a footprint body.
* Install a dialog to edit a graphic item of a footprint body.
* @param aItem = a pointer to the graphic item to edit
* @param aItem = a pointer to the graphic item to edit
*/
*/
void
InstallFootprintBodyItemPropertiesDlg
(
EDGE_MODULE
*
aItem
);
void
InstallFootprintBodyItemPropertiesDlg
(
EDGE_MODULE
*
aItem
);
/**
/**
* Function DlgGlobalChange_PadSettings
* Function DlgGlobalChange_PadSettings
...
@@ -397,7 +397,7 @@ public:
...
@@ -397,7 +397,7 @@ public:
*/
*/
bool
DeleteModuleFromCurrentLibrary
();
bool
DeleteModuleFromCurrentLibrary
();
virtual
EDA_COLOR_T
GetGridColor
(
void
)
const
;
virtual
EDA_COLOR_T
GetGridColor
()
const
;
DECLARE_EVENT_TABLE
()
DECLARE_EVENT_TABLE
()
...
@@ -429,15 +429,11 @@ protected:
...
@@ -429,15 +429,11 @@ protected:
*/
*/
void
updateTitle
();
void
updateTitle
();
/// The library nickName is a short string, for now the same as the library path
/// but without path and without extension. After library table support it becomes
/// a lookup key.
const
wxString
getLibNickName
()
const
;
void
setLibNickName
(
const
wxString
&
aNickname
);
/// The libPath is not publicly visible, grab it from the FP_LIB_TABLE if we must.
/// The libPath is not publicly visible, grab it from the FP_LIB_TABLE if we must.
wxString
getLibPath
();
const
wxString
getLibPath
();
void
restoreLastFootprint
();
void
retainLastFootprint
();
};
};
#endif // MODULE_EDITOR_FRAME_H_
#endif // MODULE_EDITOR_FRAME_H_
pcbnew/moduleframe.cpp
View file @
1385e39d
...
@@ -33,6 +33,7 @@
...
@@ -33,6 +33,7 @@
#include <pgm_base.h>
#include <pgm_base.h>
#include <kiway.h>
#include <kiway.h>
#include <project.h>
#include <project.h>
#include <kicad_plugin.h>
#include <class_drawpanel.h>
#include <class_drawpanel.h>
#include <confirm.h>
#include <confirm.h>
#include <wxPcbStruct.h>
#include <wxPcbStruct.h>
...
@@ -168,6 +169,9 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
...
@@ -168,6 +169,9 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
SetBoard
(
new
BOARD
()
);
SetBoard
(
new
BOARD
()
);
// restore the last footprint from the project, if any
restoreLastFootprint
();
// Ensure all layers and items are visible:
// Ensure all layers and items are visible:
GetBoard
()
->
SetVisibleAlls
();
GetBoard
()
->
SetVisibleAlls
();
...
@@ -177,7 +181,7 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
...
@@ -177,7 +181,7 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
LoadSettings
(
config
()
);
LoadSettings
(
config
()
);
GetScreen
()
->
AddGrid
(
m_UserGridSize
,
m_UserGridUnit
,
ID_POPUP_GRID_USER
);
GetScreen
()
->
AddGrid
(
m_UserGridSize
,
m_UserGridUnit
,
ID_POPUP_GRID_USER
);
GetScreen
()
->
SetGrid
(
ID_POPUP_GRID_LEVEL_1000
+
m_LastGridSizeId
);
GetScreen
()
->
SetGrid
(
ID_POPUP_GRID_LEVEL_1000
+
m_LastGridSizeId
);
// In modedit, set the default paper size to A4:
// In modedit, set the default paper size to A4:
// this should be OK for all footprint to plot/print
// this should be OK for all footprint to plot/print
...
@@ -230,38 +234,79 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
...
@@ -230,38 +234,79 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
FOOTPRINT_EDIT_FRAME
::~
FOOTPRINT_EDIT_FRAME
()
FOOTPRINT_EDIT_FRAME
::~
FOOTPRINT_EDIT_FRAME
()
{
{
// save the footprint in the PROJECT
retainLastFootprint
();
}
}
const
wxString
FOOTPRINT_EDIT_FRAME
::
getLib
NickName
()
const
const
wxString
FOOTPRINT_EDIT_FRAME
::
getLib
Path
()
{
{
return
Prj
().
GetModuleLibraryNickname
();
try
{
const
wxString
&
nickname
=
GetCurrentLib
();
const
FP_LIB_TABLE
::
ROW
*
row
=
Prj
().
PcbFootprintLibs
()
->
FindRow
(
nickname
);
return
row
->
GetFullURI
(
true
);
}
catch
(
const
IO_ERROR
&
ioe
)
{
return
wxEmptyString
;
}
}
}
void
FOOTPRINT_EDIT_FRAME
::
setLibNickName
(
const
wxString
&
aNickname
)
const
wxString
FOOTPRINT_EDIT_FRAME
::
GetCurrentLib
()
const
{
{
Prj
().
SetModuleLibraryNickname
(
aNickname
);
return
Prj
().
GetRString
(
PROJECT
::
PCB_LIB_NICKNAME
);
}
}
;
wxString
FOOTPRINT_EDIT_FRAME
::
getLibPath
()
void
FOOTPRINT_EDIT_FRAME
::
retainLastFootprint
()
{
{
try
PCB_IO
pcb_io
;
MODULE
*
module
=
GetBoard
()
->
m_Modules
;
if
(
module
)
{
{
const
wxString
&
nickname
=
getLibNickName
(
);
pcb_io
.
Format
(
GetBoard
()
->
m_Modules
);
const
FP_LIB_TABLE
::
ROW
*
row
=
Prj
().
PcbFootprintLibs
()
->
FindRow
(
nickname
);
wxString
pretty
=
FROM_UTF8
(
pcb_io
.
GetStringOutput
(
true
).
c_str
()
);
return
row
->
GetFullURI
(
true
);
Prj
().
SetRString
(
PROJECT
::
PCB_FOOTPRINT
,
pretty
);
}
}
catch
(
const
IO_ERROR
&
ioe
)
}
void
FOOTPRINT_EDIT_FRAME
::
restoreLastFootprint
()
{
wxString
pretty
=
Prj
().
GetRString
(
PROJECT
::
PCB_FOOTPRINT
);
if
(
!!
pretty
)
{
{
return
wxEmptyString
;
PCB_IO
pcb_io
;
MODULE
*
module
=
NULL
;
try
{
module
=
(
MODULE
*
)
pcb_io
.
Parse
(
pretty
);
}
catch
(
const
PARSE_ERROR
&
pe
)
{
// unlikely to be a problem, since we produced the pretty string.
wxLogError
(
wxT
(
"PARSE_ERROR"
)
);
}
catch
(
const
IO_ERROR
&
ioe
)
{
// unlikely to be a problem, since we produced the pretty string.
wxLogError
(
wxT
(
"IO_ERROR"
)
);
}
if
(
module
)
GetBoard
()
->
Add
(
module
);
// assumes BOARD is empty.
}
}
}
}
const
wxChar
*
FOOTPRINT_EDIT_FRAME
::
GetFootprintEditorFrameName
()
const
wxChar
*
FOOTPRINT_EDIT_FRAME
::
GetFootprintEditorFrameName
()
{
{
return
FOOTPRINT_EDIT_FRAME_NAME
;
return
FOOTPRINT_EDIT_FRAME_NAME
;
...
@@ -334,9 +379,9 @@ void FOOTPRINT_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event )
...
@@ -334,9 +379,9 @@ void FOOTPRINT_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event )
case
wxID_YES
:
case
wxID_YES
:
// code from FOOTPRINT_EDIT_FRAME::Process_Special_Functions,
// code from FOOTPRINT_EDIT_FRAME::Process_Special_Functions,
// at case ID_MODEDIT_SAVE_LIBMODULE
// at case ID_MODEDIT_SAVE_LIBMODULE
if
(
GetBoard
()
->
m_Modules
&&
getLibNickName
().
size
()
)
if
(
GetBoard
()
->
m_Modules
&&
GetCurrentLib
().
size
()
)
{
{
if
(
Save_Module_In_Library
(
getLibNickName
(),
GetBoard
()
->
m_Modules
,
true
,
true
)
)
if
(
Save_Module_In_Library
(
GetCurrentLib
(),
GetBoard
()
->
m_Modules
,
true
,
true
)
)
{
{
// save was correct
// save was correct
GetScreen
()
->
ClrModify
();
GetScreen
()
->
ClrModify
();
...
@@ -587,7 +632,7 @@ void FOOTPRINT_EDIT_FRAME::updateTitle()
...
@@ -587,7 +632,7 @@ void FOOTPRINT_EDIT_FRAME::updateTitle()
{
{
wxString
title
=
_
(
"Module Editor "
);
wxString
title
=
_
(
"Module Editor "
);
wxString
nickname
=
getLibNickName
();
wxString
nickname
=
GetCurrentLib
();
if
(
!
nickname
)
if
(
!
nickname
)
{
{
...
...
pcbnew/tool_pcb.cpp
View file @
1385e39d
...
@@ -30,6 +30,7 @@
...
@@ -30,6 +30,7 @@
*/
*/
#include <fctsys.h>
#include <fctsys.h>
#include <kiface_i.h>
#include <help_common_strings.h>
#include <help_common_strings.h>
#include <dialog_helpers.h>
#include <dialog_helpers.h>
#include <class_layer_box_selector.h>
#include <class_layer_box_selector.h>
...
@@ -218,10 +219,14 @@ void PCB_EDIT_FRAME::ReCreateHToolbar()
...
@@ -218,10 +219,14 @@ void PCB_EDIT_FRAME::ReCreateHToolbar()
wxAUI_TB_DEFAULT_STYLE
|
wxAUI_TB_HORZ_LAYOUT
);
wxAUI_TB_DEFAULT_STYLE
|
wxAUI_TB_HORZ_LAYOUT
);
// Set up toolbar
// Set up toolbar
m_mainToolBar
->
AddTool
(
ID_NEW_BOARD
,
wxEmptyString
,
KiBitmap
(
new_pcb_xpm
),
if
(
Kiface
().
IsSingle
()
)
_
(
"New board"
)
);
{
m_mainToolBar
->
AddTool
(
ID_LOAD_FILE
,
wxEmptyString
,
KiBitmap
(
open_brd_file_xpm
),
m_mainToolBar
->
AddTool
(
ID_NEW_BOARD
,
wxEmptyString
,
KiBitmap
(
new_pcb_xpm
),
_
(
"Open existing board"
)
);
_
(
"New board"
)
);
m_mainToolBar
->
AddTool
(
ID_LOAD_FILE
,
wxEmptyString
,
KiBitmap
(
open_brd_file_xpm
),
_
(
"Open existing board"
)
);
}
m_mainToolBar
->
AddTool
(
ID_SAVE_BOARD
,
wxEmptyString
,
KiBitmap
(
save_xpm
),
m_mainToolBar
->
AddTool
(
ID_SAVE_BOARD
,
wxEmptyString
,
KiBitmap
(
save_xpm
),
_
(
"Save board"
)
);
_
(
"Save board"
)
);
...
@@ -501,29 +506,29 @@ void PCB_EDIT_FRAME::ReCreateMicrowaveVToolbar()
...
@@ -501,29 +506,29 @@ void PCB_EDIT_FRAME::ReCreateMicrowaveVToolbar()
m_microWaveToolBar
->
AddTool
(
ID_PCB_MUWAVE_TOOL_SELF_CMD
,
wxEmptyString
,
m_microWaveToolBar
->
AddTool
(
ID_PCB_MUWAVE_TOOL_SELF_CMD
,
wxEmptyString
,
KiBitmap
(
mw_add_line_xpm
),
KiBitmap
(
mw_add_line_xpm
),
_
(
"Create line of specified length for microwave applications"
),
_
(
"Create line of specified length for microwave applications"
),
wxITEM_CHECK
);
wxITEM_CHECK
);
m_microWaveToolBar
->
AddTool
(
ID_PCB_MUWAVE_TOOL_GAP_CMD
,
wxEmptyString
,
m_microWaveToolBar
->
AddTool
(
ID_PCB_MUWAVE_TOOL_GAP_CMD
,
wxEmptyString
,
KiBitmap
(
mw_add_gap_xpm
),
KiBitmap
(
mw_add_gap_xpm
),
_
(
"Create gap of specified length for microwave applications"
),
_
(
"Create gap of specified length for microwave applications"
),
wxITEM_CHECK
);
wxITEM_CHECK
);
m_microWaveToolBar
->
AddSeparator
();
m_microWaveToolBar
->
AddSeparator
();
m_microWaveToolBar
->
AddTool
(
ID_PCB_MUWAVE_TOOL_STUB_CMD
,
wxEmptyString
,
m_microWaveToolBar
->
AddTool
(
ID_PCB_MUWAVE_TOOL_STUB_CMD
,
wxEmptyString
,
KiBitmap
(
mw_add_stub_xpm
),
KiBitmap
(
mw_add_stub_xpm
),
_
(
"Create stub of specified length for microwave applications"
),
_
(
"Create stub of specified length for microwave applications"
),
wxITEM_CHECK
);
wxITEM_CHECK
);
m_microWaveToolBar
->
AddTool
(
ID_PCB_MUWAVE_TOOL_STUB_ARC_CMD
,
wxEmptyString
,
m_microWaveToolBar
->
AddTool
(
ID_PCB_MUWAVE_TOOL_STUB_ARC_CMD
,
wxEmptyString
,
KiBitmap
(
mw_add_stub_arc_xpm
),
KiBitmap
(
mw_add_stub_arc_xpm
),
_
(
"Create stub (arc) of specified length for microwave applications"
),
_
(
"Create stub (arc) of specified length for microwave applications"
),
wxITEM_CHECK
);
wxITEM_CHECK
);
m_microWaveToolBar
->
AddTool
(
ID_PCB_MUWAVE_TOOL_FUNCTION_SHAPE_CMD
,
wxEmptyString
,
m_microWaveToolBar
->
AddTool
(
ID_PCB_MUWAVE_TOOL_FUNCTION_SHAPE_CMD
,
wxEmptyString
,
KiBitmap
(
mw_add_shape_xpm
),
KiBitmap
(
mw_add_shape_xpm
),
_
(
"Create a polynomial shape for microwave applications"
),
_
(
"Create a polynomial shape for microwave applications"
),
wxITEM_CHECK
);
wxITEM_CHECK
);
m_microWaveToolBar
->
Realize
();
m_microWaveToolBar
->
Realize
();
}
}
...
...
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