Esempio n. 1
0
void MSVGauge::drawGauge(void)
{
  if (mapped()==MSTrue)
   {
     int x=sliderAreaRect().x()+SliderAreaShadowThickness;
     int y=y_end();
     int curValue=valueToPixel(currentValue())+slider()->height();
     int startValue;
     if(_startValue.isSet()==MSTrue)
      {
        double sv=_startValue;
        if(sv<valueMin()) sv=valueMin();
	else if(sv>valueMax()) sv=valueMax();
	startValue=valueToPixel(sv)+slider()->height();
      }
     else startValue=y-SliderAreaShadowThickness;
     Direction direction=curValue<startValue?Up:Down;
     int thickness=slider()->shadowThickness();
     int h=abs(startValue-curValue); 
     int starty=(direction==Up)?startValue:curValue;
     
     if (h>=thickness&&slider()->width()>thickness*2)
      {
        int height=h-(h>thickness*2?thickness*2:thickness);
        XBFillRectangle(display(),window(),slider()->backgroundShadowGC(),
                        x+thickness,starty-h+thickness,slider()->width()-2*thickness,height);
      }
     if (h>thickness&&thickness>0)
      {
        drawGaugeShadow(x,starty,h,thickness,direction);
      }
     gaugeHeight(h);
     _direction=direction;
   }
}
Esempio n. 2
0
void MSVGauge::updateGauge(int h_)
{
  if (mapped()==MSTrue)
   {
     int x=sliderAreaRect().x()+SliderAreaShadowThickness;
     int y=y_end();
     int curValue=valueToPixel(h_)+slider()->height();
     int startValue;
     if(_startValue.isSet()==MSTrue)
      {
        double sv=_startValue;
        if(sv<valueMin()) sv=valueMin();
	else if(sv>valueMax()) sv=valueMax();
	startValue=valueToPixel(sv)+slider()->height();
      }
     else startValue=y-SliderAreaShadowThickness;
     Direction direction=curValue<startValue?Up:Down;
     int thickness=slider()->shadowThickness();
     int h=abs(startValue-curValue); 
     int starty=startValue;
     int height=abs(h-gaugeHeight());
             
     if (h==gaugeHeight() && direction==_direction) return;
     else if (direction==_direction)
      {
        if (h<gaugeHeight())
         {
           // value is smaller, clear area
           starty=direction==Up?starty-gaugeHeight():starty+h-thickness;
           XFillRectangle(display(),window(),selectShadowGC(),x,starty,slider()->width(),height+thickness);
         }
        else
         {
           // value is bigger, add area
           starty=direction==Up?starty-h+thickness:starty+gaugeHeight()-thickness;
           XFillRectangle(display(),window(),slider()->backgroundShadowGC(),x+thickness,
                          starty,slider()->width()-2*thickness,height);
         }
        if (h>thickness&&thickness>0) updateGaugeShadow(x,starty,h,thickness,direction);
      }
     else
      {
        // direction changed, redraw
        drawSliderArea();
        drawGauge();
      }
     gaugeHeight(h);
     _direction=direction;
   }
}
Esempio n. 3
0
void MSVGauge::updateSliderSize(double value_)
{
  if (gaugeHeight()<=slider()->shadowThickness()||value_<=valueMin()||value_>=valueMax()) 
   {
     drawSliderArea();
     drawGauge();
   }
  else updateGauge((int)(value_));
  MSString buffer;
  valueWin()->updateValue(formatValue(buffer,value_));
}
Esempio n. 4
0
//-------------------------------------------------------------------------------------------------
void_t
IpcSemaphore::create(
    clong_t         &a_initialValue,
    std::ctstring_t &a_name
)
{
    xTEST_EQ(_isValid(), false);
    xTEST_GR(Path::maxSize(), a_name.size());
    xTEST_EQ(0L <= a_initialValue && a_initialValue <= valueMax(), true);

    _create_impl(a_initialValue, a_name);
}