Commit 4c17d9bc authored by Ben Avison's avatar Ben Avison
Browse files

Simplified plug-in quit code: more of the work is now performed by the...

Simplified plug-in quit code: more of the work is now performed by the second-level plug-in (ie FontMerge).
parent 8d74f2ad
**************
* !LockSetup *
* !FontSetup *
**************
Version Date Who Change
-------------------------------------------------------------------------------
0.01 28/05/1998 BJGA First version
0.02 08/06/1998 BJGA Removed plug-in-quit objection code, this is
now to be handled by FontMerge
_TaskName:Fonts Setup
_Purpose:Configuring fonts
_Author: Acorn Computers Ltd, 1998
_Version:0.01 (28-May-98)
_Version:0.02 (08-Jun-98)
_ConfigText:Fonts
_ConfigHelp:Click SELECT to open the font configuration window.
_ConfigSprite:co_fonts
......
......@@ -25,6 +25,7 @@ Date Who Change
27/05/1998 BJGA Added fontmerge plug-in status globals
28/05/1998 BJGA Added complain, quit_parent, parent_taskhandle
and implemented main_startquit
08/06/1998 BJGA Removed complain, quit_parent and parent_taskhandle
\**************************************************************************/
......@@ -49,14 +50,11 @@ Date Who Change
/* Global variables */
BOOL quit = FALSE;
BOOL complain = TRUE;
ObjectId mainwindow_id;
ObjectId fontmenu_id;
MessagesFD messages;
BOOL fontmerge_alive = FALSE;
int fontmerge_taskhandle;
BOOL quit_parent = FALSE;
int parent_taskhandle;
const char *status_file = "<Choices$Write>.Boot.PreDesk.FontSetup";
/* Static global variables */
......
......@@ -23,6 +23,7 @@ Date Who Change
----------------------------------------------------------------------------
20/05/1998 BJGA Created
28/05/1998 BJGA Added handler for UserMessageAcknowledge
08/06/1998 BJGA Removed quit_parent code from wimpe_usermessageacknowledge
\**************************************************************************/
......@@ -74,32 +75,16 @@ static int wimpe_usermessageacknowledge (int event_code, WimpPollBlock *event, I
{
if (((WimpUserMessageAcknowledgeEvent *) event) -> hdr.action_code == Wimp_MPlugInQuit)
{
if (quit_parent)
/* Quit both unconditionally */
if (fontmerge_alive)
{
WimpMessage buffer;
complain = FALSE; /* Ignore Message_PlugInQuit next time */
quit_parent = FALSE;
/* Resume the top-level quit process */
buffer.hdr.size = 24;
buffer.hdr.size = 20;
buffer.hdr.your_ref = 0;
buffer.hdr.action_code = Wimp_MPlugInQuitContinue;
buffer.data.words [0] = PlugInSystem_Configure;
throw (wimp_send_message (17, &buffer, parent_taskhandle, 0, NULL));
}
else
{
/* Quit both unconditionally */
if (fontmerge_alive)
{
WimpMessage buffer;
buffer.hdr.size = 20;
buffer.hdr.your_ref = 0;
buffer.hdr.action_code = Wimp_MQuit;
throw (wimp_send_message (17, &buffer, fontmerge_taskhandle, 0, NULL));
}
quit = TRUE;
buffer.hdr.action_code = Wimp_MQuit;
throw (wimp_send_message (17, &buffer, fontmerge_taskhandle, 0, NULL));
}
quit = TRUE;
}
return 1;
}
......@@ -26,6 +26,7 @@ Date Who Change
28/05/1998 BJGA Added handlers for Message_PreQuit, Message_PlugInQuit,
Message_PlugInQuitContinue and Message_PlugInQuitAbort,
Also quits plug-in unconditionally on Message_Quit
08/06/1998 BJGA Removed Message_PlugInQuit and Message_PlugInQuitAbort handlers
\**************************************************************************/
......@@ -41,16 +42,13 @@ Date Who Change
static int wimpm_quit (WimpMessage *message, void *handle);
static int wimpm_prequit (WimpMessage *message, void *handle);
static int wimpm_pluginquit (WimpMessage *message, void *handle);
static int wimpm_pluginquitcontinue (WimpMessage *message, void *handle);
static int wimpm_pluginquitabort (WimpMessage *message, void *handle);
static int wimpm_taskclosedown (WimpMessage *message, void *handle);
static int wimpm_openconfigwindow (WimpMessage *message, void *handle);
int wimpm_messages [7] = { Wimp_MPreQuit,
int wimpm_messages [6] = { Wimp_MPreQuit,
Wimp_MPlugInQuit,
Wimp_MPlugInQuitContinue,
Wimp_MPlugInQuitAbort,
Wimp_MTaskCloseDown,
Wimp_MOpenConfigWindow,
0 };
......@@ -59,9 +57,7 @@ void wimpm_register (void)
{
throw (event_register_message_handler (Wimp_MQuit, wimpm_quit, NULL));
throw (event_register_message_handler (Wimp_MPreQuit, wimpm_prequit, NULL));
throw (event_register_message_handler (Wimp_MPlugInQuit, wimpm_pluginquit, NULL));
throw (event_register_message_handler (Wimp_MPlugInQuitContinue, wimpm_pluginquitcontinue, NULL));
throw (event_register_message_handler (Wimp_MPlugInQuitAbort, wimpm_pluginquitabort, NULL));
throw (event_register_message_handler (Wimp_MTaskCloseDown, wimpm_taskclosedown, NULL));
throw (event_register_message_handler (Wimp_MOpenConfigWindow, wimpm_openconfigwindow, NULL));
}
......@@ -110,28 +106,6 @@ static int wimpm_prequit (WimpMessage *message, void *handle)
return 1;
}
/****** wimpm_pluginquit() ************************************************\
Purpose: Handles Message_PlugInQuit (sent by Configure)
\**************************************************************************/
static int wimpm_pluginquit (WimpMessage *message, void *handle)
{
if (complain && message->data.words [0] == PlugInSystem_Configure)
{
quit_parent = TRUE;
parent_taskhandle = message->hdr.sender; /* Remember who to tell to resume quitting */
/* Now put the top-level quit on hold while we check our own plug-in's happiness to quit */
message->hdr.your_ref = message->hdr.my_ref;
throw (wimp_send_message (19, message, message->hdr.sender, 0, NULL));
main_startquit (0); /* Plug-in should complain if there's any outstanding work */
}
return 1;
}
/****** wimpm_pluginquitcontinue() ****************************************\
Purpose: Handles Message_PlugInQuitContinue (sent by FontMerge)
......@@ -147,22 +121,6 @@ static int wimpm_pluginquitcontinue (WimpMessage *message, void *handle)
return 1;
}
/****** wimpm_pluginquitabort() *******************************************\
Purpose: Handles Message_PlugInQuitAbort (sent by another top-level plug-in)
\**************************************************************************/
static int wimpm_pluginquitabort (WimpMessage *message, void *handle)
{
if (message->data.words [0] == PlugInSystem_Configure)
{
/* Top-level quit has been aborted */
complain = TRUE;
}
return 1;
}
/****** wimpm_taskclosedown() *********************************************\
Purpose: Handles Message_TaskCloseDown
......
......@@ -25,6 +25,7 @@ Date Who Change
27/05/1998 BJGA Added fontmerge plug-in status globals
28/05/1998 BJGA Added complain, quit_parent, parent_taskhandle
and main_startquit
08/06/1998 BJGA Removed complain, quit_parent and parent_taskhandle
\**************************************************************************/
......@@ -37,14 +38,11 @@ Date Who Change
/* Global variables */
extern BOOL quit;
extern BOOL complain;
extern ObjectId mainwindow_id;
extern ObjectId fontmenu_id;
extern MessagesFD messages;
extern BOOL fontmerge_alive;
extern int fontmerge_taskhandle;
extern BOOL quit_parent;
extern int parent_taskhandle;
extern const char *status_file;
/* Prototypes */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment