Пример #1
0
void			option_menu_2(t_data *data, int selected_index,
				      t_bunny_position pos,
				      t_bunny_position size)
{
  pos.y = data->rect_opt[2].pos.y + data->rect_opt[1].size.y + 20;
  data->rect_opt[3] = label(data, false, size, pos);
  pos.y = data->rect_opt[3].pos.y + data->rect_opt[1].size.y + 15;
  if (selected_index == 2)
    data->rect_opt[4] = slider(data, true, data->config->volume, pos);
  else
    data->rect_opt[4] = slider(data, false, data->config->volume, pos);
  pos.y = data->rect_opt[4].pos.y + data->rect_opt[1].size.y + 20;
  data->rect_opt[5] = label(data, false, size, pos);
  pos.y = data->rect_opt[5].pos.y + data->rect_opt[1].size.y + 20;
  if (selected_index == 3)
    data->rect_opt[6] = slider(data, true, data->config->fov, pos);
  else
    data->rect_opt[6] = slider(data, false, data->config->fov, pos);
  pos.y = data->rect_opt[6].pos.y + data->rect_opt[1].size.y + 20 ;
  (selected_index == 4) ? (data->rect_opt[7] = label(data, true, size, pos)) :
    (data->rect_opt[7] = label(data, false, size, pos));
  pos.y = data->rect_opt[7].pos.y + data->rect_opt[1].size.y + 20;
  (selected_index == 5) ? (data->rect_opt[8] = label(data, true, size, pos)) :
    (data->rect_opt[8] = label(data, false, size, pos));
  pos.y = data->rect_opt[8].pos.y + data->rect_opt[1].size.y + 20;
  (selected_index == 6) ? (data->rect_opt[9] = label(data, true, size, pos)) :
  (data->rect_opt[9] = label(data, false, size, pos));
}
/*! \reimp */
QString QAccessibleSlider::text(Text t, int child) const
{
    if (!slider()->isVisible())
        return QString();
    switch (t) {
    case Value:
        if (!child || child == 2)
            return QString::number(slider()->value());
        return QString();
    case Name:
        switch (child) {
        case PageLeft:
            return slider()->orientation() == Qt::Horizontal ?
                QSlider::tr("Page left") : QSlider::tr("Page up");
        case Position:
            return QSlider::tr("Position");
        case PageRight:
            return slider()->orientation() == Qt::Horizontal ?
                QSlider::tr("Page right") : QSlider::tr("Page down");
        }
        break;
    default:
        break;
    }
    return QAccessibleAbstractSlider::text(t, child);
}
Пример #3
0
void ThumbnailSlider::updateToolTip()
{
    // FIXME: i18n?
    const int size = slider()->sliderPosition();
    const QString text = QString("%1 x %2").arg(size).arg(size);
    slider()->setToolTip(text);
}
Пример #4
0
void
OCRuler::updateGeometry()
{
	QSize rsz = QFontMetrics(slider()->font()).size(SLIDER_TEXT_FLAGS, "09.,");
	int gap = 2;
	int min_sld = 2;
	int sld = 16;
	off_y = rsz.height() + gap;

	QRect br = boundingRect();
	if (br.height() < off_y + min_sld)
		br.setHeight(off_y + min_sld);
	if (br.width() < rsz.width())
		br.setWidth(rsz.width());

	if (slider()->orientation() == Vertical) {
		if (sld > br.width())
			sld = br.width();
		off_x = (br.width() - sld) / 2;
		slider()->setGeometry(br.x() + off_x, br.y() + off_y,
								sld, br.height() - off_y);
	} else {
		if (sld > br.height() - off_y)
			sld = br.height() - off_y;
		off_x = 0;
		slider()->setGeometry(br.x(), br.y() + off_y, br.width(), sld);
	}

	updateSize(br);
	update();
}
Пример #5
0
void
OCRuler::update()
{
	if (slider() && slider()->value() != int(vcur))
		slider()->setValue(int(vcur));
	vslide = vcur;
	OCDataWidget::update();
}
Пример #6
0
void ConstraintPhysicsSetup::initPhysics()
{
	m_guiHelper->setUpAxis(1);

	createEmptyDynamicsWorld();

	m_guiHelper->createPhysicsDebugDrawer(m_dynamicsWorld);
	int mode = btIDebugDraw::DBG_DrawWireframe + btIDebugDraw::DBG_DrawConstraints + btIDebugDraw::DBG_DrawConstraintLimits;
	m_dynamicsWorld->getDebugDrawer()->setDebugMode(mode);

	{
		SliderParams slider("target vel", &targetVel);
		slider.m_minVal = -4;
		slider.m_maxVal = 4;
		m_guiHelper->getParameterInterface()->registerSliderFloatParameter(slider);
	}

	{
		SliderParams slider("max impulse", &maxImpulse);
		slider.m_minVal = 0;
		slider.m_maxVal = 1000;
		m_guiHelper->getParameterInterface()->registerSliderFloatParameter(slider);
	}

	{
		SliderParams slider("actual vel", &actualHingeVelocity);
		slider.m_minVal = -4;
		slider.m_maxVal = 4;
		m_guiHelper->getParameterInterface()->registerSliderFloatParameter(slider);
	}

	val = 1.f;
	{
		SliderParams slider("angle", &val);
		slider.m_minVal = -720;
		slider.m_maxVal = 720;
		m_guiHelper->getParameterInterface()->registerSliderFloatParameter(slider);
	}

	{  // create a door using hinge constraint attached to the world
		btCollisionShape* pDoorShape = new btBoxShape(btVector3(2.0f, 5.0f, 0.2f));
		m_collisionShapes.push_back(pDoorShape);
		btTransform doorTrans;
		doorTrans.setIdentity();
		doorTrans.setOrigin(btVector3(-5.0f, -2.0f, 0.0f));
		btRigidBody* pDoorBody = createRigidBody(1.0, doorTrans, pDoorShape);
		pDoorBody->setActivationState(DISABLE_DEACTIVATION);
		const btVector3 btPivotA(10.f + 2.1f, -2.0f, 0.0f);  // right next to the door slightly outside

		spDoorHinge = new btHingeAccumulatedAngleConstraint(*pDoorBody, btPivotA, btAxisA);

		m_dynamicsWorld->addConstraint(spDoorHinge);

		spDoorHinge->setDbgDrawSize(btScalar(5.f));
	}

	m_guiHelper->autogenerateGraphicsObjects(m_dynamicsWorld);
}
Пример #7
0
void ThumbnailSlider::slotActionTriggered(int actionTriggered)
{
    updateToolTip();

    if (actionTriggered != QAbstractSlider::SliderNoAction) {
        // If we are updating because of a direct action on the slider, show
        // the tooltip immediately.
        const QPoint pos = slider()->mapToGlobal(QPoint(0, slider()->height() / 2));
        QToolTip::showText(pos, slider()->toolTip(), slider());
    }
}
Пример #8
0
void
OCRuler::drawShape(QPainter& p)
{
	QString vs;
	vs.sprintf("%.1f", vslide);
	if (slider()) {
		p.setFont(slider()->font());
		p.setPen(slider()->paletteForegroundColor());
	}
	p.drawText(boundingRect(), SLIDER_TEXT_FLAGS, vs);
}
Пример #9
0
void createUI(NVGcontext *vg, float w, float h)
{
    int col;

    uiClear();

    {
        int root = uiItem(); 
        // position root element
        uiSetLayout(root,UI_LEFT|UI_TOP);
        uiSetMargins(root,50,50,0,0);
        uiSetSize(root,250,400);
    }

    col = column(0);
    uiSetLayout(col, UI_TOP|UI_HFILL);

    button(col, __LINE__, BND_ICONID(6,3), "Item 1", demohandler);
    button(col, __LINE__, BND_ICONID(6,3), "Item 2", demohandler);

    {
        int h = hgroup(col);
        radio(h, __LINE__, BND_ICONID(6,3), "Item 3.0", &enum1);
        radio(h, __LINE__, BND_ICONID(0,10), NULL, &enum1);
        radio(h, __LINE__, BND_ICONID(1,10), NULL, &enum1);
        radio(h, __LINE__, BND_ICONID(6,3), "Item 3.3", &enum1);
    }

    {
        int colr;
        int rows = row(col);
        int coll = vgroup(rows);
        label(coll, -1, "Items 4.0:");
        coll = vgroup(coll);
        button(coll, __LINE__, BND_ICONID(6,3), "Item 4.0.0", demohandler);
        button(coll, __LINE__, BND_ICONID(6,3), "Item 4.0.1", demohandler);
        colr = vgroup(rows);
        uiSetFrozen(colr, option1);
        label(colr, -1, "Items 4.1:");
        colr = vgroup(colr);
        slider(colr, __LINE__, "Item 4.1.0", &progress1);
        slider(colr,__LINE__, "Item 4.1.1", &progress2);
    }

    button(col, __LINE__, BND_ICONID(6,3), "Item 5", NULL);

    check(col, __LINE__, "Frozen", &option1);
    check(col, __LINE__, "Item 7", &option2);
    check(col, __LINE__, "Item 8", &option3);

    textbox(col, (UIhandle)textbuffer, textbuffer, 32);

    uiLayout();
}
Пример #10
0
void build_democontent(int parent) {
    // some persistent variables for demonstration
    static float progress1 = 0.25f;
    static float progress2 = 0.75f;
    static int option1 = 1;
    static int option2 = 0;
    static int option3 = 0;

    int col = column();
    uiInsert(parent, col);
    uiSetMargins(col, 10, 10, 10, 10);
    uiSetLayout(col, UI_TOP|UI_HFILL);
    
    column_append(col, button(BND_ICON_GHOST, "Item 1", demohandler));
    if (option3)
        column_append(col, button(BND_ICON_GHOST, "Item 2", demohandler));

    {
        int h = column_append(col, hbox());
        hgroup_append(h, radio(BND_ICON_GHOST, "Item 3.0", &enum1));
        if (option2)
            uiSetMargins(hgroup_append_fixed(h, radio(BND_ICON_REC, NULL, &enum1)), -1,0,0,0);
        uiSetMargins(hgroup_append_fixed(h, radio(BND_ICON_PLAY, NULL, &enum1)), -1,0,0,0);
        uiSetMargins(hgroup_append(h, radio(BND_ICON_GHOST, "Item 3.3", &enum1)), -1,0,0,0);
    }
    
    {
        int rows = column_append(col, row());
        int coll = row_append(rows, vgroup());
        vgroup_append(coll, label(-1, "Items 4.0:"));
        coll = vgroup_append(coll, vbox());
        vgroup_append(coll, button(BND_ICON_GHOST, "Item 4.0.0", demohandler));
        uiSetMargins(vgroup_append(coll, button(BND_ICON_GHOST, "Item 4.0.1", demohandler)),0,-2,0,0);
        int colr = row_append(rows, vgroup());
        uiSetMargins(colr, 8, 0, 0, 0);
        uiSetFrozen(colr, option1);
        vgroup_append(colr, label(-1, "Items 4.1:"));
        colr = vgroup_append(colr, vbox());
        vgroup_append(colr, slider("Item 4.1.0", &progress1));
        uiSetMargins(vgroup_append(colr, slider("Item 4.1.1", &progress2)),0,-2,0,0);
    }
    
    column_append(col, button(BND_ICON_GHOST, "Item 5", NULL));

    static char textbuffer[1024] = "The quick brown fox.";
    column_append(col, textbox(textbuffer, 1024));

    column_append(col, check("Frozen", &option1));
    column_append(col, check("Item 7", &option2));
    column_append(col, check("Item 8", &option3));
}
Пример #11
0
void VariableResistor::dataChanged()
{

    double new_minResistance = dataDouble( "minimum resistance" );
    double new_maxResistance = dataDouble( "maximum resistance" );

    if( new_minResistance != m_minResistance )
    {
        if( new_minResistance >= m_maxResistance )
        {
            m_minResistance = m_maxResistance;
            property( "minimum resistance" )->setValue( m_minResistance );
        } else m_minResistance = new_minResistance;
    }

    if( new_maxResistance != m_maxResistance )
    {
        if( new_maxResistance <= m_minResistance )
        {
            m_maxResistance = m_minResistance;
            property( "maximum resistance" )->setValue( m_maxResistance );
        } else m_maxResistance = new_maxResistance;
    }

    m_tickValue = ( m_maxResistance - m_minResistance ) / m_pSlider->maxValue();

    // Calculate the resistance jump per tick of a 100 tick slider.
    sliderValueChanged( "slider", slider("slider")->value() );
}
Пример #12
0
/*airplane constructor reads conf file and intializes menu controls in mediator(mainwindow)*/
airplane::airplane(nmainwindow *m):w(NULL),mediator(m) {
trace("airplane::airplane")
 timer=new QTimer(this);
 connect(timer,SIGNAL(timeout()),this,SLOT(refreshmap()));
 readfile(":/conf.txt");
 cmenu=mediator->menuBar()->addMenu(tr("map"));
 roadmapaction=new QAction(tr("ROADMAP"),cmenu);
 satelliteaction=new QAction(tr("SATELLITE"),cmenu);
 hybridaction=new QAction(tr("HYBRID"),cmenu);
 terrainaction=new QAction(tr("TERRAIN"),cmenu);
 ctrlmenu=mediator->menuBar()->addMenu(tr("ctrl"));
 pauseaction=new QAction(tr("pause"),ctrlmenu);
 slideraction=new QAction(tr("slider"),ctrlmenu);
 snapshotaction=new QAction(tr("snapshot"),ctrlmenu);
aboutaction=new QAction(tr("about"),mediator->menuBar());
 connect(roadmapaction,SIGNAL(triggered()),this,SLOT(roadmaptriggered()));
 connect(satelliteaction,SIGNAL(triggered()),this,SLOT(satellitetriggered()));
 connect(terrainaction,SIGNAL(triggered()),this,SLOT(terraintriggered()));
 connect(hybridaction,SIGNAL(triggered()),this,SLOT(hybridtriggered()));
 connect(pauseaction,SIGNAL(triggered()),this,SLOT(pausetriggered()));
 connect(slideraction,SIGNAL(triggered()),this,SLOT(slider()));
 connect(snapshotaction,SIGNAL(triggered()),this,SLOT(snapshottriggered()));
connect(aboutaction,SIGNAL(triggered()),this,SLOT(abouttriggered()));
 cmenu->addAction(roadmapaction);
 cmenu->addAction(satelliteaction);
 cmenu->addAction(hybridaction);
 cmenu->addAction(terrainaction);
 ctrlmenu->addAction(pauseaction);
 ctrlmenu->addAction(slideraction);
 ctrlmenu->addSeparator();
 ctrlmenu->addAction(snapshotaction);
mediator->menuBar()->addAction(aboutaction);
 pzRot=plineindex=lineindex=0;
trace("~airplane::airplane")
}
Пример #13
0
void VariableCapacitor::dataChanged() {


	double new_minCapacitance = dataDouble("minimum capacitance");
	double new_maxCapacitance = dataDouble("maximum capacitance");

	if (new_minCapacitance != m_minCapacitance) {
		if (new_minCapacitance >= m_maxCapacitance) {
			m_minCapacitance = m_maxCapacitance;
			property("minimum capacitance")->setValue(m_minCapacitance);
		} else m_minCapacitance = new_minCapacitance;
	}

	if (new_maxCapacitance != m_maxCapacitance) {
		if (new_maxCapacitance <= m_minCapacitance) {
			m_maxCapacitance = m_minCapacitance;
			property("maximum capacitance")->setValue(m_maxCapacitance);
		} else m_maxCapacitance = new_maxCapacitance;
	}

	/*  Attempt at  fixme.
		m_currCapacitance = property( "currcapacitance" )->value().asDouble();

		if(m_currCapacitance > m_maxCapacitance) m_currCapacitance = m_maxCapacitance;
		else if(m_currCapacitance < m_minCapacitance) m_currCapacitance = m_minCapacitance;
	*/

	m_tickValue = (m_maxCapacitance - m_minCapacitance) / m_pSlider->maxValue();

	property("currcapacitance")->setValue(m_currCapacitance);

	// Calculate the capacitance jump per tick of a 100 tick slider.
	sliderValueChanged("slider", slider("slider")->value());
}
Пример #14
0
QString QAccessibleSlider::text(QAccessible::Text t) const
{
    if (t == QAccessible::Value)
        return QString::number(slider()->value());

    return QAccessibleAbstractSlider::text(t);
}
Пример #15
0
void CNItem::restoreFromItemData( const ItemData &itemData )
{
	Item::restoreFromItemData(itemData);
	
	updateConnectorPoints(false);
	
	{
		const BoolMap::const_iterator end = itemData.buttonMap.end();
		for ( BoolMap::const_iterator it = itemData.buttonMap.begin(); it != end; ++it )
		{
			Button *b = button(it.key());
			if (b)
				b->setState(it.data());
		}
	}
	{
		const IntMap::const_iterator end = itemData.sliderMap.end();
		for ( IntMap::const_iterator it = itemData.sliderMap.begin(); it != end; ++it )
		{
			Slider *s = slider(it.key());
			if (s)
				s->setValue(it.data());
		}
	}
}
Пример #16
0
int main(int argc, char ** argv) {
  window = new Fl_Single_Window(COLS*W,ROWS*H+90);
bt("@->");
bt("@>");
bt("@>>");
bt("@>|");
bt("@>[]");
bt("@|>");
bt("@<-");
bt("@<");
bt("@<<");
bt("@|<");
bt("@[]<");
bt("@<|");
bt("@<->");
bt("@-->");
bt("@+");
bt("@->|");
bt("@||");
bt("@arrow");
bt("@returnarrow");
bt("@square");
bt("@circle");
bt("@line");
bt("@menu");
bt("@UpArrow");
bt("@DnArrow");

  Fl_Value_Slider slider(80,
                         window->h()-60,
                         window->w()-90,
                         16,
                         "Orientation");
  slider.align(FL_ALIGN_LEFT);
  slider.type(Fl_Slider::HORIZONTAL);
  slider.range(0.0, 9.0);
  slider.value(0.0);
  slider.step(1);
  slider.callback(slider_cb, &slider);

  Fl_Value_Slider slider2(80,
                          window->h()-30,
                          window->w()-90,
                          16,
                          "Scale");
  slider2.align(FL_ALIGN_LEFT);
  slider2.type(Fl_Slider::HORIZONTAL);
  slider2.range(-9.0, 9.0);
  slider2.value(0.0);
  slider2.step(1);
  slider2.callback(slider_cb, &slider);

  rot = &slider;
  scale = &slider2;

  window->resizable(window);
  window->show(argc,argv);
  return Fl::run();
}
Пример #17
0
void	PhysicsClientExample::createButtons()
{
	bool isTrigger = false;
	
    if (m_guiHelper && m_guiHelper->getParameterInterface())
    {
		m_guiHelper->getParameterInterface()->removeAllParameters();

        createButton("Load URDF",CMD_LOAD_URDF,  isTrigger);
        createButton("Step Sim",CMD_STEP_FORWARD_SIMULATION,  isTrigger);
        createButton("Send Bullet Stream",CMD_SEND_BULLET_DATA_STREAM,  isTrigger);
        createButton("Get State",CMD_REQUEST_ACTUAL_STATE,  isTrigger);
        createButton("Send Desired State",CMD_SEND_DESIRED_STATE,  isTrigger);
        createButton("Create Box Collider",CMD_CREATE_BOX_COLLISION_SHAPE,isTrigger);
		createButton("Create Cylinder Body",CMD_CREATE_RIGID_BODY,isTrigger);
        createButton("Reset Simulation",CMD_RESET_SIMULATION,isTrigger);
		createButton("Initialize Pose",CMD_INIT_POSE,  isTrigger);
        createButton("Set gravity", CMD_SEND_PHYSICS_SIMULATION_PARAMETERS, isTrigger);


		if (m_physicsClientHandle && m_selectedBody>=0)
		{
			int numJoints = b3GetNumJoints(m_physicsClientHandle,m_selectedBody);
			for (int i=0;i<numJoints;i++)
			{
				b3JointInfo info;
				b3GetJointInfo(m_physicsClientHandle,m_selectedBody,i,&info);
				b3Printf("Joint %s at q-index %d and u-index %d\n",info.m_jointName,info.m_qIndex,info.m_uIndex);
                
				if (info.m_flags & JOINT_HAS_MOTORIZED_POWER)
				{
					if (m_numMotors<MAX_NUM_MOTORS)
					{
						char motorName[1024];
						sprintf(motorName,"%s q", info.m_jointName);
						// MyMotorInfo2* motorInfo = &m_motorTargetVelocities[m_numMotors];
                        MyMotorInfo2* motorInfo = &m_motorTargetPositions[m_numMotors];
						motorInfo->m_velTarget = 0.f;
                        motorInfo->m_posTarget = 0.f;
						motorInfo->m_uIndex = info.m_uIndex;
                        motorInfo->m_qIndex = info.m_qIndex;
                        
						// SliderParams slider(motorName,&motorInfo->m_velTarget);
						// slider.m_minVal=-4;
						// slider.m_maxVal=4;
                        SliderParams slider(motorName,&motorInfo->m_posTarget);
                        slider.m_minVal=-4;
                        slider.m_maxVal=4;
						if (m_guiHelper && m_guiHelper->getParameterInterface())
						{
							m_guiHelper->getParameterInterface()->registerSliderFloatParameter(slider);
						}
						m_numMotors++;
					}
				}
			}
		}
    }
}
int generateFrame(char *frameName,
		  unsigned int frameNumber,
		  double gX,
		  double gY,
		  double gZ,
		  unsigned int speed,
		  double throttlePercentage,
		  double brakePercentage)
{
	cairo_surface_t *surface;
	cairo_t *cr;
	char frameText[80];


	surface = cairo_image_surface_create (
			CAIRO_FORMAT_ARGB32, SIZEX, SIZEY);
	cr = cairo_create (surface);
	cairo_save (cr);
	cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
	// set alpha to produce transparency
	cairo_set_source_rgba (cr, 1, 1, 1, 0);
//	cairo_set_source_rgba (cr, 0, 0, 0.2, 1);
	cairo_paint (cr);
	cairo_restore (cr);
	cairo_move_to (cr, 17.5, 20);
	cairo_set_source_rgb (cr, 1, 1, 1);
	cairo_set_font_size(cr,20);
	sprintf(frameText,"%05u",frameNumber);
	cairo_show_text (cr, frameText);

//	G bubble
	renderGdot(cr,50,70,gX,gY,gZ);

//	throttle
	slider(cr,50,130,2,80,20,0.0,1.0,0.0,throttlePercentage);

//	brake
	slider(cr,50,160,2,80,20,1.0,0.0,0.0,brakePercentage);

	// save and clean up
	cairo_destroy (cr);
	cairo_surface_write_to_png (surface, frameName);
	cairo_surface_destroy (surface);

	return 0;
}
Пример #19
0
ThumbnailSlider::ThumbnailSlider(QWidget* parent)
: ZoomSlider(parent)
, d(new ThumbnailSliderPrivate)
{
    connect(slider(), SIGNAL(actionTriggered(int)),
            SLOT(slotActionTriggered(int)));
    slider()->setRange(ThumbnailView::MinThumbnailSize, ThumbnailView::MaxThumbnailSize);
}
Пример #20
0
void	RobotControlExample::stepSimulation(float deltaTime)
{
    m_physicsServer.processClientCommands();

	if (m_physicsClient.isConnected())
    {
		
		SharedMemoryStatus status;
		bool hasStatus = m_physicsClient.processServerStatus(status);
		if (hasStatus && status.m_type == CMD_URDF_LOADING_COMPLETED)
		{
			for (int i=0;i<m_physicsClient.getNumJoints();i++)
			{
				b3JointInfo info;
				m_physicsClient.getJointInfo(i,info);
				b3Printf("Joint %s at q-index %d and u-index %d\n",info.m_jointName,info.m_qIndex,info.m_uIndex);
				
                if (info.m_flags & JOINT_HAS_MOTORIZED_POWER)
                {
                    if (m_numMotors<MAX_NUM_MOTORS)
                    {
                        char motorName[1024];
                        sprintf(motorName,"%s q'", info.m_jointName);
                        MyMotorInfo* motorInfo = &m_motorTargetVelocities[m_numMotors];
                        motorInfo->m_velTarget = 0.f;
                        motorInfo->m_uIndex = info.m_uIndex;
                    
                        SliderParams slider(motorName,&motorInfo->m_velTarget);
                        slider.m_minVal=-4;
                        slider.m_maxVal=4;
                        m_guiHelper->getParameterInterface()->registerSliderFloatParameter(slider);
                        m_numMotors++;
                    }
                }
				
			}
		}

		
		if (m_physicsClient.canSubmitCommand())
		{
			if (m_userCommandRequests.size())
			{
				b3Printf("Outstanding user command requests: %d\n", m_userCommandRequests.size());
				SharedMemoryCommand& cmd = m_userCommandRequests[0];

				//a manual 'pop_front', we don't use 'remove' because it will re-order the commands
				for (int i=1;i<m_userCommandRequests.size();i++)
				{
					m_userCommandRequests[i-1] = m_userCommandRequests[i];
				}

				m_userCommandRequests.pop_back();
				m_physicsClient.submitClientCommand(cmd);
			}
		}
	}
}
Пример #21
0
void ECPotentiometer::dataChanged()
{
	m_resistance = dataDouble("resistance");
	
	QString display = QString::number( m_resistance / getMultiplier(m_resistance), 'g', 3 ) + getNumberMag(m_resistance) + QChar(0x3a9);
	setDisplayText( "res", display );
	
	sliderValueChanged( "slider", slider("slider")->value() );
}
Пример #22
0
int main(int argc, char **argv) {

  int i=0;
  if (Fl::args(argc,argv,i,arg) < argc)
    Fl::fatal("Options are:\n -2 = 2 windows\n -f = startup fullscreen\n%s",Fl::help);

  Fl_Single_Window window(300,300+30*NUMB); window.end();

  shape_window sw(10,10,window.w()-20,window.h()-30*NUMB-20);
#if HAVE_GL
  sw.mode(FL_RGB);
#endif

  Fl_Window *w;
  if (twowindow) {	// make it's own window
    sw.resizable(&sw);
    w = &sw;
    window.set_modal();	// makes controls stay on top when fullscreen pushed
    argc--;
    sw.show();
  } else {		// otherwise make a subwindow
    window.add(sw);
    window.resizable(&sw);
    w = &window;
  }

  window.begin();

  int y = window.h()-30*NUMB-5;
  Fl_Hor_Slider slider(50,y,window.w()-60,30,"Sides:");
  slider.clear_flag(FL_ALIGN_MASK);
  slider.set_flag(FL_ALIGN_LEFT);
  slider.callback(sides_cb,&sw);
  slider.value(sw.sides);
  slider.step(1);
  slider.range(3,40);
  y+=30;

  Fl_Toggle_Light_Button b1(50,y,window.w()-60,30,"Double Buffered");
  b1.callback(double_cb,&sw);
  y+=30;

  Fl_Toggle_Light_Button b3(50,y,window.w()-60,30,"FullScreen");
  b3.callback(fullscreen_cb,w);
  y+=30;

  Fl_Button eb(50,y,window.w()-60,30,"Exit");
  eb.callback(exit_cb);
  y+=30;

  if (initfull) {b3.set(); b3.do_callback();}

  window.end();
  window.show(argc,argv);

  return Fl::run();
}
Пример #23
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_));
}
Пример #24
0
OCRuler::OCRuler(OQCanvas *c)
	:	OCDataWidget(c),
		vmin(0), vmax(0), vcur(0), vslide(0),
		off_x(0), off_y(0)
{
	setBindLimit(1);
	attachChild(new QSlider(Horizontal, getParent()));
	slider()->setTracking(false);
	connect(slider(), SIGNAL(valueChanged(int)), SLOT(valueChanged(int)));
	connect(slider(), SIGNAL(sliderMoved(int)), SLOT(sliderMoved(int)));
}
Пример #25
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;
   }
}
Пример #26
0
void MSVGauge::drawGaugeShadow(int x,int y, int h, int thickness, Direction direction)
{
  // left
  XBFillRectangle(display(),window(),slider()->topShadowGC(),x,y-h,thickness,h);

  // top or bottom
  int starty=direction==Up?y:y+h-thickness;

  XBFillRectangle(display(),window(),slider()->topShadowGC(),x,starty-h,slider()->width(),
                  h>thickness?thickness:h);

  if (h>thickness)
   {
     XPoint points[6];
     points[0].y=points[1].y=direction==Up?y:y-h;
     points[4].y=points[5].y=direction==Up?y-thickness:y-h+thickness;
     points[2].y=direction==Up?y-h:y;
     points[3].y=direction==Up?y-h+thickness:y-thickness;
     points[0].x=x;
     points[1].x=points[2].x=x+slider()->width();
     points[3].x=points[4].x=x+slider()->width()-thickness;
     points[5].x=x+thickness;
     XBFillPolygon(display(),window(),slider()->bottomShadowGC(),points,6,Nonconvex,CoordModeOrigin);
   }
}
Пример #27
0
void LLWidgetReg::initClass(bool register_widgets)
{
	// Only need to register if the Windows linker has optimized away the
	// references to the object files.
	if (register_widgets)
	{
		LLDefaultChildRegistry::Register<LLButton> button("button");
		LLDefaultChildRegistry::Register<LLMenuButton> menu_button("menu_button");
		LLDefaultChildRegistry::Register<LLCheckBoxCtrl> check_box("check_box");
		LLDefaultChildRegistry::Register<LLComboBox> combo_box("combo_box");
		LLDefaultChildRegistry::Register<LLFilterEditor> filter_editor("filter_editor");
		LLDefaultChildRegistry::Register<LLFlyoutButton> flyout_button("flyout_button");
		LLDefaultChildRegistry::Register<LLContainerView> container_view("container_view");
		LLDefaultChildRegistry::Register<LLIconCtrl> icon("icon");
		LLDefaultChildRegistry::Register<LLLoadingIndicator> loading_indicator("loading_indicator");
		LLDefaultChildRegistry::Register<LLLineEditor> line_editor("line_editor");
		LLDefaultChildRegistry::Register<LLMenuItemSeparatorGL> menu_item_separator("menu_item_separator");
		LLDefaultChildRegistry::Register<LLMenuItemCallGL> menu_item_call_gl("menu_item_call");
		LLDefaultChildRegistry::Register<LLMenuItemCheckGL> menu_item_check_gl("menu_item_check");
		LLDefaultChildRegistry::Register<LLMenuGL> menu("menu");
		LLDefaultChildRegistry::Register<LLMenuBarGL> menu_bar("menu_bar");
		LLDefaultChildRegistry::Register<LLContextMenu> context_menu("context_menu");
		LLDefaultChildRegistry::Register<LLMultiSlider> multi_slider_bar("multi_slider_bar");
		LLDefaultChildRegistry::Register<LLMultiSliderCtrl> multi_slider("multi_slider");
		LLDefaultChildRegistry::Register<LLPanel> panel("panel", &LLPanel::fromXML);
		LLDefaultChildRegistry::Register<LLLayoutStack> layout_stack("layout_stack");
		LLDefaultChildRegistry::Register<LLProgressBar> progress_bar("progress_bar");
		LLDefaultChildRegistry::Register<LLRadioGroup> radio_group("radio_group");
		LLDefaultChildRegistry::Register<LLSearchEditor> search_editor("search_editor");
		LLDefaultChildRegistry::Register<LLScrollContainer> scroll_container("scroll_container");
		LLDefaultChildRegistry::Register<LLScrollingPanelList> scrolling_panel_list("scrolling_panel_list");
		LLDefaultChildRegistry::Register<LLScrollListCtrl> scroll_list("scroll_list");
		LLDefaultChildRegistry::Register<LLSlider> slider_bar("slider_bar");
		LLDefaultChildRegistry::Register<LLSliderCtrl> slider("slider");
		LLDefaultChildRegistry::Register<LLSpinCtrl> spinner("spinner");
		LLDefaultChildRegistry::Register<LLStatBar> stat_bar("stat_bar");
		//LLDefaultChildRegistry::Register<LLPlaceHolderPanel> placeholder("placeholder");
		LLDefaultChildRegistry::Register<LLTabContainer> tab_container("tab_container");
		LLDefaultChildRegistry::Register<LLTextBox> text("text");
		LLDefaultChildRegistry::Register<LLTimeCtrl> time("time");
		LLDefaultChildRegistry::Register<LLTextEditor> simple_text_editor("simple_text_editor");
		LLDefaultChildRegistry::Register<LLUICtrl> ui_ctrl("ui_ctrl");
		LLDefaultChildRegistry::Register<LLStatView> stat_view("stat_view");
		//LLDefaultChildRegistry::Register<LLUICtrlLocate> locate("locate");
		//LLDefaultChildRegistry::Register<LLUICtrlLocate> pad("pad");
		LLDefaultChildRegistry::Register<LLViewBorder> view_border("view_border");
	}

	// *HACK: Usually this is registered as a viewer text editor
	LLDefaultChildRegistry::Register<LLTextEditor> text_editor("text_editor");
}
Пример #28
0
void
OCRuler::polish()
{
	OCDataWidget::polish();
	if (vmin > vmax) {
		double v = vmin;
		vmin = vmax;
		vmax = v;
	}
	vcur = vcur < vmin ? vmin : vcur > vmax ? vmax : vcur;

	slider()->setMinValue(int(vmin));
	slider()->setMaxValue(int(vmax-0.1));
	slider()->setValue(int(vcur));

	if (width() <= 0 || height() <= 0) {
		if (slider()->orientation() == Vertical)
			updateSize(40, 80);
		else
			updateSize(80, 40);
		updateGeometry();
	}
}
Пример #29
0
bool QAccessibleSlider::doAction(int action, int child)
{
    if (action != Press || child < 1 || child > 2)
        return false;
    
    if (child == PageLeft)
        slider()->setValue(slider()->value() - slider()->pageStep());
    else
        slider()->setValue(slider()->value() + slider()->pageStep());
}
Пример #30
0
int main(int argc, char **argv) {
    QApplication app(argc, argv);
    QMainWindow window;
    TriangView view;
    QToolBar toolBar;
    QSlider slider(Qt::Horizontal);

    toolBar.addWidget(&slider);
    window.resize(view.size());
    window.setWindowIcon(QIcon::fromTheme("application-x-executable"));
    window.setWindowTitle("3D interpolation");
    window.setCentralWidget(&view);
 // window.addToolBar(Qt::BottomToolBarArea, &toolBar);
    window.show();

    return app.exec();
}