The API is needed for wxFormBuilder, and I couldn't figure out any
way around it, but we can at least reduce the risk of someone calling
it accidentally (again).
WindowIds aren't actually guaranteed to be unique, and we don't
perform a dynamic_cast on the result of FindWindowById() because
of linker issues....
This is an attempt to fix KICAD-39.
Fixes https://gitlab.com/kicad/code/kicad/-/issues/14928
footprint wizard frame: now shows messages from footprints python scripts. Especially usefull when a parameter is incorrect. Fix also an other issue (IO error) with some scripts which were usint the print command to output messages (now they use the nes message window.
Fix also an issue on Windows, when using the footprint viewer or the component viewer in modal mode:
Reason: these frames (when run under the Kicad manager) have the Kicad manager as parent, and were built with wxFRAME_FLOAT_ON_PARENT style.
On windows, when the frame with style wxFRAME_FLOAT_ON_PARENT is displayed its parent frame is brought to the foreground, on the top of the calling frame.
and stays displayed when closing the frame in modal mode.
This issue does not happen on unix so we use now wxSTAY_ON_TOP on Windows, and wxFRAME_FLOAT_ON_PARENT on unix to simulate a dialog called by ShowModal.
This is not perfect, but at least it works.
Fix ( workaround only) crash (Windows only) when a quasi modal frame (like footprint viewer) was called from a dialog (like the component properties dialog in schematic editor).
Very minor other fixes.
*) Eeschema can now show the footprint editor.
*) Eeschema can now invoke the footprint picker from the library part field editor.
*) KIWAY_PLAYER::ShowModal() takes aResultantFocusWindow that tells what window
to give the focus to. Required since frames are often near the top of the
hierarchy and they are invoked by a peer, not a parent.
*) KIWAY_PLAYER::IsModal() is now a retained state, controlled by SetModal()
*) Fully re-work the KIWAY_PLAYER::ShowModal() to use a nested event loop.
*) Add support to DIALOG_SHIM for a "quasi-modal" dialog presentation and mode.
See top of dialog_shim.cpp about that for benefits and need.
*) You can now pick footprint from the schematic component field dialog, although
if you do this before you open the BOARD, you will only get the global footprint
libraries, not also the project specific ones. Opening the BOARD first avoids this
problem.
This is the first example of cross KIFACE invocation, it is also the first
instance of using a TOP_FRAME other than FRAME_PCB as the first thing. It works,
but it's missing support for opening the project specific table because
historically the FRAME_PCB did that. This is now starting to expose all the near
term needs for KIWAY_PLAYER <-> PROJECT interaction, independence and out of
sequence usage.
A fix for this will be coming in a few days.
However it mostly starts to show why the KIWAY is terribly useful and important.
*) Rework the set language support, simplify it by using KIWAY. Now any major
frame with a "change language" menu can change the language for all KIWAY_PLAYERs
in the whole KIWAY. Multiple KIWAYs are not supported yet.
*) Simplify "modal wxFrame" support, and add that support exclusively to
KIWAY_PLAYER where it is inherited by all derivatives. The function
KIWAY_PLAYER::ShowModal() is in the vtable and so is cross module capable.
*) Remove the requirements and assumptions that the wxFrame hierarchy always
had PCB_EDIT_FRAME and SCH_EDIT_FRAME as immediate parents of their viewers
and editors. This is no longer the case, nor required.
*) Use KIWAY::Player() everywhere to make KIWAY_PLAYERs, this registers the
KIWAY_PLAYER within the KIWAY and makes it very easy to find an open frame
quickly. It also gives control to the KIWAY as to frame hierarchical
relationships.
*) Change single_top to use the KIWAY for loading a KIFACE and instantiating
the single KIWAY_PLAYER, see bullet immediately above.
*) Add KIWAY::OnKiwayEnd() and call it from PGM_BASE at program termination, this
gives the KIFACEs a chance to save their final configuration dope to disk.
*) Add dedicated FRAME_T's for the modal frames, so m_Ident can be tested and
these modal frames are distinctly different than their non-modal equivalents.
KIWAY_PLAYER::IsModal() is !not! a valid test during the wxFrame's constructor,
so this is another important reason for having a dedicated FRAME_T for each
modal wxFrame.
On balance, more lines were deleted than were added to achieve all this.
*) void KIWAY::ExpressMail( FRAME_T aDestination, MAIL_T aCommand, const std::string& aPayload, wxWindow* aSource=NULL );
*) virtual void KiwayMailIn( KIWAY_EXPRESS& aEvent );
*) enum MAIL_T expansion into the brave new world if cross KIWAY_PLAYER communications.
Let the KIWAY_PLAYING begin.....
through well conceived mail from one KIWAY_PLAYER to another.
Get thinking now. Add a new MAIL_T value, then send ExpressMail(),
and receive it in KiwayMailIn(), it's that easy.