diff options
Diffstat (limited to 'tksao')
-rw-r--r-- | tksao/colorbar/colorbar.C | 11 | ||||
-rw-r--r-- | tksao/colorbar/colormap.h | 2 | ||||
-rw-r--r-- | tksao/colorbar/lut.C | 5 | ||||
-rw-r--r-- | tksao/colorbar/lut.h | 2 | ||||
-rw-r--r-- | tksao/colorbar/sao.C | 5 | ||||
-rw-r--r-- | tksao/colorbar/sao.h | 2 |
6 files changed, 18 insertions, 9 deletions
diff --git a/tksao/colorbar/colorbar.C b/tksao/colorbar/colorbar.C index 49229cd..5b7a817 100644 --- a/tksao/colorbar/colorbar.C +++ b/tksao/colorbar/colorbar.C @@ -487,7 +487,10 @@ void Colorbar::mapCmd(int id) void Colorbar::saveCmd(const char* fn) { - cmaps.current()->save(fn); + if (!cmaps.current()->save(fn)) { + Tcl_AppendResult(interp, " unable to save colormap: ", fn, NULL); + result = TCL_ERROR; + } } void Colorbar::saveCmd(int id, const char* fn) @@ -495,12 +498,16 @@ void Colorbar::saveCmd(int id, const char* fn) ColorMapInfo* ptr = cmaps.begin(); while (ptr) { if (ptr->getID() == id) { - ptr->save(fn); + if (!ptr->save(fn)) { + Tcl_AppendResult(interp, " unable to save colormap: ", fn, NULL); + result = TCL_ERROR; + } return; } ptr = ptr->next(); } + Tcl_AppendResult(interp, " unable to save colormap: ", fn, NULL); result = TCL_ERROR; } diff --git a/tksao/colorbar/colormap.h b/tksao/colorbar/colormap.h index 9d1c006..45a66e0 100644 --- a/tksao/colorbar/colormap.h +++ b/tksao/colorbar/colormap.h @@ -53,7 +53,7 @@ public: virtual ColorMapInfo* dup() =0; virtual int load() =0; virtual int load(const char*) =0; - virtual void save(const char*) =0; + virtual int save(const char*) =0; virtual unsigned char getRedChar(int, int) =0; virtual unsigned char getGreenChar(int, int) =0; diff --git a/tksao/colorbar/lut.C b/tksao/colorbar/lut.C index 3b51110..08340c4 100644 --- a/tksao/colorbar/lut.C +++ b/tksao/colorbar/lut.C @@ -96,12 +96,13 @@ int LUTColorMap::load(const char* var) return 1; // we found at least one RGBColor } -void LUTColorMap::save(const char* fn) +int LUTColorMap::save(const char* fn) { ofstream fstr(fn); if (!fstr) - return; + return 0; fstr << *this; + return 1; } unsigned char LUTColorMap::getRedChar(int ii, int count) diff --git a/tksao/colorbar/lut.h b/tksao/colorbar/lut.h index 8b8bdf3..8249572 100644 --- a/tksao/colorbar/lut.h +++ b/tksao/colorbar/lut.h @@ -57,7 +57,7 @@ public: ColorMapInfo* dup() {return new LUTColorMap(*this);} int load(); int load(const char* var); - void save(const char*); + int save(const char*); unsigned char getRedChar(int, int); unsigned char getGreenChar(int, int); diff --git a/tksao/colorbar/sao.C b/tksao/colorbar/sao.C index c862371..10ff9bf 100644 --- a/tksao/colorbar/sao.C +++ b/tksao/colorbar/sao.C @@ -105,12 +105,13 @@ int SAOColorMap::load(const char* var) return 1; // we found at least one LIColor for each RGB } -void SAOColorMap::save(const char* fn) +int SAOColorMap::save(const char* fn) { ofstream f(fn); if (!f) - return; + return 0; f << *this; + return 1; } unsigned char SAOColorMap::getColorChar(int i, int count, List<LIColor>* cc) diff --git a/tksao/colorbar/sao.h b/tksao/colorbar/sao.h index 8e1d357..b67b7a7 100644 --- a/tksao/colorbar/sao.h +++ b/tksao/colorbar/sao.h @@ -65,7 +65,7 @@ public: ColorMapInfo* dup() {return new SAOColorMap(*this);} int load(); int load(const char* var); - void save(const char*); + int save(const char*); unsigned char getRedChar(int i, int c) {return getColorChar(i,c,&red);} unsigned char getGreenChar(int i, int c) {return getColorChar(i,c,&green);} |