Changeset 15 in flair-src for trunk/lib/FlairCore/src/DoubleSpinBox.cpp


Ignore:
Timestamp:
Apr 8, 2016, 3:40:57 PM (5 years ago)
Author:
Bayard Gildas
Message:

sources reformatted with flair-format-dir script

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairCore/src/DoubleSpinBox.cpp

    r2 r15  
    2020using std::string;
    2121
    22 namespace flair
    23 {
    24 namespace gui
    25 {
     22namespace flair {
     23namespace gui {
    2624
    27 DoubleSpinBox::DoubleSpinBox(const LayoutPosition* position,string name,double min,double max,double step,int decimals,double default_value):Box(position,name,"DoubleSpinBox")
    28 {
    29     //update value from xml file
    30     if(default_value<min) default_value=min;
    31     if(default_value>max) default_value=max;
    32     box_value=default_value;
     25DoubleSpinBox::DoubleSpinBox(const LayoutPosition *position, string name,
     26                             double min, double max, double step, int decimals,
     27                             double default_value)
     28    : Box(position, name, "DoubleSpinBox") {
     29  // update value from xml file
     30  if (default_value < min)
     31    default_value = min;
     32  if (default_value > max)
     33    default_value = max;
     34  box_value = default_value;
    3335
    34     SetVolatileXmlProp("min",min);
    35     SetVolatileXmlProp("max",max);
    36     SetVolatileXmlProp("step",step);
    37     SetVolatileXmlProp("decimals",decimals);
    38     GetPersistentXmlProp("value",box_value);
    39     SetPersistentXmlProp("value",box_value);
     36  SetVolatileXmlProp("min", min);
     37  SetVolatileXmlProp("max", max);
     38  SetVolatileXmlProp("step", step);
     39  SetVolatileXmlProp("decimals", decimals);
     40  GetPersistentXmlProp("value", box_value);
     41  SetPersistentXmlProp("value", box_value);
    4042
    41     SendXml();
     43  SendXml();
    4244}
    4345
    44 DoubleSpinBox::DoubleSpinBox(const LayoutPosition* position,string name,string suffix,double min,double max,double step,int decimals,double default_value):Box(position,name,"DoubleSpinBox")
    45 {
    46     //update value from xml file
    47     if(default_value<min) default_value=min;
    48     if(default_value>max) default_value=max;
    49     box_value=default_value;
     46DoubleSpinBox::DoubleSpinBox(const LayoutPosition *position, string name,
     47                             string suffix, double min, double max, double step,
     48                             int decimals, double default_value)
     49    : Box(position, name, "DoubleSpinBox") {
     50  // update value from xml file
     51  if (default_value < min)
     52    default_value = min;
     53  if (default_value > max)
     54    default_value = max;
     55  box_value = default_value;
    5056
    51     SetVolatileXmlProp("suffix",suffix);
    52     SetVolatileXmlProp("min",min);
    53     SetVolatileXmlProp("max",max);
    54     SetVolatileXmlProp("step",step);
    55     SetVolatileXmlProp("decimals",decimals);
    56     GetPersistentXmlProp("value",box_value);
    57     SetPersistentXmlProp("value",box_value);
     57  SetVolatileXmlProp("suffix", suffix);
     58  SetVolatileXmlProp("min", min);
     59  SetVolatileXmlProp("max", max);
     60  SetVolatileXmlProp("step", step);
     61  SetVolatileXmlProp("decimals", decimals);
     62  GetPersistentXmlProp("value", box_value);
     63  SetPersistentXmlProp("value", box_value);
    5864
    59     SendXml();
     65  SendXml();
    6066}
    6167
    62 DoubleSpinBox::~DoubleSpinBox()
    63 {
     68DoubleSpinBox::~DoubleSpinBox() {}
    6469
     70double DoubleSpinBox::Value(void) const {
     71  double tmp;
     72
     73  GetMutex();
     74  tmp = box_value;
     75  ReleaseMutex();
     76
     77  return tmp;
    6578}
    6679
    67 double DoubleSpinBox::Value(void) const
    68 {
    69     double tmp;
    70 
    71     GetMutex();
    72     tmp=box_value;
    73     ReleaseMutex();
    74 
    75     return tmp;
    76 }
    77 
    78 void DoubleSpinBox::XmlEvent(void)
    79 {
    80     GetMutex();
    81     if(GetPersistentXmlProp("value",box_value)) SetValueChanged();
    82     ReleaseMutex();
     80void DoubleSpinBox::XmlEvent(void) {
     81  GetMutex();
     82  if (GetPersistentXmlProp("value", box_value))
     83    SetValueChanged();
     84  ReleaseMutex();
    8385}
    8486
Note: See TracChangeset for help on using the changeset viewer.