On Sat, 20 May 2000, Bruce Pearson wrote:

> Make Insert Symbol Dialog modeless under WIN32
> 
> CVS: ----------------------------------------------------------------------
> 
> Martin,
> 
>       Why is the function UT_Bool XAP_Dialog_Modeless::isRunning(void) not a
> virtual function.

There was less chance of making a mistake propagating the function to the
other platforms and getting the cast on the other platfroms correct.

The widget pointer is cast as a (void *) and stored that way in xap_App.
If there is no running id the value of the pointer is (void *) NULL, which
is valid C++ on all platforms. OTherwise it is something else. It doesn't
matter what.

>       Storing a widget pointer in XAP_App is not cross-platform.
> 

I thought it would be OK if it is a (void *). 

>       Making isRunning virtual means that calling isRunning will call the
> platform specific code to determine if the dialog is running or not.
> 



>       EG.
> 
>       UT_Bool XAP_Win32Dialog_Insert_Symbol::isRunning(void)
>       {
>               return m_hDlg != NULL;
>       }
> 
>       or
> 
>       UT_Bool XAP_UnixDialog_Insert_Symbol::isRunning(void)
>       {
>               return mainWindow != NULL;
>       }
> 

That particular code is not nice on the linux platform without some
extra code elsewhere. The m_windowMain protected variable is not set to
NULL upon termination of the dialog. 

Subsequent invocation of the "Insert Symbol" command would return that it
is running when it actually isn't.

-Thanks for doing the Windows front end though :-)

Cheers

Martin





Reply via email to