Esempio n. 1
0
void display_setup(display_t *d)
{
  display_title(d->desktop.name);
  gtk_drawing_area_size(display_darea, d->rgb_width+DISPLAY_SEL_BORDER, d->rgb_height+DISPLAY_SEL_BORDER);
  display_sel_clip(d);
  display_redraw_all(d);
}
Esempio n. 2
0
static gint resize_cb(GtkWidget *widget, GdkEventConfigure *event)
{
	gint	width, height;

	/* detect change in window size */
	width = event->width;
	height = event->height;
	if ((width != img_physwidth || height != img_physheight)
					&& width >= 64 && height >= 64)
	{
		/* Change the image to match the window */
		gtk_drawing_area_size(GTK_DRAWING_AREA(area), width, height);
		img_resize(width, height);

		/* Store the new height & width.  Might as well grab the
		 * position too.
		 */
		config.width = width;
		config.height = height;
		config.x = event->x;
		config.y = event->y;

		/* Remember to save this change in .xmms/config eventually */
		savewhen = time(NULL) + RESIZE_SAVE_DELAY;
	}
	return TRUE;
}
Esempio n. 3
0
void gui_init(struct dt_iop_module_t *self)
{
  self->gui_data = malloc(sizeof(dt_iop_monochrome_gui_data_t));
  dt_iop_monochrome_gui_data_t *g = (dt_iop_monochrome_gui_data_t *)self->gui_data;

  g->dragging = 0;

  self->widget = GTK_WIDGET(gtk_vbox_new(FALSE, 0));
  g->area = GTK_DRAWING_AREA(gtk_drawing_area_new());
  GtkWidget *asp = gtk_aspect_frame_new(NULL, 0.5, 0.5, 1.0, TRUE);
  gtk_box_pack_start(GTK_BOX(self->widget), asp, TRUE, TRUE, 0);
  gtk_container_add(GTK_CONTAINER(asp), GTK_WIDGET(g->area));
  gtk_drawing_area_size(g->area, 258, 258);
  g_object_set(G_OBJECT(g->area), "tooltip-text", _("drag and scroll mouse wheel to adjust the virtual color filter"), (char *)NULL);

  gtk_widget_add_events(GTK_WIDGET(g->area), GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_LEAVE_NOTIFY_MASK);
  g_signal_connect (G_OBJECT (g->area), "expose-event",
                    G_CALLBACK (dt_iop_monochrome_expose), self);
  g_signal_connect (G_OBJECT (g->area), "button-press-event",
                    G_CALLBACK (dt_iop_monochrome_button_press), self);
  g_signal_connect (G_OBJECT (g->area), "button-release-event",
                    G_CALLBACK (dt_iop_monochrome_button_release), self);
  g_signal_connect (G_OBJECT (g->area), "motion-notify-event",
                    G_CALLBACK (dt_iop_monochrome_motion_notify), self);
  g_signal_connect (G_OBJECT (g->area), "leave-notify-event",
                    G_CALLBACK (dt_iop_monochrome_leave_notify), self);
  g_signal_connect (G_OBJECT (g->area), "scroll-event",
                    G_CALLBACK (dt_iop_monochrome_scrolled), self);

  g->hsRGB = dt_colorspaces_create_srgb_profile();
  g->hLab  = dt_colorspaces_create_lab_profile();
  g->xform = cmsCreateTransform(g->hLab, TYPE_Lab_DBL, g->hsRGB, TYPE_RGB_DBL,
                                INTENT_PERCEPTUAL, 0);//cmsFLAGS_NOTPRECALC);
}
Esempio n. 4
0
File: svv.c Progetto: engie/robo_gui
void gui_gtk_init(int argc, char *argv[], int w, int h, int bpp)
{
	GtkWidget *window;

	gtk_init(&argc, &argv);

	window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_window_set_title(GTK_WINDOW(window), PACKAGE_NAME);

	g_signal_connect(G_OBJECT(window), "delete_event",
			   G_CALLBACK(gui_gtk_quit), NULL);
	g_signal_connect(G_OBJECT(window), "destroy",
			   G_CALLBACK(gui_gtk_quit), NULL);
	g_signal_connect(G_OBJECT(window), "key_press_event",
			   G_CALLBACK(gui_gtk_quit), NULL);

	gtk_container_set_border_width(GTK_CONTAINER(window), 2);

	g_ui.drawing_area = gtk_drawing_area_new();
	gtk_drawing_area_size(
            GTK_DRAWING_AREA(g_ui.drawing_area),
            fmt.fmt.pix.width, fmt.fmt.pix.height);

	gtk_container_add(GTK_CONTAINER(window), g_ui.drawing_area);

	gtk_widget_show_all(window);

}
Esempio n. 5
0
int main(int argc, char *argv[])
{
  GtkWidget *window;
  GtkWidget *drawing_area;

  if(argc == 2)
    MAX=atoi(argv[1]);

  /* --- GTK initialization --- */
  gtk_init( &argc, &argv );

  /* --- Create the top level window --- */
  g_window = window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  /* --- Show the label  --- */
  gtk_widget_show(window);
  gtk_signal_connect(GTK_OBJECT(window), "destroy",
         GTK_SIGNAL_FUNC(destroyapp), NULL);

  drawing_area = gtk_drawing_area_new();
  gtk_drawing_area_size( GTK_DRAWING_AREA(drawing_area),
       PICT_WIDTH, PICT_HEIGHT);
  gtk_signal_connect(GTK_OBJECT(drawing_area), "expose_event",
         (GtkSignalFunc) expose_event, NULL);
  gtk_widget_set_events(drawing_area, GDK_EXPOSURE_MASK);
  gtk_container_add(GTK_CONTAINER(window), drawing_area);

  /* --- Show the label  --- */
  gtk_widget_show(drawing_area);

  /* --- Create GC  --- */
  g_gc = gdk_gc_new(window->window);

  gtk_main();
  return 0;
}
Esempio n. 6
0
static GtkWidget*
new_testrgb_window (GdkPixbuf *pixbuf, gchar *title)
{
	GtkWidget *window;
	GtkWidget *vbox;
	GtkWidget *temp_box;
	GtkWidget *button;
	GtkWidget *drawing_area;
	gint w, h;
 
	w = gdk_pixbuf_get_width (pixbuf);
	h = gdk_pixbuf_get_height (pixbuf);

	window = gtk_widget_new (gtk_window_get_type (),
				 "GtkObject::user_data", NULL,
				 "GtkWindow::type", GTK_WINDOW_TOPLEVEL,
				 "GtkWindow::title", "testrgb",
				 "GtkWindow::allow_shrink", TRUE,
				 NULL);
	gtk_signal_connect (GTK_OBJECT (window), "destroy",
			    (GtkSignalFunc) quit_func, NULL);

	vbox = gtk_vbox_new (FALSE, 0);

	if (title)
		gtk_box_pack_start (GTK_BOX (vbox), gtk_label_new (title),
				    TRUE, TRUE, 0);

	drawing_area = gtk_drawing_area_new ();

	temp_box = gtk_hbox_new (FALSE, 0);
	gtk_drawing_area_size (GTK_DRAWING_AREA(drawing_area), w, h);
	gtk_box_pack_start (GTK_BOX (temp_box), drawing_area, FALSE, FALSE, 0);
	gtk_box_pack_start (GTK_BOX (vbox), temp_box, FALSE, FALSE, 0);
	

	gtk_signal_connect (GTK_OBJECT(drawing_area), "expose_event",
			    GTK_SIGNAL_FUNC(expose_func), NULL);
	gtk_signal_connect (GTK_OBJECT(drawing_area), "configure_event",
			    GTK_SIGNAL_FUNC (config_func), NULL);

	gtk_object_set_data (GTK_OBJECT(drawing_area), "pixbuf", pixbuf);

	gtk_widget_show (drawing_area);

	button = gtk_button_new_with_label ("Quit");
	gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
	gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
				   (GtkSignalFunc) gtk_widget_destroy,
				   GTK_OBJECT (window));

	gtk_widget_show (button);

	gtk_container_add (GTK_CONTAINER (window), vbox);
	gtk_widget_show_all (vbox);

	gtk_widget_show (window);

        return window;
}
Esempio n. 7
0
void gui_init(struct dt_iop_module_t *self)
{
  self->gui_data = malloc(sizeof(dt_iop_levels_gui_data_t));
  dt_iop_levels_gui_data_t *c = (dt_iop_levels_gui_data_t *)self->gui_data;

  c->mouse_x = c->mouse_y = -1.0;
  c->dragging = 0;
  self->widget = GTK_WIDGET(gtk_vbox_new(FALSE, 5));
  c->area = GTK_DRAWING_AREA(gtk_drawing_area_new());
  GtkWidget *asp = gtk_aspect_frame_new(NULL, 0.5, 0.5, 1.0, TRUE);
  gtk_box_pack_start(GTK_BOX(self->widget), asp, TRUE, TRUE, 0);
  gtk_container_add(GTK_CONTAINER(asp), GTK_WIDGET(c->area));
  gtk_drawing_area_size(c->area, 258, 150);
  g_object_set (GTK_OBJECT(c->area), "tooltip-text", _("drag handles to set black, grey, and white points.  operates on L channel."), (char *)NULL);

  gtk_widget_add_events(GTK_WIDGET(c->area), GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_LEAVE_NOTIFY_MASK);
  g_signal_connect (G_OBJECT (c->area), "expose-event",
                    G_CALLBACK (dt_iop_levels_expose), self);
  g_signal_connect (G_OBJECT (c->area), "button-press-event",
                    G_CALLBACK (dt_iop_levels_button_press), self);
  g_signal_connect (G_OBJECT (c->area), "button-release-event",
                    G_CALLBACK (dt_iop_levels_button_release), self);
  g_signal_connect (G_OBJECT (c->area), "motion-notify-event",
                    G_CALLBACK (dt_iop_levels_motion_notify), self);
  g_signal_connect (G_OBJECT (c->area), "leave-notify-event",
                    G_CALLBACK (dt_iop_levels_leave_notify), self);
}
static GtkWidget *CreateOnePreviewFrame(GtkWidget *vbox, GtkWidget **preview, const gchar *szName)
{
    GtkWidget *frame = NULL;
    GtkWidget *labelFrame = NULL;
    GtkWidget *abox = NULL;
    
    if (vbox == NULL) return NULL;

    labelFrame = gtk_frame_new(szName);
    gtk_box_pack_start(GTK_BOX(vbox), labelFrame, 0, 0, 0);
    gtk_widget_show(labelFrame);

    abox = gtk_alignment_new(0.5, 0.5, 0.0, 0.0);
    gtk_container_set_border_width(GTK_CONTAINER (abox), 4);
    gtk_container_add(GTK_CONTAINER(labelFrame), abox);
    gtk_widget_show(abox);

    frame = gtk_frame_new(NULL);
    gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_IN);
    gtk_container_add(GTK_CONTAINER(abox), frame);
    gtk_widget_show(frame);

    *preview = gimp_preview_area_new();
    gimp_preview_area_set_max_size(GIMP_PREVIEW_AREA(*preview), PREVIEW_SIZE, PREVIEW_SIZE);
    gtk_drawing_area_size(GTK_DRAWING_AREA(*preview), PREVIEW_SIZE, PREVIEW_SIZE);
    gtk_container_add(GTK_CONTAINER(frame), *preview);
    gtk_widget_show(*preview);
    
    return labelFrame;
}
Esempio n. 9
0
void gui_init(struct dt_iop_module_t *self)
{
    self->gui_data = malloc(sizeof(dt_iop_tonecurve_gui_data_t));
    dt_iop_tonecurve_gui_data_t *c = (dt_iop_tonecurve_gui_data_t *)self->gui_data;
    dt_iop_tonecurve_params_t *p = (dt_iop_tonecurve_params_t *)self->params;

    c->minmax_curve = dt_draw_curve_new(0.0, 1.0, CUBIC_SPLINE);
    for(int k=0; k<6; k++) (void)dt_draw_curve_add_point(c->minmax_curve, p->tonecurve_x[k], p->tonecurve_y[k]);
    c->mouse_x = c->mouse_y = -1.0;
    c->selected = -1;
    c->selected_offset = c->selected_y = c->selected_min = c->selected_max = 0.0;
    c->dragging = 0;
    c->x_move = -1;
    self->widget = GTK_WIDGET(gtk_vbox_new(FALSE, 5));
    c->area = GTK_DRAWING_AREA(gtk_drawing_area_new());
    GtkWidget *asp = gtk_aspect_frame_new(NULL, 0.5, 0.5, 1.0, TRUE);
    gtk_box_pack_start(GTK_BOX(self->widget), asp, TRUE, TRUE, 0);
    gtk_container_add(GTK_CONTAINER(asp), GTK_WIDGET(c->area));
    // gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(c->area), TRUE, TRUE, 0);
    gtk_drawing_area_size(c->area, 258, 258);
    g_object_set (GTK_OBJECT(c->area), "tooltip-text", _("abscissa: input, ordinate: output \nworks on L channel"), (char *)NULL);

    gtk_widget_add_events(GTK_WIDGET(c->area), GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_LEAVE_NOTIFY_MASK);
    g_signal_connect (G_OBJECT (c->area), "expose-event",
                      G_CALLBACK (dt_iop_tonecurve_expose), self);
    g_signal_connect (G_OBJECT (c->area), "button-press-event",
                      G_CALLBACK (dt_iop_tonecurve_button_press), self);
    g_signal_connect (G_OBJECT (c->area), "button-release-event",
                      G_CALLBACK (dt_iop_tonecurve_button_release), self);
    g_signal_connect (G_OBJECT (c->area), "motion-notify-event",
                      G_CALLBACK (dt_iop_tonecurve_motion_notify), self);
    g_signal_connect (G_OBJECT (c->area), "leave-notify-event",
                      G_CALLBACK (dt_iop_tonecurve_leave_notify), self);
}
Esempio n. 10
0
/* main ルーチン
 */
int main( int argc, char *argv[] ) {
    GtkWidget *window, *table, *area, *hrule, *vrule;

    /* gtk を初期化、メインウィンドウを作成する */
    gtk_init( &argc, &argv );

    window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
    gtk_signal_connect (GTK_OBJECT (window), "delete_event",
            GTK_SIGNAL_FUNC( close_application ), NULL);
    gtk_container_border_width (GTK_CONTAINER (window), 10);

    /* ルーラとドローイングエリアを配置するテーブルを作成 */
    table = gtk_table_new( 3, 2, FALSE );
    gtk_container_add( GTK_CONTAINER(window), table );

    area = gtk_drawing_area_new();
    gtk_drawing_area_size( (GtkDrawingArea *)area, XSIZE, YSIZE );
    gtk_table_attach( GTK_TABLE(table), area, 1, 2, 1, 2,
                      GTK_EXPAND|GTK_FILL, GTK_FILL, 0, 0 );
    gtk_widget_set_events( area, GDK_POINTER_MOTION_MASK |
                                  GDK_POINTER_MOTION_HINT_MASK );

    /* 水平ルーラは上に置かれる。マウスがドローイングエリアを横切って
     * 移動すると、motion_notify_event がこのルーラの対応するイベント
     * ハンドラに渡される。*/
    hrule = gtk_hruler_new();
    gtk_ruler_set_metric( GTK_RULER(hrule), GTK_PIXELS );
    gtk_ruler_set_range( GTK_RULER(hrule), 7, 13, 0, 20 );
    gtk_signal_connect_object( GTK_OBJECT(area), "motion_notify_event",
                               (GtkSignalFunc)EVENT_METHOD(hrule, motion_notify_event),
                               GTK_OBJECT(hrule) );
    /*  GTK_WIDGET_CLASS(GTK_OBJECT(hrule)->klass)->motion_notify_event, */
    gtk_table_attach( GTK_TABLE(table), hrule, 1, 2, 0, 1,
                      GTK_EXPAND|GTK_SHRINK|GTK_FILL, GTK_FILL, 0, 0 );
    
    /* 垂直ルーラは左に置かれる。マウスがドローイングエリアを横切って
     * 移動すると、motion_notify_event がこのルーラの対応するイベント
     * ハンドラに渡される。*/
    vrule = gtk_vruler_new();
    gtk_ruler_set_metric( GTK_RULER(vrule), GTK_PIXELS );
    gtk_ruler_set_range( GTK_RULER(vrule), 0, YSIZE, 10, YSIZE );
    gtk_signal_connect_object( GTK_OBJECT(area), "motion_notify_event",
                               (GtkSignalFunc)
                                  GTK_WIDGET_CLASS(GTK_OBJECT(vrule)->klass)->motion_notify_event,
                               GTK_OBJECT(vrule) );
    gtk_table_attach( GTK_TABLE(table), vrule, 0, 1, 1, 2,
                      GTK_FILL, GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0 );

    /* では全てを表示しよう */
    gtk_widget_show( area );
    gtk_widget_show( hrule );
    gtk_widget_show( vrule );
    gtk_widget_show( table );
    gtk_widget_show( window );
    gtk_main();

    return 0;
}
Esempio n. 11
0
void size_callb (gpointer data,GtkWidget *wdg) {
	// Sets size when creating a new HF
	gint hf_size;
	static gchar area_label[12];
	omenu_struct_type *opt_menu;
	hf_wrapper_struct *hfw;
	hf_options_struct *hfo;
	opt_menu = (omenu_struct_type *) data;
//	printf("DATA in SIZE_CALLB: %d;\n",data);
	hfo = (hf_options_struct *) opt_menu->data;
//	printf("HFO in SIZE_CALLB: %d;\n",hfo);
	if (!hfo)
		return;

	hfw = (hf_wrapper_struct *) * (hf_wrapper_struct **)  hfo->hfw_ptr_ptr;

	hf_size = opt_menu->list[opt_menu->current_index].num;
	if (!hfw)
		return;
	if (!hfw->hf_struct)
		return;
	if (hf_size == hfw->hf_struct->max_x)
		//	No change!
		return;

	sprintf(area_label, "%d x %d", hf_size, hf_size);
	gtk_frame_set_label(GTK_FRAME(hfw->draw_area_frame), area_label);

	hf_free(hfw->hf_struct);
	hfw->hf_options->hf_size = hf_size;
	hfw->hf_struct = (hf_struct_type *) hf_new(hf_size);
	hfw->display_scale = get_display_scale(hf_size);
	hfw->hf_buf8 = (unsigned char *) x_malloc((RIGHT_SHIFT(hf_size, hfw->display_scale)) * (RIGHT_SHIFT(hf_size,hfw->display_scale))*sizeof(unsigned char), "unsigned char (hfw->buf8 in size_callb)");
	hfw->if_rgb = FALSE;
	hfw->area_size = RIGHT_SHIFT(hf_size,hfw->display_scale);
	set_current_button (hfw->sbs, hfw->display_scale);
	hfw->size_change_request = TRUE;
	
	gtk_widget_set_size_request (hfw->draw_area_frame, hfw->area_size+SCALE_PAD, hfw->area_size+SCALE_PAD);

//	printf("SIZE_CALLB: HFW: %d; HF_SIZE: %d; DISPLAY_SCALE: %d; AREA_SIZE: %d\n", hfw, hf_size, hfw->display_scale, hfw->area_size);
	
	init_render_struct(hfw->hf_options->render_str, 
		hfw->dirname, 
		hfw->filename, 
		&hfw->creation_mode,
		hfw->if_modified,
		hfw->gl_preview,
		hfw->hf_struct->hf_buf,
		hfw->hf_struct->max_x,
		hfw->hf_struct->max_y);

	gl_set_input_grid (hfw->gl_preview, hfw->hf_struct->hf_buf, hfw->hf_struct->max_x, hfw->hf_struct->max_y, HF_TYPE_ID);
	gl_update_details_display (hfw->gl_preview);
	gtk_drawing_area_size(GTK_DRAWING_AREA(hfw->area), 
		hfw->area_size, hfw->area_size);
}
Esempio n. 12
0
void Modify_ScreenCoeff(GtkWidget* widget, gpointer data)
{
	int Size = GPOINTER_TO_INT(data);
	
	gtk_drawing_area_size(GTK_DRAWING_AREA(pDrawingArea), 256 * Size, 384 * Size);
	gtk_widget_set_usize (pDrawingArea, 256 * Size, 384 * Size);
	
	ScreenCoeff_Size = Size;
	
}
Esempio n. 13
0
int main(int argc, char *argv[])
{
  GtkWidget *window;
  GtkWidget *drawing_area;

  /* --- GTK initialization --- */
  gtk_init( &argc, &argv );
  gdk_rgb_init();

  /* --- Open BMP file and Read headers --- */
  if (argc>1) strcpy(fname1, argv[1]);
  else { printf("入力画像ファイル名: "); gets(fname1); }

  fp1=open_bmpfile(fname1, &bmpf_h, &bmpi_h);

  pict_width=bmpi_h.biWidth; pict_height=bmpi_h.biHeight;

  rgbbuf=(guchar *) malloc(pict_width * pict_height * 3);
  if (rgbbuf==NULL) {
    printf("Can't allocate rgbbuf\n"); exit(1);
  }
  read_bmpfile(fp1);

  pict_width=768;
  pict_height=256;



  /* --- Create the top level window --- */
  g_window = window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  /* --- Show the label  --- */
  gtk_widget_show(window);
  gtk_signal_connect(GTK_OBJECT(window), "destroy",
		     GTK_SIGNAL_FUNC(destroyapp), NULL);

  drawing_area = gtk_drawing_area_new();
  gtk_drawing_area_size( GTK_DRAWING_AREA(drawing_area), pict_width, pict_height);
  gtk_signal_connect(GTK_OBJECT(drawing_area), "expose_event",
		     (GtkSignalFunc) expose_event, NULL);
  gtk_widget_set_events(drawing_area, GDK_EXPOSURE_MASK
	| GDK_BUTTON_PRESS_MASK);
  gtk_container_add(GTK_CONTAINER(window), drawing_area);

  /* --- Show the label  --- */
  gtk_widget_show(drawing_area);

  /* --- Create GC  --- */
  g_gc = gdk_gc_new(window->window);

  gtk_main();
  return 0;
}
Esempio n. 14
0
// whenever the scrolled window is resized, the bitmap inside
// will also be resized
static gint swin_expose_event(GtkWidget *widget, GdkEventExpose *event, 
			      GtkWidget *vbox) {
  graph_priv_t *priv = g_object_get_data(G_OBJECT(vbox), "priv");
  g_assert(priv);

  // resize embedded graph if size of scrolled window changed
  if(priv->graph->allocation.width != 
     priv->zoom * priv->graph->parent->allocation.width) 
    gtk_drawing_area_size(GTK_DRAWING_AREA(priv->graph), 
	  priv->zoom * priv->graph->parent->allocation.width, -1);

  return FALSE;
}
Esempio n. 15
0
void gui_init(struct dt_iop_module_t *self)
{
  self->gui_data = malloc(sizeof(dt_iop_lowlight_gui_data_t));
  dt_iop_lowlight_gui_data_t *c = (dt_iop_lowlight_gui_data_t *)self->gui_data;
  dt_iop_lowlight_params_t *p = (dt_iop_lowlight_params_t *)self->params;

  c->transition_curve = dt_draw_curve_new(0.0, 1.0, CATMULL_ROM);
  (void)dt_draw_curve_add_point(c->transition_curve, p->transition_x[DT_IOP_LOWLIGHT_BANDS-2]-1.0, p->transition_y[DT_IOP_LOWLIGHT_BANDS-2]);
  for(int k=0; k<DT_IOP_LOWLIGHT_BANDS; k++) (void)dt_draw_curve_add_point(c->transition_curve, p->transition_x[k], p->transition_y[k]);
  (void)dt_draw_curve_add_point(c->transition_curve, p->transition_x[1]+1.0, p->transition_y[1]);

  c->mouse_x = c->mouse_y = c->mouse_pick = -1.0;
  c->dragging = 0;
  c->x_move = -1;
  c->mouse_radius = 1.0/DT_IOP_LOWLIGHT_BANDS;

  self->widget = GTK_WIDGET(gtk_vbox_new(FALSE, DT_GUI_IOP_MODULE_CONTROL_SPACING));

  c->area = GTK_DRAWING_AREA(gtk_drawing_area_new());
  gtk_drawing_area_size(c->area, 195, 195);

  gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(c->area),FALSE, FALSE, 0);

  gtk_widget_add_events(GTK_WIDGET(c->area), GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_LEAVE_NOTIFY_MASK);
  g_signal_connect (G_OBJECT (c->area), "expose-event",
                    G_CALLBACK (lowlight_expose), self);
  g_signal_connect (G_OBJECT (c->area), "button-press-event",
                    G_CALLBACK (lowlight_button_press), self);
  g_signal_connect (G_OBJECT (c->area), "button-release-event",
                    G_CALLBACK (lowlight_button_release), self);
  g_signal_connect (G_OBJECT (c->area), "motion-notify-event",
                    G_CALLBACK (lowlight_motion_notify), self);
  g_signal_connect (G_OBJECT (c->area), "leave-notify-event",
                    G_CALLBACK (lowlight_leave_notify), self);
  g_signal_connect (G_OBJECT (c->area), "scroll-event",
                    G_CALLBACK (lowlight_scrolled), self);

  c->scale_blueness = DTGTK_SLIDER(dtgtk_slider_new_with_range(DARKTABLE_SLIDER_BAR,0.0, 100.0, 5.0, p->blueness, 2));
  dtgtk_slider_set_default_value(c->scale_blueness, p->blueness);
  dtgtk_slider_set_label(c->scale_blueness,_("blue shift"));
  dtgtk_slider_set_unit(c->scale_blueness,"%");
  dtgtk_slider_set_format_type(c->scale_blueness,DARKTABLE_SLIDER_FORMAT_PERCENT);
  g_object_set(G_OBJECT(c->scale_blueness), "tooltip-text", _("blueness in shadows"), (char *)NULL);

  gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(c->scale_blueness), TRUE, TRUE, 5);

  g_signal_connect (G_OBJECT (c->scale_blueness), "value-changed",
                    G_CALLBACK (blueness_callback), self);
}
Esempio n. 16
0
gboolean build_device(void)
{
     GtkWidget *window;
     GtkWidget *button;
     GtkWidget *box;
     GtkWidget *table;
     int i,j;

     window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
     gtk_signal_connect(GTK_OBJECT(window), "destroy",
			GTK_SIGNAL_FUNC(destroy), NULL);
     gtk_signal_connect(GTK_OBJECT(window), "key-press-event",
			GTK_SIGNAL_FUNC(key_press_event), NULL);
     box = gtk_vbox_new(FALSE,0);
     gtk_container_add(GTK_CONTAINER(window), box);

     main_canvas = gtk_drawing_area_new();
     gtk_drawing_area_size( (GtkDrawingArea*)main_canvas, 240, 320 );
     gtk_signal_connect(GTK_OBJECT(main_canvas), "configure_event",
			(GtkSignalFunc)make_frame, NULL);
     gtk_signal_connect(GTK_OBJECT(main_canvas), "expose_event",
			(GtkSignalFunc)draw_frame, NULL);
     gtk_widget_set_events( main_canvas, GDK_EXPOSURE_MASK);
     gtk_widget_show(main_canvas);
     gtk_box_pack_start(GTK_BOX(box), main_canvas, TRUE, TRUE, 0);

     table = gtk_table_new( 3, 3, TRUE);
     gtk_box_pack_start(GTK_BOX(box), table, TRUE, TRUE, 0);
     for ( j = 0 ; j < 3 ; j++ )
     {
	  for ( i = 0 ; i < 3 ; i++ )
	  {
	       char tmp[4];
	       sprintf( tmp, "%d", j*3+i );
	       button = gtk_button_new_with_label(tmp);
	       gtk_signal_connect(GTK_OBJECT(button), "clicked",
				  GTK_SIGNAL_FUNC(button_clicked), (gpointer)(j*3+i));
	       gtk_signal_connect(GTK_OBJECT(button), "key-press-event",
				  GTK_SIGNAL_FUNC(key_press_event), NULL);
	       gtk_table_attach_defaults(GTK_TABLE(table), button, i, i+1, j, j+1);
	       gtk_widget_show(button);
	  }
     }
     gtk_widget_show(table);

     gtk_widget_show(box);
     gtk_widget_show(window);

}
Esempio n. 17
0
/* Set the size that the drawing area will request in response to a "size_request"
 * signal. The drawing area may actually be allocated a size larger than this
 * depending on how it is packed within the enclosing containers. */
int
clip_GTK_DRAWINGAREASIZE(ClipMachine * ClipMachineMemory)
{
   C_widget *cda = _fetch_cw_arg(ClipMachineMemory);

   guint     width = _clip_parni(ClipMachineMemory, 2);

   guint     height = _clip_parni(ClipMachineMemory, 3);

   CHECKCWID(cda, GTK_IS_DRAWING_AREA);
   CHECKOPT(2, NUMERIC_type_of_ClipVarType);
   CHECKOPT(3, NUMERIC_type_of_ClipVarType);
   gtk_drawing_area_size(GTK_DRAWING_AREA(cda->widget), width, height);
   return 0;
 err:
   return 1;
}
int		main()
{
  GtkWidget	*draw;

  gtk_init(NULL, NULL);
  window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
  gtk_widget_show(window);

  draw = gtk_drawing_area_new();
  gtk_drawing_area_size(GTK_DRAWING_AREA(draw), 40, 40);
  gtk_widget_show(draw);
  gtk_container_add(GTK_CONTAINER(window), draw);
  gtk_signal_connect(GTK_OBJECT(draw),
                     "expose_event", (GtkSignalFunc) expose_event, NULL);
  gtk_signal_connect(GTK_OBJECT(draw),
                     "configure_event", (GtkSignalFunc) configure_event, NULL);
  gtk_main();
}
Esempio n. 19
0
/* createDrawingArea
 * Creates the main drawing area
 *
 * @return void
 */
void createDrawingArea () {
	// Background color
	GdkColor color;
	gdk_color_parse("#458B00", &color);

	// Creates drawing area with the specified dimensions and background color
	this.drawingArea = gtk_drawing_area_new();
	gtk_drawing_area_size((GtkDrawingArea*) this.drawingArea, canvas_width, canvas_height);
	gtk_widget_modify_bg((GtkWidget*) this.drawingArea, GTK_STATE_NORMAL, &color);
	gdk_color_parse("#FFA824", &color);
	gtk_widget_modify_fg((GtkWidget*) this.drawingArea, GTK_STATE_NORMAL, &color);

	// Attach events to the drawing area
	gtk_signal_connect((GtkObject*) this.drawingArea, "expose_event", G_CALLBACK(gtk_expose_event), NULL);
	gtk_signal_connect((GtkObject*) this.drawingArea, "configure_event", G_CALLBACK(gtk_configure_event), NULL);

	gtk_container_add((GtkContainer*) this.vbox, this.drawingArea);
}
Esempio n. 20
0
static void main_frontend(int argc, char *argv[])
{
	GtkWidget *window, *vbox;

	gtk_init(&argc, &argv);
	gdk_rgb_init();

	window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_window_set_title(GTK_WINDOW(window), "My WebCam");

	gtk_signal_connect(GTK_OBJECT(window), "delete_event",
			   GTK_SIGNAL_FUNC(delete_event), NULL);
	gtk_signal_connect(GTK_OBJECT(window), "destroy",
			   GTK_SIGNAL_FUNC(delete_event), NULL);
	gtk_signal_connect(GTK_OBJECT(window), "key_release_event",
			   GTK_SIGNAL_FUNC(key_event), NULL);

	gtk_container_set_border_width(GTK_CONTAINER(window), 2);

	/* vertical box */
	vbox = gtk_vbox_new(FALSE, 5);
	gtk_container_add(GTK_CONTAINER(window), vbox);

	/* image */
	drawing_area = gtk_drawing_area_new();
	gtk_drawing_area_size(GTK_DRAWING_AREA(drawing_area),
			      fmt.fmt.pix.width, fmt.fmt.pix.height);
	gtk_box_pack_start(GTK_BOX(vbox), drawing_area, FALSE, FALSE, 0);

	ctrl_create(vbox);

	gtk_widget_show_all(window);

	gdk_input_add(fd,
			GDK_INPUT_READ,
			frame_ready,
			NULL);

	printf("'g' grab an image - 'i' info toggle - 'q' quit\n");

	gtk_main();
}
Esempio n. 21
0
/*
 * main
 *
 * Program begins here.
 */ 
int main (int argc, char *argv[])
{
    GtkWidget *window;
    GtkWidget *drawing_area;
    GtkWidget *vbox;

    gtk_init (&argc, &argv);

    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

    vbox = gtk_hbox_new (FALSE, 0);
    gtk_container_add (GTK_CONTAINER (window), vbox);
    gtk_widget_show (vbox);

    gtk_signal_connect (GTK_OBJECT (window), "destroy",
                GTK_SIGNAL_FUNC (quit), NULL);

    /* --- Create the drawing area  --- */
    drawing_area = gtk_drawing_area_new ();
    gtk_drawing_area_size (GTK_DRAWING_AREA (drawing_area), 200, 200);
    gtk_box_pack_start (GTK_BOX (vbox), drawing_area, TRUE, TRUE, 0);

    gtk_widget_show (drawing_area);

    /* --- Signals used to handle backing pixmap --- */
    gtk_signal_connect (GTK_OBJECT (drawing_area), "expose_event",
                (GtkSignalFunc) expose_event, NULL);
    gtk_signal_connect (GTK_OBJECT(drawing_area),"configure_event",
                (GtkSignalFunc) configure_event, NULL);

    /* --- Show the window --- */
    gtk_widget_show (window);

    /* --- Repaint every second --- */
    gtk_timeout_add (1000, Repaint, drawing_area);

    /* --- Call gtk-main loop --- */
    gtk_main ();

    return 0;
}
void gui_init(struct dt_iop_module_t *self)
{
  self->gui_data = malloc(sizeof(dt_iop_colorcorrection_gui_data_t));
  dt_iop_colorcorrection_gui_data_t *g = (dt_iop_colorcorrection_gui_data_t *)self->gui_data;

  g->selected = 0;

  self->widget = gtk_vbox_new(FALSE, DT_BAUHAUS_SPACE);
  g->area = GTK_DRAWING_AREA(gtk_drawing_area_new());
  GtkWidget *asp = gtk_aspect_frame_new(NULL, 0.5, 0.5, 1.0, TRUE);
  gtk_box_pack_start(GTK_BOX(self->widget), asp, TRUE, TRUE, 0);
  gtk_container_add(GTK_CONTAINER(asp), GTK_WIDGET(g->area));
  gtk_drawing_area_size(g->area, 258, 258);
  g_object_set (GTK_OBJECT(g->area), "tooltip-text", _("drag the line for split toning. "
                "bright means highlights, dark means shadows. "
                "use mouse wheel to change saturation."), (char *)NULL);

  gtk_widget_add_events(GTK_WIDGET(g->area), GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_LEAVE_NOTIFY_MASK);
  g_signal_connect (G_OBJECT (g->area), "expose-event",
                    G_CALLBACK (dt_iop_colorcorrection_expose), self);
  g_signal_connect (G_OBJECT (g->area), "button-press-event",
                    G_CALLBACK (dt_iop_colorcorrection_button_press), self);
  g_signal_connect (G_OBJECT (g->area), "motion-notify-event",
                    G_CALLBACK (dt_iop_colorcorrection_motion_notify), self);
  g_signal_connect (G_OBJECT (g->area), "leave-notify-event",
                    G_CALLBACK (dt_iop_colorcorrection_leave_notify), self);
  g_signal_connect (G_OBJECT (g->area), "scroll-event",
                    G_CALLBACK (dt_iop_colorcorrection_scrolled), self);

  g->slider = dt_bauhaus_slider_new_with_range(self, -3.0f, 3.0f, 0.01f, 1.0f, 2);
  gtk_box_pack_start(GTK_BOX(self->widget), g->slider, TRUE, TRUE, 0);
  g_object_set (GTK_OBJECT(g->slider), "tooltip-text", _("set the global saturation"), (char *)NULL);
  dt_bauhaus_widget_set_label(g->slider,_("saturation"));

  g_signal_connect (G_OBJECT (g->slider), "value-changed",
                    G_CALLBACK (sat_callback), self);
  g->hsRGB = dt_colorspaces_create_srgb_profile();
  g->hLab  = dt_colorspaces_create_lab_profile();
  g->xform = cmsCreateTransform(g->hLab, TYPE_Lab_DBL, g->hsRGB, TYPE_RGB_DBL,
                                INTENT_PERCEPTUAL, 0);//cmsFLAGS_NOTPRECALC);
}
Esempio n. 23
0
GtkWidget *gpk_plot_new(int width, int height)
{
  GtkWidget *pixmapbox;
   
  pixmapbox = gtk_drawing_area_new();
  gtk_drawing_area_size(GTK_DRAWING_AREA(pixmapbox),width,height);
  gtk_signal_connect (GTK_OBJECT (pixmapbox), "expose_event",
		      (GtkSignalFunc) expose_event, NULL);
  gtk_signal_connect (GTK_OBJECT(pixmapbox),"configure_event",
		      (GtkSignalFunc) configure_event, NULL);
  gtk_widget_set_events (pixmapbox, GDK_EXPOSURE_MASK);

  if (num_plotwindows < max_plotwindows) {
    pixmapboxes[num_plotwindows] = pixmapbox;
    pixmaps[num_plotwindows] = NULL;
    num_plotwindows ++;
  } else {
    g_print("gtk_plotarea_new(): exceeded maximum of 10 plotarea windows\n");
  }

  return pixmapbox;
}
Esempio n. 24
0
/*! \todo Finish function documentation!!!
 *  \brief
 *  \par Function Description
 *
 */
void x_window_create_drawing(GtkWidget *drawbox, GSCHEM_TOPLEVEL *w_current)
{
  /* drawing next */
  w_current->drawing_area = gtk_drawing_area_new ();
  /* Set the size here.  Be sure that it has an aspect ratio of 1.333
   * We could calculate this based on root window size, but for now
   * lets just set it to:
   * Width = root_width*3/4   Height = Width/1.3333333333
   * 1.3333333 is the desired aspect ratio!
   */

  gtk_drawing_area_size (GTK_DRAWING_AREA (w_current->drawing_area),
                         w_current->win_width,
                         w_current->win_height);

  gtk_box_pack_start (GTK_BOX (drawbox), w_current->drawing_area,
                      TRUE, TRUE, 0);
  GTK_WIDGET_SET_FLAGS (w_current->drawing_area, GTK_CAN_FOCUS );
  gtk_widget_grab_focus (w_current->drawing_area);
  gtk_widget_show (w_current->drawing_area);

}
GtkWidget *
c2_network_traffic_new (C2Application *application)
{
	C2NetworkTraffic *nt;
	
	nt = gtk_type_new (c2_network_traffic_get_type ());

	gtk_widget_set_usize (GTK_WIDGET (nt), DRAWABLE_WIDTH+2, DRAWABLE_HEIGHT+2);
	gtk_drawing_area_size (GTK_DRAWING_AREA (nt),
							DRAWABLE_WIDTH+2, DRAWABLE_HEIGHT+2);
	gtk_signal_connect (GTK_OBJECT (nt), "expose_event",
						GTK_SIGNAL_FUNC (expose_event), nt);
	gtk_signal_connect (GTK_OBJECT (nt), "configure_event",
						GTK_SIGNAL_FUNC (configure_event), nt);

	nt->application = application;

	gtk_idle_add ((GtkFunction) idle_timeout, nt);
	nt->timeout_id = gtk_timeout_add (1000, (GtkFunction) timeout, nt);

	return GTK_WIDGET (nt);
}
Esempio n. 26
0
static void graph_zoom(GtkWidget *graph, int zoom_dir) {
  /* the graph itself is inside the scolled window/viewport pair */
  graph_priv_t *priv = g_object_get_data(G_OBJECT(graph), "priv");
  g_assert(priv);

  switch(zoom_dir) {
  case -1:              // zoom out
    priv->zoom /= 2;
    break;
  case 0:               // reset zoom
    priv->zoom = 1;
    break;
  case 1:               // zoom in
    priv->zoom *= 2;
    break;
  }

  if(priv->zoom < 1) priv->zoom = 1;

  gtk_drawing_area_size(GTK_DRAWING_AREA(priv->graph), 
	priv->zoom * priv->graph->parent->allocation.width, -1);
}
Esempio n. 27
0
// Fonction qui crée la zone de dessin 256x256
void creation_zone_dessin()
{
  if(ptr_window==NULL) return;

  GtkWidget * frame;
  GtkWidget * scrollbar;
	
  guint i;

  /* Création de la zone d'écriture */
  ptr_draw_area = (DrawArea*) g_malloc(sizeof(DrawArea));
  if(ptr_draw_area==NULL) return;
 
  ptr_draw_area->drawing_area = gtk_drawing_area_new();
	
  
  ptr_draw_area->buffer.width = 256;
  ptr_draw_area->buffer.height = 256;
  ptr_draw_area->buffer.mat = (guchar*) g_malloc ((sizeof(guchar))*(256)*(256));
	
  // On prèpare la zone d'écriture
  DESSIN_effacer(ptr_draw_area->buffer);

  gtk_drawing_area_size(GTK_DRAWING_AREA(ptr_draw_area->drawing_area),256,256);
	
  gtk_widget_set_events(ptr_draw_area->drawing_area, GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_POINTER_MOTION_MASK );
		
  g_signal_connect(G_OBJECT(ptr_draw_area->drawing_area),"realize", G_CALLBACK(zone_dessin_realisee), NULL);
  g_signal_connect(G_OBJECT(ptr_draw_area->drawing_area),"expose_event", G_CALLBACK(zone_dessin_rafraichir), NULL);
  g_signal_connect(G_OBJECT(ptr_draw_area->drawing_area),"button_press_event", G_CALLBACK(zone_dessin_clic_souris), NULL);
  g_signal_connect(G_OBJECT(ptr_draw_area->drawing_area),"motion_notify_event", G_CALLBACK(zone_dessin_mouvement_souris), NULL);
	
  gtk_widget_set_app_paintable(ptr_draw_area->drawing_area, TRUE); //

  gtk_container_add(GTK_CONTAINER(ptr_window->draw), ptr_draw_area->drawing_area);
	
  gtk_widget_show_all(ptr_window->draw);	
}
Esempio n. 28
0
void gui_init(struct dt_iop_module_t *self)
{
  self->gui_data = malloc(sizeof(dt_iop_basecurve_gui_data_t));
  dt_iop_basecurve_gui_data_t *c = (dt_iop_basecurve_gui_data_t *)self->gui_data;
  dt_iop_basecurve_params_t *p = (dt_iop_basecurve_params_t *)self->params;

  c->minmax_curve = dt_draw_curve_new(0.0, 1.0, p->basecurve_type[0]);
  c->minmax_curve_type = p->basecurve_type[0];
  c->minmax_curve_nodes = p->basecurve_nodes[0];
  for(int k=0; k<p->basecurve_nodes[0]; k++) (void)dt_draw_curve_add_point(c->minmax_curve, p->basecurve[0][k].x, p->basecurve[0][k].y);
  c->mouse_x = c->mouse_y = -1.0;
  c->selected = -1;

  self->widget = gtk_vbox_new(FALSE, DT_BAUHAUS_SPACE);
  c->area = GTK_DRAWING_AREA(gtk_drawing_area_new());
  g_object_set (GTK_OBJECT(c->area), "tooltip-text", _("abscissa: input, ordinate: output. works on RGB channels"), (char *)NULL);
  // GtkWidget *asp = gtk_aspect_frame_new(NULL, 0.5, 0.5, 1.0, TRUE);
  // gtk_box_pack_start(GTK_BOX(self->widget), asp, TRUE, TRUE, 0);
  // gtk_container_add(GTK_CONTAINER(asp), GTK_WIDGET(c->area));
  gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(c->area), TRUE, TRUE, 0);
  gtk_drawing_area_size(c->area, 0, 258);

  gtk_widget_add_events(GTK_WIDGET(c->area), GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_LEAVE_NOTIFY_MASK);
  g_signal_connect (G_OBJECT (c->area), "expose-event",
                    G_CALLBACK (dt_iop_basecurve_expose), self);
  g_signal_connect (G_OBJECT (c->area), "button-press-event",
                    G_CALLBACK (dt_iop_basecurve_button_press), self);
  g_signal_connect (G_OBJECT (c->area), "motion-notify-event",
                    G_CALLBACK (dt_iop_basecurve_motion_notify), self);
  g_signal_connect (G_OBJECT (c->area), "leave-notify-event",
                    G_CALLBACK (dt_iop_basecurve_leave_notify), self);
  g_signal_connect (G_OBJECT (c->area), "enter-notify-event",
                    G_CALLBACK (dt_iop_basecurve_enter_notify), self);
  g_signal_connect (G_OBJECT (c->area), "configure-event",
                    G_CALLBACK (area_resized), self);
  g_signal_connect (G_OBJECT (c->area), "scroll-event",
                    G_CALLBACK (scrolled), self);
}
Esempio n. 29
0
static void
create_same_board (char *fname)
{
	gtk_widget_push_visual (gdk_imlib_get_visual ());
	gtk_widget_push_colormap (gdk_imlib_get_colormap ());

	draw_area = gtk_drawing_area_new ();

        gtk_widget_pop_colormap ();
	gtk_widget_pop_visual ();

	gtk_widget_set_events (draw_area, gtk_widget_get_events (draw_area) | GAME_EVENTS);

	gtk_box_pack_start_defaults (GTK_BOX(vb), draw_area);
	gtk_widget_realize (draw_area);
  
	gtk_widget_show (draw_area);

	load_scenario (fname);
	gtk_drawing_area_size (GTK_DRAWING_AREA (draw_area),
			       STONE_COLS  * STONE_SIZE,
			       STONE_LINES * STONE_SIZE);
	gtk_signal_connect (GTK_OBJECT(draw_area), "event", (GtkSignalFunc) area_event, 0);
}
Esempio n. 30
0
int main (int argc, char *argv[])
{
	int i;
	
	const char *commandLine_File = NULL;
	GtkWidget *pVBox;
	GtkWidget *pMenuBar;
	GtkWidget *pMenu, *pSubMenu;
	GtkWidget *pMenuItem, *pSubMenuItem;
	GtkAccelGroup * accel_group;
       
	if(argc == 2) commandLine_File = argv[1];
	
#ifdef DEBUG
        LogStart();
#endif
	
	gtk_init(&argc, &argv);
	SDL_Init(SDL_INIT_VIDEO);
	desmume_init();
	
 	dTools_running = (BOOL*)malloc(sizeof(BOOL) * dTools_list_size);
	for(i=0; i<dTools_list_size; i++) dTools_running[i]=FALSE;
	
	CONFIG_FILE = g_build_filename(g_get_home_dir(), ".desmume.ini", NULL);
	Read_ConfigFile();
	
	/* Creation de la fenetre */
	pWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_window_set_title(GTK_WINDOW(pWindow), "Desmume");
	gtk_window_set_policy (GTK_WINDOW (pWindow), FALSE, FALSE, FALSE);
	gtk_window_set_icon(GTK_WINDOW (pWindow), gdk_pixbuf_new_from_xpm_data(DeSmuME_xpm));
	
	g_signal_connect(G_OBJECT(pWindow), "destroy", G_CALLBACK(gtk_main_quit), NULL);
	g_signal_connect(G_OBJECT(pWindow), "key_press_event", G_CALLBACK(Key_Press), NULL);
	g_signal_connect(G_OBJECT(pWindow), "key_release_event", G_CALLBACK(Key_Release), NULL);

	/* Creation de la GtkVBox */
	pVBox = gtk_vbox_new(FALSE, 0);
	gtk_container_add(GTK_CONTAINER(pWindow), pVBox);

	accel_group = gtk_accel_group_new();
	action_group = gtk_action_group_new("dui");
	gtk_action_group_add_actions(action_group, action_entries, sizeof(action_entries) / sizeof(GtkActionEntry), pWindow);
        {
                GList * list = gtk_action_group_list_actions(action_group);
                g_list_foreach(list, dui_set_accel_group, accel_group);
        }
	gtk_window_add_accel_group(GTK_WINDOW(pWindow), accel_group);
	gtk_action_set_sensitive(gtk_action_group_get_action(action_group, "pause"), FALSE);
	gtk_action_set_sensitive(gtk_action_group_get_action(action_group, "run"), FALSE);
	gtk_action_set_sensitive(gtk_action_group_get_action(action_group, "reset"), FALSE);
	gtk_action_set_sensitive(gtk_action_group_get_action(action_group, "printscreen"), FALSE);

	/**** Creation du menu ****/

	pMenuBar = gtk_menu_bar_new();
	
	/** Menu "Fichier" **/

	pMenu = gtk_menu_new();

	gtk_container_add(GTK_CONTAINER(pMenu), gtk_action_create_menu_item(gtk_action_group_get_action(action_group, "open")));
	gtk_container_add(GTK_CONTAINER(pMenu), gtk_action_create_menu_item(gtk_action_group_get_action(action_group, "printscreen")));
	gtk_container_add(GTK_CONTAINER(pMenu), gtk_action_create_menu_item(gtk_action_group_get_action(action_group, "quit")));
	
	pMenuItem = gtk_menu_item_new_with_label("File");
	gtk_menu_item_set_submenu(GTK_MENU_ITEM(pMenuItem), pMenu);
	gtk_menu_shell_append(GTK_MENU_SHELL(pMenuBar), pMenuItem);

	/** Menu "Emulation" **/
	GtkWidget *mEmulation;
		GtkWidget *mFrameskip;
			GtkWidget *mFrameskip_Radio[MAX_FRAMESKIP];
		GtkWidget *mGraphics;
			GtkWidget *mSize;
				GtkWidget *mSize_Radio[MAX_SCREENCOEFF];
			GtkWidget *mLayers;
				GtkWidget *mLayers_Radio[10];
	
	
	mEmulation = gtk_menu_new();
	pMenuItem = gtk_menu_item_new_with_label("Emulation");
	gtk_menu_item_set_submenu(GTK_MENU_ITEM(pMenuItem), mEmulation);
	gtk_menu_shell_append(GTK_MENU_SHELL(pMenuBar), pMenuItem);
	
	gtk_container_add(GTK_CONTAINER(mEmulation), gtk_action_create_menu_item(gtk_action_group_get_action(action_group, "run")));
	
	gtk_container_add(GTK_CONTAINER(mEmulation), gtk_action_create_menu_item(gtk_action_group_get_action(action_group, "pause")));

	gtk_container_add(GTK_CONTAINER(mEmulation), gtk_action_create_menu_item(gtk_action_group_get_action(action_group, "reset")));
	
		mFrameskip = gtk_menu_new();
		pMenuItem = gtk_menu_item_new_with_label("Frameskip");
		gtk_menu_item_set_submenu(GTK_MENU_ITEM(pMenuItem), mFrameskip);
		gtk_menu_shell_append(GTK_MENU_SHELL(mEmulation), pMenuItem);
		
		for(i = 0; i < MAX_FRAMESKIP; i++) {
			char frameskipRadio_buf[16];
			sprintf(frameskipRadio_buf, "%d", i);
			if(i>0) mFrameskip_Radio[i] = gtk_radio_menu_item_new_with_label_from_widget(GTK_RADIO_MENU_ITEM(mFrameskip_Radio[i-1]), frameskipRadio_buf);
			else mFrameskip_Radio[i] = gtk_radio_menu_item_new_with_label(NULL, frameskipRadio_buf);
			g_signal_connect(G_OBJECT(mFrameskip_Radio[i]), "activate", G_CALLBACK(Modify_Frameskip), GINT_TO_POINTER(i));
			gtk_menu_shell_append(GTK_MENU_SHELL(mFrameskip), mFrameskip_Radio[i]);
		}
		gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(mFrameskip_Radio[0]), TRUE);
		
		mGraphics = gtk_menu_new();
		pMenuItem = gtk_menu_item_new_with_label("Graphics");
		gtk_menu_item_set_submenu(GTK_MENU_ITEM(pMenuItem), mGraphics);
		gtk_menu_shell_append(GTK_MENU_SHELL(mEmulation), pMenuItem);
			
// TODO: Un jour, peut être... ><
			mSize = gtk_menu_new();
			pMenuItem = gtk_menu_item_new_with_label("Size");
			gtk_menu_item_set_submenu(GTK_MENU_ITEM(pMenuItem), mSize);
			gtk_menu_shell_append(GTK_MENU_SHELL(mGraphics), pMenuItem);
			
			for(i = 1; i < MAX_SCREENCOEFF; i++) {
				char sizeRadio_buf[16];
				sprintf(sizeRadio_buf, "x%d", i);
				if(i>1) mSize_Radio[i] = gtk_radio_menu_item_new_with_label_from_widget(GTK_RADIO_MENU_ITEM(mSize_Radio[i-1]), sizeRadio_buf);
				else mSize_Radio[i] = gtk_radio_menu_item_new_with_label(NULL, sizeRadio_buf);
				g_signal_connect(G_OBJECT(mSize_Radio[i]), "activate", G_CALLBACK(Modify_ScreenCoeff), GINT_TO_POINTER(i));
				gtk_menu_shell_append(GTK_MENU_SHELL(mSize), mSize_Radio[i]);
			}
			gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(mFrameskip_Radio[0]), TRUE);
		
			mLayers = gtk_menu_new();
			pMenuItem = gtk_menu_item_new_with_label("Layers");
			gtk_menu_item_set_submenu(GTK_MENU_ITEM(pMenuItem), mLayers);
			gtk_menu_shell_append(GTK_MENU_SHELL(mGraphics), pMenuItem);
		
			for(i = 0; i < 10; i++) {
				mLayers_Radio[i] = gtk_check_menu_item_new_with_label(Layers_Menu[i]);
				g_signal_connect(G_OBJECT(mLayers_Radio[i]), "activate", G_CALLBACK(Modify_Layer), (void*)Layers_Menu[i]);
				gtk_menu_shell_append(GTK_MENU_SHELL(mLayers), mLayers_Radio[i]);
				gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(mLayers_Radio[i]), TRUE);
			}
			
	
	/** Menu "Options" **/
	GtkWidget *mConfig = gtk_menu_new();
	pMenuItem = gtk_menu_item_new_with_label("Config");
	gtk_menu_item_set_submenu(GTK_MENU_ITEM(pMenuItem), mConfig);
	gtk_menu_shell_append(GTK_MENU_SHELL(pMenuBar), pMenuItem);
	
	pMenuItem = gtk_menu_item_new_with_label("Edit controls");
	g_signal_connect(G_OBJECT(pMenuItem), "activate", G_CALLBACK(Edit_Controls), (GtkWidget*) pWindow);
	gtk_menu_shell_append(GTK_MENU_SHELL(mConfig), pMenuItem);
	
#if 0
	
	GtkWidget *mFirmware;
	
	mFirmware = gtk_menu_new();
	pMenuItem = gtk_menu_item_new_with_label("Firmware");
	gtk_menu_item_set_submenu(GTK_MENU_ITEM(pMenuItem), mFirmware);
	gtk_menu_shell_append(GTK_MENU_SHELL(mConfig), pMenuItem);
	
	pMenuItem = gtk_menu_item_new_with_label("Select...");
	g_signal_connect(G_OBJECT(pMenuItem), "activate", G_CALLBACK(SelectFirmwareFile), (gpointer)0);
	gtk_menu_shell_append(GTK_MENU_SHELL(mFirmware), pMenuItem);
		
	pMenuItem = gtk_menu_item_new_with_label("Config");
	gtk_menu_item_set_submenu(GTK_MENU_ITEM(pMenuItem), mConfig);
	gtk_menu_shell_append(GTK_MENU_SHELL(pMenuBar), pMenuItem);
	
#endif
	
	/** Menu "Outils" **/
	
	pMenu = gtk_menu_new();
	
	for(i = 0; i < dTools_list_size; i++)
	{
		pMenuItem = gtk_menu_item_new_with_label(dTools_list[i]->name);
		g_signal_connect(G_OBJECT(pMenuItem), "activate", G_CALLBACK(Start_dTool), GINT_TO_POINTER(i));
		gtk_menu_shell_append(GTK_MENU_SHELL(pMenu), pMenuItem);
	}
		
	pMenuItem = gtk_menu_item_new_with_label("Tools");
	gtk_menu_item_set_submenu(GTK_MENU_ITEM(pMenuItem), pMenu);
	gtk_menu_shell_append(GTK_MENU_SHELL(pMenuBar), pMenuItem);
	
	/** Menu "?" **/

	pMenu = gtk_menu_new();

#if ((GTK_MAJOR_VERSION >= 2) && (GTK_MINOR_VERSION >= 6))
	pMenuItem = gtk_image_menu_item_new_from_stock(GTK_STOCK_ABOUT,NULL);
#else
	pMenuItem = gtk_menu_item_new_with_label("About");
#endif
	g_signal_connect(G_OBJECT(pMenuItem), "activate", G_CALLBACK(About), (GtkWidget*) pWindow);
	gtk_menu_shell_append(GTK_MENU_SHELL(pMenu), pMenuItem);

	pMenuItem = gtk_menu_item_new_with_label("?");
	gtk_menu_item_set_submenu(GTK_MENU_ITEM(pMenuItem), pMenu);
	gtk_menu_shell_append(GTK_MENU_SHELL(pMenuBar), pMenuItem);

	/* Ajout du menu a la fenetre */
	gtk_box_pack_start(GTK_BOX(pVBox), pMenuBar, FALSE, FALSE, 0);

	/* Création de la Toolbar */
	
	pToolbar = gtk_toolbar_new();
	gtk_box_pack_start(GTK_BOX(pVBox), pToolbar, FALSE, FALSE, 0);

	gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), GTK_TOOL_ITEM(gtk_action_create_tool_item(gtk_action_group_get_action(action_group, "open"))), -1);
	gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), GTK_TOOL_ITEM(gtk_action_create_tool_item(gtk_action_group_get_action(action_group, "run"))), -1);
	gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), GTK_TOOL_ITEM(gtk_action_create_tool_item(gtk_action_group_get_action(action_group, "pause"))), -1);
	gtk_toolbar_insert(GTK_TOOLBAR(pToolbar), GTK_TOOL_ITEM(gtk_action_create_tool_item(gtk_action_group_get_action(action_group, "quit"))), -1);

	/* Création de l'endroit pour l'affichage des écrans */
	
	pDrawingArea= gtk_drawing_area_new();
	
	gtk_drawing_area_size(GTK_DRAWING_AREA(pDrawingArea), 256, 384);
	gtk_widget_set_usize (pDrawingArea, 256, 384);
			
	gtk_widget_set_events(pDrawingArea, GDK_EXPOSURE_MASK | GDK_LEAVE_NOTIFY_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_KEY_PRESS_MASK );
	
	g_signal_connect(G_OBJECT(pDrawingArea), "button_press_event", G_CALLBACK(Stylus_Press), NULL);
	g_signal_connect(G_OBJECT(pDrawingArea), "button_release_event", G_CALLBACK(Stylus_Release), NULL);
	g_signal_connect(G_OBJECT(pDrawingArea), "motion_notify_event", G_CALLBACK(Stylus_Move), NULL);
	
	
	g_signal_connect( G_OBJECT(pDrawingArea), "realize", G_CALLBACK(Draw), NULL ) ;
	g_signal_connect( G_OBJECT(pDrawingArea), "expose_event", G_CALLBACK(gtkFloatExposeEvent), NULL ) ;
	
	gtk_box_pack_start(GTK_BOX(pVBox), pDrawingArea, FALSE, FALSE, 0);
	
	/* Création de la barre d'état */
	
	pStatusBar = gtk_statusbar_new();
	
	pStatusBar_Ctx = gtk_statusbar_get_context_id(GTK_STATUSBAR(pStatusBar), "Global");
	
	pStatusBar_Change("Desmume");

	gtk_box_pack_end(GTK_BOX(pVBox), pStatusBar, FALSE, FALSE, 0);
	
	gtk_widget_show_all(pWindow);
	
	//LoadFirmware("fw.bin");
	
	/* Vérifie la ligne de commandes */
	if(commandLine_File)
	{
		if(Open(commandLine_File) >= 0)
		{
			Launch();
		}
		else
		{
			GtkWidget *pDialog = gtk_message_dialog_new(GTK_WINDOW(pWindow),
					GTK_DIALOG_MODAL,
					GTK_MESSAGE_INFO,
					GTK_BUTTONS_OK,
					"Unable to load :\n%s", commandLine_File);
			gtk_dialog_run(GTK_DIALOG(pDialog));
			gtk_widget_destroy(pDialog);
		}
	}
	
	/* Boucle principale */
	
//	gtk_idle_add(&EmuLoop, pWindow);
//	g_idle_add(&EmuLoop, pWindow);
	
	gtk_main();
	
	desmume_free();

#ifdef DEBUG
        LogStop();
#endif

	SDL_Quit();
	
	Write_ConfigFile();
	
	return EXIT_SUCCESS;
}