Example #1
0
/*********************************************************************************************************
 * dialog creation
 */
int
create_romPropDialog( void )
{
	GtkWidget *button_ok, *button_cancel;
	GtkWidget *frame;
	GtkWidget *table;
	GtkWidget *label;
	GtkWidget *button;

	g_RomPropDialog.dialog = gtk_dialog_new();
	gtk_container_set_border_width( GTK_CONTAINER(g_RomPropDialog.dialog), 10 );
	gtk_window_set_title( GTK_WINDOW(g_RomPropDialog.dialog), tr("Rom Properties") );
	gtk_signal_connect(GTK_OBJECT(g_RomPropDialog.dialog), "delete_event",
				GTK_SIGNAL_FUNC(delete_question_event), (gpointer)NULL );

	// rom info
	frame = gtk_frame_new( tr("Rom Info") );
	gtk_box_pack_start( GTK_BOX(GTK_DIALOG(g_RomPropDialog.dialog)->vbox), frame, TRUE, TRUE, 0 );

	table = gtk_table_new( 7, 3, FALSE );
	gtk_container_set_border_width( GTK_CONTAINER(table), 10 );
	gtk_table_set_col_spacings( GTK_TABLE(table), 10 );
	gtk_container_add( GTK_CONTAINER(frame), table );

	label = gtk_label_new( tr("Rom Name") );
	g_RomPropDialog.romNameEntry = gtk_entry_new();
	gtk_entry_set_editable( GTK_ENTRY(g_RomPropDialog.romNameEntry), FALSE );
	gtk_table_attach_defaults( GTK_TABLE(table), label, 0, 1, 0, 1 );
	gtk_table_attach_defaults( GTK_TABLE(table), g_RomPropDialog.romNameEntry, 1, 3, 0, 1 );

	label = gtk_label_new( tr("Size") );
	g_RomPropDialog.sizeEntry = gtk_entry_new();
	gtk_entry_set_editable( GTK_ENTRY(g_RomPropDialog.sizeEntry), FALSE );
	gtk_table_attach_defaults( GTK_TABLE(table), label, 0, 1, 1, 2 );
	gtk_table_attach_defaults( GTK_TABLE(table), g_RomPropDialog.sizeEntry, 1, 3, 1, 2 );

	label = gtk_label_new( tr("Country") );
	g_RomPropDialog.countryEntry = gtk_entry_new();
	gtk_entry_set_editable( GTK_ENTRY(g_RomPropDialog.countryEntry), FALSE );
	gtk_table_attach_defaults( GTK_TABLE(table), label, 0, 1, 2, 3 );
	gtk_table_attach_defaults( GTK_TABLE(table), g_RomPropDialog.countryEntry, 1, 3, 2, 3 );

	label = gtk_label_new( tr("Ini Code") );
	g_RomPropDialog.iniCodeEntry = gtk_entry_new();
	gtk_entry_set_editable( GTK_ENTRY(g_RomPropDialog.iniCodeEntry), FALSE );
	gtk_table_attach_defaults( GTK_TABLE(table), label, 0, 1, 3, 4 );
	gtk_table_attach_defaults( GTK_TABLE(table), g_RomPropDialog.iniCodeEntry, 1, 3, 3, 4 );

	label = gtk_label_new( tr("MD5 Checksum") );
	g_RomPropDialog.md5Entry = gtk_entry_new();
	gtk_entry_set_editable( GTK_ENTRY(g_RomPropDialog.md5Entry), FALSE );
	button = gtk_button_new_with_label( tr("Calculate") );
	gtk_signal_connect( GTK_OBJECT(button), "clicked",
				GTK_SIGNAL_FUNC(callback_calculateMd5Clicked), (gpointer)NULL );
	gtk_table_attach_defaults( GTK_TABLE(table), label, 0, 1, 4, 5 );
	gtk_table_attach_defaults( GTK_TABLE(table), g_RomPropDialog.md5Entry, 1, 2, 4, 5 );
	gtk_table_attach_defaults( GTK_TABLE(table), button, 2, 3, 4, 5 );

	frame = gtk_frame_new( tr("Comments") );
	gtk_box_pack_start( GTK_BOX(GTK_DIALOG(g_RomPropDialog.dialog)->vbox), frame, TRUE, TRUE, 0 );

	g_RomPropDialog.commentsEntry = gtk_entry_new();
	gtk_entry_set_max_length( GTK_ENTRY(g_RomPropDialog.commentsEntry), 199 );

	gtk_container_add( GTK_CONTAINER(frame), g_RomPropDialog.commentsEntry );

	// ok/cancel button
	button_ok = gtk_button_new_with_label( tr("Ok") );
	gtk_box_pack_start( GTK_BOX(GTK_DIALOG(g_RomPropDialog.dialog)->action_area), button_ok, TRUE, TRUE, 0 );
	gtk_signal_connect( GTK_OBJECT(button_ok), "clicked",
				GTK_SIGNAL_FUNC(callback_okClicked), (gpointer)NULL );

	button_cancel = gtk_button_new_with_label( tr("Cancel") );
	gtk_box_pack_start( GTK_BOX(GTK_DIALOG(g_RomPropDialog.dialog)->action_area), button_cancel, TRUE, TRUE, 0 );
	gtk_signal_connect( GTK_OBJECT(button_cancel), "clicked",
				GTK_SIGNAL_FUNC(callback_cancelClicked), (gpointer)NULL );

	return 0;
}
Example #2
0
File: popup.c Project: bion/ats
/*
 * Popup
 *
 * Display a popup dialog window with a message and an 
 * "Ok" button
 */
void Popup (char *szMessage)
{
    static GtkWidget *label;
    GtkWidget *button;
    GtkWidget *dialog_window;

    /* --- Create a dialog window --- */
    dialog_window = gtk_dialog_new ();
    gtk_window_set_policy(GTK_WINDOW (dialog_window),FALSE,FALSE,FALSE); 
    /* --- Trap the window close signal to release the grab --- */
    gtk_signal_connect (GTK_OBJECT (dialog_window), "destroy",
	                GTK_SIGNAL_FUNC (ClosingDialog),
	                &dialog_window);

    /* --- Add a title to the window --- */
    gtk_window_set_title (GTK_WINDOW (dialog_window), "HEY...!!!");

    /* --- Create a small border --- */
    gtk_container_border_width (GTK_CONTAINER (dialog_window), 5);

    /*
     * --- Create the message
     */

    /* --- Create the message in a label --- */
    label = gtk_label_new (szMessage);

    /* --- Put some room around the label --- */
    gtk_misc_set_padding (GTK_MISC (label), 10, 10);

    /* --- Add the label to the dialog --- */
    gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog_window)->vbox), 
                        label, TRUE, TRUE, 0);

    /* --- Make the label visible --- */
    gtk_widget_show (label);

    /* 
     * --- "ok" button
     */ 

    /* --- Create the "ok" button --- */
    button = gtk_button_new_with_label ("Ok");

    /* --- Need to close the window if they press "ok" --- */
    gtk_signal_connect (GTK_OBJECT (button), "clicked",
	                GTK_SIGNAL_FUNC (CloseDialog),
	                dialog_window);

    /* --- Allow it to be the default button --- */
    GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);

    /* --- Add the button to the dialog --- */
    gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog_window)->action_area), 
			  button, TRUE, TRUE, 0);

    /* --- Make the button the default button --- */
    gtk_widget_grab_default (button);

    /* --- Make the button visible --- */
    gtk_widget_show (button);

    /* --- Make the dialog visible --- */
    gtk_window_set_position(GTK_WINDOW(dialog_window),GTK_WIN_POS_CENTER);
    gtk_widget_show (dialog_window);

    gtk_grab_add (dialog_window);
}
Example #3
0
GtkWidget*
create_ncolors_dbox (void)
{
  GtkWidget *ncolors_dbox;
  GtkWidget *dialog_vbox5;
  GtkWidget *frame16;
  GtkWidget *vbox26;
  GSList *ncolors_grp_group = NULL;
  GtkWidget *radiobutton24;
  GtkWidget *radiobutton25;
  GtkWidget *radiobutton26;
  GtkWidget *radiobutton27;
  GtkWidget *dialog_action_area5;
  GtkWidget *hbuttonbox8;
  GtkWidget *button29;
  GtkWidget *hbox9;
  GtkWidget *pixmap1;
  guint label29_key;
  GtkWidget *label29;
  GtkWidget *button30;
  GtkWidget *hbox8;
  GtkWidget *pixmap2;
  guint label30_key;
  GtkWidget *label30;
  GtkAccelGroup *accel_group;

  accel_group = gtk_accel_group_new ();

  ncolors_dbox = gtk_dialog_new ();
  gtk_widget_set_name (ncolors_dbox, "ncolors_dbox");
  gtk_object_set_data (GTK_OBJECT (ncolors_dbox), "ncolors_dbox", ncolors_dbox);
  gtk_window_set_title (GTK_WINDOW (ncolors_dbox), _("Number of grayscales colors"));
  gtk_window_set_policy (GTK_WINDOW (ncolors_dbox), FALSE, FALSE, FALSE);

  dialog_vbox5 = GTK_DIALOG (ncolors_dbox)->vbox;
  gtk_widget_set_name (dialog_vbox5, "dialog_vbox5");
  gtk_object_set_data (GTK_OBJECT (ncolors_dbox), "dialog_vbox5", dialog_vbox5);
  gtk_widget_show (dialog_vbox5);

  frame16 = gtk_frame_new (_("Number of extra grayscales colors"));
  gtk_widget_set_name (frame16, "frame16");
  gtk_widget_ref (frame16);
  gtk_object_set_data_full (GTK_OBJECT (ncolors_dbox), "frame16", frame16,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (frame16);
  gtk_box_pack_start (GTK_BOX (dialog_vbox5), frame16, TRUE, TRUE, 5);
  gtk_container_set_border_width (GTK_CONTAINER (frame16), 5);

  vbox26 = gtk_vbox_new (FALSE, 0);
  gtk_widget_set_name (vbox26, "vbox26");
  gtk_widget_ref (vbox26);
  gtk_object_set_data_full (GTK_OBJECT (ncolors_dbox), "vbox26", vbox26,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (vbox26);
  gtk_container_add (GTK_CONTAINER (frame16), vbox26);

  radiobutton24 = gtk_radio_button_new_with_label (ncolors_grp_group, _("0 - no grayscales, only 2 colors (B&W)"));
  ncolors_grp_group = gtk_radio_button_group (GTK_RADIO_BUTTON (radiobutton24));
  gtk_widget_set_name (radiobutton24, "radiobutton24");
  gtk_widget_ref (radiobutton24);
  gtk_object_set_data_full (GTK_OBJECT (ncolors_dbox), "radiobutton24", radiobutton24,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (radiobutton24);
  gtk_box_pack_start (GTK_BOX (vbox26), radiobutton24, TRUE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (radiobutton24), 5);
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radiobutton24), TRUE);

  radiobutton25 = gtk_radio_button_new_with_label (ncolors_grp_group, _("2 - two extra colors, 4 colors (graylib4)"));
  ncolors_grp_group = gtk_radio_button_group (GTK_RADIO_BUTTON (radiobutton25));
  gtk_widget_set_name (radiobutton25, "radiobutton25");
  gtk_widget_ref (radiobutton25);
  gtk_object_set_data_full (GTK_OBJECT (ncolors_dbox), "radiobutton25", radiobutton25,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (radiobutton25);
  gtk_box_pack_start (GTK_BOX (vbox26), radiobutton25, TRUE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (radiobutton25), 5);
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radiobutton25), TRUE);

  radiobutton26 = gtk_radio_button_new_with_label (ncolors_grp_group, _("5 - five extra colors, 7 colors (graylib7)"));
  ncolors_grp_group = gtk_radio_button_group (GTK_RADIO_BUTTON (radiobutton26));
  gtk_widget_set_name (radiobutton26, "radiobutton26");
  gtk_widget_ref (radiobutton26);
  gtk_object_set_data_full (GTK_OBJECT (ncolors_dbox), "radiobutton26", radiobutton26,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (radiobutton26);
  gtk_box_pack_start (GTK_BOX (vbox26), radiobutton26, TRUE, FALSE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (radiobutton26), 5);

  radiobutton27 = gtk_radio_button_new_with_label (ncolors_grp_group, _("11 - blurry, graylib4 & graylib7"));
  ncolors_grp_group = gtk_radio_button_group (GTK_RADIO_BUTTON (radiobutton27));
  gtk_widget_set_name (radiobutton27, "radiobutton27");
  gtk_widget_ref (radiobutton27);
  gtk_object_set_data_full (GTK_OBJECT (ncolors_dbox), "radiobutton27", radiobutton27,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (radiobutton27);
  gtk_box_pack_start (GTK_BOX (vbox26), radiobutton27, TRUE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (radiobutton27), 5);

  dialog_action_area5 = GTK_DIALOG (ncolors_dbox)->action_area;
  gtk_widget_set_name (dialog_action_area5, "dialog_action_area5");
  gtk_object_set_data (GTK_OBJECT (ncolors_dbox), "dialog_action_area5", dialog_action_area5);
  gtk_widget_show (dialog_action_area5);
  gtk_container_set_border_width (GTK_CONTAINER (dialog_action_area5), 10);

  hbuttonbox8 = gtk_hbutton_box_new ();
  gtk_widget_set_name (hbuttonbox8, "hbuttonbox8");
  gtk_widget_ref (hbuttonbox8);
  gtk_object_set_data_full (GTK_OBJECT (ncolors_dbox), "hbuttonbox8", hbuttonbox8,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbuttonbox8);
  gtk_box_pack_start (GTK_BOX (dialog_action_area5), hbuttonbox8, TRUE, TRUE, 0);

  button29 = gtk_button_new ();
  gtk_widget_set_name (button29, "button29");
  gtk_widget_ref (button29);
  gtk_object_set_data_full (GTK_OBJECT (ncolors_dbox), "button29", button29,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button29);
  gtk_container_add (GTK_CONTAINER (hbuttonbox8), button29);
  GTK_WIDGET_SET_FLAGS (button29, GTK_CAN_DEFAULT);
  gtk_widget_add_accelerator (button29, "clicked", accel_group,
                              GDK_Return, 0,
                              GTK_ACCEL_VISIBLE);

  hbox9 = gtk_hbox_new (TRUE, 0);
  gtk_widget_set_name (hbox9, "hbox9");
  gtk_widget_ref (hbox9);
  gtk_object_set_data_full (GTK_OBJECT (ncolors_dbox), "hbox9", hbox9,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox9);
  gtk_container_add (GTK_CONTAINER (button29), hbox9);

  pixmap1 = create_pixmap (ncolors_dbox, "yes.xpm");
  gtk_widget_set_name (pixmap1, "pixmap1");
  gtk_widget_ref (pixmap1);
  gtk_object_set_data_full (GTK_OBJECT (ncolors_dbox), "pixmap1", pixmap1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (pixmap1);
  gtk_box_pack_start (GTK_BOX (hbox9), pixmap1, TRUE, FALSE, 0);

  label29 = gtk_label_new ("");
  label29_key = gtk_label_parse_uline (GTK_LABEL (label29),
                                   _("_OK"));
  gtk_widget_set_name (label29, "label29");
  gtk_widget_ref (label29);
  gtk_object_set_data_full (GTK_OBJECT (ncolors_dbox), "label29", label29,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label29);
  gtk_box_pack_start (GTK_BOX (hbox9), label29, FALSE, TRUE, 0);
  gtk_misc_set_alignment (GTK_MISC (label29), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label29), 5, 0);

  button30 = gtk_button_new ();
  gtk_widget_set_name (button30, "button30");
  gtk_widget_ref (button30);
  gtk_object_set_data_full (GTK_OBJECT (ncolors_dbox), "button30", button30,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button30);
  gtk_container_add (GTK_CONTAINER (hbuttonbox8), button30);
  GTK_WIDGET_SET_FLAGS (button30, GTK_CAN_DEFAULT);
  gtk_widget_add_accelerator (button30, "clicked", accel_group,
                              GDK_Escape, 0,
                              GTK_ACCEL_VISIBLE);

  hbox8 = gtk_hbox_new (FALSE, 0);
  gtk_widget_set_name (hbox8, "hbox8");
  gtk_widget_ref (hbox8);
  gtk_object_set_data_full (GTK_OBJECT (ncolors_dbox), "hbox8", hbox8,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox8);
  gtk_container_add (GTK_CONTAINER (button30), hbox8);

  pixmap2 = create_pixmap (ncolors_dbox, "no.xpm");
  gtk_widget_set_name (pixmap2, "pixmap2");
  gtk_widget_ref (pixmap2);
  gtk_object_set_data_full (GTK_OBJECT (ncolors_dbox), "pixmap2", pixmap2,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (pixmap2);
  gtk_box_pack_start (GTK_BOX (hbox8), pixmap2, TRUE, FALSE, 0);

  label30 = gtk_label_new ("");
  label30_key = gtk_label_parse_uline (GTK_LABEL (label30),
                                   _("_Cancel"));
  gtk_widget_set_name (label30, "label30");
  gtk_widget_ref (label30);
  gtk_object_set_data_full (GTK_OBJECT (ncolors_dbox), "label30", label30,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label30);
  gtk_box_pack_start (GTK_BOX (hbox8), label30, FALSE, TRUE, 0);
  gtk_misc_set_alignment (GTK_MISC (label30), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label30), 5, 0);

  gtk_signal_connect (GTK_OBJECT (ncolors_dbox), "destroy",
                      GTK_SIGNAL_FUNC (on_ncolors_dbox_destroy),
                      ncolors_dbox);
  gtk_signal_connect (GTK_OBJECT (radiobutton24), "toggled",
                      GTK_SIGNAL_FUNC (on_radiobutton24_toggled),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (radiobutton25), "toggled",
                      GTK_SIGNAL_FUNC (on_radiobutton25_toggled),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (radiobutton26), "toggled",
                      GTK_SIGNAL_FUNC (on_radiobutton26_toggled),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (radiobutton27), "toggled",
                      GTK_SIGNAL_FUNC (on_radiobutton27_toggled),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (button29), "clicked",
                      GTK_SIGNAL_FUNC (on_button29_clicked),
                      ncolors_dbox);
  gtk_signal_connect (GTK_OBJECT (button30), "clicked",
                      GTK_SIGNAL_FUNC (on_button30_clicked),
                      ncolors_dbox);

  gtk_widget_add_accelerator (button29, "clicked", accel_group,
                              label29_key, GDK_MOD1_MASK, 0);
  gtk_widget_add_accelerator (button30, "clicked", accel_group,
                              label30_key, GDK_MOD1_MASK, 0);

  gtk_window_add_accel_group (GTK_WINDOW (ncolors_dbox), accel_group);

  return ncolors_dbox;
}
Example #4
0
void vmat_v_row(GtkTreeView *treeview,GtkTreePath *arg1,GtkTreeViewColumn *arg2,
class vmat_data *data)
{
printf("vmat_v_row\n");
gtk_signal_emit_by_name(GTK_OBJECT(data->knopka[FK2]),"clicked");
}
Example #5
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;
  c->activeToggleButton = NULL;
  c->current_pick = NONE;
  c->last_picked_color = -1;
  for (int i=0; i<3; i++)
    for (int j=0; j<2; j++) c->pick_xy_positions[i][j] = -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_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);
  g_signal_connect (G_OBJECT (c->area), "scroll-event",
                    G_CALLBACK (dt_iop_levels_scroll), self);

  GtkWidget *autobutton = dtgtk_button_new_with_label(_("auto"), NULL, CPF_STYLE_FLAT|CPF_DO_NOT_USE_BORDER);
  g_object_set(G_OBJECT(autobutton), "tooltip-text", _("apply auto levels"), (char *)NULL);
  gtk_widget_set_size_request(autobutton, 70, 24);

  GtkWidget *blackpick = dtgtk_togglebutton_new(dtgtk_cairo_paint_colorpicker, CPF_STYLE_FLAT);
  g_object_set(G_OBJECT(blackpick), "tooltip-text", _("pick blackpoint from image"), (char *)NULL);
  gtk_widget_set_size_request(blackpick, 24, 24);

  GtkWidget *greypick = dtgtk_togglebutton_new(dtgtk_cairo_paint_colorpicker, CPF_STYLE_FLAT);
  g_object_set(G_OBJECT(greypick), "tooltip-text", _("pick medium greypoint from image"), (char *)NULL);
  gtk_widget_set_size_request(greypick, 24, 24);

  GtkWidget *whitepick = dtgtk_togglebutton_new(dtgtk_cairo_paint_colorpicker, CPF_STYLE_FLAT);
  g_object_set(G_OBJECT(whitepick), "tooltip-text", _("pick whitepoint from image"), (char *)NULL);
  gtk_widget_set_size_request(whitepick, 24, 24);

  GdkColor col;
  col.red = col.green = col.blue = 0;
  gtk_widget_modify_fg(GTK_WIDGET(blackpick), GTK_STATE_NORMAL, &col);
  gtk_widget_modify_fg(GTK_WIDGET(blackpick), GTK_STATE_SELECTED, &col);
  col.red = col.green = col.blue = 32767;
  gtk_widget_modify_fg(GTK_WIDGET(greypick), GTK_STATE_NORMAL, &col);
  gtk_widget_modify_fg(GTK_WIDGET(greypick), GTK_STATE_SELECTED, &col);
  col.red = col.green = col.blue = 65535;
  gtk_widget_modify_fg(GTK_WIDGET(whitepick), GTK_STATE_NORMAL, &col);
  gtk_widget_modify_fg(GTK_WIDGET(whitepick), GTK_STATE_SELECTED, &col);
  col.red = col.green = col.blue = 4096;
  gtk_widget_modify_bg(GTK_WIDGET(blackpick), GTK_STATE_ACTIVE, &col);
  gtk_widget_modify_bg(GTK_WIDGET(greypick), GTK_STATE_ACTIVE, &col);
  gtk_widget_modify_bg(GTK_WIDGET(whitepick), GTK_STATE_ACTIVE, &col);

  GtkWidget *box = gtk_hbox_new(TRUE,0);
  gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(autobutton), FALSE, FALSE, 0);
  gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(blackpick), FALSE, FALSE, 0);
  gtk_box_pack_start(GTK_BOX(box), GTK_WIDGET(greypick), FALSE, FALSE, 0);
  gtk_box_pack_end(GTK_BOX(box), GTK_WIDGET(whitepick), FALSE, FALSE, 0);

  gtk_box_pack_start(GTK_BOX(self->widget), box, TRUE, TRUE, 0);

  g_signal_connect (G_OBJECT(autobutton), "clicked",
		    G_CALLBACK(dt_iop_levels_autoadjust_callback), (gpointer)self);
  g_signal_connect (G_OBJECT(blackpick), "toggled",
                    G_CALLBACK (dt_iop_levels_pick_black_callback), self);
  g_signal_connect (G_OBJECT(greypick), "toggled",
                    G_CALLBACK (dt_iop_levels_pick_grey_callback), self);
  g_signal_connect (G_OBJECT(whitepick), "toggled",
                    G_CALLBACK (dt_iop_levels_pick_white_callback), self);
}
Example #6
0
static gint glspi_choose(lua_State* L)
{
	const gchar *arg1=NULL;
	gint i, n;
	GtkResponseType rv;
	GtkWidget*dialog, *ok_btn, *cancel_btn, *tree, *scroll;
	GtkListStore *store;
	GtkTreeIter iter;
	GtkTreeSelection *select;

	if ( (lua_gettop(L)!=2) || (!lua_istable(L,2)) ) {
		return FAIL_TABLE_ARG(2);
	}

	if (!lua_isnil(L, 1)) {
		if (!lua_isstring(L, 1))	{ return FAIL_STRING_ARG(1); }
			arg1=lua_tostring(L, 1);
	}

	n=lua_objlen(L,2);
	for (i=1;i<=n; i++) {
		lua_rawgeti(L,2,i);
		if (!lua_isstring(L, -1)) {
			return glspi_fail_elem_type(L, __FUNCTION__, 2, i, "string");
		}
		lua_pop(L, 1);
	}
	store=gtk_list_store_new(1, G_TYPE_STRING);
	for (i=1;i<=n; i++) {
		lua_rawgeti(L,2,i);
		gtk_list_store_append(store, &iter);
		gtk_list_store_set(store, &iter, 0, lua_tostring(L, -1), -1);
		lua_pop(L, 1);
	}
	dialog = new_dlg(GTK_MESSAGE_OTHER, GTK_BUTTONS_NONE, arg1, NULL);
	ok_btn=gtk_dialog_add_button(GTK_DIALOG(dialog),
			GTK_STOCK_OK, GTK_RESPONSE_OK);
	cancel_btn=gtk_dialog_add_button(GTK_DIALOG(dialog),
			GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
	gtk_widget_grab_default(ok_btn);
	set_dialog_title(L,dialog);

	tree = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store));
	gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(tree), TRUE);
	gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(tree), FALSE);
	gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(tree),
				-1, NULL, gtk_cell_renderer_text_new(), "text", 0, NULL);

	select = gtk_tree_view_get_selection (GTK_TREE_VIEW (tree));
	gtk_tree_selection_set_mode(select, GTK_SELECTION_SINGLE);

	scroll=gtk_scrolled_window_new(NULL, NULL);
	gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scroll),
		GTK_POLICY_AUTOMATIC,  GTK_POLICY_AUTOMATIC);
	gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox),scroll);
	gtk_container_add(GTK_CONTAINER(scroll),tree);

	gtk_widget_set_size_request(tree, 320, 240);
	gtk_widget_show_all(dialog);
	gtk_window_set_resizable(GTK_WINDOW(dialog), TRUE);

	gtk_signal_connect(GTK_OBJECT(tree), "button-press-event",
		GTK_SIGNAL_FUNC(on_tree_clicked), dialog);
	gtk_signal_connect(GTK_OBJECT(tree), "key-release-event",
		GTK_SIGNAL_FUNC(on_tree_key_release), dialog);

	rv=glspi_dialog_run(GTK_DIALOG(dialog));

	if (GTK_RESPONSE_OK == rv ) {
		gchar *txt=NULL;
		GtkTreeModel *model;
		if (gtk_tree_selection_get_selected(select, &model, &iter)) {
			gtk_tree_model_get(model, &iter, 0, &txt, -1);
		}
		if (txt) {
			lua_pushstring(L, txt);
			g_free(txt);
		} else {
			lua_pushnil(L);
		}
	} else {
		lua_pushnil(L);
	}
	gtk_widget_destroy(dialog);
	return 1;
}
Example #7
0
bool wxButton::Create(  wxWindow *parent, wxWindowID id, const wxString &label,
      const wxPoint &pos, const wxSize &size,
      long style, const wxValidator& validator, const wxString &name )
{
    m_needParent = TRUE;
    m_acceptsFocus = TRUE;

    if (!PreCreation( parent, pos, size ) ||
        !CreateBase( parent, id, pos, size, style, validator, name ))
    {
        wxFAIL_MSG( wxT("wxButton creation failed") );
        return FALSE;
    }

/*
    wxString label2( label );
    for (size_t i = 0; i < label2.Len(); i++)
    {
        if (label2.GetChar(i) == wxT('&'))
        label2.SetChar(i,wxT('_'));
    }

    GtkWidget *accel_label = gtk_accel_label_new( label2.mb_str() );
    gtk_widget_show( accel_label );

    m_widget = gtk_button_new();
    gtk_container_add( GTK_CONTAINER(m_widget), accel_label );

    gtk_accel_label_set_accel_widget( GTK_ACCEL_LABEL(accel_label), m_widget );

    guint accel_key = gtk_label_parse_uline (GTK_LABEL(accel_label), label2.mb_str() );
    gtk_accel_label_refetch( GTK_ACCEL_LABEL(accel_label) );

    wxControl::SetLabel( label );
*/

#ifdef __WXGTK20__
    m_widget = gtk_button_new_with_mnemonic("");
#else
    m_widget = gtk_button_new_with_label("");
#endif

    float x_alignment = 0.5;
    if (HasFlag(wxBU_LEFT))
        x_alignment = 0.0;
    else if (HasFlag(wxBU_RIGHT))
        x_alignment = 1.0;

    float y_alignment = 0.5;
    if (HasFlag(wxBU_TOP))
        y_alignment = 0.0;
    else if (HasFlag(wxBU_BOTTOM))
        y_alignment = 1.0;

#if __WXGTK24__
    if (!gtk_check_version(2,4,0))
    {
        gtk_button_set_alignment(GTK_BUTTON(m_widget), x_alignment, y_alignment);
    }
    else
#endif
    {
        if (GTK_IS_MISC(BUTTON_CHILD(m_widget)))
            gtk_misc_set_alignment (GTK_MISC (BUTTON_CHILD (m_widget)),
                                x_alignment, y_alignment);
    }

    SetLabel(label);

    if (style & wxNO_BORDER)
       gtk_button_set_relief( GTK_BUTTON(m_widget), GTK_RELIEF_NONE );

    gtk_signal_connect_after( GTK_OBJECT(m_widget), "clicked",
      GTK_SIGNAL_FUNC(gtk_button_clicked_callback), (gpointer*)this );

    gtk_signal_connect_after( GTK_OBJECT(m_widget), "style_set",
      GTK_SIGNAL_FUNC(gtk_button_style_set_callback), (gpointer*) this );
      
    m_parent->DoAddChild( this );

    PostCreation(size);

    return true;
}
Example #8
0
GtkWidget*
create_dbgopt_dbox (void)
{
  GtkWidget *dbgopt_dbox;
  GtkWidget *dialog_vbox1;
  GtkWidget *vbox1;
  GtkWidget *frame2;
  GtkWidget *hbox3;
  GtkWidget *label3;
  GtkObject *spinbutton1_adj;
  GtkWidget *spinbutton1;
  GtkWidget *label4;
  GtkWidget *frame3;
  GtkWidget *hbox4;
  GtkWidget *label5;
  GtkObject *spinbutton2_adj;
  GtkWidget *spinbutton2;
  GtkWidget *label6;
  GtkWidget *frame4;
  GtkWidget *hbox5;
  GtkWidget *label7;
  GtkObject *spinbutton3_adj;
  GtkWidget *spinbutton3;
  GtkWidget *label8;
  GtkWidget *dialog_action_area1;
  GtkWidget *hbuttonbox1;
  GtkWidget *ok_button;
  GtkWidget *hbox2;
  GtkWidget *pixmap2;
  guint label2_key;
  GtkWidget *label2;
  GtkWidget *cancel_button;
  GtkWidget *hbox1;
  GtkWidget *pixmap1;
  guint label1_key;
  GtkWidget *label1;
  GtkAccelGroup *accel_group;

  accel_group = gtk_accel_group_new ();

  dbgopt_dbox = gtk_dialog_new ();
  gtk_object_set_data (GTK_OBJECT (dbgopt_dbox), "dbgopt_dbox", dbgopt_dbox);
  gtk_window_set_title (GTK_WINDOW (dbgopt_dbox), _("Advanced settings"));
  gtk_window_set_position (GTK_WINDOW (dbgopt_dbox), GTK_WIN_POS_CENTER);
  gtk_window_set_policy (GTK_WINDOW (dbgopt_dbox), TRUE, FALSE, TRUE);

  dialog_vbox1 = GTK_DIALOG (dbgopt_dbox)->vbox;
  gtk_object_set_data (GTK_OBJECT (dbgopt_dbox), "dialog_vbox1", dialog_vbox1);
  gtk_widget_show (dialog_vbox1);

  vbox1 = gtk_vbox_new (TRUE, 0);
  gtk_widget_ref (vbox1);
  gtk_object_set_data_full (GTK_OBJECT (dbgopt_dbox), "vbox1", vbox1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (vbox1);
  gtk_box_pack_start (GTK_BOX (dialog_vbox1), vbox1, TRUE, TRUE, 0);

  frame2 = gtk_frame_new (_("Dissasembly window"));
  gtk_widget_ref (frame2);
  gtk_object_set_data_full (GTK_OBJECT (dbgopt_dbox), "frame2", frame2,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (frame2);
  gtk_box_pack_start (GTK_BOX (vbox1), frame2, TRUE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (frame2), 5);

  hbox3 = gtk_hbox_new (TRUE, 0);
  gtk_widget_ref (hbox3);
  gtk_object_set_data_full (GTK_OBJECT (dbgopt_dbox), "hbox3", hbox3,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox3);
  gtk_container_add (GTK_CONTAINER (frame2), hbox3);
  gtk_container_set_border_width (GTK_CONTAINER (hbox3), 5);

  label3 = gtk_label_new (_("Size:"));
  gtk_widget_ref (label3);
  gtk_object_set_data_full (GTK_OBJECT (dbgopt_dbox), "label3", label3,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label3);
  gtk_box_pack_start (GTK_BOX (hbox3), label3, FALSE, FALSE, 0);
  gtk_misc_set_alignment (GTK_MISC (label3), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label3), 5, 0);

  spinbutton1_adj = gtk_adjustment_new (20, 1, 100, 1, 10, 10);
  spinbutton1 = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton1_adj), 1, 0);
  gtk_widget_ref (spinbutton1);
  gtk_object_set_data_full (GTK_OBJECT (dbgopt_dbox), "spinbutton1", spinbutton1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (spinbutton1);
  gtk_box_pack_start (GTK_BOX (hbox3), spinbutton1, FALSE, TRUE, 0);

  label4 = gtk_label_new (_("lines"));
  gtk_widget_ref (label4);
  gtk_object_set_data_full (GTK_OBJECT (dbgopt_dbox), "label4", label4,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label4);
  gtk_box_pack_start (GTK_BOX (hbox3), label4, FALSE, FALSE, 0);
  gtk_misc_set_alignment (GTK_MISC (label4), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label4), 5, 0);

  frame3 = gtk_frame_new (_("Memory window"));
  gtk_widget_ref (frame3);
  gtk_object_set_data_full (GTK_OBJECT (dbgopt_dbox), "frame3", frame3,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (frame3);
  gtk_box_pack_start (GTK_BOX (vbox1), frame3, TRUE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (frame3), 5);

  hbox4 = gtk_hbox_new (TRUE, 0);
  gtk_widget_ref (hbox4);
  gtk_object_set_data_full (GTK_OBJECT (dbgopt_dbox), "hbox4", hbox4,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox4);
  gtk_container_add (GTK_CONTAINER (frame3), hbox4);
  gtk_container_set_border_width (GTK_CONTAINER (hbox4), 5);

  label5 = gtk_label_new (_("Size:"));
  gtk_widget_ref (label5);
  gtk_object_set_data_full (GTK_OBJECT (dbgopt_dbox), "label5", label5,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label5);
  gtk_box_pack_start (GTK_BOX (hbox4), label5, FALSE, FALSE, 0);
  gtk_misc_set_alignment (GTK_MISC (label5), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label5), 5, 0);

  spinbutton2_adj = gtk_adjustment_new (20, 1, 100, 1, 10, 10);
  spinbutton2 = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton2_adj), 1, 0);
  gtk_widget_ref (spinbutton2);
  gtk_object_set_data_full (GTK_OBJECT (dbgopt_dbox), "spinbutton2", spinbutton2,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (spinbutton2);
  gtk_box_pack_start (GTK_BOX (hbox4), spinbutton2, FALSE, TRUE, 0);

  label6 = gtk_label_new (_("lines"));
  gtk_widget_ref (label6);
  gtk_object_set_data_full (GTK_OBJECT (dbgopt_dbox), "label6", label6,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label6);
  gtk_box_pack_start (GTK_BOX (hbox4), label6, FALSE, FALSE, 0);
  gtk_misc_set_alignment (GTK_MISC (label6), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label6), 5, 0);

  frame4 = gtk_frame_new (_("Stack window"));
  gtk_widget_ref (frame4);
  gtk_object_set_data_full (GTK_OBJECT (dbgopt_dbox), "frame4", frame4,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (frame4);
  gtk_box_pack_start (GTK_BOX (vbox1), frame4, TRUE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (frame4), 5);

  hbox5 = gtk_hbox_new (TRUE, 0);
  gtk_widget_ref (hbox5);
  gtk_object_set_data_full (GTK_OBJECT (dbgopt_dbox), "hbox5", hbox5,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox5);
  gtk_container_add (GTK_CONTAINER (frame4), hbox5);
  gtk_container_set_border_width (GTK_CONTAINER (hbox5), 5);

  label7 = gtk_label_new (_("Size:"));
  gtk_widget_ref (label7);
  gtk_object_set_data_full (GTK_OBJECT (dbgopt_dbox), "label7", label7,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label7);
  gtk_box_pack_start (GTK_BOX (hbox5), label7, FALSE, FALSE, 0);
  gtk_misc_set_alignment (GTK_MISC (label7), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label7), 5, 0);

  spinbutton3_adj = gtk_adjustment_new (10, 1, 50, 1, 10, 10);
  spinbutton3 = gtk_spin_button_new (GTK_ADJUSTMENT (spinbutton3_adj), 1, 0);
  gtk_widget_ref (spinbutton3);
  gtk_object_set_data_full (GTK_OBJECT (dbgopt_dbox), "spinbutton3", spinbutton3,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (spinbutton3);
  gtk_box_pack_start (GTK_BOX (hbox5), spinbutton3, FALSE, TRUE, 0);

  label8 = gtk_label_new (_("lines"));
  gtk_widget_ref (label8);
  gtk_object_set_data_full (GTK_OBJECT (dbgopt_dbox), "label8", label8,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label8);
  gtk_box_pack_start (GTK_BOX (hbox5), label8, FALSE, FALSE, 0);
  gtk_misc_set_alignment (GTK_MISC (label8), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label8), 5, 0);

  dialog_action_area1 = GTK_DIALOG (dbgopt_dbox)->action_area;
  gtk_object_set_data (GTK_OBJECT (dbgopt_dbox), "dialog_action_area1", dialog_action_area1);
  gtk_widget_show (dialog_action_area1);
  gtk_container_set_border_width (GTK_CONTAINER (dialog_action_area1), 10);

  hbuttonbox1 = gtk_hbutton_box_new ();
  gtk_widget_ref (hbuttonbox1);
  gtk_object_set_data_full (GTK_OBJECT (dbgopt_dbox), "hbuttonbox1", hbuttonbox1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbuttonbox1);
  gtk_box_pack_start (GTK_BOX (dialog_action_area1), hbuttonbox1, TRUE, TRUE, 0);

  ok_button = gtk_button_new ();
  gtk_widget_ref (ok_button);
  gtk_object_set_data_full (GTK_OBJECT (dbgopt_dbox), "ok_button", ok_button,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (ok_button);
  gtk_container_add (GTK_CONTAINER (hbuttonbox1), ok_button);
  GTK_WIDGET_SET_FLAGS (ok_button, GTK_CAN_DEFAULT);
  gtk_widget_add_accelerator (ok_button, "clicked", accel_group,
                              GDK_Return, 0,
                              GTK_ACCEL_VISIBLE);

  hbox2 = gtk_hbox_new (FALSE, 0);
  gtk_widget_ref (hbox2);
  gtk_object_set_data_full (GTK_OBJECT (dbgopt_dbox), "hbox2", hbox2,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox2);
  gtk_container_add (GTK_CONTAINER (ok_button), hbox2);

  pixmap2 = create_pixmap (dbgopt_dbox, "yes.xpm");
  gtk_widget_ref (pixmap2);
  gtk_object_set_data_full (GTK_OBJECT (dbgopt_dbox), "pixmap2", pixmap2,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (pixmap2);
  gtk_box_pack_start (GTK_BOX (hbox2), pixmap2, TRUE, TRUE, 0);

  label2 = gtk_label_new ("");
  label2_key = gtk_label_parse_uline (GTK_LABEL (label2),
                                   _("_OK"));
  gtk_widget_ref (label2);
  gtk_object_set_data_full (GTK_OBJECT (dbgopt_dbox), "label2", label2,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label2);
  gtk_box_pack_start (GTK_BOX (hbox2), label2, TRUE, TRUE, 0);
  gtk_misc_set_alignment (GTK_MISC (label2), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label2), 5, 0);

  cancel_button = gtk_button_new ();
  gtk_widget_ref (cancel_button);
  gtk_object_set_data_full (GTK_OBJECT (dbgopt_dbox), "cancel_button", cancel_button,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (cancel_button);
  gtk_container_add (GTK_CONTAINER (hbuttonbox1), cancel_button);
  GTK_WIDGET_SET_FLAGS (cancel_button, GTK_CAN_DEFAULT);
  gtk_widget_add_accelerator (cancel_button, "clicked", accel_group,
                              GDK_Escape, 0,
                              GTK_ACCEL_VISIBLE);

  hbox1 = gtk_hbox_new (FALSE, 0);
  gtk_widget_ref (hbox1);
  gtk_object_set_data_full (GTK_OBJECT (dbgopt_dbox), "hbox1", hbox1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox1);
  gtk_container_add (GTK_CONTAINER (cancel_button), hbox1);

  pixmap1 = create_pixmap (dbgopt_dbox, "no.xpm");
  gtk_widget_ref (pixmap1);
  gtk_object_set_data_full (GTK_OBJECT (dbgopt_dbox), "pixmap1", pixmap1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (pixmap1);
  gtk_box_pack_start (GTK_BOX (hbox1), pixmap1, TRUE, TRUE, 0);

  label1 = gtk_label_new ("");
  label1_key = gtk_label_parse_uline (GTK_LABEL (label1),
                                   _("_Cancel"));
  gtk_widget_ref (label1);
  gtk_object_set_data_full (GTK_OBJECT (dbgopt_dbox), "label1", label1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label1);
  gtk_box_pack_start (GTK_BOX (hbox1), label1, TRUE, TRUE, 0);
  gtk_misc_set_alignment (GTK_MISC (label1), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label1), 5, 0);

  gtk_signal_connect (GTK_OBJECT (dbgopt_dbox), "destroy",
                      GTK_SIGNAL_FUNC (on_dbgopt_dbox_destroy),
                      dbgopt_dbox);
  gtk_signal_connect (GTK_OBJECT (spinbutton1), "changed",
                      GTK_SIGNAL_FUNC (on_dbgopt_spinbutton1_changed),
                      spinbutton1);
  gtk_signal_connect (GTK_OBJECT (spinbutton2), "changed",
                      GTK_SIGNAL_FUNC (on_dbgopt_spinbutton2_changed),
                      spinbutton2);
  gtk_signal_connect (GTK_OBJECT (spinbutton3), "changed",
                      GTK_SIGNAL_FUNC (on_dbgopt_spinbutton3_changed),
                      spinbutton3);
  gtk_signal_connect (GTK_OBJECT (ok_button), "clicked",
                      GTK_SIGNAL_FUNC (on_dbgopt_ok_button_clicked),
                      dbgopt_dbox);
  gtk_signal_connect (GTK_OBJECT (cancel_button), "clicked",
                      GTK_SIGNAL_FUNC (on_dbgopt_cancel_button_clicked),
                      dbgopt_dbox);

  gtk_widget_add_accelerator (ok_button, "clicked", accel_group,
                              label2_key, GDK_MOD1_MASK, 0);
  gtk_widget_add_accelerator (cancel_button, "clicked", accel_group,
                              label1_key, GDK_MOD1_MASK, 0);

  gtk_window_add_accel_group (GTK_WINDOW (dbgopt_dbox), accel_group);

  return dbgopt_dbox;
}
Example #9
0
/*
 * Create dialog window for configuration.
 */
static void configure (void)
{
  GtkWidget *vbox, *bbox, *ok, *cancel, *apply, *hbox, *label,
    *button, *unit_label, *hbox2, *vbox2, *sep;


  GSList *group = NULL;

  DEBUG("configure");
  if (configure_win)
    return;

  read_config ();

  configure_win = gtk_window_new (GTK_WINDOW_DIALOG);

  gtk_signal_connect (GTK_OBJECT (configure_win), "destroy",
		      GTK_SIGNAL_FUNC (gtk_widget_destroyed), &configure_win);

  gtk_window_set_title (GTK_WINDOW (configure_win),
			"On Screen Display Configuration - " XOSD_VERSION);

  vbox = gtk_vbox_new (FALSE, 10);
  gtk_container_add (GTK_CONTAINER (configure_win), vbox);
  gtk_container_set_border_width (GTK_CONTAINER (configure_win), 5);

  hbox = gtk_hbox_new (FALSE, 5);
  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
  label = gtk_label_new ("Font:");
  gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
  font_entry = gtk_entry_new ();
  if (font)
    gtk_entry_set_text (GTK_ENTRY (font_entry), font);
  gtk_box_pack_start (GTK_BOX (hbox), font_entry, TRUE, TRUE, 0);
  button = gtk_button_new_with_label ("Set");
  gtk_signal_connect (GTK_OBJECT (button), "clicked",
		      GTK_SIGNAL_FUNC (font_dialog_window), NULL);
  gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);


  hbox = gtk_hbox_new (FALSE, 5);
  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
  label = gtk_label_new ("Colour:");
  gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
  colour_entry = gtk_entry_new ();
  if (colour)
    gtk_entry_set_text (GTK_ENTRY (colour_entry), colour);
  gtk_box_pack_start (GTK_BOX (hbox), colour_entry, TRUE, TRUE, 0);
  button = gtk_button_new_with_label ("Set");
  gtk_signal_connect (GTK_OBJECT (button), "clicked",
		      GTK_SIGNAL_FUNC (colour_dialog_window), NULL);
  gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);


  hbox = gtk_hbox_new (FALSE, 5);
  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
  label = gtk_label_new ("Timeout:");
  gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
  timeout_obj = gtk_adjustment_new (timeout, -1, 60, 1, 1, 1);
  timeout_spin = gtk_spin_button_new (GTK_ADJUSTMENT (timeout_obj), 1.0, 0);
  if (timeout)
    gtk_spin_button_set_value (GTK_SPIN_BUTTON (timeout_spin),
			       (gfloat) timeout);
  gtk_box_pack_start (GTK_BOX (hbox), timeout_spin, FALSE, FALSE, 0);
  unit_label = gtk_label_new ("seconds");
  gtk_box_pack_start (GTK_BOX (hbox), unit_label, FALSE, FALSE, 0);


  hbox = gtk_hbox_new (FALSE, 5);
  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
  label = gtk_label_new ("Vertical Offset:");
  gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
  offset_obj = gtk_adjustment_new (timeout, 0, 60, 1, 1, 1);
  offset_spin = gtk_spin_button_new (GTK_ADJUSTMENT (offset_obj), 1.0, 0);
  if (offset)
    gtk_spin_button_set_value (GTK_SPIN_BUTTON (offset_spin),
			       (gfloat) offset);
  gtk_box_pack_start (GTK_BOX (hbox), offset_spin, FALSE, FALSE, 0);
  unit_label = gtk_label_new ("pixels");
  gtk_box_pack_start (GTK_BOX (hbox), unit_label, FALSE, FALSE, 0);

  hbox = gtk_hbox_new (FALSE, 5);
  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
  label = gtk_label_new ("Shadow Offset:");
  gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);

  shadow_obj = gtk_adjustment_new (timeout, 0, 60, 1, 1, 1);
  shadow_spin = gtk_spin_button_new (GTK_ADJUSTMENT (shadow_obj), 1.0, 0);
  gtk_spin_button_set_value (GTK_SPIN_BUTTON (shadow_spin),
			     (gfloat) shadow_offset);
  gtk_box_pack_start (GTK_BOX (hbox), shadow_spin, FALSE, FALSE, 0);
  unit_label = gtk_label_new ("pixels");
  gtk_box_pack_start (GTK_BOX (hbox), unit_label, FALSE, FALSE, 0);


  hbox = gtk_hbox_new (FALSE, 5);
  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
  label = gtk_label_new ("Position:");
  gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
  pos_top = gtk_radio_button_new_with_label (NULL, "Top");
  group = gtk_radio_button_group (GTK_RADIO_BUTTON (pos_top));
  pos_bottom = gtk_radio_button_new_with_label (group, "Bottom");
  gtk_box_pack_start (GTK_BOX (hbox), pos_top, FALSE, FALSE, 0);
  gtk_box_pack_start (GTK_BOX (hbox), pos_bottom, FALSE, FALSE, 0);

  if (pos == XOSD_top)
    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pos_top), TRUE);
  else
    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (pos_bottom), TRUE);


  /*
  hbox = gtk_hbox_new (FALSE, 5);

  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
  label = gtk_label_new ("Volume :");
  gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
  vol_on = gtk_radio_button_new_with_label (NULL, "Yes");
  group = gtk_radio_button_group (GTK_RADIO_BUTTON (vol_on));
  vol_off = gtk_radio_button_new_with_label (group, "No");
  gtk_box_pack_start (GTK_BOX (hbox), vol_on, FALSE, FALSE, 0);
  gtk_box_pack_start (GTK_BOX (hbox), vol_off, FALSE, FALSE, 0);

  if (show_volume == 1)
    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (vol_on), TRUE);
  else
    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (vol_off), TRUE);
  */

  sep=gtk_hseparator_new();
  gtk_box_pack_start (GTK_BOX (vbox), sep, FALSE, FALSE, 0);

  hbox2 = gtk_hbox_new (FALSE, 2);
  gtk_box_pack_start (GTK_BOX (vbox), hbox2, FALSE, FALSE, 0);
  label=gtk_label_new("Show:");
  gtk_box_pack_start (GTK_BOX (hbox2), label, FALSE, FALSE, 0);

  hbox2 = gtk_hbox_new (FALSE, 2);
  gtk_box_pack_start (GTK_BOX (vbox), hbox2, FALSE, FALSE, 0);

  vbox2 = gtk_vbox_new (FALSE, 4);
  gtk_box_pack_start (GTK_BOX (hbox2), vbox2, FALSE, FALSE, 0);

  show_item(vbox2, "Volume", show_volume, &vol_on);
  show_item(vbox2, "Balance", show_balance, &bal_on);
  show_item(vbox2, "Pause", show_pause, &pause_on);
  show_item(vbox2, "Track Name", show_trackname, &trackname_on);
  vbox2 = gtk_vbox_new (FALSE, 5);
  gtk_box_pack_start (GTK_BOX (hbox2), vbox2, FALSE, FALSE, 0);
  show_item(vbox2, "Stop", show_stop, &stop_on);
  show_item(vbox2, "Repeat", show_repeat, &repeat_on);
  show_item(vbox2, "Shuffle", show_shuffle, &shuffle_on);

  sep=gtk_hseparator_new();
  gtk_box_pack_start (GTK_BOX (vbox), sep, FALSE, FALSE, 0);

  bbox = gtk_hbutton_box_new ();
  gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_END);
  gtk_button_box_set_spacing (GTK_BUTTON_BOX (bbox), 5);
  gtk_box_pack_start (GTK_BOX (vbox), bbox, FALSE, FALSE, 0);

  ok = gtk_button_new_with_label ("Ok");
  gtk_signal_connect (GTK_OBJECT (ok), "clicked",
		      GTK_SIGNAL_FUNC (configure_ok_cb), NULL);
  GTK_WIDGET_SET_FLAGS (ok, GTK_CAN_DEFAULT);
  gtk_box_pack_start (GTK_BOX (bbox), ok, TRUE, TRUE, 0);
  gtk_widget_grab_default (ok);

  apply = gtk_button_new_with_label ("Apply");
  gtk_signal_connect (GTK_OBJECT (apply), "clicked",
		      GTK_SIGNAL_FUNC (configure_apply_cb), NULL);
  GTK_WIDGET_SET_FLAGS (apply, GTK_CAN_DEFAULT);
  gtk_box_pack_start (GTK_BOX (bbox), apply, TRUE, TRUE, 0);

  cancel = gtk_button_new_with_label ("Cancel");
  gtk_signal_connect_object (GTK_OBJECT (cancel), "clicked",
			     GTK_SIGNAL_FUNC (gtk_widget_destroy),
			     GTK_OBJECT (configure_win));
  GTK_WIDGET_SET_FLAGS (cancel, GTK_CAN_DEFAULT);
  gtk_box_pack_start (GTK_BOX (bbox), cancel, TRUE, TRUE, 0);


  gtk_widget_show_all (configure_win);
}
Example #10
0
static void main_window_fill_panes(void)
{
	GtkWidget *box;
	GtkWidget *box2;
	GtkWidget *chkOnlyCurFileFuncs;
	GtkCellRenderer *renderer;
	GtkTreeViewColumn *column;

	//Commented out as panes aren't used yet AJ 2003-01-21 TODO: replace old style code with new main_window.* code
	/*notebook_manager = gtk_notebook_new ();
	gtk_widget_show (notebook_manager);
	gtk_paned_pack1 (GTK_PANED (hpaned1), notebook_manager, FALSE, TRUE);
	gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook_manager), GTK_POS_BOTTOM);
	gtk_widget_set_usize(notebook_manager,200,400);*/

	box = gtk_vbox_new(FALSE, 0);
	gtk_widget_show(box);
	gtk_paned_pack1 (GTK_PANED (main_window.main_horizontal_pane), box, FALSE, TRUE);
	
	//add checkbox to show only current file's classes
	//the signals to be checked for the check box are onclick of the checkbox 
	//and the on change of the file.
	//Close button for the side bar
	GtkWidget *hbox;
	hbox = gtk_hbox_new(FALSE, 0);
	gtk_container_set_border_width(GTK_CONTAINER(hbox), 0);
	main_window.close_image = gtk_image_new_from_stock(GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU);
	gtk_misc_set_padding(GTK_MISC(main_window.close_image), 0, 0);
	main_window.close_sidebar_button = gtk_button_new();
	gtk_widget_set_tooltip_text(main_window.close_sidebar_button, _("Close class Browser"));
	gtk_button_set_image(GTK_BUTTON(main_window.close_sidebar_button), main_window.close_image);
	gtk_button_set_relief(GTK_BUTTON(main_window.close_sidebar_button), GTK_RELIEF_NONE);
	gtk_button_set_focus_on_click(GTK_BUTTON(main_window.close_sidebar_button), FALSE);
	gtk_signal_connect(GTK_OBJECT(main_window.close_sidebar_button), "clicked", G_CALLBACK (classbrowser_show_hide),NULL);
	gtk_widget_show(main_window.close_image);
	gtk_widget_show(main_window.close_sidebar_button);
	//
	main_window.chkOnlyCurFileFuncs = gtk_check_button_new_with_label(_("Parse only current file")); 
	gtk_widget_show (main_window.chkOnlyCurFileFuncs);
	gtk_box_pack_start(GTK_BOX(hbox), main_window.chkOnlyCurFileFuncs, FALSE, FALSE, 10);
//	gtk_box_pack_start(GTK_BOX(box), main_window.chkOnlyCurFileFuncs, FALSE, FALSE, 10);
	gtk_box_pack_start(GTK_BOX(hbox), main_window.close_sidebar_button, FALSE, FALSE, 0);
	gtk_widget_show(hbox);	
	gtk_box_pack_start(GTK_BOX(box), hbox, FALSE, FALSE, 10);
	g_signal_connect (G_OBJECT (main_window.chkOnlyCurFileFuncs), "clicked",
						G_CALLBACK (on_parse_current_click), NULL);

	main_window.scrolledwindow3 = gtk_scrolled_window_new (NULL, NULL);
	gtk_widget_show (main_window.scrolledwindow3);
	gtk_box_pack_start(GTK_BOX(box), main_window.scrolledwindow3, TRUE, TRUE, 0);
	gtk_paned_pack1 (GTK_PANED (main_window.main_horizontal_pane), main_window.scrolledwindow3, FALSE, TRUE);

	box2 = gtk_hbox_new(FALSE, 0);
	gtk_widget_show(box2);
	main_window.treeviewlabel = gtk_label_new(_("FILE: "));
	gtk_label_set_justify(GTK_LABEL(main_window.treeviewlabel), GTK_JUSTIFY_LEFT);
	gtk_widget_show(main_window.treeviewlabel);
	gtk_box_pack_start(GTK_BOX(box2), main_window.treeviewlabel, FALSE, FALSE, 0);
	gtk_box_pack_end(GTK_BOX(box), box2, FALSE, FALSE, 4);
	//gtk_container_add (GTK_CONTAINER (notebook_manager), main_window.scrolledwindow3);

	main_window.classtreestore = gtk_tree_store_new (N_COLUMNS, G_TYPE_STRING,
															 G_TYPE_INT, G_TYPE_STRING, G_TYPE_INT, G_TYPE_INT);
	//enable sorting of the columns
	classbrowser_set_sortable(main_window.classtreestore);

	main_window.classtreeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (main_window.classtreestore));
	gtk_widget_show (main_window.classtreeview);
	gtk_container_add (GTK_CONTAINER (main_window.scrolledwindow3), main_window.classtreeview);

	main_window.classtreeselect = gtk_tree_view_get_selection (GTK_TREE_VIEW (main_window.classtreeview));
	gtk_tree_selection_set_mode (main_window.classtreeselect, GTK_SELECTION_SINGLE);
	renderer = gtk_cell_renderer_text_new ();
	column = gtk_tree_view_column_new_with_attributes (_("Name"),
					 renderer, "text", NAME_COLUMN, NULL);
	gtk_tree_view_append_column (GTK_TREE_VIEW (main_window.classtreeview), column);

	/*label1 = gtk_label_new ("Functions");
	gtk_widget_show (label1);
	gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook_manager), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook_manager), 0), label1);
	gtk_label_set_justify (GTK_LABEL (label1), GTK_JUSTIFY_LEFT);
	 
	notebook_manager_functions_page = gtk_vbox_new (FALSE, 0);
	gtk_widget_show (notebook_manager_functions_page);
	gtk_container_add (GTK_CONTAINER (notebook_manager), notebook_manager_functions_page);

	label2 = gtk_label_new ("Files");
	gtk_widget_show (label2);
	gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook_manager), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook_manager), 1), label2);
	gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_LEFT);

	notebook_manager_files_page = gtk_vbox_new (FALSE, 0);
	gtk_widget_show (notebook_manager_files_page);
	gtk_container_add (GTK_CONTAINER (notebook_manager), notebook_manager_files_page);

	label3 = gtk_label_new ("Help");
	gtk_widget_show (label3);
	gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook_manager), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook_manager), 2), label3);
	gtk_label_set_justify (GTK_LABEL (label3), GTK_JUSTIFY_LEFT);
	*/
	main_window.scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
	gtk_paned_pack2 (GTK_PANED (main_window.main_vertical_pane), main_window.scrolledwindow1, FALSE, TRUE);

	main_window.lint_view = gtk_tree_view_new ();
	gtk_container_add (GTK_CONTAINER (main_window.scrolledwindow1), main_window.lint_view);
	main_window.lint_renderer = gtk_cell_renderer_text_new ();
	main_window.lint_column = gtk_tree_view_column_new_with_attributes (_("Syntax Check Output"),
								main_window.lint_renderer,
								"text", 0,
								NULL);
	gtk_tree_view_append_column (GTK_TREE_VIEW (main_window.lint_view), main_window.lint_column);
	//gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (main_window.lint_view), FALSE);
	gtk_widget_set_usize(main_window.lint_view,80,80);
	main_window.lint_select = gtk_tree_view_get_selection (GTK_TREE_VIEW (main_window.lint_view));
	gtk_tree_selection_set_mode (main_window.lint_select, GTK_SELECTION_SINGLE);
	g_signal_connect (G_OBJECT (main_window.lint_select), "changed",
						G_CALLBACK (lint_row_activated), NULL);

	main_window.notebook_editor = gtk_notebook_new ();
	gtk_notebook_set_scrollable(GTK_NOTEBOOK(main_window.notebook_editor), TRUE);
	//GTK_WIDGET_UNSET_FLAGS (main_window.notebook_editor, GTK_CAN_FOCUS | GTK_RECEIVES_DEFAULT);
	// Fix to scrollable list of tabs, however it then messes up grabbing of focus
	// Hence the focus-tab event (which GTK doesn't seem to recognise
	GTK_WIDGET_UNSET_FLAGS (main_window.notebook_editor, GTK_RECEIVES_DEFAULT);
	gtk_widget_show (main_window.notebook_editor);
	gtk_paned_pack2 (GTK_PANED (main_window.main_horizontal_pane), main_window.notebook_editor, TRUE, TRUE);
	gtk_widget_set_usize(main_window.notebook_editor,400,400);
	g_signal_connect (G_OBJECT (main_window.notebook_editor), "switch_page", GTK_SIGNAL_FUNC (on_notebook_switch_page), NULL);
	g_signal_connect (G_OBJECT (main_window.notebook_editor), "focus-tab", GTK_SIGNAL_FUNC (on_notebook_focus_tab), NULL);
}
Example #11
0
static void
create_show_hide (void)
{
   GtkWidget *window = NULL;
   GtkWidget *box1;
   GtkWidget *box2;
   GtkWidget *close_button;
   GtkWidget *enable_box;
   GtkWidget *box;
   GtkWidget *table;
   GtkWidget *label;
   GtkWidget *separator;
   GtkDataboxGraph *graph;
   gfloat *X;
   gfloat *Y;
   GdkColor color;
   gint i;

   window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
   gtk_widget_set_size_request (window, 600, 600);

   g_signal_connect (GTK_OBJECT (window), "destroy",
		     G_CALLBACK (gtk_main_quit), NULL);

   gtk_window_set_title (GTK_WINDOW (window),
			 "GtkDatabox: Enable/Disable Features");
   gtk_container_set_border_width (GTK_CONTAINER (window), 0);

   box1 = gtk_vbox_new (FALSE, 0);
   gtk_container_add (GTK_CONTAINER (window), box1);

   label =
      gtk_label_new
      ("Click on the buttons to enable/disable features.\n\nFor basic understanding: See basics :-)\n\n");
   gtk_box_pack_start (GTK_BOX (box1), label, FALSE, FALSE, 0);
   separator = gtk_hseparator_new ();
   gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, FALSE, 0);

   enable_box = gtk_hbox_new (FALSE, 0);
   gtk_box_pack_start (GTK_BOX (box1), enable_box, FALSE, FALSE, 0);
   separator = gtk_hseparator_new ();
   gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, FALSE, 0);

   /* Create a GtkDatabox widget along with scrollbars and rulers */
   gtk_databox_create_box_with_scrollbars_and_rulers (&box, &table,
						      TRUE, TRUE, TRUE, TRUE);

   gtk_box_pack_start (GTK_BOX (box1), table, TRUE, TRUE, 0);

   X = g_new0 (gfloat, POINTS);
   Y = g_new0 (gfloat, POINTS);

   for (i = 0; i < POINTS; i++)
   {
      X[i] = i;
      Y[i] = 100. * sin (i * 2 * G_PI / POINTS);
   }
   color.red = 0;
   color.green = 0;
   color.blue = 65535;

   graph = gtk_databox_bars_new (POINTS, X, Y, &color, 1);
   gtk_databox_graph_add (GTK_DATABOX (box), graph);

   gtk_databox_auto_rescale (GTK_DATABOX (box), 0.05);

   separator = gtk_hseparator_new ();
   gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);

   box2 = gtk_vbox_new (FALSE, 10);
   gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
   gtk_box_pack_end (GTK_BOX (box1), box2, FALSE, TRUE, 0);
   close_button = gtk_button_new_with_label ("close");
   g_signal_connect_swapped (GTK_OBJECT (close_button), "clicked",
			     G_CALLBACK (gtk_main_quit), GTK_OBJECT (box));
   gtk_box_pack_start (GTK_BOX (box2), close_button, TRUE, TRUE, 0);
   GTK_WIDGET_SET_FLAGS (close_button, GTK_CAN_DEFAULT);
   for (i = 0; i < noEnableSets; ++i)
   {
      GtkWidget *vbox = gtk_vbox_new (FALSE, 10);
      GtkWidget *label = gtk_label_new (enableSets[i].title);
      GtkWidget *entry = gtk_entry_new ();
      GtkWidget *button = gtk_button_new_with_label ("Change");

      gtk_box_pack_start (GTK_BOX (enable_box), vbox, TRUE, TRUE, 0);
      gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, TRUE, 0);
      gtk_box_pack_start (GTK_BOX (vbox), entry, TRUE, TRUE, 0);
      gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);

      gtk_editable_set_editable (GTK_EDITABLE (entry), FALSE);
      g_signal_connect_swapped (button, "clicked",
				G_CALLBACK (update_enable),
				(gpointer) & (enableSets[i]));
      enableSets[i].box = GTK_DATABOX (box);
      enableSets[i].entry = GTK_ENTRY (entry);

      update_enable (&enableSets[i]);
      update_enable (&enableSets[i]);

   }

   gtk_widget_grab_default (close_button);
   gtk_widget_show_all (window);

}
Example #12
0
static void main_window_create_toolbars(void)
{
	//updated toolbar code with the new gtk+ functions
	// Create the Main Toolbar
	main_window.toolbar_main = gtk_toolbar_new ();
	gtk_widget_show (main_window.toolbar_main);
	gnome_app_add_toolbar (GNOME_APP (main_window.window), GTK_TOOLBAR (main_window.toolbar_main), "toolbar1",
							 BONOBO_DOCK_ITEM_BEH_NORMAL, BONOBO_DOCK_TOP, 1, 0, 0);
	gtk_container_set_border_width (GTK_CONTAINER (main_window.toolbar_main), 1);
	gtk_toolbar_set_style (GTK_TOOLBAR (main_window.toolbar_main), GTK_TOOLBAR_ICONS);
	gtk_toolbar_set_show_arrow (GTK_TOOLBAR (main_window.toolbar_main), FALSE);


	// Add the File operations to the Main Toolbar
	//main_window.toolbar_main_button_new = gtk_toolbar_insert_stock (GTK_TOOLBAR (main_window.toolbar_main),GTK_STOCK_NEW, _("New File"), NULL, NULL, NULL, -1);
	main_window.toolbar_main_button_new = GTK_WIDGET(gtk_tool_button_new_from_stock(GTK_STOCK_NEW));
	gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM (main_window.toolbar_main_button_new), _("New File"));
  	gtk_toolbar_insert(GTK_TOOLBAR(main_window.toolbar_main), GTK_TOOL_ITEM (main_window.toolbar_main_button_new), -1);
	gtk_widget_show (main_window.toolbar_main_button_new);
	//main_window.toolbar_main_button_open = gtk_toolbar_insert_stock (GTK_TOOLBAR (main_window.toolbar_main),GTK_STOCK_OPEN, _("Open File"), NULL, NULL, NULL, -1);
	//gtk_widget_show (main_window.toolbar_main_button_open);
	main_window.toolbar_main_button_open = GTK_WIDGET(gtk_tool_button_new_from_stock(GTK_STOCK_OPEN));
	gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM (main_window.toolbar_main_button_open), _("Open File"));
  	gtk_toolbar_insert(GTK_TOOLBAR(main_window.toolbar_main), GTK_TOOL_ITEM (main_window.toolbar_main_button_open), -1);
	gtk_widget_show (main_window.toolbar_main_button_open);
//	main_window.toolbar_main_button_save = gtk_toolbar_insert_stock (GTK_TOOLBAR (main_window.toolbar_main),GTK_STOCK_SAVE, _("Save File"), NULL, NULL, NULL, -1);
	main_window.toolbar_main_button_save = GTK_WIDGET(gtk_tool_button_new_from_stock(GTK_STOCK_SAVE));
	gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM (main_window.toolbar_main_button_save), _("Save File"));
  	gtk_toolbar_insert(GTK_TOOLBAR(main_window.toolbar_main), GTK_TOOL_ITEM (main_window.toolbar_main_button_save), -1);
	gtk_widget_show (main_window.toolbar_main_button_save);
//	main_window.toolbar_main_button_save_as = gtk_toolbar_insert_stock (GTK_TOOLBAR (main_window.toolbar_main),GTK_STOCK_SAVE_AS, _("Save File As..."), NULL, NULL, NULL, -1);
	main_window.toolbar_main_button_save_as = GTK_WIDGET(gtk_tool_button_new_from_stock(GTK_STOCK_SAVE_AS));
	gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM (main_window.toolbar_main_button_save_as), _("Save File As..."));
  	gtk_toolbar_insert(GTK_TOOLBAR(main_window.toolbar_main), GTK_TOOL_ITEM (main_window.toolbar_main_button_save_as), -1);
	gtk_widget_show (main_window.toolbar_main_button_save_as);

//	main_window.toolbar_main_button_close = gtk_toolbar_insert_stock (GTK_TOOLBAR (main_window.toolbar_main),GTK_STOCK_CLOSE, _("Close File"), NULL, NULL, NULL, -1);
	main_window.toolbar_main_button_close = GTK_WIDGET(gtk_tool_button_new_from_stock(GTK_STOCK_CLOSE));
	gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM (main_window.toolbar_main_button_close), _("Close File"));
  	gtk_toolbar_insert(GTK_TOOLBAR(main_window.toolbar_main), GTK_TOOL_ITEM (main_window.toolbar_main_button_close), -1);
	gtk_widget_show (main_window.toolbar_main_button_close);
	gtk_signal_connect (GTK_OBJECT (main_window.toolbar_main_button_open), "clicked", GTK_SIGNAL_FUNC (on_open1_activate), NULL);
	gtk_signal_connect (GTK_OBJECT (main_window.toolbar_main_button_new), "clicked", GTK_SIGNAL_FUNC (on_new1_activate), NULL);
	gtk_signal_connect (GTK_OBJECT (main_window.toolbar_main_button_save), "clicked", GTK_SIGNAL_FUNC (on_save1_activate), NULL);
	gtk_signal_connect (GTK_OBJECT (main_window.toolbar_main_button_save_as), "clicked", GTK_SIGNAL_FUNC (on_save_as1_activate), NULL);
	gtk_signal_connect (GTK_OBJECT (main_window.toolbar_main_button_close), "clicked", GTK_SIGNAL_FUNC (on_close1_activate), NULL);
//	gtk_toolbar_append_space(GTK_TOOLBAR(main_window.toolbar_main));
	main_window.toolbar_separator=gtk_separator_tool_item_new();
	gtk_toolbar_insert(GTK_TOOLBAR(main_window.toolbar_main), GTK_TOOL_ITEM (main_window.toolbar_separator), -1);
	gtk_widget_show (GTK_WIDGET(main_window.toolbar_separator));
	// Add the Undo operations to the Main Toolbar
//	main_window.toolbar_main_button_undo = gtk_toolbar_insert_stock (GTK_TOOLBAR (main_window.toolbar_main),GTK_STOCK_UNDO, _("Undo last change"), NULL, NULL, NULL, -1);
	main_window.toolbar_main_button_undo = GTK_WIDGET(gtk_tool_button_new_from_stock(GTK_STOCK_UNDO));
	gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM (main_window.toolbar_main_button_undo), _("Undo last change"));
  	gtk_toolbar_insert(GTK_TOOLBAR(main_window.toolbar_main), GTK_TOOL_ITEM (main_window.toolbar_main_button_undo), -1);
	gtk_widget_show (main_window.toolbar_main_button_undo);
//	main_window.toolbar_main_button_redo = gtk_toolbar_insert_stock (GTK_TOOLBAR (main_window.toolbar_main),GTK_STOCK_REDO, _("Redo last change"), NULL, NULL, NULL, -1);
	main_window.toolbar_main_button_redo = GTK_WIDGET(gtk_tool_button_new_from_stock(GTK_STOCK_REDO));
	gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM (main_window.toolbar_main_button_redo), _("Redo last change"));
  	gtk_toolbar_insert(GTK_TOOLBAR(main_window.toolbar_main), GTK_TOOL_ITEM (main_window.toolbar_main_button_redo), -1);
	gtk_widget_show (main_window.toolbar_main_button_redo);
	gtk_signal_connect (GTK_OBJECT (main_window.toolbar_main_button_undo), "clicked", GTK_SIGNAL_FUNC (on_undo1_activate), NULL);
	gtk_signal_connect (GTK_OBJECT (main_window.toolbar_main_button_redo), "clicked", GTK_SIGNAL_FUNC (on_redo1_activate), NULL);
	//gtk_toolbar_append_space(GTK_TOOLBAR(main_window.toolbar_main));
	main_window.toolbar_separator=gtk_separator_tool_item_new();
	gtk_toolbar_insert(GTK_TOOLBAR(main_window.toolbar_main), GTK_TOOL_ITEM (main_window.toolbar_separator), -1);
	gtk_widget_show (GTK_WIDGET(main_window.toolbar_separator));

	// Add the Clipboard operations to the Main Toolbar
	//main_window.toolbar_main_button_cut = gtk_toolbar_insert_stock (GTK_TOOLBAR (main_window.toolbar_main),GTK_STOCK_CUT, _("Cut current selection"), NULL, NULL, NULL, -1);
	main_window.toolbar_main_button_cut = GTK_WIDGET(gtk_tool_button_new_from_stock(GTK_STOCK_CUT));
	gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM (main_window.toolbar_main_button_cut), _("Cut current selection"));
  	gtk_toolbar_insert(GTK_TOOLBAR(main_window.toolbar_main), GTK_TOOL_ITEM (main_window.toolbar_main_button_cut), -1);
	gtk_signal_connect (GTK_OBJECT (main_window.toolbar_main_button_cut), "clicked", GTK_SIGNAL_FUNC (on_cut1_activate), NULL);
	gtk_widget_show (main_window.toolbar_main_button_cut);
//	main_window.toolbar_main_button_copy = gtk_toolbar_insert_stock (GTK_TOOLBAR (main_window.toolbar_main),GTK_STOCK_COPY, _("Copy current selection"), NULL, NULL, NULL, -1);
	main_window.toolbar_main_button_copy = GTK_WIDGET(gtk_tool_button_new_from_stock(GTK_STOCK_COPY));
  	gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM (main_window.toolbar_main_button_copy), _("Copy current selection"));
	gtk_toolbar_insert(GTK_TOOLBAR(main_window.toolbar_main), GTK_TOOL_ITEM (main_window.toolbar_main_button_copy), -1);
	gtk_signal_connect (GTK_OBJECT (main_window.toolbar_main_button_copy), "clicked", GTK_SIGNAL_FUNC (on_copy1_activate), NULL);
	gtk_widget_show (main_window.toolbar_main_button_copy);
	//main_window.toolbar_main_button_paste = gtk_toolbar_insert_stock (GTK_TOOLBAR (main_window.toolbar_main),GTK_STOCK_PASTE, _("Paste current selection"), NULL, NULL, NULL, -1);
	main_window.toolbar_main_button_paste = GTK_WIDGET(gtk_tool_button_new_from_stock(GTK_STOCK_PASTE));
  	gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM (main_window.toolbar_main_button_paste), _("Paste current selection"));
  	gtk_toolbar_insert(GTK_TOOLBAR(main_window.toolbar_main), GTK_TOOL_ITEM (main_window.toolbar_main_button_paste), -1);
	gtk_signal_connect (GTK_OBJECT (main_window.toolbar_main_button_paste), "clicked", GTK_SIGNAL_FUNC (on_paste1_activate), NULL);
	gtk_widget_show (main_window.toolbar_main_button_paste);
	//gtk_toolbar_append_space(GTK_TOOLBAR(main_window.toolbar_main));
	main_window.toolbar_separator=gtk_separator_tool_item_new();
	gtk_toolbar_insert(GTK_TOOLBAR(main_window.toolbar_main), GTK_TOOL_ITEM (main_window.toolbar_separator), -1);
	gtk_widget_show (GTK_WIDGET(main_window.toolbar_separator));
	// Add the Search operations to the Main Toolbar
//	main_window.toolbar_main_button_find = gtk_toolbar_insert_stock (GTK_TOOLBAR (main_window.toolbar_main),GTK_STOCK_FIND, _("Find text"), NULL, NULL, NULL, -1);
	main_window.toolbar_main_button_find = GTK_WIDGET(gtk_tool_button_new_from_stock(GTK_STOCK_FIND));
  	gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM (main_window.toolbar_main_button_find), _("Find Text"));
  	gtk_toolbar_insert(GTK_TOOLBAR(main_window.toolbar_main), GTK_TOOL_ITEM (main_window.toolbar_main_button_find), -1);
	gtk_widget_show (main_window.toolbar_main_button_find);
	gtk_signal_connect (GTK_OBJECT (main_window.toolbar_main_button_find), "clicked", GTK_SIGNAL_FUNC (on_find1_activate), NULL);
	//main_window.toolbar_main_button_replace = gtk_toolbar_insert_stock (GTK_TOOLBAR (main_window.toolbar_main),GTK_STOCK_FIND_AND_REPLACE, _("Find/Replace text"), NULL, NULL, NULL, -1);
	main_window.toolbar_main_button_replace = GTK_WIDGET(gtk_tool_button_new_from_stock(GTK_STOCK_FIND_AND_REPLACE));
  	gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM (main_window.toolbar_main_button_replace), _("Find/Replace text"));
  	gtk_toolbar_insert(GTK_TOOLBAR(main_window.toolbar_main), GTK_TOOL_ITEM (main_window.toolbar_main_button_replace), -1);
	gtk_signal_connect (GTK_OBJECT (main_window.toolbar_main_button_replace), "clicked", GTK_SIGNAL_FUNC (on_replace1_activate), NULL);
	gtk_widget_show (main_window.toolbar_main_button_replace);
	
	main_window.toolbar_separator=gtk_separator_tool_item_new();
	gtk_toolbar_insert(GTK_TOOLBAR(main_window.toolbar_main), GTK_TOOL_ITEM (main_window.toolbar_separator), -1);
	gtk_widget_show (GTK_WIDGET(main_window.toolbar_separator));

	// Add the indent/unindent operations to the Main Toolbar	
	/*indent block*/

	main_window.toolbar_main_button_indent = GTK_WIDGET(gtk_tool_button_new_from_stock(GTK_STOCK_INDENT));
	gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM (main_window.toolbar_main_button_indent), _("Indent block"));
  	gtk_toolbar_insert(GTK_TOOLBAR(main_window.toolbar_main), GTK_TOOL_ITEM (main_window.toolbar_main_button_indent), -1);
	gtk_signal_connect (GTK_OBJECT (main_window.toolbar_main_button_indent), "clicked", GTK_SIGNAL_FUNC (block_indent), NULL);
	gtk_widget_show (main_window.toolbar_main_button_indent);
	/*unindent block*/
	main_window.toolbar_main_button_unindent = GTK_WIDGET(gtk_tool_button_new_from_stock(GTK_STOCK_UNINDENT));
	gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM (main_window.toolbar_main_button_unindent), _("Unindent block"));
  	gtk_toolbar_insert(GTK_TOOLBAR(main_window.toolbar_main), GTK_TOOL_ITEM (main_window.toolbar_main_button_unindent), -1);
	gtk_signal_connect (GTK_OBJECT (main_window.toolbar_main_button_unindent), "clicked", GTK_SIGNAL_FUNC (block_unindent), NULL);
	gtk_widget_show (main_window.toolbar_main_button_unindent);

	main_window.toolbar_separator=gtk_separator_tool_item_new();
	gtk_toolbar_insert(GTK_TOOLBAR(main_window.toolbar_main), GTK_TOOL_ITEM (main_window.toolbar_separator), -1);
	gtk_widget_show (GTK_WIDGET(main_window.toolbar_separator));
	//zoom in
	main_window.toolbar_main_button_zoom_in = GTK_WIDGET(gtk_tool_button_new_from_stock(GTK_STOCK_ZOOM_IN));
	gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM (main_window.toolbar_main_button_zoom_in), _("Zoom in"));
  	gtk_toolbar_insert(GTK_TOOLBAR(main_window.toolbar_main), GTK_TOOL_ITEM (main_window.toolbar_main_button_zoom_in), -1);
	gtk_signal_connect (GTK_OBJECT (main_window.toolbar_main_button_zoom_in), "clicked", GTK_SIGNAL_FUNC (zoom_in), NULL);
	gtk_widget_show (main_window.toolbar_main_button_zoom_in);
	//zoom out
	main_window.toolbar_main_button_zoom_out = GTK_WIDGET(gtk_tool_button_new_from_stock(GTK_STOCK_ZOOM_OUT));
	gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM (main_window.toolbar_main_button_zoom_out), _("Zoom out"));
  	gtk_toolbar_insert(GTK_TOOLBAR(main_window.toolbar_main), GTK_TOOL_ITEM (main_window.toolbar_main_button_zoom_out), -1);
	gtk_signal_connect (GTK_OBJECT (main_window.toolbar_main_button_zoom_out), "clicked", GTK_SIGNAL_FUNC (zoom_out), NULL);
	gtk_widget_show (main_window.toolbar_main_button_zoom_out);

	// Create the Search Toolbar
	
	GtkToolItem *item;

	main_window.toolbar_find = gtk_toolbar_new ();
	gtk_widget_show (main_window.toolbar_find);
	gtk_toolbar_set_show_arrow (GTK_TOOLBAR (main_window.toolbar_find), FALSE);
	gtk_container_set_border_width (GTK_CONTAINER (main_window.toolbar_find), 1);
	gnome_app_add_toolbar (GNOME_APP (main_window.window), GTK_TOOLBAR (main_window.toolbar_find), "toolbar_search",
							 BONOBO_DOCK_ITEM_BEH_NORMAL, BONOBO_DOCK_TOP, 2, 0, 0);

	main_window.toolbar_find_search_label = gtk_label_new(_("Search for: "));
	gtk_widget_show(main_window.toolbar_find_search_label);
	item=gtk_tool_item_new();
	gtk_tool_item_set_expand (item, TRUE);
	gtk_container_add (GTK_CONTAINER (item), main_window.toolbar_find_search_label);
	gtk_toolbar_insert(GTK_TOOLBAR(main_window.toolbar_find), GTK_TOOL_ITEM (item), -1);
	gtk_widget_show(GTK_WIDGET(item));

	item=gtk_tool_item_new();
	gtk_tool_item_set_expand (item, TRUE);
	main_window.toolbar_find_search_entry = gtk_entry_new();
	gtk_widget_show(main_window.toolbar_find_search_entry);
	gtk_container_add (GTK_CONTAINER (item), main_window.toolbar_find_search_entry);
	gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM (item), _("Incremental search"));
	gtk_toolbar_insert(GTK_TOOLBAR(main_window.toolbar_find), GTK_TOOL_ITEM (item), -1);
	gtk_widget_show(GTK_WIDGET(item));
	//gtk_toolbar_append_widget(GTK_TOOLBAR (main_window.toolbar_find), main_window.toolbar_find_search_entry, _("Incremental search"),NULL);
	gtk_signal_connect_after(GTK_OBJECT(main_window.toolbar_find_search_entry), "insert_text", GTK_SIGNAL_FUNC(inc_search_typed), NULL);
	gtk_signal_connect_after(GTK_OBJECT(main_window.toolbar_find_search_entry), "key_release_event", GTK_SIGNAL_FUNC(inc_search_key_release_event), NULL);
	gtk_signal_connect_after(GTK_OBJECT(main_window.toolbar_find_search_entry), "activate", GTK_SIGNAL_FUNC(inc_search_activate), NULL);
	main_window.toolbar_separator=gtk_separator_tool_item_new();
	gtk_toolbar_insert(GTK_TOOLBAR(main_window.toolbar_find), GTK_TOOL_ITEM (main_window.toolbar_separator), -1);
	gtk_widget_show (GTK_WIDGET(main_window.toolbar_separator));
	
	//gtk_toolbar_append_space(GTK_TOOLBAR(main_window.toolbar_find));
	main_window.toolbar_find_goto_label = gtk_label_new(_("Go to line: "));
	gtk_widget_show(main_window.toolbar_find_goto_label);
	item=gtk_tool_item_new();
	gtk_tool_item_set_expand (item, TRUE);
	gtk_container_add (GTK_CONTAINER (item), main_window.toolbar_find_goto_label);
	gtk_toolbar_insert(GTK_TOOLBAR(main_window.toolbar_find), GTK_TOOL_ITEM (item), -1);
	gtk_widget_show(GTK_WIDGET(item));
//	gtk_toolbar_append_widget(GTK_TOOLBAR (main_window.toolbar_find), main_window.toolbar_find_goto_label,NULL,NULL);

	main_window.toolbar_find_goto_entry = gtk_entry_new_with_max_length(6);
	gtk_entry_set_width_chars(GTK_ENTRY(main_window.toolbar_find_goto_entry),7);
	gtk_widget_show(main_window.toolbar_find_goto_entry);
	item=gtk_tool_item_new();
	gtk_tool_item_set_expand (item, TRUE);
	gtk_container_add (GTK_CONTAINER (item), main_window.toolbar_find_goto_entry);
	gtk_tool_item_set_tooltip_text(GTK_TOOL_ITEM (item), _("Go to line"));
	gtk_toolbar_insert(GTK_TOOLBAR(main_window.toolbar_find), GTK_TOOL_ITEM (item), -1);
	gtk_widget_show(GTK_WIDGET(item));

//	gtk_toolbar_append_widget(GTK_TOOLBAR (main_window.toolbar_find), main_window.toolbar_find_goto_entry, _("Go to line"),NULL);
	gtk_signal_connect_after(GTK_OBJECT(main_window.toolbar_find_goto_entry), "activate", GTK_SIGNAL_FUNC(goto_line_activate), NULL);
	
	/*
	GtkToolItem * search_toolbar_separator;
	search_toolbar_separator = gtk_separator_tool_item_new();
	gtk_separator_tool_item_set_draw(search_toolbar_separator, FALSE); 
	gtk_tool_item_set_expand(search_toolbar_separator, TRUE);
	//gtk_toolbar_insert(GTK_TOOLBAR(main_window.toolbar_find), search_toolbar_separator, 0);
	gtk_toolbar_append_widget(GTK_TOOLBAR (main_window.toolbar_find), search_toolbar_separator,NULL,NULL);
	gtk_widget_show(search_toolbar_separator);
	*/
}
Example #13
0
void uade_gui_seek_subsong(int to)
{
    GtkWidget *seek_button_box;
    GtkWidget *prev_next_button_box;
    GtkWidget *seek_button_vbox;
    GtkWidget *seek_slider_box;
    GtkWidget *hscale;

    GtkWidget *prev_button;
    GtkWidget *prev_button_frame;
    GtkWidget *frame;
    GtkWidget *maxsong_label;
    GtkWidget *next_button,*ffwd_button;
    GtkWidget *ffwd_button_frame;

    if (!uade_thread_running) {
	fprintf(stderr, "uade: BUG! Seek not possible.\n");
	return;
    }

    if (seekpopup == NULL) {
	/* uade's subsong popup */
	seekpopup = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_window_set_title(GTK_WINDOW(seekpopup), "UADE seek subsong");
	gtk_window_set_position(GTK_WINDOW(seekpopup), GTK_WIN_POS_MOUSE);
	gtk_container_set_border_width(GTK_CONTAINER(seekpopup), 0);

	gtk_window_set_policy(GTK_WINDOW(seekpopup), FALSE, FALSE, FALSE);

	gtk_signal_connect(GTK_OBJECT(seekpopup), "destroy",
			   GTK_SIGNAL_FUNC(gtk_widget_destroyed),
			   &seekpopup);

	gtk_signal_connect(GTK_OBJECT(seekpopup), "focus_out_event",
			   GTK_SIGNAL_FUNC(focus_out_event), NULL);

	gtk_widget_realize(seekpopup);
	gdk_window_set_decorations(seekpopup->window, 0);

        /* define Slider code, will be used by all styles of the popup */

	if (uade_get_max_subsong(-1) >= 0) {

	    subsong_adj =
		gtk_adjustment_new(uade_get_cur_subsong(0), uade_get_min_subsong(0),
				   uade_get_max_subsong(0), 1, 0, 0);	/*our scale for the subsong slider */
	    maxsong_label =
		gtk_label_new(g_strdup_printf("%d", uade_get_max_subsong(0))); /* until we can't get the reliable maximum number of subsongs this has to do :-) */
	    gtk_widget_set_usize(maxsong_label, 24, -1);

	} else {
	    subsong_adj =
		gtk_adjustment_new(uade_get_cur_subsong(0), uade_get_min_subsong(0),
				   (uade_get_max_subsong(0)) + 10, 1, 0, 0);	/*our scale for the subsong slider */
	    /*currently: min - min+10  */
	    maxsong_label = gtk_label_new("..."); /* until we can't get the reliable maximum number of subsongs this has to do :-) */
	    gtk_widget_set_usize(maxsong_label, 24, -1);
	}

	hscale = gtk_hscale_new(GTK_ADJUSTMENT(subsong_adj));
	gtk_widget_set_usize(hscale, 160, -1);
	gtk_scale_set_digits(GTK_SCALE(hscale), 0);
	gtk_scale_set_value_pos(GTK_SCALE(hscale), GTK_POS_LEFT);
	gtk_scale_set_draw_value(GTK_SCALE(hscale), TRUE);
	gtk_range_set_update_policy(GTK_RANGE(hscale),
				    GTK_UPDATE_DISCONTINUOUS);
	gtk_signal_connect_object(GTK_OBJECT(subsong_adj), "value_changed",
				  GTK_SIGNAL_FUNC(uade_seek_directly),
				  NULL);


        /* previous subsong button, will be used by all styles of the seek popup*/
	prev_button = gtk_button_new_with_label("<");
	gtk_widget_set_usize(prev_button, 27, -1);
	gtk_signal_connect_object(GTK_OBJECT(prev_button), "clicked",
				  GTK_SIGNAL_FUNC(uade_seek_previous),
				  NULL);

	prev_button_frame = gtk_frame_new(NULL);
	gtk_frame_set_shadow_type(GTK_FRAME(prev_button_frame),
				  GTK_SHADOW_IN);


        /* next subsong button, will be used by all styles of the seek popup*/
	next_button = gtk_button_new_with_label(">");
	gtk_widget_set_usize(next_button, 27, -1);
	gtk_signal_connect_object(GTK_OBJECT(next_button), "clicked",
				  GTK_SIGNAL_FUNC(uade_seek_next), NULL);

	ffwd_button_frame = gtk_frame_new(NULL);
	gtk_frame_set_shadow_type(GTK_FRAME(ffwd_button_frame),
				  GTK_SHADOW_IN);

	ffwd_button = gtk_button_new_with_label("10s fwd");
	gtk_widget_set_usize(ffwd_button, 27, -1);
	gtk_signal_connect_object(GTK_OBJECT(ffwd_button), "clicked",
				  GTK_SIGNAL_FUNC(uade_ffwd), NULL);

	/* with the alternative styles of the subsongseeker,
	 * following suggestions made by David Le Corfec*/
	seek_button_box = gtk_hbox_new(FALSE, 0);
	gtk_container_add(GTK_CONTAINER(seekpopup), seek_button_box);

	frame = gtk_frame_new(NULL);
	gtk_box_pack_start_defaults(GTK_BOX(seek_button_box), frame);
	gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_OUT);


	seek_button_vbox = gtk_vbox_new(FALSE, 0);
	gtk_container_add(GTK_CONTAINER(frame), seek_button_vbox);
	gtk_signal_connect(GTK_OBJECT(seek_button_vbox), "focus_out_event",
			   GTK_SIGNAL_FUNC(focus_out_event), NULL);

	prev_next_button_box = gtk_hbox_new(FALSE, 0);

	/* use the previous defined buttons here */

	gtk_box_pack_start_defaults(GTK_BOX(seek_button_vbox),
			   prev_button_frame);

	gtk_container_add(GTK_CONTAINER(prev_button_frame),
			   prev_next_button_box);

	gtk_box_pack_start_defaults(GTK_BOX(prev_next_button_box),
			   prev_button);
	gtk_box_pack_start_defaults(GTK_BOX(prev_next_button_box),
			   next_button);



	seek_slider_box = gtk_hbox_new(FALSE, 0);
	gtk_box_pack_start(GTK_BOX(seek_button_vbox), seek_slider_box,
			   FALSE, FALSE, 0);

	/* use the previous defined slider and label here */
	gtk_box_pack_start(GTK_BOX(seek_slider_box), hscale, FALSE, FALSE,
			   0);
	gtk_box_pack_start(GTK_BOX(seek_slider_box), maxsong_label, FALSE,
			   FALSE, 0);

	/* use the previous defined buttons here */
	gtk_box_pack_start_defaults(GTK_BOX(seek_button_vbox),
			   ffwd_button_frame);
	gtk_container_add(GTK_CONTAINER(ffwd_button_frame),
			   ffwd_button);

	gtk_widget_show_all(seekpopup);
	seekpopup_open = 1;

    } else {
	gdk_window_raise(seekpopup->window);
    }
}
Example #14
0
GtkWidget * create_FileSelect( void )
{
 GtkWidget     * vbox4;
 GtkWidget     * hbox4;
 GtkWidget     * vseparator1;
 GtkWidget     * hbox6;
 GtkWidget     * fsFNameListWindow;
 GtkWidget     * hbuttonbox3;

 GtkWidget     * uppixmapwid;
 GdkPixmap     * uppixmap;
 GdkBitmap     * upmask;
 GtkStyle      * upstyle;


 fsFileSelect=gtk_window_new( GTK_WINDOW_TOPLEVEL );
 gtk_widget_set_name( fsFileSelect,"fsFileSelect" );
 gtk_object_set_data( GTK_OBJECT( fsFileSelect ),"fsFileSelect",fsFileSelect );
 gtk_widget_set_usize( fsFileSelect,512,300 );
 GTK_WIDGET_SET_FLAGS( fsFileSelect,GTK_CAN_DEFAULT );
 gtk_widget_set_events( fsFileSelect,GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_FOCUS_CHANGE_MASK | GDK_STRUCTURE_MASK | GDK_PROPERTY_CHANGE_MASK | GDK_VISIBILITY_NOTIFY_MASK );
 gtk_window_set_title( GTK_WINDOW( fsFileSelect ),MSGTR_FileSelect );
 gtk_window_set_position( GTK_WINDOW( fsFileSelect ),GTK_WIN_POS_CENTER );
 gtk_window_set_policy( GTK_WINDOW( fsFileSelect ),TRUE,TRUE,TRUE );
 gtk_window_set_wmclass( GTK_WINDOW( fsFileSelect ),"FileSelect","MPlayer" );
 fsColorMap=gdk_colormap_get_system();

 gtk_widget_realize( fsFileSelect );
 gtkAddIcon( fsFileSelect );

 style=gtk_widget_get_style( fsFileSelect );
 dpixmap=gdk_pixmap_colormap_create_from_xpm_d( fsFileSelect->window,fsColorMap,&dmask,&style->bg[GTK_STATE_NORMAL],(gchar **)dir_xpm );
 fpixmap=gdk_pixmap_colormap_create_from_xpm_d( fsFileSelect->window,fsColorMap,&fmask,&style->bg[GTK_STATE_NORMAL],(gchar **)file_xpm );

 vbox4=AddVBox( AddDialogFrame( fsFileSelect ),0 );
 hbox4=AddHBox( vbox4,1 );

 fsCombo4=gtk_combo_new();
 gtk_widget_set_name( fsCombo4,"fsCombo4" );
 gtk_widget_show( fsCombo4 );
 gtk_box_pack_start( GTK_BOX( hbox4 ),fsCombo4,TRUE,TRUE,0 );
 gtk_widget_set_usize( fsCombo4,-2,20 );

 fsPathCombo=GTK_COMBO( fsCombo4 )->entry;
 gtk_widget_set_name( fsPathCombo,"fsPathCombo" );
 gtk_widget_show( fsPathCombo );
 gtk_widget_set_usize( fsPathCombo,-2,20 );

 vseparator1=gtk_vseparator_new();
 gtk_widget_set_name( vseparator1,"vseparator1" );
 gtk_widget_show( vseparator1 );
 gtk_box_pack_start( GTK_BOX( hbox4 ),vseparator1,FALSE,TRUE,0 );
 gtk_widget_set_usize( vseparator1,7,20 );

 upstyle=gtk_widget_get_style( fsFileSelect );
 uppixmap=gdk_pixmap_colormap_create_from_xpm_d( fsFileSelect->window,fsColorMap,&upmask,&upstyle->bg[GTK_STATE_NORMAL],(gchar **)up_xpm );
 uppixmapwid=gtk_pixmap_new( uppixmap,upmask );
 gtk_widget_show( uppixmapwid );

 fsUp=gtk_button_new();
 gtk_container_add( GTK_CONTAINER(fsUp ),uppixmapwid );
 gtk_widget_show( fsUp );
 gtk_box_pack_start( GTK_BOX( hbox4 ),fsUp,FALSE,FALSE,0 );
 gtk_widget_set_usize( fsUp,65,15 );

 AddHSeparator( vbox4 );

 hbox6=AddHBox( NULL,0 );
   gtk_box_pack_start( GTK_BOX( vbox4 ),hbox6,TRUE,TRUE,0 );

 fsFNameListWindow=gtk_scrolled_window_new( NULL,NULL );
 gtk_widget_set_name( fsFNameListWindow,"fsFNameListWindow" );
 gtk_widget_show( fsFNameListWindow );
 gtk_box_pack_start( GTK_BOX( hbox6 ),fsFNameListWindow,TRUE,TRUE,0 );
 gtk_widget_set_usize( fsFNameListWindow,-2,145 );
 gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( fsFNameListWindow ),GTK_POLICY_NEVER,GTK_POLICY_AUTOMATIC );

 fsFNameList=gtk_clist_new( 2 );
 gtk_widget_set_name( fsFNameList,"fsFNameList" );
 gtk_container_add( GTK_CONTAINER( fsFNameListWindow ),fsFNameList );
 gtk_clist_set_column_width( GTK_CLIST( fsFNameList ),0,80 );
 gtk_clist_set_selection_mode( GTK_CLIST( fsFNameList ),GTK_SELECTION_BROWSE );
 gtk_clist_column_titles_hide( GTK_CLIST( fsFNameList ) );
 gtk_clist_set_shadow_type( GTK_CLIST( fsFNameList ),GTK_SHADOW_ETCHED_OUT );

 AddHSeparator( vbox4 );

 List=gtk_combo_new();
 gtk_widget_set_name( List,"List" );
 gtk_widget_ref( List );
 gtk_object_set_data_full( GTK_OBJECT( fsFileSelect ),"List",List,(GtkDestroyNotify)gtk_widget_unref );
 gtk_widget_show( List );
 gtk_box_pack_start( GTK_BOX( vbox4 ),List,FALSE,FALSE,0 );
 gtk_widget_set_usize( List,-2,20 );

 fsFilterCombo=GTK_COMBO( List )->entry;
 gtk_widget_set_name( fsFilterCombo,"fsFilterCombo" );
 gtk_widget_show( fsFilterCombo );
 gtk_entry_set_editable (GTK_ENTRY( fsFilterCombo ),FALSE );
 gtk_widget_set_usize( fsFilterCombo,-2,20 );

 AddHSeparator( vbox4 );

 hbuttonbox3=AddHButtonBox( vbox4 );
   gtk_button_box_set_layout( GTK_BUTTON_BOX( hbuttonbox3 ),GTK_BUTTONBOX_END );
   gtk_button_box_set_spacing( GTK_BUTTON_BOX( hbuttonbox3 ),10 );

 fsOk=AddButton( MSGTR_Ok,hbuttonbox3 );
 fsCancel=AddButton( MSGTR_Cancel,hbuttonbox3 );

 gtk_signal_connect( GTK_OBJECT( fsFileSelect ),"destroy",GTK_SIGNAL_FUNC( fs_Destroy ), NULL );
 gtk_signal_connect( GTK_OBJECT( fsFileSelect ),"key_release_event",GTK_SIGNAL_FUNC( on_FileSelect_key_release_event ),NULL );

 gtk_signal_connect( GTK_OBJECT( fsFilterCombo ),"changed",GTK_SIGNAL_FUNC( fs_fsFilterCombo_changed ),fsFilterCombo );
 gtk_signal_connect( GTK_OBJECT( fsFilterCombo ),"activate",GTK_SIGNAL_FUNC( fs_fsFilterCombo_activate ),fsFilterCombo );
 gtk_signal_connect( GTK_OBJECT( fsPathCombo ),"changed",GTK_SIGNAL_FUNC( fs_fsPathCombo_changed ),fsPathCombo );
 gtk_signal_connect( GTK_OBJECT( fsPathCombo ),"activate",GTK_SIGNAL_FUNC( fs_fsPathCombo_activate ),fsPathCombo );
 gtk_signal_connect( GTK_OBJECT( fsUp ),"released",GTK_SIGNAL_FUNC( fs_Up_released ),fsFNameList );
 gtk_signal_connect( GTK_OBJECT( fsUp ),"key_release_event",GTK_SIGNAL_FUNC( on_FileSelect_key_release_event ),NULL );
 gtk_signal_connect( GTK_OBJECT( fsOk ),"released",GTK_SIGNAL_FUNC( fs_Ok_released ),fsCombo4 );
 gtk_signal_connect( GTK_OBJECT( fsOk ),"key_release_event",GTK_SIGNAL_FUNC( on_FileSelect_key_release_event ),NULL );
 gtk_signal_connect( GTK_OBJECT( fsCancel ),"released",GTK_SIGNAL_FUNC( fs_Cancel_released ),NULL );
 gtk_signal_connect( GTK_OBJECT( fsCancel ),"key_release_event",GTK_SIGNAL_FUNC( on_FileSelect_key_release_event ),NULL );
 gtk_signal_connect( GTK_OBJECT( fsFNameList ),"select_row",(GtkSignalFunc)fs_fsFNameList_select_row,NULL );
 gtk_signal_connect( GTK_OBJECT( fsFNameList ),"event", (GtkSignalFunc)fs_fsFNameList_event,NULL );

 return fsFileSelect;
}
int main (int argc, char **argv)
{
    state     *st;
    GtkWidget *window;
    GtkWidget *drawing_area;

    GError    *error = NULL;

    DBusError dbus_error;

    gtk_set_locale();

    gtk_init_with_args(&argc, &argv,
                       parameter_string,
                       options,
                       "gnome-screensaver",
                       &error);

    if (error != NULL) {
        g_printerr ("%s. See --help for usage information.\n",
                  error->message);
        g_error_free (error);
        return EX_SOFTWARE;
    }

    copy_gifs();
    get_time_str();
    window = gs_theme_window_new();
    drawing_area = gtk_drawing_area_new();
    st = clock_init(window, drawing_area);
    init_weather(st);

    gtk_widget_show(drawing_area);
    gtk_container_add(GTK_CONTAINER (window), drawing_area);

    gtk_widget_show(window);

    loop = g_main_loop_new (NULL, FALSE);

    dbus_error_init (&dbus_error);
    bus = dbus_bus_get (DBUS_BUS_SESSION, &dbus_error);
    if (!bus) {
      g_warning ("Failed to connect to the D-BUS daemon: %s", dbus_error.message);
      dbus_error_free (&dbus_error);
      return 1;
    }
    dbus_connection_setup_with_g_main (bus, NULL);

    /* listening to messages from all objects as no path is specified */
    dbus_bus_add_match (bus, "type='signal',interface='org.freedesktop.MediaPlayer'", &dbus_error);
    dbus_bus_add_match (bus, "type='signal',interface='org.freedesktop.DBus.Properties'", &dbus_error);
    dbus_connection_add_filter (bus, signal_filter, loop, NULL);


    g_signal_connect(G_OBJECT (window), "delete-event",
                     GTK_SIGNAL_FUNC(quit_app), loop);
    g_signal_connect(GTK_OBJECT (drawing_area), "configure_event",
                     GTK_SIGNAL_FUNC (configure_event), st);
    g_signal_connect(GTK_OBJECT (drawing_area), "expose_event",
                     GTK_SIGNAL_FUNC (expose_event), st);

    g_signal_connect(GTK_OBJECT (window), "configure_event",
                     GTK_SIGNAL_FUNC (w_configure_event), st);

    g_random_set_seed(time (NULL));

    st->timer_id = g_timeout_add_seconds(1, clock_timer, st);

    g_main_loop_run (loop);

    clock_free (st);

    return EX_OK;
}
int main(int argc, char **argv){
   GtkBuilder *builder = NULL;
   GError     *error = NULL;

   GtkWidget  *main_window = NULL;
   GtkWidget  *main_screen = NULL;
   GtkWidget  *button_list[MAX_BUTTON];
   GtkWidget  *led_list[MAX_LEDS];

#ifndef TRUE_COLOR
   guint32 virtual_color[256];
#endif
   //
   init_sighandler();

   //init gtk context
   gtk_init(&argc, &argv);
   gdk_rgb_init();

   //init color palette
#ifndef TRUE_COLOR
   virtual_palette_set((unsigned int *)virtual_color);
   V_CPU.cmap = gdk_rgb_cmap_new(virtual_color, 256);
#endif

   builder = gtk_builder_new();

   //load UI from file. If error occurs, report it and quit application.
   if(!gtk_builder_add_from_file(builder, UI_FILE, &error)) {
      g_warning("%s", error->message);
      g_free(error);
      return -1;
   }

   //
   gtk_builder_connect_signals(builder,NULL);

   //create main_window and configure it main_screen an buttonq
   main_window = GTK_WIDGET(gtk_builder_get_object(builder,"main_window"));
   gtk_signal_connect(GTK_OBJECT (main_window), "delete_event",
                      GTK_SIGNAL_FUNC(destroy),NULL);

   //create main screen and configure it
   main_screen = GTK_WIDGET(gtk_builder_get_object(builder,"main_screen"));
   //gtk_drawing_area_size(GTK_DRAWING_AREA(main_screen), SCREEN_XRES, SCREEN_YRES);
   gtk_signal_connect(GTK_OBJECT (main_screen), "expose_event",
                      GTK_SIGNAL_FUNC(on_darea_expose),NULL);

   //refresh screen rate 75 ms
   gtk_timeout_add(75, Repaint,(gpointer)main_screen);

   //read kb layout provide by user interface
   virtual_kb_create_button(builder,button_list,MAX_BUTTON,kb_layout,read_kb);

   //create radio button provide by user interface
   virtual_leds_create_radio_button(builder,led_list,MAX_LEDS);

   //add stdin in watch descriptor
   V_CPU.gui_event = gio_watch;
   V_CPU.gui_event[0].watch = (void*)g_io_channel_unix_new(0);
   g_io_add_watch((GIOChannel *)V_CPU.gui_event[0].watch,G_IO_IN, (GIOFunc)gio_watch[0].func,0);

   gtk_widget_add_events(main_screen,
                         GDK_POINTER_MOTION_MASK|GDK_BUTTON_PRESS_MASK|GDK_BUTTON_RELEASE_MASK);
   gtk_widget_show(main_window);

   //destroy builder, since we don't need it anymore
   g_object_unref(G_OBJECT(builder));

   //init hardware
   init_hardware((void *)&V_CPU);

   //wait for pipe ready
   if(load_pipe()<0) {
      return -1;
   }

   //main gtk loop
   gtk_main();

   return 0;
}
Example #17
0
int ras_kl_menu(int kn_fokus,const char *kod_kl,const char *fio,int denrog,int pol,class iceb_u_str *zap_vv,int metka_blok,double *saldo,double *saldo_po_kas)
{

class iceb_gdite_data gdite;
iceb_gdite(&gdite,1,NULL); //открываем окно ждите
iceb_refresh();
double ost_na_saldo=0.;
*saldo_po_kas=0.;
*saldo=ras_sal_kl(kod_kl,&ost_na_saldo,saldo_po_kas,NULL);

class iceb_u_str zagolovok;
zagolovok.plus(gettext("Клиент"));
zagolovok.plus(":");
zagolovok.plus(kod_kl);
zagolovok.plus(" ");
zagolovok.plus(fio);

zagolovok.ps_plus(gettext("Общее сальдо"));
zagolovok.plus(":");
zagolovok.plus(*saldo);

zagolovok.ps_plus(gettext("Наличное сальдо"));
zagolovok.plus(":");
zagolovok.plus(*saldo_po_kas);

zagolovok.ps_plus(gettext("Безналичное сальдо"));
zagolovok.plus(":");
zagolovok.plus(*saldo-*saldo_po_kas);

zagolovok.ps_plus(gettext("Пол"));
zagolovok.plus(":");
if(pol == 0)
 zagolovok.plus(gettext("Мужчина"));
else
 zagolovok.plus(gettext("Женщина"));


if(denrog == 1)
 {
  zagolovok.ps_plus(gettext("У клиента сегодня день рождения"));
 }

if(metka_blok == 1)
  zagolovok.ps_plus(gettext("Внимание !!! Карточка заблокирована !!!"));

iceb_refresh();


gdite.close(); //закрываем окно ждите
















class ras_kl_data data;
char bros[300];

data.window = gtk_window_new( GTK_WINDOW_TOPLEVEL );

gtk_window_set_position( GTK_WINDOW(data.window),ICEB_POS_CENTER);

sprintf(bros,"%s %s",NAME_SYSTEM,gettext("Расчёт клиентов"));
gtk_window_set_title(GTK_WINDOW(data.window),iceb_u_toutf(bros));

//Установка ширины окантовки внутренней области   
gtk_container_set_border_width(GTK_CONTAINER(data.window),1);
//gtk_widget_show(data.window); //Отрисовываем, чтобы можно было взять цвет

gtk_signal_connect(GTK_OBJECT(data.window),"delete_event",GTK_SIGNAL_FUNC(ras_kl_destroy),&data.knopka);
gtk_signal_connect(GTK_OBJECT(data.window),"destroy",GTK_SIGNAL_FUNC(gtk_main_quit),NULL);

gtk_signal_connect_after(GTK_OBJECT(data.window),"key_press_event",GTK_SIGNAL_FUNC(iceb_vihod),&data.knopka);

GtkWidget *vbox=gtk_vbox_new(FALSE,1);
gtk_container_add(GTK_CONTAINER(data.window),vbox);

GtkWidget *label=gtk_label_new(zagolovok.ravno_toutf());
gtk_box_pack_start((GtkBox*)vbox,label,FALSE,FALSE,1);

if(zap_vv->getdlinna() > 1)
 {
  GdkColor color;
  label=gtk_label_new(zap_vv->ravno_toutf());
  gdk_color_parse("red",&color);
  gtk_widget_modify_fg(label,GTK_STATE_NORMAL,&color);
  gtk_box_pack_start((GtkBox*)vbox,label,FALSE,FALSE,1);
 }
 
GtkWidget *knopka[KOLKNOP];


knopka[VOZVRAT_KAR]=gtk_button_new_with_label(gettext("Возврат карточки клиентом"));
gtk_box_pack_start((GtkBox*)vbox,knopka[VOZVRAT_KAR],TRUE,TRUE,1);
gtk_signal_connect(GTK_OBJECT(knopka[VOZVRAT_KAR]),"clicked",GTK_SIGNAL_FUNC(ras_kl_knopka),&data);
gtk_object_set_user_data(GTK_OBJECT(knopka[VOZVRAT_KAR]),(gpointer)VOZVRAT_KAR);

knopka[VOZVRAT_SUM]=gtk_button_new_with_label(gettext("Возвратить деньги из кассы"));
gtk_box_pack_start((GtkBox*)vbox,knopka[VOZVRAT_SUM],TRUE,TRUE,1);
gtk_signal_connect(GTK_OBJECT(knopka[VOZVRAT_SUM]),"clicked",GTK_SIGNAL_FUNC(ras_kl_knopka),&data);
gtk_object_set_user_data(GTK_OBJECT(knopka[VOZVRAT_SUM]),(gpointer)VOZVRAT_SUM);

knopka[OPLATA]=gtk_button_new_with_label(gettext("Оплата"));
gtk_box_pack_start((GtkBox*)vbox,knopka[OPLATA],TRUE,TRUE,1);
gtk_signal_connect(GTK_OBJECT(knopka[OPLATA]),"clicked",GTK_SIGNAL_FUNC(ras_kl_knopka),&data);
gtk_object_set_user_data(GTK_OBJECT(knopka[OPLATA]),(gpointer)OPLATA);

knopka[VID_KART]=gtk_button_new_with_label(gettext("Выдача карточки клиенту"));
gtk_box_pack_start((GtkBox*)vbox,knopka[VID_KART],TRUE,TRUE,1);
gtk_signal_connect(GTK_OBJECT(knopka[VID_KART]),"clicked",GTK_SIGNAL_FUNC(ras_kl_knopka),&data);
gtk_object_set_user_data(GTK_OBJECT(knopka[VID_KART]),(gpointer)VID_KART);

knopka[PROS_SHETS]=gtk_button_new_with_label(gettext("Просмотр счетов по клиенту"));
gtk_box_pack_start((GtkBox*)vbox,knopka[PROS_SHETS],TRUE,TRUE,1);
gtk_signal_connect(GTK_OBJECT(knopka[PROS_SHETS]),"clicked",GTK_SIGNAL_FUNC(ras_kl_knopka),&data);
gtk_object_set_user_data(GTK_OBJECT(knopka[PROS_SHETS]),(gpointer)PROS_SHETS);

knopka[PROV_VV]=gtk_button_new_with_label(gettext("Проверка возможности входа/выхода в подразделение"));
gtk_box_pack_start((GtkBox*)vbox,knopka[PROV_VV],TRUE,TRUE,1);
gtk_signal_connect(GTK_OBJECT(knopka[PROV_VV]),"clicked",GTK_SIGNAL_FUNC(ras_kl_knopka),&data);
gtk_object_set_user_data(GTK_OBJECT(knopka[PROV_VV]),(gpointer)PROV_VV);

knopka[PROS_VV]=gtk_button_new_with_label(gettext("Просмотр движения по карточке"));
gtk_box_pack_start((GtkBox*)vbox,knopka[PROS_VV],TRUE,TRUE,1);
gtk_signal_connect(GTK_OBJECT(knopka[PROS_VV]),"clicked",GTK_SIGNAL_FUNC(ras_kl_knopka),&data);
gtk_object_set_user_data(GTK_OBJECT(knopka[PROS_VV]),(gpointer)PROS_VV);


knopka[VIHOD]=gtk_button_new_with_label(gettext("Выход"));
gtk_box_pack_start((GtkBox*)vbox,knopka[VIHOD],TRUE,TRUE,1);
gtk_signal_connect(GTK_OBJECT(knopka[VIHOD]),"clicked",GTK_SIGNAL_FUNC(ras_kl_knopka),&data);
gtk_object_set_user_data(GTK_OBJECT(knopka[VIHOD]),(gpointer)VIHOD);

gtk_widget_grab_focus(knopka[kn_fokus]);

gtk_widget_show_all( data.window );

gtk_main();


return(data.knopka);

}
Example #18
0
int GCcreatewidget(Gwidget_t * parent, Gwidget_t * widget,
		   int attrn, Gwattr_t * attrp)
{
    PIXsize_t ps;
    int width, height;
    int ai, i;
    GdkGCValues gcv;
    int r, g, b, color;
    GdkColor *cp;

    if (!parent) {
	Gerr(POS, G_ERRNOPARENTWIDGET);
	return -1;
    }

    canvas = widget;
    WCU->func = NULL;
    WCU->needredraw = FALSE;
    WCU->buttonsdown = 0;
    WCU->bstate[0] = WCU->bstate[1] = WCU->bstate[2] = 0;
    ps.x = ps.y = MINCWSIZE;

    for (ai = 0; ai < attrn; ai++) {
	switch (attrp[ai].id) {
	case G_ATTRSIZE:
	    GETSIZE(attrp[ai].u.s, ps, MINCWSIZE);
	    break;
	case G_ATTRBORDERWIDTH:
	    break;
#ifdef FEATURE_GMAP
	case G_ATTRMODE:
	    if (Strcmp("gmap", attrp[ai].u.t) == 0) {
		gmapmode = TRUE;
	    } else {
		Gerr(POS, G_ERRBADATTRVALUE, attrp[ai].u.t);
		return -1;
	    }
	    break;
#endif
	case G_ATTRCURSOR:
	    break;
	case G_ATTRCOLOR:
	    break;
	case G_ATTRVIEWPORT:
	    break;
	case G_ATTRWINDOW:
	    break;
	case G_ATTRWINDOWID:
	    Gerr(POS, G_ERRCANNOTSETATTR2, "windowid");
	    return -1;
	case G_ATTREVENTCB:
	    WCU->func = (Gcanvascb) attrp[ai].u.func;
	    break;
	case G_ATTRUSERDATA:
	    widget->udata = attrp[ai].u.u;
	    break;
	default:
	    Gerr(POS, G_ERRBADATTRID, attrp[ai].id);
	    return -1;
	}
    }
/*    	XtSetValues (widget->w, argp, argn);	*/

    widget->w = gtk_drawing_area_new();
    gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(parent->w),
					  widget->w);
    gtk_drawing_area_size(GTK_DRAWING_AREA(widget->w), ps.x, ps.y);

    gtk_widget_add_events(widget->w, GDK_ALL_EVENTS_MASK);
    gtk_signal_connect(GTK_OBJECT(widget->w), "key_release_event",
		       GTK_SIGNAL_FUNC(Gcwkeyaction), NULL);
    gtk_signal_connect(GTK_OBJECT(widget->w), "key_press_event",
		       GTK_SIGNAL_FUNC(Gcwkeyaction), NULL);
    gtk_signal_connect(G_OBJECT(widget->w), "button_press_event",
		       GTK_SIGNAL_FUNC(Gcwbutaction), NULL);
    gtk_signal_connect(G_OBJECT(widget->w), "button_release_event",
		       GTK_SIGNAL_FUNC(Gcwbutaction), NULL);
    gtk_signal_connect(G_OBJECT(widget->w), "visibility_notify_event",
		       GTK_SIGNAL_FUNC(cweventhandler), NULL);
    gtk_signal_connect(G_OBJECT(widget->w), "expose_event",
		       GTK_SIGNAL_FUNC(exposeeventhandler), NULL);
    gtk_signal_connect(G_OBJECT(widget->w), "motion_notify_event",
		       GTK_SIGNAL_FUNC(cweventhandler), NULL);

    gtk_widget_show(widget->w);
    gtk_widget_show(parent->w);

    GC = gdk_gc_new(widget->w->window);
    WCU->cmap = gdk_colormap_get_system();
    WCU->colors[0].color.pixel = WCU->colors[1].color.pixel = 1000000;
    if (WCU->colors[0].color.pixel == 1000000) {
	gdk_gc_get_values(GC, &gcv);
	WCU->colors[0].color = gcv.background;
    }
    if (WCU->colors[1].color.pixel == 1000000) {
	gdk_gc_get_values(GC, &gcv);
	WCU->colors[1].color = gcv.foreground;
    }

    WCU->colors[0].color.red = 65535;
    WCU->colors[0].color.green = 65535;
    WCU->colors[0].color.blue = 65535;
    WCU->colors[1].color.red = 0;
    WCU->colors[1].color.green = 0;
    WCU->colors[1].color.blue = 0;

    gdk_colormap_alloc_color(WCU->cmap, &WCU->colors[0].color, FALSE,
			     TRUE);
    WCU->colors[0].inuse = TRUE;
    gdk_colormap_alloc_color(WCU->cmap, &WCU->colors[1].color, FALSE,
			     TRUE);
    WCU->colors[1].inuse = TRUE;

    WCU->allocedcolor[0] = WCU->allocedcolor[1] = FALSE;
    for (i = 2; i < G_MAXCOLORS; i++)
	WCU->colors[i].inuse = FALSE;

    WCU->gattr.color = 1;
/*	gdk_gc_set_background(GC, widget->w->style->white_gc);
	gdk_gc_set_foreground(GC, widget->w->style->black_gc);
*/

    WCU->gattr.width = 0;
    WCU->gattr.mode = 0;
    WCU->gattr.fill = 0;
    WCU->gattr.style = 0;
    WCU->defgattr = WCU->gattr;
    WCU->font = NULL;
    WCU->wrect.o.x = 0.0, WCU->wrect.o.y = 0.0;
    WCU->wrect.c.x = 1.0, WCU->wrect.c.y = 1.0;
    WCU->vsize.x = ps.x, WCU->vsize.y = ps.y;

    for (ai = 0; ai < attrn; ai++) {
	switch (attrp[ai].id) {
	case G_ATTRCURSOR:
	    if (Strcmp(attrp[ai].u.t, "default") == 0) {
		curcursori = -1;
	    }
	    break;
	case G_ATTRCOLOR:
	    color = attrp[ai].u.c.index;
	    if (color < 0 || color > G_MAXCOLORS) {
		Gerr(POS, G_ERRBADCOLORINDEX, color);
		return -1;
	    }
	    r = attrp[ai].u.c.r * 257;
	    g = attrp[ai].u.c.g * 257;
	    b = attrp[ai].u.c.b * 257;
	    cp = &WCU->colors[color].color;
	    if (WCU->colors[color].inuse)
		if (cp->red != r || cp->green != g || cp->blue != b)
		    if (color > 1 || WCU->allocedcolor[color])
			gdk_colormap_free_colors(WCU->cmap, cp, 1);

	    cp->red = r, cp->green = g, cp->blue = b;
	    if (gdk_colormap_alloc_color(WCU->cmap, cp, TRUE, TRUE)) {
		WCU->colors[color].inuse = TRUE;
		if (color <= 1)
		    WCU->allocedcolor[color] = TRUE;
	    }
	    cp->red = r, cp->green = g, cp->blue = b;
	    if (color == WCU->gattr.color)
		WCU->gattr.color = -1;
	    break;
	case G_ATTRVIEWPORT:
	    WCU->vsize.x = (int) (attrp[ai].u.s.x + 0.5);
	    WCU->vsize.y = (int) (attrp[ai].u.s.y + 0.5);
	    break;
	case G_ATTRWINDOW:
	    WCU->wrect = attrp[ai].u.r;
	    break;
	}
    }
    adjustclip(widget);
    return 0;
}
Example #19
0
int main( int argc, char *argv[] )
{
	GtkWidget *mainbox, *hbox, *hbox2, *label,*pixmap_w;
/*	GdkPixmap *pixmap;
	GdkBitmap *mask;
	GtkStyle *style;*/

	init_pipes(); /* set all pipe data to 0 */

	command_line_options(argc, argv);

	/* g_thread_init(NULL); no ide why I had to remove it */
	gtk_init(&argc, &argv);
	gdk_rgb_init ();

/*	capturing_init = FALSE;
	playing = FALSE;*/

	signal(SIGSEGV, signal_handler);
	signal(SIGTERM, signal_handler);
	signal(SIGINT, signal_handler);
	signal(SIGPIPE, signal_handler);

	window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

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

	gtk_window_set_title (GTK_WINDOW (window), "Linux Video Studio");
	gtk_container_set_border_width (GTK_CONTAINER (window), 0);

	mainbox = gtk_vbox_new(FALSE,0);
	gtk_container_add (GTK_CONTAINER (window), mainbox);
	gtk_widget_show (mainbox);

	make_menus(mainbox);

	notebook = gtk_notebook_new ();

/*	style = gtk_widget_get_style(window);*/
	gtk_widget_realize(window);
	hbox = create_lavrec_layout(window);
	if (hbox != NULL)
	{
		hbox2 = gtk_hbox_new(FALSE, 10);
/*		pixmap = gdk_pixmap_create_from_xpm_d(window->window, &mask,
			&style->bg[GTK_STATE_NORMAL], cam_xpm);
		pixmap_w = gtk_pixmap_new(pixmap, mask);*/
		pixmap_w = gtk_widget_from_xpm_data(cam_xpm);
		gtk_widget_show(pixmap_w);
		gtk_box_pack_start(GTK_BOX(hbox2), pixmap_w, FALSE, FALSE, 0);
		label = gtk_label_new("Capture Video");
		gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0);
		gtk_widget_show(label);
		gtk_notebook_append_page (GTK_NOTEBOOK (notebook), hbox, hbox2);
		gtk_widget_show(hbox);
		gtk_widget_show(hbox2);
	}

	hbox = create_lavedit_layout(window);
	hbox2 = gtk_hbox_new(FALSE, 10);
/*	pixmap = gdk_pixmap_create_from_xpm_d(window->window, &mask, &style->bg[GTK_STATE_NORMAL], editing_xpm);
	pixmap_w = gtk_pixmap_new(pixmap, mask);*/
	pixmap_w = gtk_widget_from_xpm_data(editing_xpm);
	gtk_widget_show(pixmap_w);
	gtk_box_pack_start(GTK_BOX(hbox2), pixmap_w, FALSE, FALSE, 0);
	label = gtk_label_new("Edit Video");
	gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0);
	gtk_widget_show(label);
	gtk_notebook_append_page (GTK_NOTEBOOK (notebook), hbox, hbox2);
	gtk_widget_show(hbox);
	gtk_widget_show(hbox2);

	hbox = create_lavplay_layout();
	if (hbox != NULL)
	{
		hbox2 = gtk_hbox_new(FALSE, 10);
/*		pixmap = gdk_pixmap_create_from_xpm_d(window->window, &mask,
			&style->bg[GTK_STATE_NORMAL], tv_xpm);
		pixmap_w = gtk_pixmap_new(pixmap, mask);*/
		pixmap_w = gtk_widget_from_xpm_data(tv_xpm);
		gtk_widget_show(pixmap_w);
		gtk_box_pack_start(GTK_BOX(hbox2), pixmap_w, FALSE, FALSE, 0);
		label = gtk_label_new("Playback Video");
		gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0);
		gtk_widget_show(label);
		gtk_notebook_append_page (GTK_NOTEBOOK (notebook), hbox, hbox2);
		gtk_widget_show(hbox);
		gtk_widget_show(hbox2);
	}

        /* New notebook entry for encoding */
	hbox = create_lavencode_layout(); 
	hbox2 = gtk_hbox_new(FALSE, 10);
/*	pixmap = gdk_pixmap_create_from_xpm_d(window->window, &mask,
		&style->bg[GTK_STATE_NORMAL], arrows_xpm);
	pixmap_w = gtk_pixmap_new(pixmap, mask);*/
	pixmap_w = gtk_widget_from_xpm_data(arrows_xpm);
	gtk_widget_show(pixmap_w);
	gtk_box_pack_start(GTK_BOX(hbox2), pixmap_w, FALSE, FALSE, 0);
	label = gtk_label_new("Encode Video");
	gtk_box_pack_start(GTK_BOX(hbox2), label, FALSE, FALSE, 0);
	gtk_widget_show(label);
	gtk_notebook_append_page (GTK_NOTEBOOK (notebook), hbox, hbox2);
	gtk_widget_show(hbox);
	gtk_widget_show(hbox2);

	hbox = gtk_hbox_new(FALSE,5);
	gtk_box_pack_start(GTK_BOX(hbox), notebook, FALSE, FALSE, 5);
	gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook), GTK_POS_TOP);
	gtk_widget_show(notebook);
	gtk_box_pack_start(GTK_BOX(mainbox), hbox, FALSE, FALSE, 5);
	gtk_widget_show(hbox);

	gtk_signal_connect(GTK_OBJECT(notebook), "switch_page", GTK_SIGNAL_FUNC(notebook_page_switched),NULL);

	gtk_widget_show(window);
	if (verbose) g_print("Linux Video Studio initialized correctly\n");

	gdk_threads_enter();
	gtk_main();
	gdk_threads_leave();
	
	return 0;
}
Example #20
0
int main ( int argc, char** argv)
{
  int s = sizeof(local_uav);

  gtk_init(&argc, &argv);

  if (argc < 3)
  {
    printf("Use: ivy2serial ac_id serial_device\n");
    printf("or\n");
    printf("Use: ivy2serial ac_id serial_device xbee_power_level [0-4] to configure the xbee as broadcast, no retries\n");
    return -1;
  }

  if (argc == 4)
  {
    printf("Programming XBee Modem\n");
    power_level = (int) (argv[3][0]) - (int) '0';
    if (power_level < 0)
      power_level = 0;
    else if (power_level > 4)
      power_level = 4;
    printf("Set Power Level To: '%d'\n", power_level);
  }
  else
  {
    power_level = -1;
  }

  local_uav.ac_id = atoi(argv[1]);

  sprintf(status_str, "Listening to AC=%d, Serial Data Size = %d",local_uav.ac_id, s);
  sprintf(status_ivy_str, "---");
  sprintf(status_serial_str, "---");
  printf("%s\n",status_str);

  // Open Serial or Die
  port = argv[2];
  open_port(port);

  // Init UAV
  remote_uav.ac_id = 6;

  remote_uav.phi = 1000;
  remote_uav.theta = 200;
  remote_uav.psi = -3140;

  // Start IVY
  IvyInit ("IVY <-> Serial", "IVY <-> Serial READY", NULL, NULL, NULL, NULL);
  IvyBindMsg(on_Desired, NULL, "^%d DESIRED (\\S*) (\\S*) (\\S*) (\\S*) (\\S*) (\\S*) (\\S*)",local_uav.ac_id);
  IvyBindMsg(on_Estimator, NULL, "^%d ESTIMATOR (\\S*) (\\S*)",local_uav.ac_id);
  IvyBindMsg(on_Navigation, NULL, "^%d NAVIGATION (\\S*) (\\S*) (\\S*) (\\S*) (\\S*) (\\S*) (\\S*) (\\S*)",local_uav.ac_id);
  IvyBindMsg(on_Attitude, NULL, "^%d ATTITUDE (\\S*) (\\S*) (\\S*)", local_uav.ac_id);
  IvyBindMsg(on_Gps, NULL, "^%d GPS (\\S*) (\\S*) (\\S*) (\\S*) (\\S*) (\\S*) (\\S*) (\\S*) (\\S*) (\\S*) (\\S*)",local_uav.ac_id);
  IvyStart("127.255.255.255");

  // Add Timer
  gtk_timeout_add(delay / 4, timeout_callback, NULL);

  // GTK Window
  GtkWidget *window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_window_set_title (GTK_WINDOW (window), "IVY_Serial_Bridge");

  gtk_signal_connect (GTK_OBJECT (window), "delete_event",
                        GTK_SIGNAL_FUNC (delete_event), NULL);

  GtkWidget *box = gtk_vbox_new(TRUE, 1);
  gtk_container_add (GTK_CONTAINER (window), box);

  GtkWidget *hbox = gtk_hbox_new(FALSE, 1);
  gtk_container_add (GTK_CONTAINER (box), hbox);
  status = gtk_label_new( "Status:" );
  gtk_box_pack_start(GTK_BOX(hbox), status, FALSE, FALSE, 1);
  gtk_label_set_justify( (GtkLabel*) status, GTK_JUSTIFY_LEFT );
  status = gtk_label_new( status_str );
  gtk_box_pack_start(GTK_BOX(hbox), status, FALSE, FALSE, 1);
  gtk_label_set_justify( (GtkLabel*) status, GTK_JUSTIFY_LEFT );

  hbox = gtk_hbox_new(FALSE, 1);
  gtk_container_add (GTK_CONTAINER (box), hbox);
  status_ivy = gtk_label_new( "IVY->SERIAL:" );
  gtk_box_pack_start(GTK_BOX(hbox), status_ivy, FALSE, FALSE, 1);
  gtk_label_set_justify( (GtkLabel*) status_ivy, GTK_JUSTIFY_LEFT );
  status_ivy = gtk_label_new( status_ivy_str );
  gtk_box_pack_start(GTK_BOX(hbox), status_ivy, FALSE, FALSE, 1);
  gtk_label_set_justify( (GtkLabel*) status_ivy, GTK_JUSTIFY_LEFT );

  hbox = gtk_hbox_new(FALSE, 1);
  gtk_container_add (GTK_CONTAINER (box), hbox);
  status_serial = gtk_label_new( "SERIAL->IVY:" );
  gtk_box_pack_start(GTK_BOX(hbox), status_serial, FALSE, FALSE, 1);
  gtk_label_set_justify( (GtkLabel*) status_serial, GTK_JUSTIFY_LEFT );
  status_serial = gtk_label_new( status_serial_str );
  gtk_label_set_justify( GTK_LABEL(status_serial), GTK_JUSTIFY_LEFT );
  gtk_box_pack_start(GTK_BOX(hbox), status_serial, FALSE, FALSE, 1);


  gtk_widget_show_all(window);

  gtk_main();

  // Clean up
  fprintf(stderr,"Stopping\n");


  return 0;
}
Example #21
0
static void
setup_gtk (state_t *self)
{
    self->window = GTK_WINDOW (gtk_window_new (GTK_WINDOW_TOPLEVEL));
    gtk_window_set_title(self->window, "Camview");
    gtk_window_set_resizable(self->window, TRUE);
    gtk_window_set_default_size(self->window, 1000, 540);
    gtk_signal_connect (GTK_OBJECT (self->window), "delete_event", 
            GTK_SIGNAL_FUNC (gtk_main_quit), NULL);

    GtkWidget *vbox = gtk_vbox_new (FALSE, 0);
    gtk_container_add (GTK_CONTAINER (self->window), vbox);

    // menu bar
    GtkWidget *menubar = gtk_menu_bar_new ();
    gtk_box_pack_start (GTK_BOX (vbox), menubar, FALSE, TRUE, 0);
    
    // file menu
    GtkWidget *file_menu_item = gtk_menu_item_new_with_mnemonic ("_File");
    gtk_menu_bar_append (GTK_MENU_BAR (menubar), file_menu_item);
    GtkWidget *file_menu = gtk_menu_new ();
    gtk_menu_item_set_submenu (GTK_MENU_ITEM (file_menu_item), file_menu);
    
    GtkWidget *open_mi = 
        gtk_image_menu_item_new_from_stock (GTK_STOCK_OPEN, NULL);
    gtk_menu_append (GTK_MENU (file_menu), open_mi);
    gtk_signal_connect (GTK_OBJECT (open_mi), "activate", 
            GTK_SIGNAL_FUNC (on_open_menu_item_activate), self);
    
    GtkWidget *save_mi = 
        gtk_image_menu_item_new_from_stock (GTK_STOCK_SAVE, NULL);
    gtk_menu_append (GTK_MENU (file_menu), save_mi);
    gtk_signal_connect (GTK_OBJECT (save_mi), "activate", 
            GTK_SIGNAL_FUNC (on_save_menu_item_activate), self);
    
    GtkWidget *quit_mi = 
        gtk_image_menu_item_new_from_stock (GTK_STOCK_QUIT, NULL);
    gtk_menu_append (GTK_MENU (file_menu), quit_mi);
    gtk_signal_connect (GTK_OBJECT (quit_mi), "activate", 
            GTK_SIGNAL_FUNC (gtk_main_quit), NULL);

    // view menu
    GtkWidget *view_menu_item = gtk_menu_item_new_with_mnemonic ("_View");
    gtk_menu_bar_append (GTK_MENU_BAR (menubar), view_menu_item);
    GtkWidget *view_menu = gtk_menu_new ();
    gtk_menu_item_set_submenu (GTK_MENU_ITEM (view_menu_item), view_menu);

    GtkWidget *show_manager_mi = 
        gtk_check_menu_item_new_with_mnemonic ("Show _Manager");
    gtk_menu_append (GTK_MENU (view_menu), show_manager_mi);
    gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (show_manager_mi), 
            TRUE);
    gtk_signal_connect (GTK_OBJECT (show_manager_mi), "toggled",
            GTK_SIGNAL_FUNC (on_show_manager_mi_toggled), self);
    GtkWidget *show_chain_mi = 
        gtk_check_menu_item_new_with_mnemonic ("Show _Chain");
    gtk_menu_append (GTK_MENU (view_menu), show_chain_mi);
    gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (show_chain_mi), TRUE);
    gtk_signal_connect (GTK_OBJECT (show_chain_mi), "toggled",
            GTK_SIGNAL_FUNC (on_show_chain_mi_toggled), self);

    // horizontal panes
    GtkWidget *hpane1 = gtk_hpaned_new ();
    gtk_box_pack_start (GTK_BOX (vbox), hpane1, TRUE, TRUE, 0);
    self->manager_frame = gtk_frame_new ("Manager");
    gtk_paned_pack1 (GTK_PANED (hpane1), self->manager_frame, FALSE, TRUE);

    
    GtkWidget *hpane2 = gtk_hpaned_new ();
    gtk_paned_pack2 (GTK_PANED(hpane1), hpane2, TRUE, TRUE);

    self->chain_frame = gtk_frame_new ("Chain");
    GtkWidget *display_frame = gtk_frame_new ("Display");
    gtk_paned_pack1 (GTK_PANED(hpane2), display_frame, TRUE, TRUE);
    gtk_paned_pack2 (GTK_PANED(hpane2), self->chain_frame, FALSE, TRUE);

    gtk_paned_set_position (GTK_PANED (hpane1), 200);
    gtk_paned_set_position (GTK_PANED (hpane2), 400);


    // manager widget
    self->manager_widget = cam_unit_manager_widget_new ();
    GtkWidget *sw1 = gtk_scrolled_window_new (NULL, NULL);
    gtk_container_add (GTK_CONTAINER (sw1), GTK_WIDGET (self->manager_widget));
    //gtk_paned_pack1 (GTK_PANED (hpane1), sw, FALSE, TRUE);
    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw1), 
            GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
    g_signal_connect (G_OBJECT (self->manager_widget), 
            "unit-description-activated", 
            G_CALLBACK (on_unit_description_activated), self);

    // description widget
    self->desc_widget = cam_unit_description_widget_new ();
    cam_unit_description_widget_set_manager (
            CAM_UNIT_DESCRIPTION_WIDGET (self->desc_widget),
            self->manager_widget);
    GtkWidget *sw2 = gtk_scrolled_window_new (NULL, NULL);
    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw2), 
            GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
    gtk_container_add (GTK_CONTAINER (sw2), GTK_WIDGET (self->desc_widget));

    // vertical pane
    GtkWidget * vpane = gtk_vpaned_new ();
    gtk_paned_pack1 (GTK_PANED (vpane), sw1, TRUE, TRUE);
    gtk_paned_pack2 (GTK_PANED (vpane), sw2, FALSE, TRUE);
    gtk_paned_set_position (GTK_PANED (vpane), 350);
    //gtk_paned_pack1 (GTK_PANED (hpane1), vpane, FALSE, TRUE);
    gtk_container_add (GTK_CONTAINER (self->manager_frame), vpane);

    // chain gl widget
    self->chain_gl_widget = cam_unit_chain_gl_widget_new (self->chain);
    gtk_container_add (GTK_CONTAINER (display_frame), 
                GTK_WIDGET (self->chain_gl_widget));

    // chain widget
    self->chain_widget = cam_unit_chain_widget_new (self->chain);
    GtkWidget *sw_chain = gtk_scrolled_window_new (NULL, NULL);
    gtk_container_add (GTK_CONTAINER (self->chain_frame), sw_chain);
    gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw_chain), 
            GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
    gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw_chain), 
            GTK_WIDGET (self->chain_widget));

    gtk_widget_show_all (GTK_WIDGET (self->window));

    g_timeout_add(250, decay_fps, self);
}
Example #22
0
void dt_iop_gui_init_blendif(GtkVBox *blendw, dt_iop_module_t *module)
{
  dt_iop_gui_blend_data_t *bd = (dt_iop_gui_blend_data_t*)module->blend_data;

  /* create and add blendif support if module supports it */
  if (bd->blendif_support)
  {
    int lightness=32768;
    char *Lab_labels[3] = { "  L  ", "  a  ", "  b  " };
    char *Lab_tooltips[3] = { _("sliders for L channel"), _("sliders for a channel"), _("sliders for b channel") };
    char *rgb_labels[4] = { _(" gray "), _(" red "), _(" green "), _(" blue ") };
    char *rgb_tooltips[4] = { _("sliders for gray value"), _("sliders for red channel"), _("sliders for green channel"), _("sliders for blue channel") };

    GdkColor Lab_colors[4][3] = { { /* L channel */
                                   (GdkColor){ 0,0,0,0 }, (GdkColor){ 0,lightness/2,lightness/2,lightness/2 }, (GdkColor){ 0,lightness,lightness,lightness }
                                  },
                                  { /* a channel */
                                   (GdkColor){ 0,0,0.34*lightness*2,0.27*lightness*2 }, (GdkColor){ 0,lightness,lightness,lightness }, (GdkColor){ 0,0.53*lightness*2,0.08*lightness*2,0.28*lightness*2 }
                                  },
                                  { /* b channel */
                                   (GdkColor){ 0,0,0.27*lightness*2,0.58*lightness*2 }, (GdkColor){ 0,lightness,lightness,lightness }, (GdkColor){ 0,0.81*lightness*2,0.66*lightness*2,0 }
                                  },
                                  { /* not used */
                                   (GdkColor){ 0,0,0,0 }, (GdkColor){ 0,0,0,0 }, (GdkColor){ 0,0,0,0 }
                                  } };                     

    GdkColor rgb_colors[4][3] = { { /* gray channel */
                                   (GdkColor){ 0,0,0,0 }, (GdkColor){ 0,lightness/2,lightness/2,lightness/2 }, (GdkColor){ 0,lightness,lightness,lightness }
                                  },
                                  { /* red channel */
                                   (GdkColor){ 0,0,0,0 }, (GdkColor){ 0,lightness/2,0,0 }, (GdkColor){ 0,lightness,0,0 }
                                  },
                                  { /* green channel */
                                   (GdkColor){ 0,0,0,0 }, (GdkColor){ 0,0,lightness/2,0 }, (GdkColor){ 0,0,lightness,0 }
                                  },
                                  { /* blue channel */
                                   (GdkColor){ 0,0,0,0 }, (GdkColor){ 0,0,0,lightness/2 }, (GdkColor){ 0,0,0,lightness }
                                  } };

    char *ttinput = _("adjustment based on input received by this module:\n* range between inner markers (upper filled triangles): blend fully\n* range outside of outer markers (lower open triangles): do not blend at all\n* range between adjacent inner/outer markers: blend gradually");

    char *ttoutput = _("adjustment based on unblended output of this module:\n* range between inner markers (upper filled triangles): blend fully\n* range outside of outer markers (lower open triangles): do not blend at all\n* range between adjacent inner/outer markers: blend gradually");


    bd->channel = 0;

    int maxchannels = 0;
    char **labels = NULL;
    char **tooltips = NULL;

    switch(bd->csp)
    {
      case iop_cs_Lab:
        maxchannels = 3;
        labels = Lab_labels;
        tooltips = Lab_tooltips;
        memcpy(bd->colors, Lab_colors, sizeof(rgb_colors));
        bd->scale_print[0] = _blendif_scale_print_L;
        bd->scale_print[1] = _blendif_scale_print_ab;
        bd->scale_print[2] = _blendif_scale_print_ab;
        bd->scale_print[3] = NULL;
        bd->increments[0] = 1.0f/100.0f;
        bd->increments[1] = 1.0f/256.0f;
        bd->increments[2] = 1.0f/256.0f;
        bd->increments[3] = 1.0f;
        break;
      case iop_cs_rgb:
        maxchannels = 4;
        labels = rgb_labels;
        tooltips = rgb_tooltips;
        memcpy(bd->colors, rgb_colors, sizeof(rgb_colors));
        bd->scale_print[0] = _blendif_scale_print_rgb;
        bd->scale_print[1] = _blendif_scale_print_rgb;
        bd->scale_print[2] = _blendif_scale_print_rgb;
        bd->scale_print[3] = _blendif_scale_print_rgb;
        bd->increments[0] = 1.0f/255.0f;
        bd->increments[1] = 1.0f/255.0f;
        bd->increments[2] = 1.0f/255.0f;
        bd->increments[3] = 1.0f/255.0f;
        break;
      default:
        assert(FALSE);		// blendif not supported for RAW, which is already catched upstream; we should not get here
    }


    bd->blendif_box = GTK_VBOX(gtk_vbox_new(FALSE,DT_GUI_IOP_MODULE_CONTROL_SPACING));
    GtkWidget *uplabel = gtk_hbox_new(FALSE,0);
    GtkWidget *lowlabel = gtk_hbox_new(FALSE,0);
    GtkWidget *notebook = gtk_hbox_new(FALSE,0);

    bd->blendif_enable = dt_bauhaus_combobox_new(module);
    dt_bauhaus_widget_set_label(bd->blendif_enable, _("blend"));
    dt_bauhaus_combobox_add(bd->blendif_enable, _("uniformly"));
    dt_bauhaus_combobox_add(bd->blendif_enable, _("only, if.."));

    bd->channel_tabs = GTK_NOTEBOOK(gtk_notebook_new());

    for(int ch=0; ch<maxchannels; ch++)
    {
      gtk_notebook_append_page(GTK_NOTEBOOK(bd->channel_tabs), GTK_WIDGET(gtk_hbox_new(FALSE,0)), gtk_label_new(labels[ch]));
      g_object_set(G_OBJECT(gtk_notebook_get_tab_label(bd->channel_tabs, gtk_notebook_get_nth_page(bd->channel_tabs, -1))), "tooltip-text", tooltips[ch], NULL);
    }

    gtk_widget_show_all(GTK_WIDGET(gtk_notebook_get_nth_page(bd->channel_tabs, bd->channel)));
    gtk_notebook_set_current_page(GTK_NOTEBOOK(bd->channel_tabs), bd->channel);
    g_object_set(G_OBJECT(bd->channel_tabs), "homogeneous", TRUE, (char *)NULL);

    GtkWidget *tb = dtgtk_togglebutton_new(dtgtk_cairo_paint_colorpicker, CPF_STYLE_FLAT);
    g_object_set(G_OBJECT(tb), "tooltip-text", _("pick gui color from image"), (char *)NULL);

    GtkWidget *sm = dtgtk_togglebutton_new(dtgtk_cairo_paint_showmask, CPF_STYLE_FLAT);
    g_object_set(G_OBJECT(sm), "tooltip-text", _("display mask"), (char *)NULL);

    gtk_box_pack_start(GTK_BOX(notebook), GTK_WIDGET(bd->channel_tabs), FALSE, FALSE, 0);
    gtk_box_pack_end(GTK_BOX(notebook), GTK_WIDGET(tb), FALSE, FALSE, 0);
    gtk_box_pack_end(GTK_BOX(notebook), GTK_WIDGET(sm), FALSE, FALSE, 0);

    bd->lower_slider = DTGTK_GRADIENT_SLIDER_MULTIVALUE(dtgtk_gradient_slider_multivalue_new(4));
    bd->upper_slider = DTGTK_GRADIENT_SLIDER_MULTIVALUE(dtgtk_gradient_slider_multivalue_new(4));

    dtgtk_gradient_slider_multivalue_set_marker(bd->lower_slider, GRADIENT_SLIDER_MARKER_LOWER_OPEN_BIG, 0);
    dtgtk_gradient_slider_multivalue_set_marker(bd->lower_slider, GRADIENT_SLIDER_MARKER_UPPER_FILLED_BIG, 1);
    dtgtk_gradient_slider_multivalue_set_marker(bd->lower_slider, GRADIENT_SLIDER_MARKER_UPPER_FILLED_BIG, 2);
    dtgtk_gradient_slider_multivalue_set_marker(bd->lower_slider, GRADIENT_SLIDER_MARKER_LOWER_OPEN_BIG, 3);

    dtgtk_gradient_slider_multivalue_set_marker(bd->upper_slider, GRADIENT_SLIDER_MARKER_LOWER_OPEN_BIG, 0);
    dtgtk_gradient_slider_multivalue_set_marker(bd->upper_slider, GRADIENT_SLIDER_MARKER_UPPER_FILLED_BIG, 1);
    dtgtk_gradient_slider_multivalue_set_marker(bd->upper_slider, GRADIENT_SLIDER_MARKER_UPPER_FILLED_BIG, 2);
    dtgtk_gradient_slider_multivalue_set_marker(bd->upper_slider, GRADIENT_SLIDER_MARKER_LOWER_OPEN_BIG, 3);

    dtgtk_gradient_slider_multivalue_set_stop(bd->lower_slider, 0.0f, bd->colors[bd->channel][0]);
    dtgtk_gradient_slider_multivalue_set_stop(bd->lower_slider, 0.5f, bd->colors[bd->channel][1]);
    dtgtk_gradient_slider_multivalue_set_stop(bd->lower_slider, 1.0f, bd->colors[bd->channel][2]);

    dtgtk_gradient_slider_multivalue_set_stop(bd->upper_slider, 0.0f, bd->colors[bd->channel][0]);
    dtgtk_gradient_slider_multivalue_set_stop(bd->upper_slider, 0.5f, bd->colors[bd->channel][1]);
    dtgtk_gradient_slider_multivalue_set_stop(bd->upper_slider, 1.0f, bd->colors[bd->channel][2]);

    GtkWidget *output = gtk_label_new(_("output"));
    bd->upper_picker_label = GTK_LABEL(gtk_label_new(""));
    gtk_box_pack_start(GTK_BOX(uplabel), GTK_WIDGET(output), FALSE, FALSE, 0);
    gtk_box_pack_start(GTK_BOX(uplabel), GTK_WIDGET(bd->upper_picker_label), TRUE, TRUE, 0);
    for(int k=0; k < 4 ; k++)
    {
      bd->upper_label[k] = GTK_LABEL(gtk_label_new(NULL));
      gtk_label_set_width_chars(bd->upper_label[k], 6);
      gtk_box_pack_start(GTK_BOX(uplabel), GTK_WIDGET(bd->upper_label[k]), FALSE, FALSE, 0);      
    }

    GtkWidget *input = gtk_label_new(_("input"));
    bd->lower_picker_label = GTK_LABEL(gtk_label_new(""));
    gtk_box_pack_start(GTK_BOX(lowlabel), GTK_WIDGET(input), FALSE, FALSE, 0);
    gtk_box_pack_start(GTK_BOX(lowlabel), GTK_WIDGET(bd->lower_picker_label), TRUE, TRUE, 0);
    for(int k=0; k < 4 ; k++)
    {
      bd->lower_label[k] = GTK_LABEL(gtk_label_new(NULL));
      gtk_label_set_width_chars(bd->lower_label[k], 6);
      gtk_box_pack_start(GTK_BOX(lowlabel), GTK_WIDGET(bd->lower_label[k]), FALSE, FALSE, 0);      
    }

    gtk_object_set(GTK_OBJECT(bd->blendif_enable), "tooltip-text", _("enable conditional blending"), (char *)NULL);
    gtk_object_set(GTK_OBJECT(bd->lower_slider), "tooltip-text", _("double click to reset"), (char *)NULL);
    gtk_object_set(GTK_OBJECT(bd->upper_slider), "tooltip-text", _("double click to reset"), (char *)NULL);
    gtk_object_set(GTK_OBJECT(output), "tooltip-text", ttoutput, (char *)NULL);
    gtk_object_set(GTK_OBJECT(input), "tooltip-text", ttinput, (char *)NULL);


    g_signal_connect (G_OBJECT (bd->lower_slider), "expose-event",
                      G_CALLBACK (_blendop_blendif_expose), module);

    g_signal_connect (G_OBJECT (bd->upper_slider), "expose-event",
                      G_CALLBACK (_blendop_blendif_expose), module);

    g_signal_connect (G_OBJECT (bd->blendif_enable), "value-changed",
                      G_CALLBACK (_blendop_blendif_callback), bd);

    g_signal_connect(G_OBJECT (bd->channel_tabs), "switch_page",
                     G_CALLBACK (_blendop_blendif_tab_switch), bd);

    g_signal_connect (G_OBJECT (bd->upper_slider), "value-changed",
                      G_CALLBACK (_blendop_blendif_upper_callback), bd);

    g_signal_connect (G_OBJECT (bd->lower_slider), "value-changed",
                      G_CALLBACK (_blendop_blendif_lower_callback), bd);

    g_signal_connect (G_OBJECT(tb), "toggled", 
                      G_CALLBACK (_blendop_blendif_pick_toggled), module);

    g_signal_connect (G_OBJECT(sm), "toggled", 
                      G_CALLBACK (_blendop_blendif_showmask_toggled), module);


    gtk_box_pack_start(GTK_BOX(bd->blendif_box), GTK_WIDGET(notebook), TRUE, FALSE, 0);
    gtk_box_pack_start(GTK_BOX(bd->blendif_box), GTK_WIDGET(uplabel), TRUE, FALSE, 0);
    gtk_box_pack_start(GTK_BOX(bd->blendif_box), GTK_WIDGET(bd->upper_slider), TRUE, FALSE, 0);
    gtk_box_pack_start(GTK_BOX(bd->blendif_box), GTK_WIDGET(lowlabel), TRUE, FALSE, 0);
    gtk_box_pack_start(GTK_BOX(bd->blendif_box), GTK_WIDGET(bd->lower_slider), TRUE, FALSE, 0);

    gtk_box_pack_end(GTK_BOX(blendw), GTK_WIDGET(bd->blendif_box),TRUE,TRUE,0);
    gtk_box_pack_end(GTK_BOX(blendw), GTK_WIDGET(bd->blendif_enable),TRUE,TRUE,0);
  }
}
Example #23
0
int l_vmat(int *kodv,//выбранный код
int kodgr, //Код группы для которой ищем записи
int metkarr, //0-работа со списком товаров 1-списком услуг
GtkWidget *wpredok)
{
vmat_data data;
char strsql[300];
//GdkColor color;
SQLCURSOR cur;
SQL_str   row;
printf("l_vmat %d\n",kodgr);

data.kodgr=kodgr;
data.metkarr=metkarr;
if(metkarr == 0)
  sprintf(strsql,"select naik from Grup where kod=%d",kodgr);
if(metkarr == 1)
  sprintf(strsql,"select naik from Uslgrup where kod=%d",kodgr);

if(sql_readkey(&bd,strsql,&row,&cur) == 1)
 data.naigr.new_plus(row[0]);

data.window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

gtk_window_set_position( GTK_WINDOW(data.window),ICEB_POS_CENTER);
gtk_window_set_modal(GTK_WINDOW(data.window),TRUE);

gtk_window_set_default_size (GTK_WINDOW  (data.window),600,600);
//gdk_color_parse("black",&color);
//gtk_widget_modify_bg(data.window,GTK_STATE_NORMAL,&color);

if(metkarr == 0)
  sprintf(strsql,"%s %s",name_system,gettext("Список товаров"));
if(metkarr == 1)
  sprintf(strsql,"%s %s",name_system,gettext("Список услуг"));

gtk_window_set_title (GTK_WINDOW (data.window),strsql);
gtk_container_set_border_width (GTK_CONTAINER (data.window), 5);

gtk_signal_connect(GTK_OBJECT(data.window),"delete_event",GTK_SIGNAL_FUNC(gtk_widget_destroy),NULL);
gtk_signal_connect(GTK_OBJECT(data.window),"destroy",GTK_SIGNAL_FUNC(gtk_main_quit),NULL);


if(wpredok != NULL)
 {
  //Удерживать окно над породившем его окном всегда
  gtk_window_set_transient_for(GTK_WINDOW(data.window),GTK_WINDOW(wpredok));
  //Закрыть окно если окно предок удалено
  gtk_window_set_destroy_with_parent(GTK_WINDOW(data.window),TRUE);
 }

gtk_signal_connect_after(GTK_OBJECT(data.window),"key_press_event",GTK_SIGNAL_FUNC(vmat_key_press),&data);
gtk_signal_connect_after(GTK_OBJECT(data.window),"key_release_event",GTK_SIGNAL_FUNC(iceb_key_release),&data.kl_shift);

GtkWidget *hbox = gtk_hbox_new (FALSE, 1);
gtk_container_add (GTK_CONTAINER (data.window), hbox);

GtkWidget *vbox1 = gtk_vbox_new (FALSE, 1);
GtkWidget *vbox2 = gtk_vbox_new (FALSE, 1);

gtk_box_pack_start (GTK_BOX (hbox), vbox1, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox), vbox2, TRUE, TRUE, 0);
gtk_widget_show(hbox);

data.label_kolstr=gtk_label_new (gettext("Выберите нужную запись"));
//gdk_color_parse("green",&color);
//gtk_widget_modify_fg(data.label_kolstr,GTK_STATE_NORMAL,&color);


gtk_box_pack_start (GTK_BOX (vbox2),data.label_kolstr,FALSE, FALSE, 0);

gtk_widget_show(vbox1);
gtk_widget_show(vbox2);

data.sw = gtk_scrolled_window_new (NULL, NULL);
gtk_widget_set_usize(GTK_WIDGET(data.sw),400,300);

gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (data.sw),GTK_SHADOW_ETCHED_IN);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (data.sw),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC);
//gtk_box_pack_start (GTK_BOX (vbox2), data.sw, TRUE, TRUE, 0);
gtk_box_pack_end (GTK_BOX (vbox2), data.sw, TRUE, TRUE, 0);

//Кнопки
GtkTooltips *tooltips[KOL_F_KL];

sprintf(strsql,"F2 %s",gettext("Выбор"));
data.knopka[FK2]=gtk_button_new_with_label(strsql);
gtk_box_pack_start(GTK_BOX(vbox1), data.knopka[FK2], TRUE, TRUE, 0);
gtk_signal_connect(GTK_OBJECT(data.knopka[FK2]), "clicked",GTK_SIGNAL_FUNC(vmat_knopka),&data);
tooltips[FK2]=gtk_tooltips_new();
gtk_tooltips_set_tip(tooltips[FK2],data.knopka[FK2],gettext("Выбор отмеченной записи"),NULL);
gtk_object_set_user_data(GTK_OBJECT(data.knopka[FK2]),(gpointer)FK2);
gtk_widget_show(data.knopka[FK2]);

GtkWidget *arrow=gtk_arrow_new(GTK_ARROW_UP,GTK_SHADOW_OUT);

//sprintf(strsql,"%s",gettext("Вверх"));
//data.knopka[FK_VVERH]=gtk_button_new_with_label(strsql);
data.knopka[FK_VVERH]=gtk_button_new();
gtk_container_add(GTK_CONTAINER(data.knopka[FK_VVERH]),arrow);

gtk_box_pack_start(GTK_BOX(vbox1), data.knopka[FK_VVERH], TRUE, TRUE, 0);
//gtk_signal_connect(GTK_OBJECT(data.knopka[FK_VVERH]), "clicked",GTK_SIGNAL_FUNC(vmat_knopka),&data);
gtk_signal_connect(GTK_OBJECT(data.knopka[FK_VVERH]), "pressed",GTK_SIGNAL_FUNC(l_vmat_knopka_vverh_press),&data);
gtk_signal_connect(GTK_OBJECT(data.knopka[FK_VVERH]), "released",GTK_SIGNAL_FUNC(l_vmat_knopka_released),&data);
//tooltips[FK_VVERH]=gtk_tooltips_new();
//gtk_tooltips_set_tip(tooltips[FK_VVERH],data.knopka[FK_VVERH],gettext("Выбор отмеченной записи"),NULL);
gtk_object_set_user_data(GTK_OBJECT(data.knopka[FK_VVERH]),(gpointer)FK_VVERH);
gtk_widget_show(data.knopka[FK_VVERH]);
gtk_widget_show(arrow);

arrow=gtk_arrow_new(GTK_ARROW_DOWN,GTK_SHADOW_OUT);

//sprintf(strsql,"%s",gettext("Вниз"));
//data.knopka[FK_VNIZ]=gtk_button_new_with_label(strsql);

data.knopka[FK_VNIZ]=gtk_button_new();
gtk_container_add(GTK_CONTAINER(data.knopka[FK_VNIZ]),arrow);

gtk_box_pack_start(GTK_BOX(vbox1), data.knopka[FK_VNIZ], TRUE, TRUE, 0);
//gtk_signal_connect(GTK_OBJECT(data.knopka[FK_VNIZ]), "clicked",GTK_SIGNAL_FUNC(vmat_knopka),&data);
gtk_signal_connect(GTK_OBJECT(data.knopka[FK_VNIZ]), "pressed",GTK_SIGNAL_FUNC(l_vmat_knopka_vniz_press),&data);
gtk_signal_connect(GTK_OBJECT(data.knopka[FK_VNIZ]), "released",GTK_SIGNAL_FUNC(l_vmat_knopka_released),&data);
//tooltips[FK_VNIZ]=gtk_tooltips_new();
//gtk_tooltips_set_tip(tooltips[FK_VNIZ],data.knopka[FK_VNIZ],gettext("Выбор отмеченной записи"),NULL);
gtk_object_set_user_data(GTK_OBJECT(data.knopka[FK_VNIZ]),(gpointer)FK_VNIZ);
gtk_widget_show(data.knopka[FK_VNIZ]);
gtk_widget_show(arrow);


sprintf(strsql,"F10 %s",gettext("Выход"));
data.knopka[FK10]=gtk_button_new_with_label(strsql);
gtk_box_pack_start(GTK_BOX(vbox1),data.knopka[FK10],TRUE,TRUE, 0);
tooltips[FK10]=gtk_tooltips_new();
gtk_tooltips_set_tip(tooltips[FK10],data.knopka[FK10],gettext("Завершение работы в этом окне"),NULL);
gtk_signal_connect(GTK_OBJECT(data.knopka[FK10]), "clicked",GTK_SIGNAL_FUNC(vmat_knopka),&data);
gtk_object_set_user_data(GTK_OBJECT(data.knopka[FK10]),(gpointer)FK10);
gtk_widget_show(data.knopka[FK10]);


gtk_widget_realize(data.window);
gdk_window_set_cursor(data.window->window,gdk_cursor_new(ICEB_CURSOR));

gtk_widget_grab_focus(data.knopka[FK10]);

vmat_create_list (&data);

//gtk_window_maximize(GTK_WINDOW(data.window));
//gtk_window_fullscreen(GTK_WINDOW(data.window));
gtk_widget_show(data.window);

gtk_main();

printf("l_vmat end\n");
*kodv=atoi(data.kod.ravno());
return(data.voz);
}
Example #24
0
void dt_iop_gui_init_blending(GtkWidget *iopw, dt_iop_module_t *module)
{
  /* create and add blend mode if module supports it */
  if (module->flags()&IOP_FLAGS_SUPPORTS_BLENDING)
  {
    module->blend_data = g_malloc(sizeof(dt_iop_gui_blend_data_t));
    dt_iop_gui_blend_data_t *bd = (dt_iop_gui_blend_data_t*)module->blend_data;

    dt_iop_gui_blendop_modes_t modes[21]; /* number must fit exactly!!! */
    modes[0].mode  = DEVELOP_BLEND_DISABLED;          modes[0].name  = _("off");
    modes[1].mode  = DEVELOP_BLEND_NORMAL;            modes[1].name  = _("normal");
    modes[2].mode  = DEVELOP_BLEND_INVERSE;           modes[2].name  = _("inverse");
    modes[3].mode  = DEVELOP_BLEND_LIGHTEN;           modes[3].name  = _("lighten");
    modes[4].mode  = DEVELOP_BLEND_DARKEN;            modes[4].name  = _("darken");
    modes[5].mode  = DEVELOP_BLEND_MULTIPLY;          modes[5].name  = _("multiply");
    modes[6].mode  = DEVELOP_BLEND_AVERAGE;           modes[6].name  = _("average");
    modes[7].mode  = DEVELOP_BLEND_ADD;               modes[7].name  = _("addition");
    modes[8].mode  = DEVELOP_BLEND_SUBSTRACT;         modes[8].name  = _("subtract");
    modes[9].mode  = DEVELOP_BLEND_DIFFERENCE;        modes[9].name  = _("difference");
    modes[10].mode = DEVELOP_BLEND_SCREEN;            modes[10].name = _("screen");
    modes[11].mode = DEVELOP_BLEND_OVERLAY;           modes[11].name = _("overlay");
    modes[12].mode = DEVELOP_BLEND_SOFTLIGHT;         modes[12].name = _("softlight");
    modes[13].mode = DEVELOP_BLEND_HARDLIGHT;         modes[13].name = _("hardlight");
    modes[14].mode = DEVELOP_BLEND_VIVIDLIGHT;        modes[14].name = _("vividlight");
    modes[15].mode = DEVELOP_BLEND_LINEARLIGHT;       modes[15].name = _("linearlight");
    modes[16].mode = DEVELOP_BLEND_PINLIGHT;          modes[16].name = _("pinlight");
    modes[17].mode = DEVELOP_BLEND_LIGHTNESS;         modes[17].name = _("lightness");
    modes[18].mode = DEVELOP_BLEND_CHROMA;            modes[18].name = _("chroma");
    modes[19].mode = DEVELOP_BLEND_HUE;               modes[19].name = _("hue");
    modes[20].mode = DEVELOP_BLEND_COLOR;             modes[20].name = _("color");


    bd->number_modes = sizeof(modes) / sizeof(dt_iop_gui_blendop_modes_t);
    memcpy(bd->modes, modes, bd->number_modes * sizeof(dt_iop_gui_blendop_modes_t));
    bd->iopw = iopw;
    bd->module = module;
    bd->csp = dt_iop_module_colorspace(module);
    bd->blendif_support = (bd->csp == iop_cs_Lab || bd->csp == iop_cs_rgb);
    bd->blendif_box = NULL;

    bd->blend_modes_combo = dt_bauhaus_combobox_new(module);
    dt_bauhaus_widget_set_label(bd->blend_modes_combo, _("blend mode"));
    bd->opacity_slider = dt_bauhaus_slider_new_with_range(module, 0.0, 100.0, 1, 100.0, 0);
    dt_bauhaus_widget_set_label(bd->opacity_slider, _("opacity"));
    dt_bauhaus_slider_set_format(bd->opacity_slider, "%.0f%%");
    module->fusion_slider = bd->opacity_slider;


    for(int k = 0; k < bd->number_modes; k++)
      dt_bauhaus_combobox_add(bd->blend_modes_combo, bd->modes[k].name);
    
    dt_bauhaus_combobox_set(bd->blend_modes_combo, 0);

    gtk_object_set(GTK_OBJECT(bd->opacity_slider), "tooltip-text", _("set the opacity of the blending"), (char *)NULL);
    gtk_object_set(GTK_OBJECT(bd->blend_modes_combo), "tooltip-text", _("choose blending mode"), (char *)NULL);

    g_signal_connect (G_OBJECT (bd->opacity_slider), "value-changed",
                      G_CALLBACK (_blendop_opacity_callback), bd);
    g_signal_connect (G_OBJECT (bd->blend_modes_combo), "value-changed",
                      G_CALLBACK (_blendop_mode_callback), bd);

    gtk_box_pack_start(GTK_BOX(iopw), bd->blend_modes_combo, TRUE, TRUE,0);
    gtk_box_pack_start(GTK_BOX(iopw), bd->opacity_slider, TRUE, TRUE,0);

    if(bd->blendif_support)
    {
      dt_iop_gui_init_blendif(GTK_VBOX(iopw), module);
    }
    gtk_widget_queue_draw(GTK_WIDGET(iopw));
  }
}
Example #25
0
GtkWidget*
create_msg_dbox (void)
{
  GtkWidget *msg_dbox;
  GtkWidget *dialog_vbox1;
  GtkWidget *label2;
  GtkWidget *dialog_action_area1;
  GtkWidget *hbuttonbox1;
  GtkWidget *button1;
  GtkWidget *hbox1;
  GtkWidget *pixmap1;
  guint label1_key;
  GtkWidget *label1;
  GtkAccelGroup *accel_group;

  accel_group = gtk_accel_group_new ();

  msg_dbox = gtk_dialog_new ();
  gtk_object_set_data (GTK_OBJECT (msg_dbox), "msg_dbox", msg_dbox);
  gtk_window_set_title (GTK_WINDOW (msg_dbox), _("Title"));

  dialog_vbox1 = GTK_DIALOG (msg_dbox)->vbox;
  gtk_object_set_data (GTK_OBJECT (msg_dbox), "dialog_vbox1", dialog_vbox1);
  gtk_widget_show (dialog_vbox1);

  label2 = gtk_label_new (_("Message."));
  gtk_widget_ref (label2);
  gtk_object_set_data_full (GTK_OBJECT (msg_dbox), "label2", label2,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label2);
  gtk_box_pack_start (GTK_BOX (dialog_vbox1), label2, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_FILL);
  gtk_label_set_line_wrap (GTK_LABEL (label2), TRUE);
  gtk_misc_set_alignment (GTK_MISC (label2), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label2), 5, 5);

  dialog_action_area1 = GTK_DIALOG (msg_dbox)->action_area;
  gtk_object_set_data (GTK_OBJECT (msg_dbox), "dialog_action_area1", dialog_action_area1);
  gtk_widget_show (dialog_action_area1);
  gtk_container_set_border_width (GTK_CONTAINER (dialog_action_area1), 10);

  hbuttonbox1 = gtk_hbutton_box_new ();
  gtk_widget_ref (hbuttonbox1);
  gtk_object_set_data_full (GTK_OBJECT (msg_dbox), "hbuttonbox1", hbuttonbox1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbuttonbox1);
  gtk_box_pack_start (GTK_BOX (dialog_action_area1), hbuttonbox1, TRUE, TRUE, 0);

  button1 = gtk_button_new ();
  gtk_widget_ref (button1);
  gtk_object_set_data_full (GTK_OBJECT (msg_dbox), "button1", button1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button1);
  gtk_container_add (GTK_CONTAINER (hbuttonbox1), button1);
  GTK_WIDGET_SET_FLAGS (button1, GTK_CAN_DEFAULT);
  gtk_widget_add_accelerator (button1, "clicked", accel_group,
                              GDK_Return, 0,
                              GTK_ACCEL_VISIBLE);
  gtk_widget_add_accelerator (button1, "clicked", accel_group,
                              GDK_Escape, 0,
                              GTK_ACCEL_VISIBLE);

  hbox1 = gtk_hbox_new (FALSE, 0);
  gtk_widget_ref (hbox1);
  gtk_object_set_data_full (GTK_OBJECT (msg_dbox), "hbox1", hbox1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox1);
  gtk_container_add (GTK_CONTAINER (button1), hbox1);

  pixmap1 = create_pixmap (msg_dbox, "yes.xpm");
  gtk_widget_ref (pixmap1);
  gtk_object_set_data_full (GTK_OBJECT (msg_dbox), "pixmap1", pixmap1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (pixmap1);
  gtk_box_pack_start (GTK_BOX (hbox1), pixmap1, TRUE, FALSE, 0);

  label1 = gtk_label_new ("");
  label1_key = gtk_label_parse_uline (GTK_LABEL (label1),
                                   _("_OK"));
  gtk_widget_ref (label1);
  gtk_object_set_data_full (GTK_OBJECT (msg_dbox), "label1", label1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label1);
  gtk_box_pack_start (GTK_BOX (hbox1), label1, FALSE, TRUE, 0);
  gtk_misc_set_alignment (GTK_MISC (label1), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label1), 5, 0);

  gtk_signal_connect (GTK_OBJECT (msg_dbox), "destroy",
                      GTK_SIGNAL_FUNC (on_msg_dbox_destroy),
                      msg_box);
  gtk_signal_connect (GTK_OBJECT (button1), "clicked",
                      GTK_SIGNAL_FUNC (msg_ok_button_clicked),
                      msg_dbox);

  gtk_widget_add_accelerator (button1, "clicked", accel_group,
                              label1_key, GDK_MOD1_MASK, 0);

  gtk_window_add_accel_group (GTK_WINDOW (msg_dbox), accel_group);

  return msg_dbox;
}
Example #26
0
 void read_rek()
  {
   for(int i=0; i < KOLENTER; i++)
     gtk_signal_emit_by_name(GTK_OBJECT(entry[i]),"activate");
  }
Example #27
0
int main( int   argc,
          char *argv[] )
{
    GtkWidget *window = NULL;
    GtkWidget *box1;
    GtkWidget *box2;
    GtkWidget *button;
    GtkWidget *separator;
    GSList *group;

    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_window_set_title (GTK_WINDOW (window), "radio buttons");
    gtk_container_set_border_width (GTK_CONTAINER (window), 0);

    box1 = gtk_vbox_new (FALSE, 0);
    gtk_container_add (GTK_CONTAINER (window), box1);
    gtk_widget_show (box1);

    box2 = gtk_vbox_new (FALSE, 10);
    gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
    gtk_box_pack_start (GTK_BOX (box1), box2, TRUE, TRUE, 0);
    gtk_widget_show (box2);

    button = gtk_radio_button_new_with_label (NULL, "button1");
    gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
    gtk_widget_show (button);

    group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
    button = gtk_radio_button_new_with_label(group, "button2");
    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
    gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
    gtk_widget_show (button);

    button = gtk_radio_button_new_with_label(
                 gtk_radio_button_group (GTK_RADIO_BUTTON (button)),
                 "button3");
    gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
    gtk_widget_show (button);

    separator = gtk_hseparator_new ();
    gtk_box_pack_start (GTK_BOX (box1), separator, FALSE, TRUE, 0);
    gtk_widget_show (separator);

    box2 = gtk_vbox_new (FALSE, 10);
    gtk_container_set_border_width (GTK_CONTAINER (box2), 10);
    gtk_box_pack_start (GTK_BOX (box1), box2, FALSE, TRUE, 0);
    gtk_widget_show (box2);

    button = gtk_button_new_with_label ("close");
    gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
                               GTK_SIGNAL_FUNC(close_application),
                               GTK_OBJECT (window));
    gtk_box_pack_start (GTK_BOX (box2), button, TRUE, TRUE, 0);
    GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
    gtk_widget_grab_default (button);
    gtk_widget_show (button);
    gtk_widget_show (window);

    gtk_main();

    return(0);
}
Example #28
0
int vmat_medp(iceb_u_str *innom,short *dn,short *mn,short *gn,iceb_u_str *regnom,GtkWidget *wpredok)
{
vmat_medp_data data;

char strsql[512];

data.window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_position( GTK_WINDOW(data.window),ICEB_POS_CENTER);
gtk_window_set_modal(GTK_WINDOW(data.window),TRUE);

sprintf(strsql,"%s %s",name_system,gettext("Ввод карточки мед. препората"));
gtk_window_set_title (GTK_WINDOW (data.window),strsql);
gtk_container_set_border_width (GTK_CONTAINER (data.window), 5);

gtk_signal_connect(GTK_OBJECT(data.window),"delete_event",GTK_SIGNAL_FUNC(gtk_widget_destroy),NULL);
gtk_signal_connect(GTK_OBJECT(data.window),"destroy",GTK_SIGNAL_FUNC(gtk_main_quit),NULL);

gtk_signal_connect_after(GTK_OBJECT(data.window),"key_press_event",GTK_SIGNAL_FUNC(vmat_medp_v_key_press),&data);

if(wpredok != NULL)
 {
  gdk_window_set_cursor(wpredok->window,gdk_cursor_new(ICEB_CURSOR_GDITE));
  //Удерживать окно над породившем его окном всегда
  gtk_window_set_transient_for(GTK_WINDOW(data.window),GTK_WINDOW(wpredok));
  //Закрыть окно если окно предок удалено
  gtk_window_set_destroy_with_parent(GTK_WINDOW(data.window),TRUE);
 }

GtkWidget *label=gtk_label_new(gettext("Ввод карточки мед. препората"));

GtkWidget *vbox = gtk_vbox_new (FALSE, 0);
GtkWidget *hbox[KOLENTER];
for(int i=0; i < KOLENTER; i++)
  hbox[i] = gtk_hbox_new (FALSE, 0);

GtkWidget *hboxknop = gtk_hbox_new (FALSE, 0);


gtk_container_add (GTK_CONTAINER (data.window), vbox);
gtk_container_add (GTK_CONTAINER (vbox), label);

for(int i=0; i < KOLENTER; i++)
  gtk_container_add (GTK_CONTAINER (vbox), hbox[i]);

gtk_container_add (GTK_CONTAINER (vbox), hboxknop);

sprintf(strsql,"%s",gettext("Дата регистрации медицинского препарата"));
label=gtk_label_new(iceb_u_toutf(strsql));
data.entry[E_DATAR] = gtk_entry_new_with_max_length (10);
gtk_box_pack_start (GTK_BOX (hbox[E_DATAR]), label, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox[E_DATAR]), data.entry[E_DATAR], TRUE, TRUE, 0);
gtk_signal_connect(GTK_OBJECT (data.entry[E_DATAR]), "activate",GTK_SIGNAL_FUNC(vmat_medp_v_vvod),&data);
gtk_entry_set_text(GTK_ENTRY(data.entry[E_DATAR]),data.datar.ravno());
gtk_object_set_user_data(GTK_OBJECT(data.entry[E_DATAR]),(gpointer)E_DATAR);

sprintf(strsql,"%s",gettext("Серия медицинского препарата"));
label=gtk_label_new(iceb_u_toutf(strsql));
data.entry[E_SERIQ] = gtk_entry_new_with_max_length (20);
gtk_box_pack_start (GTK_BOX (hbox[E_SERIQ]), label, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox[E_SERIQ]), data.entry[E_SERIQ], TRUE, TRUE, 0);
gtk_signal_connect(GTK_OBJECT (data.entry[E_SERIQ]), "activate",GTK_SIGNAL_FUNC(vmat_medp_v_vvod),&data);
gtk_entry_set_text(GTK_ENTRY(data.entry[E_SERIQ]),data.seriq.ravno());
gtk_object_set_user_data(GTK_OBJECT(data.entry[E_SERIQ]),(gpointer)E_SERIQ);

sprintf(strsql,"%s",gettext("Регистрационный номер документа мед.прерарата"));
label=gtk_label_new(iceb_u_toutf(strsql));
data.entry[E_REGNOM] = gtk_entry_new_with_max_length (20);
gtk_box_pack_start (GTK_BOX (hbox[E_REGNOM]), label, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox[E_REGNOM]), data.entry[E_REGNOM], TRUE, TRUE, 0);
gtk_signal_connect(GTK_OBJECT (data.entry[E_REGNOM]), "activate",GTK_SIGNAL_FUNC(vmat_medp_v_vvod),&data);
gtk_entry_set_text(GTK_ENTRY(data.entry[E_REGNOM]),data.regnom.ravno());
gtk_object_set_user_data(GTK_OBJECT(data.entry[E_REGNOM]),(gpointer)E_REGNOM);


GtkTooltips *tooltips[KOL_F_KL];

sprintf(strsql,"F2 %s",gettext("Записать"));
data.knopka[FK2]=gtk_button_new_with_label(strsql);
tooltips[FK2]=gtk_tooltips_new();
gtk_tooltips_set_tip(tooltips[FK2],data.knopka[FK2],gettext("Записать введенную в меню информацию."),NULL);
gtk_signal_connect(GTK_OBJECT(data.knopka[FK2]),"clicked",GTK_SIGNAL_FUNC(vmat_medp_v_knopka),&data);
gtk_object_set_user_data(GTK_OBJECT(data.knopka[FK2]),(gpointer)FK2);
gtk_box_pack_start(GTK_BOX(hboxknop), data.knopka[FK2], TRUE, TRUE, 0);

/*******************
sprintf(strsql,"F3 %s",gettext("Реквизиты"));
data.knopka[FK3]=gtk_button_new_with_label(strsql);
tooltips[FK3]=gtk_tooltips_new();
gtk_tooltips_set_tip(tooltips[FK3],data.knopka[FK3],gettext("Просмотр нужных реквизитов."),NULL);
gtk_signal_connect(GTK_OBJECT(data.knopka[FK3]),"clicked",GTK_SIGNAL_FUNC(vmat_medp_v_knopka),&data);
gtk_object_set_user_data(GTK_OBJECT(data.knopka[FK3]),(gpointer)FK3);
gtk_box_pack_start(GTK_BOX(hboxknop), data.knopka[FK3], TRUE, TRUE, 0);
******************/

sprintf(strsql,"F4 %s",gettext("Очистить"));
data.knopka[FK4]=gtk_button_new_with_label(strsql);
tooltips[FK4]=gtk_tooltips_new();
gtk_tooltips_set_tip(tooltips[FK4],data.knopka[FK4],gettext("Очистить меню от введенной информации."),NULL);
gtk_signal_connect(GTK_OBJECT(data.knopka[FK4]),"clicked",GTK_SIGNAL_FUNC(vmat_medp_v_knopka),&data);
gtk_object_set_user_data(GTK_OBJECT(data.knopka[FK4]),(gpointer)FK4);
gtk_box_pack_start(GTK_BOX(hboxknop), data.knopka[FK4], TRUE, TRUE, 0);


sprintf(strsql,"F10 %s",gettext("Выход"));
data.knopka[FK10]=gtk_button_new_with_label(strsql);
tooltips[FK10]=gtk_tooltips_new();
gtk_tooltips_set_tip(tooltips[FK10],data.knopka[FK10],gettext("Завершение работы в этом окне."),NULL);
gtk_signal_connect(GTK_OBJECT(data.knopka[FK10]),"clicked",GTK_SIGNAL_FUNC(vmat_medp_v_knopka),&data);
gtk_object_set_user_data(GTK_OBJECT(data.knopka[FK10]),(gpointer)FK10);
gtk_box_pack_start(GTK_BOX(hboxknop), data.knopka[FK10], TRUE, TRUE, 0);

gtk_widget_grab_focus(data.entry[0]);

gtk_widget_show_all (data.window);


gtk_main();

if(data.voz == 0)
 {
  innom->new_plus(data.seriq.ravno());
  regnom->new_plus(data.regnom.ravno());
  iceb_u_rsdat(dn,mn,gn,data.datar.ravno(),1);
 }
if(wpredok != NULL)
  gdk_window_set_cursor(wpredok->window,gdk_cursor_new(ICEB_CURSOR));

return(data.voz);


}
Example #29
0
bool wxClipboard::AddData( wxDataObject *data )
{
#if wxUSE_NANOX
    return false;
#else
    wxCHECK_MSG( m_open, false, wxT("clipboard not open") );

    wxCHECK_MSG( data, false, wxT("data is invalid") );

    /* we can only store one wxDataObject */
    Clear();

    m_data = data;

    /* get formats from wxDataObjects */
    wxDataFormat *array = new wxDataFormat[ m_data->GetFormatCount() ];
    m_data->GetAllFormats( array );

#if 0
    /* primary selection or clipboard */
    Atom clipboard = m_usePrimary ? (Atom) 1  // 1 = primary selection
                     : g_clipboardAtom;
#endif // 0


    for (size_t i = 0; i < m_data->GetFormatCount(); i++)
    {
        wxLogTrace( TRACE_CLIPBOARD,
                    wxT("wxClipboard now supports atom %s"),
                    array[i].GetId().c_str() );

#if 0
        gtk_selection_add_target( GTK_WIDGET(m_clipboardWidget),
                                  clipboard,
                                  array[i],
                                  0 );  /* what is info ? */
#endif
    }

    delete[] array;

#if 0
    gtk_signal_connect( GTK_OBJECT(m_clipboardWidget),
                        "selection_get",
                        GTK_SIGNAL_FUNC(selection_handler),
                        (gpointer) NULL );
#endif

#if wxUSE_THREADS
    /* disable GUI threads */
#endif

    bool res = false;
#if 0
    /* Tell the world we offer clipboard data */
    res = (gtk_selection_owner_set( m_clipboardWidget,
                                    clipboard,
                                    (guint32) GDK_CURRENT_TIME ));
#endif

    if (m_usePrimary)
        m_ownsPrimarySelection = res;
    else
        m_ownsClipboard = res;

#if wxUSE_THREADS
    /* re-enable GUI threads */
#endif

    return res;
#endif
}
Example #30
0
void AddSectionWindowInit( )
{
	GtkWidget *vbox;
	GtkWidget * ButtonOk;
	GtkWidget * hbox[ 3 ];
	GtkWidget * Lbl[ 3 ];
	GList *LangageItems = NULL;
	GList *SubRoutinesNbrItems = NULL;
	int NumSub;
	char * ArrayNumSub[ ] = { "SR0", "SR1", "SR2", "SR3", "SR4", "SR5", "SR6", "SR7", "SR8", "SR9" };
	int Line;
	LangageItems = g_list_append( LangageItems, "Ladder" );
#ifdef SEQUENTIAL_SUPPORT
	LangageItems = g_list_append( LangageItems, "Sequential" );
#endif

	SubRoutinesNbrItems = g_list_append( SubRoutinesNbrItems, "Main" );
	for ( NumSub=0; NumSub<10; NumSub++ )
	{
		SubRoutinesNbrItems = g_list_append( SubRoutinesNbrItems, ArrayNumSub[ NumSub ] );
	}

	AddSectionWindow = gtk_window_new (GTK_WINDOW_TOPLEVEL);
	gtk_window_set_title ((GtkWindow *)AddSectionWindow, "Add a section...");

	vbox = gtk_vbox_new (FALSE, 0);
	gtk_container_add (GTK_CONTAINER (AddSectionWindow), vbox);
	gtk_widget_show (vbox);

	for ( Line = 0; Line<3; Line++ )
	{
		char * text;
		hbox[ Line ] = gtk_hbox_new (FALSE, 0);
		gtk_container_add (GTK_CONTAINER (vbox), hbox[ Line ]);
		gtk_widget_show (hbox[ Line ]);

		switch( Line )
		{
			case 1 : text = "Language"; break;
			case 2 : text = "Main/Sub-Routine"; break;
			default: text = "Name"; break;
		}
		Lbl[ Line ] = gtk_label_new( text );
		gtk_box_pack_start (GTK_BOX (hbox[ Line ]), Lbl[ Line ], FALSE, FALSE, 0);
		gtk_widget_show ( Lbl[ Line ]);

		switch( Line )
		{
			case 0:
				EditName = gtk_entry_new();
				gtk_entry_set_max_length( GTK_ENTRY(EditName),LGT_SECTION_NAME-1 );
				gtk_box_pack_start (GTK_BOX (hbox[Line]), EditName, TRUE, TRUE, 0);
				gtk_widget_show( EditName );
				break;
			case 1:
				CycleLanguage = gtk_combo_new();
				gtk_combo_set_value_in_list(GTK_COMBO(CycleLanguage), TRUE /*val*/, FALSE /*ok_if_empty*/);
				gtk_combo_set_popdown_strings(GTK_COMBO(CycleLanguage),LangageItems);
				gtk_box_pack_start (GTK_BOX (hbox[Line]), CycleLanguage, TRUE, TRUE, 0);
				gtk_widget_show( CycleLanguage );
				break;
			case 2:
				CycleSubRoutineNbr = gtk_combo_new();
				gtk_combo_set_value_in_list(GTK_COMBO(CycleSubRoutineNbr), TRUE /*val*/, FALSE /*ok_if_empty*/);
				gtk_combo_set_popdown_strings(GTK_COMBO(CycleSubRoutineNbr),SubRoutinesNbrItems);
				gtk_box_pack_start (GTK_BOX (hbox[Line]), CycleSubRoutineNbr, TRUE, TRUE, 0);
				gtk_widget_show( CycleSubRoutineNbr );
				break;
		}
	}

	ButtonOk = gtk_button_new_with_label("Ok");
	gtk_box_pack_start (GTK_BOX (vbox), ButtonOk, TRUE, FALSE, 0);
	gtk_signal_connect(GTK_OBJECT (ButtonOk), "clicked",
		(GtkSignalFunc)ButtonAddSectionDoneClickSignal, 0);
	gtk_widget_show (ButtonOk);
	gtk_window_set_modal(GTK_WINDOW(AddSectionWindow),TRUE);
	gtk_window_set_position(GTK_WINDOW(AddSectionWindow),GTK_WIN_POS_CENTER);
	gtk_signal_connect( GTK_OBJECT(AddSectionWindow), "delete_event",
		(GtkSignalFunc)AddSectionWindowDeleteEvent, 0 );
}