Example #1
0
void ControlItem::connect_signals(EditorCanvas* canvas) {
  signal_button_press_event().connect(
      sigc::mem_fun(canvas, &EditorCanvas::on_group_button_press));
  signal_button_release_event().connect(
      sigc::mem_fun(canvas, &EditorCanvas::on_group_button_release));
  signal_motion_notify_event().connect(
      sigc::mem_fun(canvas, &EditorCanvas::on_group_motion_notify));
}
Example #2
0
Rotateable::Rotateable():
    axis(-M_PI/4),
    maxdecl(M_PI/4)
{
		dragging = false;
		working = false;
		scrolling = false;
		modifier = 0;
		current_axis = axis;

    signal_button_press_event().connect(sigc::mem_fun(*this, &Rotateable::on_click));
    signal_motion_notify_event().connect(sigc::mem_fun(*this, &Rotateable::on_motion));
    signal_button_release_event().connect(sigc::mem_fun(*this, &Rotateable::on_release));
    signal_scroll_event().connect(sigc::mem_fun(*this, &Rotateable::on_scroll));

}
/* would be prettier! */
CPagePreview::CPagePreview() :
	Hand(Gdk::FLEUR)
	{
	int hrequest = 250;
	int wrequest = 180;
	
	image_width_ratio = 0.8;
	image_height_ratio = 0.8;	

	borderratio = 0.05;
	offset = 2.0;
	xborder = wrequest*borderratio;
	yborder = hrequest*borderratio;
	
	page_width = wrequest-2*xborder;
	page_height = hrequest-2*yborder;	

	lmargin_ratio = rmargin_ratio = bmargin_ratio = tmargin_ratio = 0;
	lmargin = rmargin = page_width * rmargin_ratio;
	bmargin = tmargin = page_height * tmargin_ratio;
	
	lmargin = bmargin = rmargin = tmargin = 10;

	uleft.x = xborder-offset+lmargin;
	uleft.y = yborder-offset+tmargin;
	lright.x = uleft.x+(page_width-rmargin-lmargin);
	lright.y = uleft.y+(page_height-bmargin-tmargin);
	xpos = uleft.x;
	ypos = uleft.y;	
	
	//std::cout << uleft.x << " " << lright.x << " " << page_width << " " << lright.x - uleft.x << " " << lmargin + rmargin << std::endl;
	
	set_size_request(wrequest,hrequest);
	
	// set up event mask
	set_events( 
		Gdk::EXPOSURE_MASK | 
		Gdk::BUTTON1_MOTION_MASK | 
		Gdk::BUTTON_PRESS_MASK | 
		Gdk::BUTTON_RELEASE_MASK );
		
	signal_motion_notify_event().connect(sigc::mem_fun(*this,&CPagePreview::on_button1_pressed_motion));
	signal_button_press_event().connect(sigc::mem_fun(*this,&CPagePreview::on_button_press_event));
	signal_button_release_event().connect(sigc::mem_fun(*this,&CPagePreview::on_button_release_event));	
	}
Example #4
0
ImageWidget::ImageWidget() :
	_isInitialized(false),
	_initializedWidth(0),
	_initializedHeight(0),
	_showOriginalMask(true),
	_showAlternativeMask(true),
	_colorMap(BWMap),
	_image(),
	_highlighting(false),
	_startHorizontal(0.0),
	_endHorizontal(1.0),
	_startVertical(0.0),
	_endVertical(1.0),
	_segmentedImage(),
	_horiScale(0),
	_vertScale(0),
	_colorScale(0),
	_plotTitle(0),
	_scaleOption(NormalScale),
	_showXYAxes(true),
	_showColorScale(true),
	_showXAxisDescription(true),
	_showYAxisDescription(true),
	_showZAxisDescription(true),
	_showTitle(true),
	_max(1.0), _min(0.0),
	_range(Winsorized),
	_cairoFilter(Cairo::FILTER_BEST),
	_manualTitle(false),
	_manualXAxisDescription(false),
	_manualYAxisDescription(false),
	_manualZAxisDescription(false),
	_mouseIsIn(false)
{
	_highlightConfig = new ThresholdConfig();
	_highlightConfig->InitializeLengthsSingleSample();

	add_events(Gdk::POINTER_MOTION_MASK | Gdk::BUTTON_RELEASE_MASK |
		   Gdk::BUTTON_PRESS_MASK | Gdk::LEAVE_NOTIFY_MASK);
	signal_motion_notify_event().connect(sigc::mem_fun(*this, &ImageWidget::onMotion));
	signal_leave_notify_event().connect(sigc::mem_fun(*this, &ImageWidget::onLeave));
	signal_button_release_event().connect(sigc::mem_fun(*this, &ImageWidget::onButtonReleased));
	signal_draw().connect(sigc::mem_fun(*this, &ImageWidget::onDraw) );
}
Example #5
0
/** Constructor. */
SkillGuiGraphDrawingArea::SkillGuiGraphDrawingArea()
{
  add_events(Gdk::SCROLL_MASK | Gdk::BUTTON_MOTION_MASK);

  __gvc = gvContext();
  __graph = NULL;

  __graph_fsm = "";
  __graph_dot = "";

  __bbw = __bbh = __pad_x = __pad_y = 0.0;
  __translation_x = __translation_y = 0.0;
  __scale = 1.0;
  __speed = 0.0;
  __speed_max = 200.0;
  __speed_ramp_distance = 40.0;
  __translation_x_setpoint = __translation_y_setpoint = 0.0;
  __scale_override = false;
  __update_graph = true;
  __recording = false;

  timeval now;
  gettimeofday(&now, NULL);
  __last_update_time = (float)now.tv_sec + now.tv_usec/1000000.;
  
  __mouse_motion = false;

  gvplugin_skillgui_cairo_setup(__gvc, this);

  __fcd_save = new Gtk::FileChooserDialog("Save Graph",
					  Gtk::FILE_CHOOSER_ACTION_SAVE);
  __fcd_open = new Gtk::FileChooserDialog("Load Graph",
					  Gtk::FILE_CHOOSER_ACTION_OPEN);
  __fcd_recording = new Gtk::FileChooserDialog("Recording Directory",
						 Gtk::FILE_CHOOSER_ACTION_CREATE_FOLDER);

  //Add response buttons the the dialog:
  __fcd_save->add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
  __fcd_save->add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_OK);
  __fcd_open->add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
  __fcd_open->add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_OK);
  __fcd_recording->add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
  __fcd_recording->add_button(Gtk::Stock::OK, Gtk::RESPONSE_OK);

  __filter_pdf = new Gtk::FileFilter();
  __filter_pdf->set_name("Portable Document Format (PDF)");
  __filter_pdf->add_pattern("*.pdf");
  __filter_svg = new Gtk::FileFilter();
  __filter_svg->set_name("Scalable Vector Graphic (SVG)");
  __filter_svg->add_pattern("*.svg");
  __filter_png = new Gtk::FileFilter();
  __filter_png->set_name("Portable Network Graphic (PNG)");
  __filter_png->add_pattern("*.png");
  __filter_dot = new Gtk::FileFilter();
  __filter_dot->set_name("DOT Graph");
  __filter_dot->add_pattern("*.dot");
  __fcd_save->add_filter(*__filter_pdf);
  __fcd_save->add_filter(*__filter_svg);
  __fcd_save->add_filter(*__filter_png);
  __fcd_save->add_filter(*__filter_dot);
  __fcd_save->set_filter(*__filter_pdf);

  __fcd_open->add_filter(*__filter_dot);
  __fcd_open->set_filter(*__filter_dot);

  add_events(Gdk::SCROLL_MASK | Gdk::BUTTON_MOTION_MASK |
	     Gdk::BUTTON_PRESS_MASK | Gdk::BUTTON_RELEASE_MASK );

#ifndef GLIBMM_DEFAULT_SIGNAL_HANDLERS_ENABLED
  signal_expose_event().connect(sigc::mem_fun(*this, &SkillGuiGraphDrawingArea::on_expose_event));
  signal_button_press_event().connect(sigc::mem_fun(*this, &SkillGuiGraphDrawingArea::on_button_press_event));
  signal_button_release_event().connect(sigc::mem_fun(*this, &SkillGuiGraphDrawingArea::on_button_release_event));
  signal_motion_notify_event().connect(sigc::mem_fun(*this, &SkillGuiGraphDrawingArea::on_motion_notify_event));
#endif
}