File: GARApplication.h

package info (click to toggle)
dx 1%3A4.4.4-9
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 55,184 kB
  • ctags: 54,432
  • sloc: ansic: 365,478; cpp: 156,582; sh: 10,872; java: 10,641; makefile: 2,291; awk: 444; yacc: 327
file content (235 lines) | stat: -rw-r--r-- 6,496 bytes parent folder | download | duplicates (7)
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
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
/***********************************************************************/
/* 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>


#ifndef _GARApplication_h
#define _GARApplication_h

#if defined(HAVE_SSTREAM)
#include <sstream>
#elif defined(HAVE_STRSTREAM_H)
#include <strstream.h>
#elif defined(HAVE_STRSTREA_H)
#include <strstrea.h>
#endif

#if 0
#if defined(cygwin)
#include <g++/iostream.h>
#endif
#endif

#include <Xm/Xm.h>

#include "../base/MainWindow.h"
#include "../base/Dialog.h"
#include "../base/IBMApplication.h"
#include "../base/List.h"
#if !defined(DXD_OS_NON_UNIX) && defined(DXD_LICENSED_VERSION)
#include "../base/TemporaryLicense.h"
#endif


class GARMainWindow;
class GARChooserWindow;
class Command;
class GridChoice;

//
// Class name definition:
//
#define ClassGARApplication	"GARApplication"

//
// XtCallbackProc (*CB), XtEventHandler (*EH) and XtActionProc (*AP)
// DialogCallback (*DCB), XtInputCallbackProc (*ICP), XtWorkProc (*WP)
// functions for this and derived classes
//
extern "C" void GARApplication_XtWarningHandler(char*);
extern "C" void GARApplication_HelpCB(Widget, XtPointer, XtPointer);
extern "C" int	GARApplication_XErrorHandler(Display *display, 
						XErrorEvent *event);
extern "C" void GARApplication_NoStdinCB(XtPointer, int*, XtInputId*);
extern "C" void GARApplication_StdinCB(XtPointer, int*, XtInputId*);
extern "C" Boolean GARApplication_CheckStdoutWP (XtPointer );
extern "C" void GARApplication_CheckStdoutTO (XtPointer , XtIntervalId* );


// If you're building on IRIX 6 or later, then remove the test for defined(sgi)
#if defined(sun4) || defined(sgi) && !( __mips > 1)
extern "C" void GARApplication_HandleCoreDump(int dummy, ... );
extern "C" void GARApplication_CleanUp(int dummy, ... );
#else
extern "C" void GARApplication_HandleCoreDump(int dummy);
extern "C" void GARApplication_CleanUp(int dummy);
#endif


typedef struct
{
    Pixel	insensitiveColor;
    Boolean	full;
    Boolean	help;
    String	file;
    int		port;
    String	exec;
    String	net_dir;
    Boolean	debugging;
    String	data_file;
    Boolean	limited_use;
} GARResource;

#if !defined(DXD_OS_NON_UNIX) && defined(DXD_LICENSED_VERSION)
class GARApplication : public IBMApplication, public TemporaryLicense
#else
class GARApplication : public IBMApplication
#endif
{

  private:
    //
    // Private class data:
    //
    static boolean    GARApplicationClassInitialized; // class initialized?
    friend void GARApplication_XtWarningHandler(char *message);
    friend int	      GARApplication_XErrorHandler(Display *display, 
						XErrorEvent *event);
    friend Boolean GARApplication_CheckStdoutWP (XtPointer );
    friend void GARApplication_CheckStdoutTO (XtPointer , XtIntervalId* );

    friend class GARChooserWindow;
    friend class GridChoice;

    void shutdownApplication() {};

    GARMainWindow	*mainWindow;
    GARChooserWindow	*chooserWindow;

    boolean		is_dirty;
    List                dumpedObjects;

    friend void GARApplication_HelpCB(Widget, XtPointer , XtPointer);

    void destroyDumpedObjects();
    void *dataFileSource;

    void destroyMainWindow();

    void	openGeneralFile(const char *);

  protected:
    //
    // Overrides the Application class version:
    //   Initializes Xt Intrinsics with option list (switches).
    //
    virtual boolean initialize(int* argcp,
			    char**        argv);

    CommandScope       *commandScope;   // command scope

    //
    //   Handles application events.
    //   This routine should be called by main() only.
    //
    virtual void handleEvents();

    static GARResource	resource;

    virtual const char* getRootDir() { return this->getUIRoot(); }

  public:

    static char *FileFound (const char *, const char *);

    void postChooserWindow();
    void postMainWindow(unsigned long);
    GARMainWindow *getMainWindow(boolean create = FALSE);
    GARChooserWindow *getChooserWindow() { return this->chooserWindow; }
    char *resolvePathName(const char *, const char *);

    void *getDataFileSource() { return this->dataFileSource; }
    void  setDataFileSource(void *source) { this->dataFileSource = source; }

    boolean isDirty(){return this->is_dirty;}
    void setDirty();
    void setClean();

    void changeMode(unsigned long, std::istream *);

    const char *getResourcesExec() { return this->resource.exec; }
    int	        getResourcesPort() { return this->resource.port; }
    const char *getResourcesNetDir();
    boolean     getResourcesDebug(){ return this->resource.debugging; }
    const char *getResourcesData() { return this->resource.data_file; }

#if !defined(DXD_OS_NON_UNIX) && defined(DXD_LICENSED_VERSION)
    const char *getResourcesDxuiArgs() { 
	return (this->resource.limited_use?this->getLimitedArgs():NUL(char*));
    }
#endif

    Pixel getInsensitiveColor()
    {
	return this->resource.insensitiveColor;
    }

    static void addHelpCallbacks(Widget, const char *widget_name_key=NULL);

    virtual const char *getHelpDirFileName();

    //
    // Constructor:
    //
    GARApplication(char* className);

    //
    // Destructor:
    //
    ~GARApplication();

    //
    // Return the name of the application (i.e. 'Data Explorer',
    // 'Data Prompter', 'Medical Visualizer'...).
    //
    virtual const char *getInformalName();

    //
    // Return the formal name of the application (i.e.
    // 'Open Visualization Data Explorer', 'Open Visualization Data Prompter'...)
    //
    virtual const char *getFormalName();

    //
    // Get the applications copyright notice, for example...
    // "Copyright International Business Machines Corporation 1991-1993
    // All rights reserved"
    //
    virtual const char *getCopyrightNotice();

    const char *getStartTutorialCommandString();

    void dumpObject(Base *object);

    virtual boolean inWizardMode() { return TRUE; }

    //
    // Returns a pointer to the class name.
    //
    const char* getClassName()
    {
        return ClassGARApplication;
    }
};


extern GARApplication* theGARApplication;

#endif /*  _GARApplication_h */