void JointVelocityControlWidget::init(ref<BasicEnvironment> env, ref<Robot> robot, Int index, ref<ControlInterface> interface)
{
  velInterface = interface; 

  // Joint velocity controls
  Gtk::VBox* jointControlBox = new Gtk::VBox(false,5);

  Int dof =  velInterface->inputSize();
  velAdjustments.clear();
  for(Int j=0; j<dof; j++) {
    Gtk::HBox* hbox = new Gtk::HBox();
    Gtk::Label* label = new Gtk::Label(base::intToString(j)+":");
    hbox->pack_start(*manage(label), Gtk::PACK_SHRINK,5);
    Gtk::Adjustment* adj = new Gtk::Adjustment(0,-3,3,0.01,0.1);
    velAdjustments.push_back(adj);
    Gtk::HScale* scale = new Gtk::HScale(*manage(adj));
    scale->set_draw_value(true);
    scale->set_digits(2);
    scale->set_value_pos(Gtk::POS_LEFT);
    scale->set_update_policy(Gtk::UPDATE_CONTINUOUS);
    scale->set_size_request(100,-1);
    hbox->pack_end(*manage(scale));
    jointControlBox->pack_start(*manage(hbox),false,false);
    adj->signal_value_changed().connect( SigC::bind<Int>( SigC::slot(*this, &JointVelocityControlWidget::jointVelScaleChanged ), j) );
  }
  
  pack_start(*manage(jointControlBox));
}
/* === E N T R Y P O I N T ================================================= */
studio::Widget_NavView::Widget_NavView(CanvasView::LooseHandle cv)
:canvview(cv),
adj_zoom(Gtk::Adjustment::create(0,-4,4,1,2)),
scrolling(false),
surface(new synfig::Surface),
cairo_surface(cairo_image_surface_create(CAIRO_FORMAT_ARGB32, 1, 1))
{
	attach(drawto,0,4,0,1);

	attach(*manage(new Gtk::HSeparator),0,4,1,2,Gtk::SHRINK|Gtk::FILL,Gtk::SHRINK|Gtk::FILL);

	//zooming stuff
	attach(zoom_print,0,1,2,3,Gtk::SHRINK|Gtk::FILL,Gtk::SHRINK|Gtk::FILL);
	zoom_print.set_size_request(40,-1);

	Gtk::HScale *s = manage(new Gtk::HScale(adj_zoom));
	s->set_draw_value(false);
	//s->set_update_policy(Gtk::UPDATE_DELAYED);
	//s->signal_event().connect(sigc::mem_fun(*this,&Dock_Navigator::on_scroll_event));
	attach(*s,1,4,2,3,Gtk::EXPAND|Gtk::FILL,Gtk::SHRINK|Gtk::FILL);

	show_all();

	adj_zoom->signal_value_changed().connect(sigc::mem_fun(*this,&Widget_NavView::on_number_modify));

	if(cv)
	{
		drawto.signal_draw().connect(sigc::mem_fun(*this,&Widget_NavView::on_drawto_draw));
		drawto.signal_event().connect(sigc::mem_fun(*this,&Widget_NavView::on_mouse_event));

		drawto.add_events(Gdk::BUTTON_MOTION_MASK|Gdk::BUTTON_PRESS_MASK);

		//get_canvas_view()->canvas_interface()->signal_dirty_preview()
		//				.connect(sigc::mem_fun(*this,&Widget_NavView::on_dirty_preview));
		get_canvas_view()->work_area->signal_rendering()
						.connect(sigc::mem_fun(*this,&Widget_NavView::on_dirty_preview));

		get_canvas_view()->work_area->signal_view_window_changed()
						.connect(sigc::mem_fun(*this,&Widget_NavView::on_workarea_view_change));

		//update with this canvas' view
		on_workarea_view_change();

		dirty = true;
		queue_draw();
	}

	adj_zoom->set_value(0);
}
Example #3
0
void ArgTable::insertArg (thArg *arg)
{
    if (arg == NULL)
        return;

    int row = args_++;

    Gtk::Label *label = manage(new Gtk::Label((arg->label().length() > 0) ?
                                              arg->label() : arg->name()));
    Gtk::HScale *slider = manage(new Gtk::HScale(arg->min(),arg->max(),.0001));

    Gtk::Adjustment *argAdjust = slider->get_adjustment();

    slider->set_draw_value(false);

    slider->signal_value_changed().connect(
        sigc::bind<Gtk::HScale *, thArg *>(
            sigc::mem_fun(*this, &ArgTable::sliderChanged),
            slider, arg));

    arg->signal_arg_changed().connect(
        sigc::bind<Gtk::HScale *>(
            sigc::mem_fun(*this, &ArgTable::argChanged),
            slider));

    slider->set_value((*arg)[0]);
    
    Gtk::SpinButton *valEntry = manage(new Gtk::SpinButton(
                                           *argAdjust, .0001,
                                           4));

    if (args_ > rows_)
    {
        resize(args_, 3);
        rows_ = args_;
    }

    attach(*label, 0, 1, row, row+1, Gtk::SHRINK,
           Gtk::SHRINK);
    attach(*slider, 1, 2, row, row+1,
           Gtk::EXPAND|Gtk::FILL,
           Gtk::EXPAND|Gtk::FILL);
    attach(*valEntry, 2, 3, row, row+1,
           Gtk::SHRINK|Gtk::FILL,
           Gtk::SHRINK|Gtk::FILL);
}
Example #4
0
void PrefPage::appendSlider(const std::string& name, const std::string& registryKey, bool drawValue,
                            double value, double lower, double upper, double step_increment, double page_increment, double page_size)
{
	// Create a new adjustment with the boundaries <lower> and <upper> and all the increments
	Gtk::Adjustment* adj = Gtk::manage(new Gtk::Adjustment(value, lower, upper, step_increment, page_increment, page_size));

	// Connect the registry key to this adjustment
    registry::bindPropertyToBufferedKey(adj->property_value(), registryKey, _registryBuffer, _resetValuesSignal);

	// scale
	Gtk::Alignment* alignment = Gtk::manage(new Gtk::Alignment(0.0, 0.5, 1.0, 0.0));
	alignment->show();

	Gtk::HScale* scale = Gtk::manage(new Gtk::HScale(*adj));
	scale->set_value_pos(Gtk::POS_LEFT);
	scale->show();

	alignment->add(*scale);

	scale->set_draw_value(drawValue);
	scale->set_digits((step_increment < 1.0f) ? 2 : 0);

	appendNamedWidget(name, *alignment);
}