Logo ROOT   6.30.04
Reference Guide
 All Namespaces Files Pages
TASPaletteEditor.h
Go to the documentation of this file.
1 // @(#)root/asimage:$Id$
2 // Author: Reiner Rohlfs 24/03/2002
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2002, Rene Brun, Fons Rademakers and Reiner Rohlfs *
6  * All rights reserved. *
7  * *
8  * For the licensing terms see $ROOTSYS/LICENSE. *
9  * For the list of contributors see $ROOTSYS/README/CREDITS. *
10  *************************************************************************/
11 
12 #ifndef ROOT_TASPaletteEditor
13 #define ROOT_TASPaletteEditor
14 
15 
16 //////////////////////////////////////////////////////////////////////////
17 // //
18 // TASPaletteEditor //
19 // //
20 // This is a GUI window to edit a color palette. //
21 // It is called by a context menu item of TImage. //
22 // //
23 //////////////////////////////////////////////////////////////////////////
24 
25 #include "TAttImage.h"
26 #include "TGFrame.h"
27 #include "TLine.h"
28 
29 
30 class TVirtualPad;
31 class TH1D;
32 class TRootEmbeddedCanvas;
33 class TGTextButton;
34 class TGCheckButton;
35 class TGComboBox;
36 class TGRadioButton;
37 
38 
39 class TASPaletteEditor : public TPaletteEditor, public TGMainFrame {
40 
41 protected:
42  class PaintPalette : public TObject {
43  protected :
44  TImagePalette **fPalette;
45  TAttImage *fAttImage;
46  public:
47  PaintPalette(TImagePalette **palette, TAttImage *attImage)
48  { fPalette = palette; fAttImage = attImage; }
49  void Paint(Option_t *option);
50  };
51 
52  class LimitLine : public TLine {
53  private:
54  TASPaletteEditor *fGui;
55  protected:
56  virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py);
57  public:
58  LimitLine(Coord_t x, Coord_t y1, Coord_t y2, TASPaletteEditor *gui);
59  void Paint(Option_t *option);
60  };
61 
62  Double_t fMinValue; ///< min value of image
63  Double_t fMaxValue; ///< max value of image
64 
65  TH1D *fHisto; ///< histogram of image pixels
66  TRootEmbeddedCanvas *fPaletteCanvas; ///< canvas to draw the current palette
67  TRootEmbeddedCanvas *fHistCanvas; ///< canvas to draw the histogram
68  TList *fPaletteList; ///< list of palettes for undo and redo
69  TImagePalette *fPalette; ///< current palette
70  TVirtualPad *fImagePad;
71  PaintPalette *fPaintPalette;
72  LimitLine *fLimitLine[2];
73 
74  TGTextButton *fUnDoButton;
75  TGTextButton *fReDoButton;
76 
77  TGCheckButton *fAutoUpdate;
78  TGCheckButton *fStepButton;
79  TGRadioButton *fRamps[3];
80  Int_t fRampFactor;
81 
82  TGComboBox *fComboBox;
83 
84  void InsertNewPalette(TImagePalette *newPalette);
85 
86  void Save();
87  void Open();
88 
89  void LogPalette();
90  void ExpPalette();
91  void LinPalette();
92  void InvertPalette();
93  void NewPalette(Long_t id);
94  void SetStep();
95  void SetRamp(Long_t ramp);
96 
97  void UpdateScreen(Bool_t histoUpdate);
98 
99 public:
100  TASPaletteEditor(TAttImage *attImage, UInt_t w, UInt_t h);
101  virtual ~TASPaletteEditor();
102 
103  Bool_t ProcessMessage(Long_t msg, Long_t param1, Long_t param2);
104 
105  void UpdateRange();
106  void CloseWindow();
107 
108  ClassDef(TASPaletteEditor,0) // GUI to edit a color palette
109 };
110 
111 #endif