Better management of KIWAY_PLAYER frame when called in modal mode, and having the wxFLOAT_ON_PARENT style option.
(previously, did not use the actual parent)
This commit is contained in:
parent
2fd7ab248e
commit
6bb349e933
|
@ -42,9 +42,7 @@ int KIWAY::m_kiface_version[KIWAY_FACE_COUNT];
|
|||
|
||||
|
||||
KIWAY::KIWAY( PGM_BASE* aProgram, int aCtlBits, wxFrame* aTop ):
|
||||
m_program( aProgram ),
|
||||
m_ctl( aCtlBits ),
|
||||
m_top( 0 )
|
||||
m_program( aProgram ), m_ctl( aCtlBits ), m_top( 0 )
|
||||
{
|
||||
SetTop( aTop ); // hook player_destroy_handler() into aTop.
|
||||
|
||||
|
@ -299,7 +297,7 @@ KIWAY_PLAYER* KIWAY::GetPlayerFrame( FRAME_T aFrameType )
|
|||
}
|
||||
|
||||
|
||||
KIWAY_PLAYER* KIWAY::Player( FRAME_T aFrameType, bool doCreate, KIWAY_PLAYER* aParent )
|
||||
KIWAY_PLAYER* KIWAY::Player( FRAME_T aFrameType, bool doCreate, wxTopLevelWindow* aParent )
|
||||
{
|
||||
// Since this will be called from python, cannot assume that code will
|
||||
// not pass a bad aFrameType.
|
||||
|
@ -329,10 +327,11 @@ KIWAY_PLAYER* KIWAY::Player( FRAME_T aFrameType, bool doCreate, KIWAY_PLAYER* aP
|
|||
if( kiface )
|
||||
{
|
||||
frame = (KIWAY_PLAYER*) kiface->CreateWindow(
|
||||
aParent, // Parent window of frame, NULL in non modal mode
|
||||
aParent, // Parent window of frame in modal mode, NULL in non modal mode
|
||||
aFrameType,
|
||||
this,
|
||||
m_ctl // questionable need, these same flags where passed to the KIFACE::OnKifaceStart()
|
||||
m_ctl // questionable need, these same flags where passed
|
||||
// to the KIFACE::OnKifaceStart()
|
||||
);
|
||||
wxASSERT( frame );
|
||||
|
||||
|
|
|
@ -516,7 +516,7 @@ bool DIALOG_EDIT_COMPONENTS_LIBID::setLibIdByBrowser( int aRow )
|
|||
// Use library viewer to choose a symbol
|
||||
LIB_ID aPreselectedLibid;
|
||||
SCH_BASE_FRAME::COMPONENT_SELECTION sel =
|
||||
m_parent->SelectComponentFromLibBrowser( NULL, aPreselectedLibid, 0, 0 );
|
||||
m_parent->SelectComponentFromLibBrowser( this, NULL, aPreselectedLibid, 0, 0 );
|
||||
#endif
|
||||
|
||||
if( sel.LibId.empty() ) // command aborted
|
||||
|
|
|
@ -53,8 +53,8 @@
|
|||
|
||||
|
||||
SCH_BASE_FRAME::COMPONENT_SELECTION SCH_BASE_FRAME::SelectComponentFromLibBrowser(
|
||||
const SCHLIB_FILTER* aFilter,
|
||||
const LIB_ID& aPreselectedLibId,
|
||||
wxTopLevelWindow* aParent,
|
||||
const SCHLIB_FILTER* aFilter, const LIB_ID& aPreselectedLibId,
|
||||
int aUnit, int aConvert )
|
||||
{
|
||||
// Close any open non-modal Lib browser, and open a new one, in "modal" mode:
|
||||
|
@ -63,7 +63,7 @@ SCH_BASE_FRAME::COMPONENT_SELECTION SCH_BASE_FRAME::SelectComponentFromLibBrowse
|
|||
if( viewlibFrame )
|
||||
viewlibFrame->Destroy();
|
||||
|
||||
viewlibFrame = (LIB_VIEW_FRAME*) Kiway().Player( FRAME_SCH_VIEWER_MODAL, true, this );
|
||||
viewlibFrame = (LIB_VIEW_FRAME*) Kiway().Player( FRAME_SCH_VIEWER_MODAL, true, aParent );
|
||||
|
||||
if( aFilter )
|
||||
viewlibFrame->SetFilter( aFilter );
|
||||
|
@ -169,7 +169,7 @@ SCH_BASE_FRAME::COMPONENT_SELECTION SCH_BASE_FRAME::SelectComponentFromLibrary(
|
|||
|
||||
if( dlg.IsExternalBrowserSelected() ) // User requested component browser.
|
||||
{
|
||||
sel = SelectComponentFromLibBrowser( aFilter, id, sel.Unit, sel.Convert );
|
||||
sel = SelectComponentFromLibBrowser( this, aFilter, id, sel.Unit, sel.Convert );
|
||||
id = sel.LibId;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -223,6 +223,7 @@ public:
|
|||
* Calls the library viewer to select component to import into schematic.
|
||||
* if the library viewer is currently running, it is closed and reopened
|
||||
* in modal mode.
|
||||
* @param aParent is the caller
|
||||
* @param aFilter is a filter to pass the allowed library names
|
||||
* and/or some other filter
|
||||
* @param aPreselectedLibId Preselected component LIB_ID. Not valid if none selected.
|
||||
|
@ -231,6 +232,7 @@ public:
|
|||
* @return the selected component
|
||||
*/
|
||||
COMPONENT_SELECTION SelectComponentFromLibBrowser(
|
||||
wxTopLevelWindow* aParent,
|
||||
const SCHLIB_FILTER* aFilter,
|
||||
const LIB_ID& aPreselectedLibid,
|
||||
int aUnit, int aConvert );
|
||||
|
|
|
@ -133,6 +133,7 @@ class wxConfigBase;
|
|||
class PGM_BASE;
|
||||
class KIWAY;
|
||||
class KIWAY_PLAYER;
|
||||
class wxTopLevelWindow;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -304,14 +305,16 @@ public:
|
|||
* @param doCreate when true asks that the player be created if it is not
|
||||
* already created, false means do not create and maybe return NULL.
|
||||
* @param aParent is a parent for modal KIWAY_PLAYER frames, otherwise NULL
|
||||
* used only when doCreate = true
|
||||
* used only when doCreate = true and by KIWAY_PLAYER frames created in modal form
|
||||
* because the are using the wxFLOAT_ON_PARENT style
|
||||
*
|
||||
* @return KIWAY_PLAYER* - a valid opened KIWAY_PLAYER or NULL if there
|
||||
* is something wrong or doCreate was false and the player has yet to be created.
|
||||
*
|
||||
* @throw IO_ERROR if the *.kiface file could not be found, filled with text saying what.
|
||||
*/
|
||||
VTBL_ENTRY KIWAY_PLAYER* Player( FRAME_T aFrameType, bool doCreate = true, KIWAY_PLAYER* aParent = NULL );
|
||||
VTBL_ENTRY KIWAY_PLAYER* Player( FRAME_T aFrameType, bool doCreate = true,
|
||||
wxTopLevelWindow* aParent = NULL );
|
||||
|
||||
/**
|
||||
* Function PlayerClose
|
||||
|
|
Loading…
Reference in New Issue