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 "ImageFormatRGB.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 ImageFormatRGB::ClassInitialized = FALSE;
25 
26 String ImageFormatRGB::DefaultResources[] = {
27     NUL(char*)
28 };
29 
30 
ImageFormatRGB(ImageFormatDialog * dialog)31 ImageFormatRGB::ImageFormatRGB (ImageFormatDialog* dialog) :
32     PixelImageFormat("RGBformat", dialog)
33 {
34 
35 }
36 
~ImageFormatRGB()37 ImageFormatRGB::~ImageFormatRGB()
38 {
39 }
40 
41 
initialize()42 void ImageFormatRGB::initialize()
43 {
44     if (!ImageFormatRGB::ClassInitialized) {
45 	this->setDefaultResources (theApplication->getRootWidget(),
46 	    ImageFormat::DefaultResources);
47 	this->setDefaultResources (theApplication->getRootWidget(),
48 	    PixelImageFormat::DefaultResources);
49 	this->setDefaultResources (theApplication->getRootWidget(),
50 	    ImageFormatRGB::DefaultResources);
51 	ImageFormatRGB::ClassInitialized = TRUE;
52     }
53 }
54 
eraseOutputFile(const char * fname)55 void ImageFormatRGB::eraseOutputFile(const char *fname)
56 {
57     char *cp;
58     char *srcfile = DuplicateString(fname);
59     char *file_to_delete = new char[strlen(fname) + 8];
60     if ( (cp = strstr (srcfile, ".rgb")) ) cp[0] = '\0';
61     sprintf (file_to_delete, "%s.rgb", srcfile);
62     unlink (file_to_delete);
63     sprintf (file_to_delete, "%s.size", srcfile);
64     unlink (file_to_delete);
65 
66     delete file_to_delete;
67     delete srcfile;
68 }
69 
isA(Symbol classname)70 boolean ImageFormatRGB::isA(Symbol classname)
71 {
72     Symbol s = theSymbolManager->registerSymbol(ClassImageFormatRGB);
73     if (s == classname)
74 	return TRUE;
75     else
76 	return this->ImageFormat::isA(classname);
77 }
78 
79