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
f9f3ff22
Commit
f9f3ff22
authored
Apr 19, 2014
by
Dick Hollenbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hook top frame with KIWAY::playerDestroyHandler()
parent
ea66e572
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
5 deletions
+47
-5
kiway.cpp
common/kiway.cpp
+40
-1
kiway.h
include/kiway.h
+7
-4
No files found.
common/kiway.cpp
View file @
f9f3ff22
...
@@ -38,11 +38,50 @@ int KIWAY::m_kiface_version[KIWAY_FACE_COUNT];
...
@@ -38,11 +38,50 @@ int KIWAY::m_kiface_version[KIWAY_FACE_COUNT];
KIWAY
::
KIWAY
(
PGM_BASE
*
aProgram
,
wxFrame
*
aTop
)
:
KIWAY
::
KIWAY
(
PGM_BASE
*
aProgram
,
wxFrame
*
aTop
)
:
m_program
(
aProgram
),
m_program
(
aProgram
),
m_top
(
aTop
)
m_top
(
0
)
{
{
SetTop
(
aTop
);
// hook playerDestroyHandler() into aTop.
memset
(
m_player
,
0
,
sizeof
(
m_player
)
);
memset
(
m_player
,
0
,
sizeof
(
m_player
)
);
}
}
// Any event types derived from wxCommandEvt, like wxWindowDestroyEvent, are
// propogated upwards to parent windows if not handled below. Therefor the
// m_top window should receive all wxWindowDestroyEvents from originating
// from KIWAY_PLAYERs. It does anyways, but now playerDestroyHandler eavesdrops
// on that event stream looking for KIWAY_PLAYERs being closed.
void
KIWAY
::
playerDestroyHandler
(
wxWindowDestroyEvent
&
event
)
{
wxWindow
*
w
=
event
.
GetWindow
();
for
(
unsigned
i
=
0
;
i
<
DIM
(
m_player
);
++
i
)
{
// if destroying one of our flock, then mark it as diseased.
if
(
(
wxWindow
*
)
m_player
[
i
]
==
w
)
{
// DBG(printf( "%s: marking m_player[%d] as destroyed\n", __func__, i );)
m_player
[
i
]
=
0
;
}
}
}
void
KIWAY
::
SetTop
(
wxFrame
*
aTop
)
{
if
(
m_top
)
{
m_top
->
Disconnect
(
wxEVT_DESTROY
,
wxWindowDestroyEventHandler
(
KIWAY
::
playerDestroyHandler
),
NULL
,
this
);
}
if
(
aTop
)
{
aTop
->
Connect
(
wxEVT_DESTROY
,
wxWindowDestroyEventHandler
(
KIWAY
::
playerDestroyHandler
),
NULL
,
this
);
}
m_top
=
aTop
;
}
const
wxString
KIWAY
::
dso_full_path
(
FACE_T
aFaceId
)
const
wxString
KIWAY
::
dso_full_path
(
FACE_T
aFaceId
)
{
{
...
...
include/kiway.h
View file @
f9f3ff22
...
@@ -331,22 +331,25 @@ public:
...
@@ -331,22 +331,25 @@ public:
KIWAY
(
PGM_BASE
*
aProgram
,
wxFrame
*
aTop
=
NULL
);
KIWAY
(
PGM_BASE
*
aProgram
,
wxFrame
*
aTop
=
NULL
);
/// In case aTop may not be known at time of KIWAY construction:
/// In case aTop may not be known at time of KIWAY construction:
void
SetTop
(
wxFrame
*
aTop
)
{
m_top
=
aTop
;
}
void
SetTop
(
wxFrame
*
aTop
)
;
private
:
private
:
/// Get the full path & name of the DSO holding the requested FACE_T.
/// Get the full path & name of the DSO holding the requested FACE_T.
static
const
wxString
dso_full_path
(
FACE_T
aFaceId
);
static
const
wxString
dso_full_path
(
FACE_T
aFaceId
);
/// hooked into m_top in SetTop(), marks child frame as closed.
void
playerDestroyHandler
(
wxWindowDestroyEvent
&
event
);
static
KIFACE
*
m_kiface
[
KIWAY_FACE_COUNT
];
static
KIFACE
*
m_kiface
[
KIWAY_FACE_COUNT
];
static
int
m_kiface_version
[
KIWAY_FACE_COUNT
];
static
int
m_kiface_version
[
KIWAY_FACE_COUNT
];
PGM_BASE
*
m_program
;
wxFrame
*
m_top
;
KIWAY_PLAYER
*
m_player
[
KIWAY_PLAYER_COUNT
];
// from frame_type.h
KIWAY_PLAYER
*
m_player
[
KIWAY_PLAYER_COUNT
];
// from frame_type.h
PROJECT
m_project
;
// do not assume this is here, use Prj().
PROJECT
m_project
;
// do not assume this is here, use Prj().
PGM_BASE
*
m_program
;
wxFrame
*
m_top
;
};
};
...
...
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