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[ 10.5 ] [ 10.5.p1 ] [ 10.6 ] [ 10.6.p1 ] [ 10.6.p2 ] [ 10.6.p3 ] [ 10.7 ] [ 10.7.p1 ] [ 10.7.p2 ] [ 10.7.p3 ] [ 10.7.p4 ] [ 11.0 ] [ 11.0.p1 ] [ 11.0.p2 ] [ 11.0.p3, ] [ 11.0.p4 ] [ 11.1 ] [ 11.1.1 ] [ 11.1.2 ] [ 11.1.3 ] [ 11.2 ] [ 11.2.1 ] [ 11.2.2 ] [ 11.3.0 ]

Diff markup

Differences between /visualization/OpenGL/src/G4OpenGLXmSliderBar.cc (Version 11.3.0) and /visualization/OpenGL/src/G4OpenGLXmSliderBar.cc (Version 3.1)


                                                   >>   1 // This code implementation is the intellectual property of
                                                   >>   2 // the GEANT4 collaboration.
  1 //                                                  3 //
  2 // ******************************************* <<   4 // By copying, distributing or modifying the Program (or any work
  3 // * License and Disclaimer                    <<   5 // based on the Program) you indicate your acceptance of this statement,
  4 // *                                           <<   6 // and all its terms.
  5 // * The  Geant4 software  is  copyright of th << 
  6 // * the Geant4 Collaboration.  It is provided << 
  7 // * conditions of the Geant4 Software License << 
  8 // * LICENSE and available at  http://cern.ch/ << 
  9 // * include a list of copyright holders.      << 
 10 // *                                           << 
 11 // * Neither the authors of this software syst << 
 12 // * institutes,nor the agencies providing fin << 
 13 // * work  make  any representation or  warran << 
 14 // * regarding  this  software system or assum << 
 15 // * use.  Please see the license in the file  << 
 16 // * for the full disclaimer and the limitatio << 
 17 // *                                           << 
 18 // * This  code  implementation is the result  << 
 19 // * technical work of the GEANT4 collaboratio << 
 20 // * By using,  copying,  modifying or  distri << 
 21 // * any work based  on the software)  you  ag << 
 22 // * use  in  resulting  scientific  publicati << 
 23 // * acceptance of all terms of the Geant4 Sof << 
 24 // ******************************************* << 
 25 //                                             << 
 26 //                                                  7 //
                                                   >>   8 // $Id: G4OpenGLXmSliderBar.cc,v 1.4 2001/03/07 14:56:20 johna Exp $
                                                   >>   9 // GEANT4 tag $Name: geant4-03-01 $
 27 //                                                 10 //
 28 //Slider bar class. Inherits from G4OpenGLXmVW     11 //Slider bar class. Inherits from G4OpenGLXmVWidgetComponent
 29                                                    12 
                                                   >>  13 #ifdef G4VIS_BUILD_OPENGLXM_DRIVER
                                                   >>  14 
 30 #include "G4OpenGLXmVWidgetComponent.hh"           15 #include "G4OpenGLXmVWidgetComponent.hh"
 31 #include "G4OpenGLXmVWidgetContainer.hh"           16 #include "G4OpenGLXmVWidgetContainer.hh"
 32 #include "G4OpenGLXmSliderBar.hh"                  17 #include "G4OpenGLXmSliderBar.hh"
 33 #include <X11/Intrinsic.h>                         18 #include <X11/Intrinsic.h>
 34 #include <Xm/Scale.h>                              19 #include <Xm/Scale.h>
 35 #include "globals.hh"                              20 #include "globals.hh"
 36                                                    21 
 37 G4OpenGLXmSliderBar::G4OpenGLXmSliderBar (cons     22 G4OpenGLXmSliderBar::G4OpenGLXmSliderBar (const char* n,
 38             XtCallbackRec* c,                      23             XtCallbackRec* c,
 39             G4bool sh,                         <<  24             G4bool s,
 40             short dp,                              25             short dp,
 41             G4double v,                            26             G4double v,
 42             G4double max,                          27             G4double max,
 43             G4double min,                          28             G4double min,
 44             unsigned char o,                       29             unsigned char o,
 45             unsigned char d)                       30             unsigned char d) 
 46 : sliderbar(0)                                 << 
 47 , parent(0)                                    << 
 48 {                                                  31 {
 49   name = n;                                        32   name = n;
 50   callback = c;                                    33   callback = c;
 51   show = sh;                                   <<  34   show = s;
 52   decimal_places = dp;                             35   decimal_places = dp;
 53   initial_value = int(v * std::pow(10.0, (G4do <<  36   initial_value = int(v * pow(10.0, (G4double)dp));
 54   max_value = int(max * std::pow(10.0, (G4doub <<  37   max_value = int(max * pow(10.0, (G4double)dp));
 55   min_value = int(min * std::pow(10.0, (G4doub <<  38   min_value = int(min * pow(10.0, (G4double)dp));
 56   orientation = o;                                 39   orientation = o;
 57   direction = d;                                   40   direction = d;
 58 }                                                  41 }
 59                                                    42 
 60 G4OpenGLXmSliderBar::~G4OpenGLXmSliderBar ()       43 G4OpenGLXmSliderBar::~G4OpenGLXmSliderBar ()
 61 {}                                                 44 {}
 62                                                    45 
 63 const char* G4OpenGLXmSliderBar::GetName ()        46 const char* G4OpenGLXmSliderBar::GetName () 
 64 {                                                  47 {
 65   return name;                                     48   return name;
 66 }                                                  49 }
 67                                                    50 
 68 G4bool G4OpenGLXmSliderBar::GetShow ()             51 G4bool G4OpenGLXmSliderBar::GetShow () 
 69 {                                                  52 {
 70   return show;                                     53   return show;
 71 }                                                  54 }
 72                                                    55 
 73 short G4OpenGLXmSliderBar::GetDecimalPlaces ()     56 short G4OpenGLXmSliderBar::GetDecimalPlaces () 
 74 {                                                  57 {
 75   return decimal_places;                           58   return decimal_places;
 76 }                                                  59 }
 77                                                    60 
 78 G4double G4OpenGLXmSliderBar::GetInitialValue      61 G4double G4OpenGLXmSliderBar::GetInitialValue () 
 79 {                                                  62 {
 80   return (G4double)initial_value / std::pow(10 <<  63   return (G4double)initial_value / pow(10.0, (G4double)GetDecimalPlaces());
 81 }                                                  64 }
 82                                                    65 
 83 G4double G4OpenGLXmSliderBar::GetMaxValue ()       66 G4double G4OpenGLXmSliderBar::GetMaxValue () 
 84 {                                                  67 {
 85   return (G4double)max_value / std::pow(10.0,  <<  68   return (G4double)max_value / pow(10.0, (G4double)GetDecimalPlaces());
 86 }                                                  69 }
 87                                                    70 
 88 G4double G4OpenGLXmSliderBar::GetMinValue ()       71 G4double G4OpenGLXmSliderBar::GetMinValue () 
 89 {                                                  72 {
 90   return (G4double)min_value / std::pow(10.0,  <<  73   return (G4double)min_value / pow(10.0, (G4double)GetDecimalPlaces());
 91 }                                                  74 }
 92                                                    75 
 93 unsigned char G4OpenGLXmSliderBar::GetOrientat     76 unsigned char G4OpenGLXmSliderBar::GetOrientation () 
 94 {                                                  77 {
 95   return orientation;                              78   return orientation;
 96 }                                                  79 }
 97                                                    80 
 98 unsigned char G4OpenGLXmSliderBar::GetDirectio     81 unsigned char G4OpenGLXmSliderBar::GetDirection () 
 99 {                                                  82 {
100   return direction;                                83   return direction;
101 }                                                  84 }
102                                                    85 
103 void G4OpenGLXmSliderBar::SetName (const char*     86 void G4OpenGLXmSliderBar::SetName (const char* n) 
104 {                                                  87 {
105   name = n;                                        88   name = n;
106   XmString sliderbar_string = XmStringCreateLo     89   XmString sliderbar_string = XmStringCreateLocalized ((char*)name);
107   XtVaSetValues (sliderbar,                        90   XtVaSetValues (sliderbar,
108      XmNlabelString, sliderbar_string,             91      XmNlabelString, sliderbar_string,
109      NULL);                                        92      NULL);
110  XmStringFree (sliderbar_string);                  93  XmStringFree (sliderbar_string);
111 }                                                  94 }
112                                                    95 
113 void G4OpenGLXmSliderBar::SetShow (G4bool sh)  <<  96 void G4OpenGLXmSliderBar::SetShow (G4bool s) 
114 {                                                  97 {
115   show = sh;                                   <<  98   show = s;
116   XtVaSetValues (sliderbar,                        99   XtVaSetValues (sliderbar,
117      XmNshowValue, show,                          100      XmNshowValue, show,
118      NULL);                                       101      NULL);
119                                                   102   
120 }                                                 103 }
121                                                   104 
122 void G4OpenGLXmSliderBar::SetDecimalPlaces (sh    105 void G4OpenGLXmSliderBar::SetDecimalPlaces (short dp) 
123 {                                                 106 {
124   decimal_places = dp;                            107   decimal_places = dp;
125   XtVaSetValues (sliderbar,                       108   XtVaSetValues (sliderbar,
126      XmNdecimalPoints, decimal_places,            109      XmNdecimalPoints, decimal_places,
127      NULL);                                       110      NULL);
128                                                   111   
129 }                                                 112 }
130                                                   113 
131 void G4OpenGLXmSliderBar::SetInitialValue (G4d    114 void G4OpenGLXmSliderBar::SetInitialValue (G4double v) 
132 {                                                 115 {
133   initial_value = int(v * std::pow(10.0, (G4do << 116   initial_value = int(v * pow(10.0, (G4double)GetDecimalPlaces()));
134   XtVaSetValues (sliderbar,                       117   XtVaSetValues (sliderbar,
135      XmNvalue, initial_value,                     118      XmNvalue, initial_value,
136      NULL);                                       119      NULL);
137                                                   120   
138 }                                                 121 }
139                                                   122 
140 void G4OpenGLXmSliderBar::SetMaxValue (G4doubl    123 void G4OpenGLXmSliderBar::SetMaxValue (G4double v) 
141 {                                                 124 {
142   max_value = int(v * std::pow(10.0, (G4double << 125   max_value = int(v * pow(10.0, (G4double)GetDecimalPlaces()));
143   XtVaSetValues (sliderbar,                       126   XtVaSetValues (sliderbar,
144      XmNmaximum, max_value,                       127      XmNmaximum, max_value,
145      NULL);                                       128      NULL);
146                                                   129   
147 }                                                 130 }
148                                                   131 
149 void G4OpenGLXmSliderBar::SetMinValue (G4doubl    132 void G4OpenGLXmSliderBar::SetMinValue (G4double v) 
150 {                                                 133 {
151   min_value = int(v * std::pow(10.0, (G4double << 134   min_value = int(v * pow(10.0, (G4double)GetDecimalPlaces()));
152   XtVaSetValues (sliderbar,                       135   XtVaSetValues (sliderbar,
153      XmNminimum, min_value,                       136      XmNminimum, min_value,
154      NULL);                                       137      NULL);
155                                                   138   
156 }                                                 139 }
157                                                   140 
158 void G4OpenGLXmSliderBar::SetOrientation (unsi    141 void G4OpenGLXmSliderBar::SetOrientation (unsigned char o) 
159 {                                                 142 {
160   orientation = o;                                143   orientation = o;
161   XtVaSetValues (sliderbar,                       144   XtVaSetValues (sliderbar,
162      XmNorientation, orientation,                 145      XmNorientation, orientation,
163      NULL);                                       146      NULL);
164                                                   147   
165 }                                                 148 }
166                                                   149 
167 void G4OpenGLXmSliderBar::SetDirection (unsign    150 void G4OpenGLXmSliderBar::SetDirection (unsigned char d) 
168 {                                                 151 {
169   direction = d;                                  152   direction = d;
170   XtVaSetValues (sliderbar,                       153   XtVaSetValues (sliderbar,
171      XmNprocessingDirection, direction,           154      XmNprocessingDirection, direction,
172      NULL);                                       155      NULL);
173                                                   156   
174 }                                                 157 }
175                                                   158 
176 void G4OpenGLXmSliderBar::AddYourselfTo (G4Ope    159 void G4OpenGLXmSliderBar::AddYourselfTo (G4OpenGLXmVWidgetContainer* container)
177 {                                                 160 {
178                                                   161 
179   pView = container->GetView ();                  162   pView = container->GetView ();
180   ProcesspView ();                                163   ProcesspView ();
181                                                   164 
182   parent = container->GetPointerToWidget ();      165   parent = container->GetPointerToWidget ();
183   XmString name_string = XmStringCreateLocaliz    166   XmString name_string = XmStringCreateLocalized ((char*)name);
184   sliderbar = XtVaCreateManagedWidget (name,      167   sliderbar = XtVaCreateManagedWidget (name,
185                xmScaleWidgetClass,                168                xmScaleWidgetClass,
186                *parent,                           169                *parent,
187                                                   170                
188                XmNtitleString, name_string,       171                XmNtitleString, name_string,
189                XmNmaximum, max_value,             172                XmNmaximum, max_value,
190                XmNminimum, min_value,             173                XmNminimum, min_value,
191                XmNvalue, initial_value,           174                XmNvalue, initial_value,
192                XmNshowValue, show,                175                XmNshowValue, show,
193                XmNdecimalPoints, decimal_place    176                XmNdecimalPoints, decimal_places,
194                XmNorientation, orientation,       177                XmNorientation, orientation,
195                XmNprocessingDirection, directi    178                XmNprocessingDirection, direction,
196                                                   179   
197                XtNvisual, visual,                 180                XtNvisual, visual,
198                XtNdepth, depth,                   181                XtNdepth, depth,
199                XtNcolormap, cmap,                 182                XtNcolormap, cmap,
200                XtNborderColor, borcol,            183                XtNborderColor, borcol,
201                XtNbackground, bgnd,               184                XtNbackground, bgnd,
202                                                   185 
203                NULL);                             186                NULL);
204                                                   187                
205   XtAddCallbacks (sliderbar,                      188   XtAddCallbacks (sliderbar,
206       XmNvalueChangedCallback,                    189       XmNvalueChangedCallback,
207       callback);                                  190       callback);
208                                                   191 
209   XtAddCallbacks (sliderbar,                      192   XtAddCallbacks (sliderbar,
210       XmNdragCallback,                            193       XmNdragCallback,
211       callback);                                  194       callback);
212   XmStringFree (name_string);                     195   XmStringFree (name_string);
213 }                                                 196 }
214                                                   197 
215 Widget* G4OpenGLXmSliderBar::GetPointerToParen    198 Widget* G4OpenGLXmSliderBar::GetPointerToParent ()
216 {                                                 199 {
217   return parent;                                  200   return parent;
218 }                                                 201 }
219                                                   202 
220 Widget* G4OpenGLXmSliderBar::GetPointerToWidge    203 Widget* G4OpenGLXmSliderBar::GetPointerToWidget () 
221 {                                                 204 {
222   return &sliderbar;                              205   return &sliderbar;
223 }                                                 206 }
                                                   >> 207 
                                                   >> 208 #endif
224                                                   209