1 /***********************************************************************/
2 /* Open Visualization Data Explorer */
3 /* (C) Copyright IBM Corp. 1989,1999 */
4 /* ALL RIGHTS RESERVED */
5 /* This code licensed under the */
6 /* "IBM PUBLIC LICENSE - Open Visualization Data Explorer" */
7 /***********************************************************************/
8
9 #include <dxconfig.h>
10 #include "../base/defines.h"
11
12
13 #include "ImageFormatREX.h"
14 #include "Application.h"
15 #include "DXStrings.h"
16 #if defined(DXD_WIN) || defined(OS2)
17 #define unlink _unlink
18 #endif
19 #if defined(HAVE_UNISTD_H)
20 #include <unistd.h>
21 #endif
22
23
24 boolean ImageFormatREX::ClassInitialized = FALSE;
25
26 String ImageFormatREX::DefaultResources[] = {
27 NUL(char*)
28 };
29
30
ImageFormatREX(ImageFormatDialog * dialog)31 ImageFormatREX::ImageFormatREX (ImageFormatDialog* dialog) :
32 PixelImageFormat("REXformat", dialog)
33 {
34
35 }
36
~ImageFormatREX()37 ImageFormatREX::~ImageFormatREX()
38 {
39 }
40
41
initialize()42 void ImageFormatREX::initialize()
43 {
44 if (!ImageFormatREX::ClassInitialized) {
45 this->setDefaultResources (theApplication->getRootWidget(),
46 ImageFormat::DefaultResources);
47 this->setDefaultResources (theApplication->getRootWidget(),
48 PixelImageFormat::DefaultResources);
49 this->setDefaultResources (theApplication->getRootWidget(),
50 ImageFormatREX::DefaultResources);
51 ImageFormatREX::ClassInitialized = TRUE;
52 }
53 }
54
55
eraseOutputFile(const char * fname)56 void ImageFormatREX::eraseOutputFile(const char *fname)
57 {
58 char *cp;
59 char *srcfile = DuplicateString(fname);
60 char *file_to_delete = new char[strlen(fname) + 8];
61 if ( (cp = strstr (srcfile, ".r")) ) cp[0] = '\0';
62 sprintf (file_to_delete, "%s.r", srcfile);
63 unlink (file_to_delete);
64 sprintf (file_to_delete, "%s.g", srcfile);
65 unlink (file_to_delete);
66 sprintf (file_to_delete, "%s.b", srcfile);
67 unlink (file_to_delete);
68 sprintf (file_to_delete, "%s.size", srcfile);
69 unlink (file_to_delete);
70
71 delete file_to_delete;
72 delete srcfile;
73 }
74
isA(Symbol classname)75 boolean ImageFormatREX::isA(Symbol classname)
76 {
77 Symbol s = theSymbolManager->registerSymbol(ClassImageFormatREX);
78 if (s == classname)
79 return TRUE;
80 else
81 return this->ImageFormat::isA(classname);
82 }
83
84