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
741bfb68
Commit
741bfb68
authored
Feb 02, 2014
by
Dick Hollenbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Another attempt at wxFrame::SaveSettings() standard infrastructure.
parent
8afe2dfb
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
31 additions
and
39 deletions
+31
-39
basicframe.cpp
common/basicframe.cpp
+14
-16
cvframe.cpp
cvpcb/cvframe.cpp
+0
-3
schframe.cpp
eeschema/schframe.cpp
+0
-2
gerbview_frame.cpp
gerbview/gerbview_frame.cpp
+0
-3
wxstruct.h
include/wxstruct.h
+17
-12
mainframe.cpp
kicad/mainframe.cpp
+0
-2
footprint_wizard_frame.cpp
pcbnew/footprint_wizard_frame.cpp
+0
-1
No files found.
common/basicframe.cpp
View file @
741bfb68
...
...
@@ -99,6 +99,18 @@ EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* aParent,
Connect
(
ID_AUTO_SAVE_TIMER
,
wxEVT_TIMER
,
wxTimerEventHandler
(
EDA_BASE_FRAME
::
onAutoSaveTimer
)
);
// hook wxEVT_CLOSE_WINDOW so we can call SaveSettings(). This function seems
// to be called before any other hook for wxCloseEvent, which is necessary.
Connect
(
wxEVT_CLOSE_WINDOW
,
wxCloseEventHandler
(
EDA_BASE_FRAME
::
windowClosing
)
);
}
void
EDA_BASE_FRAME
::
windowClosing
(
wxCloseEvent
&
event
)
{
SaveSettings
();
// virtual, wxFrame specific
event
.
Skip
();
// we did not "handle" the event, only eavesdropped on it.
}
...
...
@@ -109,9 +121,8 @@ EDA_BASE_FRAME::~EDA_BASE_FRAME()
delete
m_autoSaveTimer
;
/* This needed for OSX: avoids further OnDraw processing after this
* destructor and before the native window is destroyed
*/
// This is needed for OSX: avoids further OnDraw processing after this
// destructor and before the native window is destroyed
this
->
Freeze
();
}
...
...
@@ -141,19 +152,6 @@ bool EDA_BASE_FRAME::ProcessEvent( wxEvent& aEvent )
}
bool
EDA_BASE_FRAME
::
Show
(
bool
show
)
{
if
(
!
show
)
// closing
{
SaveSettings
();
// virtual, wxFrame specific
}
int
ret
=
wxFrame
::
Show
(
show
);
return
ret
;
}
void
EDA_BASE_FRAME
::
onAutoSaveTimer
(
wxTimerEvent
&
aEvent
)
{
if
(
!
doAutoSave
()
)
...
...
cvpcb/cvframe.cpp
View file @
741bfb68
...
...
@@ -338,9 +338,6 @@ void CVPCB_MAINFRAME::OnCloseWindow( wxCloseEvent& Event )
m_modified
=
false
;
// hide main frame, which also forces saving curr pos and size in config
Show
(
false
);
Destroy
();
return
;
}
...
...
eeschema/schframe.cpp
View file @
741bfb68
...
...
@@ -505,8 +505,6 @@ void SCH_EDIT_FRAME::OnCloseWindow( wxCloseEvent& aEvent )
// all sub sheets are deleted, only the main sheet is usable
m_CurrentSheet
->
Clear
();
// hide main frame, which also forces saving curr pos and size in config
Show
(
false
);
Destroy
();
}
...
...
gerbview/gerbview_frame.cpp
View file @
741bfb68
...
...
@@ -177,9 +177,6 @@ GERBVIEW_FRAME::~GERBVIEW_FRAME()
void
GERBVIEW_FRAME
::
OnCloseWindow
(
wxCloseEvent
&
Event
)
{
// hide main frame, which also forces saving curr pos and size in config
Show
(
false
);
Destroy
();
}
...
...
include/wxstruct.h
View file @
741bfb68
...
...
@@ -107,10 +107,26 @@ extern const wxChar traceAutoSave[];
/**
* Class EDA_BASE_FRAME
* is the base frame for deriving all KiCad main window classes. This class is not
* intended to be used directly.
* intended to be used directly. It provides support for automatic calls to
* a virtual SaveSettings() function. SaveSettings() for a derived class can choose
* to do nothing, or rely on basic SaveSettings() support in this base class to do
* most of the work by calling it from the derived class's SaveSettings().
*/
class
EDA_BASE_FRAME
:
public
wxFrame
{
/**
* Function windowClosing
* (with its unexpected name so it does not collide with the real OnWindowClose()
* function provided in derived classes) is called just before a window
* closing, and is used to call a derivation specific
* SaveSettings(). SaveSettings() is called for all derived wxFrames in this
* base class overload. (Calling it from a destructor is deprecated since the
* wxFrame's position is not available in the destructor on linux.) In other words,
* you should not need to call call SaveSettings() anywhere, except in this
* one function found only in this class.
*/
void
windowClosing
(
wxCloseEvent
&
event
);
protected
:
ID_DRAWFRAME_TYPE
m_Ident
;
///< Id Type (pcb, schematic, library..)
wxPoint
m_FramePos
;
...
...
@@ -177,17 +193,6 @@ public:
*/
bool
ProcessEvent
(
wxEvent
&
aEvent
);
// overload wxFrame::ProcessEvent()
/**
* Function Show
* hooks the wxFrame close scenario so we can grab the window size and position
* in the wxFrame specific SaveSettings() function. SaveSettings() is
* called for all derived wxFrames in this base class overload. Calling it
* from a destructor is deprecated since the wxFrame's position is not available
* in the destructor on linux. In other words, don't call SaveSettings() anywhere,
* except in this one function.
*/
bool
Show
(
bool
show
);
// overload wxFrame::Show()
void
SetAutoSaveInterval
(
int
aInterval
)
{
m_autoSaveInterval
=
aInterval
;
}
int
GetAutoSaveInterval
()
const
{
return
m_autoSaveInterval
;
}
...
...
kicad/mainframe.cpp
View file @
741bfb68
...
...
@@ -159,8 +159,6 @@ void KICAD_MANAGER_FRAME::OnCloseWindow( wxCloseEvent& Event )
}
m_LeftWin
->
Show
(
false
);
// hide main frame, which also forces saving curr pos and size in config
Show
(
false
);
Destroy
();
}
...
...
pcbnew/footprint_wizard_frame.cpp
View file @
741bfb68
...
...
@@ -258,7 +258,6 @@ void FOOTPRINT_WIZARD_FRAME::OnCloseWindow( wxCloseEvent& Event )
}
else
{
Show
(
false
);
Destroy
();
}
}
...
...
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