summaryrefslogtreecommitdiffstats
path: root/tksao/colorbar/colorbar.h
blob: f33b96dcfa3ea1204cc0cdd12e254dc68e02bebc (plain)
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
// Copyright (C) 1999-2018
// Smithsonian Astrophysical Observatory, Cambridge, MA, USA
// For conditions of distribution and use, see copyright notice in "copyright"

#ifndef __colorbar_h__
#define __colorbar_h__

#include "colorbarbase.h"
#include "colormap.h"
#include "colortag.h"
#include "list.h"

// Colormap(s) are X window Colormap ID's. ColorMapInfo(s) contain a fixed 
// number of real RGB color cells. RGB Values of ColorMapInfo(s) are 
// never altered. Colormap(s) are initialized from ColorMapInfo values. 
// Colormap RGB values will changed, based on user input.

class Filter;

class Colorbar : public ColorbarBase {
 public:
  enum ColorTagAction {NONE,CREATE,START,STOP,MOVE};

 protected:
  List<ColorMapInfo> cmaps;
  List<ColorTag> ctags;
  float bias;
  float contrast;

  ColorTag* tag;
  ColorTagAction tagaction;
  int taginit;

 private:
  ColorMapInfo* newColorMap(const char*, const char*);

  void psHorz(ostream&, Filter&, int, int);
  void psVert(ostream&, Filter&, int, int);

 protected:
  int calcContrastBias(int);
  void loadDefaultCMaps();
  void reset();
  void updateColorCells();

#ifdef MAC_OSX_TK
  void macosx(float, int, int, const Vector&, const Vector&);
#endif
#ifdef __WIN32
  void win32(float, int, int, const Vector&, const Vector&);
#endif

 public:
  Colorbar(Tcl_Interp*, Tk_Canvas, Tk_Item*);
  virtual ~Colorbar();

  // commands

  void adjustCmd(float, float);
  void getBiasCmd();
  void getColorbarCmd();
  void getColormapCmd();
  void getColormapNameCmd(int);
  void getColormapFileNameCmd(int);
  void getContrastCmd();
  void getCurrentFileNameCmd();
  void getCurrentIDCmd();
  void getCurrentNameCmd();
  void listIDCmd();
  void listNameCmd();
  void loadCmd(const char*, const char*);
  void loadCmd(const char*, const char*, const char*);
  void mapCmd(char*);
  void mapCmd(int);
  void saveCmd(const char*);
  void saveCmd(int, const char*);
  void setColorbarCmd(int, float, float, int);

  void getTagCmd();
  void getTagCmd(int,int);
  void tagCmd(const char*);
  void tagCmd(int, const Vector&, const char*);
  void tagDeleteCmd();
  void tagDeleteCmd(int,int);
  void tagEditBeginCmd(int,int,const char*);
  void tagEditMotionCmd(int,int);
  void tagEditEndCmd(int,int);
  void tagLoadCmd(const char*);
  void tagSaveCmd(const char*);

  void getRGBChannelCmd();
};

#endif