1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209
|
/***********************************************************************/
/* Open Visualization Data Explorer */
/* (C) Copyright IBM Corp. 1989,1999 */
/* ALL RIGHTS RESERVED */
/* This code licensed under the */
/* "IBM PUBLIC LICENSE - Open Visualization Data Explorer" */
/***********************************************************************/
#include <dxconfig.h>
#include "../base/defines.h"
#include <Xm/Xm.h>
#include <Xm/Label.h>
#include <X11/cursorfont.h>
#if defined(HAVE_UNISTD_H)
#include <unistd.h>
#endif
#include <signal.h>
#include <errno.h>
#include "DXStrings.h"
#include "MainWindow.h"
#include "MBApplication.h"
#include "MBMainWindow.h"
#include "../widgets/Number.h"
#define XK_MISCELLANY
#include <X11/keysym.h>
MBApplication* theMBApplication = NUL(MBApplication*);
boolean MBApplication::MBApplicationClassInitialized = FALSE;
MBResource MBApplication::resource;
static
XrmOptionDescRec _MBOptionList[] =
{
{
"-warning",
"*warningEnabled",
XrmoptionSepArg,
"False"
},
};
static
XtResource _MBResourceList[] =
{
{
"MBInsensitiveColor",
"Color",
XmRPixel,
sizeof(Pixel),
XtOffset(MBResource*, insensitiveColor),
XmRString,
(XtPointer)"#888"
},
};
static
const String _defaultMBResources[] =
{
"*XmScrollBar.initialDelay: 2000",
"*XmScrollBar.repeatDelay: 2000",
NULL
};
MBApplication::MBApplication(char* className): IBMApplication(className)
{
//
// Set the global MB application pointer.
//
theMBApplication = this;
theMBApplication->is_dirty = FALSE;
}
MBApplication::~MBApplication()
{
//
// Set the flag to terminate the event processing loop.
//
theMBApplication = NULL;
}
#if defined (SIGDANGER)
extern "C" {
static void
SigDangerHandler(int dummy)
{
char *msg =
#if defined(ibm6000)
"AIX has notified Data Explorer that the User Interface\nis in"
" danger of being killed due to insufficient page space.\n";
#else
"The operating system has issued a SIGDANGER to the User Interface\n";
#endif
write(2, msg, strlen(msg));
signal(SIGDANGER, SigDangerHandler);
}
}
#endif
static void
InitializeSignals(void)
{
#if defined(SIGDANGER)
signal(SIGDANGER, SigDangerHandler);
#endif
}
boolean MBApplication::initialize(int* argcp,
char** argv)
{
ASSERT(argcp);
ASSERT(argv);
if (!this->IBMApplication::initializeWindowSystem(argcp,argv))
return FALSE;
if (!this->IBMApplication::initialize(argcp,argv))
return FALSE;
InitializeSignals();
this->parseCommand(argcp, argv, _MBOptionList, XtNumber(_MBOptionList));
this->setDefaultResources(this->getRootWidget(), _defaultMBResources);
this->setDefaultResources(this->getRootWidget(),
IBMApplication::DefaultResources);
//
// Get application resources.
//
if (NOT MBApplication::MBApplicationClassInitialized)
{
this->getResources((XtPointer)&MBApplication::resource,
_MBResourceList,
XtNumber(_MBResourceList));
MBApplication::MBApplicationClassInitialized = TRUE;
}
this->mainWindow = new MBMainWindow();
this->mainWindow->manage();
this->setBusyCursor(TRUE);
//
// Refresh the screen.
//
XmUpdateDisplay(this->getRootWidget());
//
// Post the copyright message.
//
this->postCopyrightNotice();
this->setBusyCursor(FALSE);
return TRUE;
}
//
// Return the name of the application (i.e. 'Data Explorer',
// 'Data Prompter', 'Medical Visualizer'...).
//
const char *MBApplication::getInformalName()
{
return "Module Builder";
}
//
// Return the formal name of the application (i.e.
// 'Open Visualization Data Explorer', 'Open Visualization Data Prompter'...)
//
const char *MBApplication::getFormalName()
{
return "Open Visualization Module Builder";
}
//
// Get the applications copyright notice, for example...
// "Copyright International Business Machines Corporation 1991-1993
// All rights reserved"
//
const char *MBApplication::getCopyrightNotice()
{
return DXD_COPYRIGHT_STRING;
}
const char *MBApplication::getHelpDirFileName()
{
return "MBHelpDir";
}
const char *MBApplication::getStartTutorialCommandString()
{
// At some point we may want to define this to be the module builder
// specific tutorial.
return this->IBMApplication::getStartTutorialCommandString();
}
|