GtkWidget*
create_popupRecite (void)
{
  GtkWidget *popupRecite;
  GtkWidget *hbox10;
  GtkWidget *table12;
  GtkWidget *scrolledwindow11;
  GtkWidget *recitePopupText;
  GtkWidget *vbox9;
  GtkWidget *removebutton;
  GtkWidget *button19;
  GtkWidget *pausecheck;
  GtkWidget *hbox11;
  GtkWidget *label47;
  GtkWidget *wordcheck;
  GtkWidget *phoncheck;
  GtkWidget *transcheck;
  GtkWidget *vseparator1;
  GtkWidget *label50;
  GtkWidget *Backbutton;
  GtkWidget *nextbutton;

  popupRecite = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_object_set_data (GTK_OBJECT (popupRecite), "popupRecite", popupRecite);
  gtk_widget_set_usize (popupRecite, 500, -2);
  gtk_window_set_title (GTK_WINDOW (popupRecite), _("Recite"));

  hbox10 = gtk_hbox_new (FALSE, 0);
  gtk_widget_ref (hbox10);
  gtk_object_set_data_full (GTK_OBJECT (popupRecite), "hbox10", hbox10,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox10);
  gtk_container_add (GTK_CONTAINER (popupRecite), hbox10);

  table12 = gtk_table_new (2, 2, FALSE);
  gtk_widget_ref (table12);
  gtk_object_set_data_full (GTK_OBJECT (popupRecite), "table12", table12,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (table12);
  gtk_box_pack_start (GTK_BOX (hbox10), table12, TRUE, TRUE, 0);

  scrolledwindow11 = gtk_scrolled_window_new (NULL, NULL);
  gtk_widget_ref (scrolledwindow11);
  gtk_object_set_data_full (GTK_OBJECT (popupRecite), "scrolledwindow11", scrolledwindow11,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (scrolledwindow11);
  gtk_table_attach (GTK_TABLE (table12), scrolledwindow11, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
  gtk_widget_set_usize (scrolledwindow11, -2, 28);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow11), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);

  recitePopupText = gtk_text_new (NULL, NULL);
  gtk_widget_ref (recitePopupText);
  gtk_object_set_data_full (GTK_OBJECT (popupRecite), "recitePopupText", recitePopupText,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (recitePopupText);
  gtk_container_add (GTK_CONTAINER (scrolledwindow11), recitePopupText);
  gtk_widget_set_usize (recitePopupText, -2, 26);

  vbox9 = gtk_vbox_new (FALSE, 0);
  gtk_widget_ref (vbox9);
  gtk_object_set_data_full (GTK_OBJECT (popupRecite), "vbox9", vbox9,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (vbox9);
  gtk_table_attach (GTK_TABLE (table12), vbox9, 1, 2, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);

  removebutton = gtk_button_new_with_label (_("Remove"));
  gtk_widget_ref (removebutton);
  gtk_object_set_data_full (GTK_OBJECT (popupRecite), "removebutton", removebutton,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (removebutton);
  gtk_box_pack_start (GTK_BOX (vbox9), removebutton, FALSE, FALSE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (removebutton), 3);

  button19 = gtk_button_new_with_label (_("Quit"));
  gtk_widget_ref (button19);
  gtk_object_set_data_full (GTK_OBJECT (popupRecite), "button19", button19,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button19);
  gtk_box_pack_start (GTK_BOX (vbox9), button19, FALSE, FALSE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (button19), 3);

  pausecheck = gtk_check_button_new_with_label (_("Pause"));
  gtk_widget_ref (pausecheck);
  gtk_object_set_data_full (GTK_OBJECT (popupRecite), "pausecheck", pausecheck,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (pausecheck);
  gtk_table_attach (GTK_TABLE (table12), pausecheck, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  hbox11 = gtk_hbox_new (FALSE, 0);
  gtk_widget_ref (hbox11);
  gtk_object_set_data_full (GTK_OBJECT (popupRecite), "hbox11", hbox11,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox11);
  gtk_table_attach (GTK_TABLE (table12), hbox11, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (GTK_FILL), 0, 0);

  label47 = gtk_label_new (_("Display: "));
  gtk_widget_ref (label47);
  gtk_object_set_data_full (GTK_OBJECT (popupRecite), "label47", label47,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label47);
  gtk_box_pack_start (GTK_BOX (hbox11), label47, FALSE, FALSE, 0);
  gtk_misc_set_padding (GTK_MISC (label47), 5, 0);

  wordcheck = gtk_check_button_new_with_label (_("Word"));
  gtk_widget_ref (wordcheck);
  gtk_object_set_data_full (GTK_OBJECT (popupRecite), "wordcheck", wordcheck,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (wordcheck);
  gtk_box_pack_start (GTK_BOX (hbox11), wordcheck, FALSE, FALSE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (wordcheck), 1);
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (wordcheck), TRUE);

  phoncheck = gtk_check_button_new_with_label (_("Phonetic"));
  gtk_widget_ref (phoncheck);
  gtk_object_set_data_full (GTK_OBJECT (popupRecite), "phoncheck", phoncheck,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (phoncheck);
  gtk_box_pack_start (GTK_BOX (hbox11), phoncheck, FALSE, FALSE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (phoncheck), 1);
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (phoncheck), TRUE);

  transcheck = gtk_check_button_new_with_label (_("Translation"));
  gtk_widget_ref (transcheck);
  gtk_object_set_data_full (GTK_OBJECT (popupRecite), "transcheck", transcheck,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (transcheck);
  gtk_box_pack_start (GTK_BOX (hbox11), transcheck, FALSE, FALSE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (transcheck), 1);
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (transcheck), TRUE);

  vseparator1 = gtk_vseparator_new ();
  gtk_widget_ref (vseparator1);
  gtk_object_set_data_full (GTK_OBJECT (popupRecite), "vseparator1", vseparator1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (vseparator1);
  gtk_box_pack_start (GTK_BOX (hbox11), vseparator1, FALSE, TRUE, 0);

  label50 = gtk_label_new ("");
  gtk_widget_ref (label50);
  gtk_object_set_data_full (GTK_OBJECT (popupRecite), "label50", label50,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label50);
  gtk_box_pack_start (GTK_BOX (hbox11), label50, TRUE, FALSE, 0);

  Backbutton = gtk_button_new_with_label (_("Back"));
  gtk_widget_ref (Backbutton);
  gtk_object_set_data_full (GTK_OBJECT (popupRecite), "Backbutton", Backbutton,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (Backbutton);
  gtk_box_pack_start (GTK_BOX (hbox11), Backbutton, FALSE, FALSE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (Backbutton), 2);

  nextbutton = gtk_button_new_with_label (_("Next"));
  gtk_widget_ref (nextbutton);
  gtk_object_set_data_full (GTK_OBJECT (popupRecite), "nextbutton", nextbutton,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (nextbutton);
  gtk_box_pack_start (GTK_BOX (hbox11), nextbutton, FALSE, FALSE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (nextbutton), 2);

  gtk_signal_connect (GTK_OBJECT (recitePopupText), "button_press_event",
                      GTK_SIGNAL_FUNC (on_recitePopupText_button_press_event),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (removebutton), "clicked",
                      GTK_SIGNAL_FUNC (on_removebutton_clicked),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (button19), "clicked",
                      GTK_SIGNAL_FUNC (on_quitReciteButton_clicked),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (pausecheck), "toggled",
                      GTK_SIGNAL_FUNC (on_pausecheck_toggled),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (wordcheck), "toggled",
                      GTK_SIGNAL_FUNC (on_wordcheck_toggled),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (phoncheck), "toggled",
                      GTK_SIGNAL_FUNC (on_phoncheck_toggled),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (transcheck), "toggled",
                      GTK_SIGNAL_FUNC (on_transcheck_toggled),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (Backbutton), "clicked",
                      GTK_SIGNAL_FUNC (on_Backbutton_clicked),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (nextbutton), "clicked",
                      GTK_SIGNAL_FUNC (on_nextbutton_clicked),
                      NULL);

  return popupRecite;
}
Example #2
0
int xrnn_rasp_r(class xrnn_poiw *datark,GtkWidget *wpredok)
{
char strsql[512];
iceb_u_str repl;
class xrnn_rasp_r_data data;
data.rk=datark;

data.window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_modal(GTK_WINDOW(data.window),TRUE);
gtk_window_set_position( GTK_WINDOW(data.window),ICEB_POS_CENTER);
gtk_window_set_default_size (GTK_WINDOW  (data.window),400,-1);

sprintf(strsql,"%s %s",name_system,gettext("Распечатать реестр налоговых накладных"));
gtk_window_set_title(GTK_WINDOW(data.window),strsql);

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(xrnn_rasp_r_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 *vbox=gtk_vbox_new(FALSE, 2);

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

data.label=gtk_label_new(gettext("Ждите !!!"));

gtk_box_pack_start(GTK_BOX(vbox),data.label,FALSE,FALSE,0);

repl.plus(gettext("Распечатать реестр налоговых накладных"));
sprintf(strsql,"%s:%s %s\n",gettext("База данных"),imabaz,organ);
repl.ps_plus(strsql);

GtkWidget *label=gtk_label_new(repl.ravno_toutf());

gtk_box_pack_start(GTK_BOX(vbox),label,FALSE,FALSE,0);

data.view=gtk_text_view_new();
gtk_widget_set_usize(GTK_WIDGET(data.view),450,300);

gtk_text_view_set_editable(GTK_TEXT_VIEW(data.view),FALSE); //Запрет на редактирование текста
//PangoFontDescription *font_pango=pango_font_description_from_string("Nimbus Mono L, Bold 12");
PangoFontDescription *font_pango=pango_font_description_from_string(shrift_ravnohir.ravno());
gtk_widget_modify_font(GTK_WIDGET(data.view),font_pango);
pango_font_description_free(font_pango);

data.buffer=gtk_text_view_get_buffer(GTK_TEXT_VIEW(data.view));

GtkWidget *sw=gtk_scrolled_window_new(NULL,NULL);
//gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw),GTK_SHADOW_ETCHED_IN);
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),GTK_POLICY_AUTOMATIC,GTK_POLICY_AUTOMATIC);
//gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sw),GTK_POLICY_ALWAYS,GTK_POLICY_ALWAYS);
gtk_box_pack_start (GTK_BOX (vbox), sw, TRUE, TRUE, 0);
gtk_container_add(GTK_CONTAINER(sw),data.view);


data.bar=gtk_progress_bar_new();

gtk_progress_bar_set_bar_style(GTK_PROGRESS_BAR(data.bar),GTK_PROGRESS_CONTINUOUS);

gtk_progress_bar_set_orientation(GTK_PROGRESS_BAR(data.bar),GTK_PROGRESS_LEFT_TO_RIGHT);

gtk_box_pack_start (GTK_BOX (vbox), data.bar, FALSE, FALSE, 2);



sprintf(strsql,"F10 %s",gettext("Выход"));
data.knopka=gtk_button_new_with_label(strsql);
GtkTooltips *tooltops=gtk_tooltips_new();
gtk_tooltips_set_tip(tooltops,data.knopka,gettext("Завершение работы в этом окне"),NULL);
gtk_signal_connect(GTK_OBJECT(data.knopka),"clicked",GTK_SIGNAL_FUNC(xrnn_rasp_r_v_knopka),&data);
gtk_object_set_user_data(GTK_OBJECT(data.knopka),(gpointer)0);
gtk_box_pack_start (GTK_BOX (vbox), data.knopka, FALSE, FALSE, 2);

gtk_widget_set_sensitive(GTK_WIDGET(data.knopka),FALSE);//Недоступна

gtk_widget_show_all(data.window);


//gtk_window_set_decorated(GTK_WINDOW(data.window),FALSE); //Убирает рамку вокруг окна

//gtk_widget_set_sensitive(GTK_WIDGET(data.knopka),FALSE);//Недоступна

gtk_idle_add((GtkFunction)xrnn_rasp_r1,&data);

gtk_main();

if(wpredok != NULL)
  gdk_window_set_cursor(wpredok->window,gdk_cursor_new(ICEB_CURSOR));

return(data.voz);
}
Example #3
0
int main (int argc, char *argv[])
{
    /* this variable will store a pointer to the window object. */
    GtkWidget *window;
    GtkWidget *vbox;
    /* this will store a text entry */
    GtkWidget *entry;
    GtkWidget *entry2;   
  
    /* this will store a horizontal box*/
    GtkWidget *hbox;

    GtkWidget *label;
    GtkWidget *frame;
	
    GtkWidget *timeLabel;
    gint tmp_pos;

// ----------------------------------------------------------------------------

    /* this is called in all GTK applications. Arguments 
	are parsed from the command line and are returned
 	to the application. */
    gtk_init (&argc, &argv);

    /* create a new window */
    window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title (GTK_WINDOW (window), "PC GTK Entry");
    gtk_widget_set_size_request(GTK_WIDGET (window), 200, 350);
    gtk_container_set_border_width(GTK_CONTAINER (window), 5);
    gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);

    /* When the window is given the "delete_event" signal (usually by
	the "close" opthion), we ask it to call the delete_event() function. 
	*/
    g_signal_connect_swapped (window, "delete-event",
				G_CALLBACK (gtk_widget_destroy), window);
    /* Here we connect the "destory" event to a signal handler.
 	This event occurs when we call gtk_widget_destroy() on the window, 
	or if we return FALSE in the "delete_event" callback. */
    g_signal_connect (window, "destroy",G_CALLBACK (gtk_main_quit), NULL);

// ----------------------------------------------------------------------------
    //vbox
    vbox = gtk_vbox_new (FALSE, 5);
  
   // hbox
    hbox = gtk_hbox_new (FALSE, 5);
  
    gtk_container_add (GTK_CONTAINER (window), hbox);
    gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
    gtk_container_set_border_width (GTK_CONTAINER (window), 5);

   // frame
    frame = gtk_frame_new("NULL");
    gtk_frame_set_label (GTK_FRAME(frame), "STATE");
    gtk_frame_set_label_align (GTK_FRAME (frame), 0.5, 0.0);
    gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_OUT);


 
    //entry ..	
    entry = gtk_entry_new ();
    gtk_entry_set_max_length (GTK_ENTRY (entry), 100);
    gtk_widget_set_size_request(entry, 170, 50);
    g_signal_connect (entry, "activate",G_CALLBACK (enter1_callback), entry);
    gtk_entry_set_text (GTK_ENTRY (entry), "Disconnect");

    tmp_pos = GTK_ENTRY (entry)->text_length;
    gtk_editable_select_region (GTK_EDITABLE (entry),0, 
				GTK_ENTRY (entry)->text_length);
    gtk_container_add (GTK_CONTAINER (frame), entry);
    gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);

    gtk_widget_show (entry);


      // frame
    frame = gtk_frame_new("NULL");
    gtk_frame_set_label (GTK_FRAME(frame), "DATA");
    gtk_frame_set_label_align (GTK_FRAME (frame), 0.5, 0.0);
    gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_OUT);


    //entry2 ..	
    entry2 = gtk_entry_new ();
    gtk_entry_set_max_length (GTK_ENTRY (entry2), 100);
     gtk_widget_set_size_request(entry2, 170, 50);
    g_signal_connect (entry2, "activate",G_CALLBACK (enter2_callback), entry2);
    gtk_entry_set_text (GTK_ENTRY (entry2), "What data");

    tmp_pos = GTK_ENTRY (entry2)->text_length;
    gtk_editable_select_region (GTK_EDITABLE (entry2),0, 
				GTK_ENTRY (entry2)->text_length);
    gtk_container_add (GTK_CONTAINER (frame), entry2);
    gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
    gtk_widget_show (entry2);

   
    //button ...
    button1 = gtk_button_new_with_label("Open");
   

    //gtk_signal_connect_object (GTK_OBJECT (button), "clicked", 
	//	GTK_SIGNAL_FUNC (gtk_widget_destory), 
	//	GTK_OBJECT (window));
    
    //gtk_container_add (GTK_CONTAINER (window), button1);
    gtk_widget_set_size_request(button1, 50, 50);
    gtk_box_pack_start (GTK_BOX (vbox), button1, FALSE, TRUE, 1);
    

    gtk_signal_connect (GTK_OBJECT (button1), "clicked", 
		GTK_SIGNAL_FUNC (on_button1_clicked), NULL);

    gtk_widget_show(button1);


   // button2
   button2 = gtk_button_new_with_label("Close");
   gtk_widget_set_size_request(button2, 50, 50);  
   gtk_box_pack_start (GTK_BOX (vbox), button2, FALSE, TRUE, 1);
   gtk_signal_connect (GTK_OBJECT (button2), "clicked", 
			GTK_SIGNAL_FUNC (on_button2_clicked), NULL);

	// test
   gtk_widget_set_sensitive(button2, FALSE);

    gtk_widget_show(button2);

   // button3
   button3 = gtk_button_new_with_label("Quit");  
   gtk_widget_set_size_request(button3, 50, 50);
   gtk_box_pack_start (GTK_BOX (vbox), button3, FALSE, TRUE, 1);
   gtk_signal_connect (GTK_OBJECT (button3), "clicked", 
			GTK_SIGNAL_FUNC (on_quit_clicked), NULL);

    gtk_widget_show(button3);

    gtk_widget_show_all(window);

    gtk_main();

    return 0;
}
Example #4
0
int
main (int argc, char **argv)
{
	int i;
	int found_valid = FALSE;

	GdkPixbufAnimation *animation;

	gtk_init (&argc, &argv);

	gdk_rgb_set_verbose (TRUE);

	gdk_rgb_init ();

	gtk_widget_set_default_colormap (gdk_rgb_get_cmap ());
	gtk_widget_set_default_visual (gdk_rgb_get_visual ());

	{
		char *tbf_readlen = getenv("TBF_READLEN");
		if(tbf_readlen) readlen = atoi(tbf_readlen);
	}

	{
		char *tbf_bps = getenv("TBF_KBPS");
		guint bps;

		if (tbf_bps) {
			bps = atoi(tbf_bps);
			g_print ("Simulating %d kBytes/sec\n", bps);
			readlen = (bps*1024)/10;
		}
	}

	i = 1;
	if (argc == 1) {
		g_print ("USAGE:  testanimation FILE1 ...\n");
		return 0;
	} else {
		for (i = 1; i < argc; i++) {
			animation = gdk_pixbuf_animation_new_from_file (argv[i]);

			if (animation) {
				gint i = 0;
				GList *listptr;
				for (listptr = gdk_pixbuf_animation_get_frames (animation);
				     listptr;
				     listptr = listptr->next) {
					GdkPixbufFrame *frame;
					GdkPixbuf *pixbuf;
					gchar *title;

					frame = listptr->data;
					pixbuf = gdk_pixbuf_frame_get_pixbuf (frame);

					title = g_strdup_printf ("Frame %d", i);
					g_print ("Frame %d  x:%d y:%d width:%d height:%d\n",
						 i,
						 gdk_pixbuf_frame_get_x_offset (frame),
						 gdk_pixbuf_frame_get_y_offset (frame),
						 gdk_pixbuf_get_width (pixbuf),
						 gdk_pixbuf_get_height (pixbuf));
					new_testrgb_window (pixbuf, title);
					g_free (title);
					i++;
				}
				found_valid = TRUE;
			}
		}
#if 0
                {
                        GtkWidget* rgb_window = NULL;
			ProgressFileStatus   status;
			GdkPixbufLoader *pixbuf_loader;

                        pixbuf_loader = gdk_pixbuf_loader_new ();
			status.loader = pixbuf_loader;

			status.rgbwin = &rgb_window;

			status.buf = g_malloc (readlen);
                        gtk_signal_connect(GTK_OBJECT(pixbuf_loader),
                                           "area_prepared",
                                           GTK_SIGNAL_FUNC(progressive_prepared_callback),
                                           &rgb_window);

                        gtk_signal_connect(GTK_OBJECT(pixbuf_loader),
                                           "area_updated",
                                           GTK_SIGNAL_FUNC(progressive_updated_callback),
                                           &rgb_window);

			
                        status.imagefile = fopen (argv[1], "r");
                        g_assert (status.imagefile != NULL);

			status.readlen = readlen;

                        status.timeout = gtk_timeout_add(100, update_timeout, &status);
                }
#endif
	}

	if (found_valid)
		gtk_main ();

	return 0;
}
Example #5
0
GtkWidget * create_layer_view_widget (void)
{
  GtkWidget  *vbox;
  GtkWidget  *hbox;
  GtkWidget  *label;
  GtkWidget  *hide_button;
  GtkRcStyle *rcstyle;    /* For hide_button */   
  GtkWidget  *image;      /* For hide_button */
  GtkWidget  *list;
  GtkWidget  *separator;
  GtkWidget  *scrolled_win;
  GtkWidget  *button_box;
  
  /* if layer_dialog were renamed to layer_view_data this would make
   * more sense.
   */
  layer_dialog = g_new (struct LayerDialog, 1);

  layer_dialog->diagram = NULL;

  layer_dialog->dialog = vbox = gtk_vbox_new (FALSE, 1);
    
  hbox = gtk_hbox_new (FALSE, 1);
  
  label = gtk_label_new (_ ("Layers:"));
  gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 2);
  gtk_widget_show (label);
  
  layer_dialog->diagram_omenu = NULL;

  /* Hide Button */
  hide_button = gtk_button_new ();
  gtk_button_set_relief (GTK_BUTTON (hide_button), GTK_RELIEF_NONE);
  gtk_button_set_focus_on_click (GTK_BUTTON (hide_button), FALSE);

  /* make it as small as possible */
  rcstyle = gtk_rc_style_new ();
  rcstyle->xthickness = rcstyle->ythickness = 0;
  gtk_widget_modify_style (hide_button, rcstyle);
  g_object_unref (rcstyle);

  image = gtk_image_new_from_stock (GTK_STOCK_CLOSE,
                                    GTK_ICON_SIZE_MENU);

  gtk_container_add (GTK_CONTAINER(hide_button), image);
  gtk_signal_connect (GTK_OBJECT (hide_button), "clicked", 
                      GTK_SIGNAL_FUNC (layer_view_hide_button_clicked), NULL);    
    
  gtk_box_pack_start (GTK_BOX (hbox), hide_button, FALSE, FALSE, 2);
    
  gtk_box_pack_start (GTK_BOX(vbox), hbox, FALSE, FALSE, 2);
  gtk_widget_show_all (hbox);

  button_box = create_button_box(vbox, FALSE);
  
  gtk_box_pack_start (GTK_BOX (vbox), button_box, FALSE, FALSE, 2);
  gtk_widget_show (button_box);
    
  separator = gtk_hseparator_new();
  gtk_box_pack_start(GTK_BOX(vbox), separator, FALSE, FALSE, 2);
  gtk_widget_show (separator);

  scrolled_win = gtk_scrolled_window_new (NULL, NULL);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
				  GTK_POLICY_AUTOMATIC, 
				  GTK_POLICY_AUTOMATIC);
  gtk_box_pack_start (GTK_BOX (vbox), scrolled_win, TRUE, TRUE, 2);

  layer_dialog->layer_list = list = gtk_list_new();

  gtk_list_set_selection_mode (GTK_LIST (list), GTK_SELECTION_BROWSE);
  gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_win), list);
  gtk_container_set_focus_vadjustment (GTK_CONTAINER (list),
				       gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (scrolled_win)));
  gtk_widget_show (scrolled_win);
  gtk_widget_show (list);

  g_signal_connect (GTK_OBJECT (list), "event",
		      (GtkSignalFunc) layer_list_events,
		      NULL);
    
  return vbox;
}
Example #6
0
int
nsSetupTypeDlg::VerifyDestination()
{
    int stat_err = 0;
    struct stat stbuf; 
    GtkWidget *yesButton, *noButton, *label;
    GtkWidget *noPermsDlg, *okButton;
    char message[MAXPATHLEN];
  
    stat_err = stat(gCtx->opt->mDestination, &stbuf);
    if (stat_err == 0)
    {
      if (access(gCtx->opt->mDestination, R_OK | W_OK | X_OK ) != 0)
      {
        if (gCtx->opt->mMode != nsXIOptions::MODE_DEFAULT) {
          ErrorHandler(E_NO_PERMS);
          return E_NO_PERMS;
        }
        sprintf(message, gCtx->Res("NO_PERMS"), gCtx->opt->mDestination);

        noPermsDlg = gtk_dialog_new();
        gtk_window_set_modal(GTK_WINDOW(noPermsDlg), TRUE);
        label = gtk_label_new(message);
        okButton = gtk_button_new_with_label(gCtx->Res("OK_LABEL"));

        if (noPermsDlg && label && okButton)
        {
          gtk_window_set_title(GTK_WINDOW(noPermsDlg), gCtx->opt->mTitle);
          gtk_window_set_position(GTK_WINDOW(noPermsDlg), 
            GTK_WIN_POS_CENTER);
          gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
          gtk_box_pack_start(GTK_BOX(
            GTK_DIALOG(noPermsDlg)->action_area), okButton, FALSE, FALSE, 10);
          gtk_signal_connect(GTK_OBJECT(okButton), "clicked", 
            GTK_SIGNAL_FUNC(NoPermsOK), noPermsDlg);
          gtk_box_pack_start(GTK_BOX(
            GTK_DIALOG(noPermsDlg)->vbox), label, FALSE, FALSE, 10);

          GTK_WIDGET_SET_FLAGS(okButton, GTK_CAN_DEFAULT);
          gtk_widget_grab_default(okButton);

          gtk_widget_show_all(noPermsDlg);
        }

        return E_NO_PERMS;
      }
      else
      {
        // perms OK, we can proceed
        return OK;
      }
    }

    if (gCtx->opt->mMode != nsXIOptions::MODE_DEFAULT)
    {
      CreateDestYes((GtkWidget *)NULL, (gpointer) gCtx->sdlg);
      return E_NO_DEST;
    }
    // destination doesn't exist so ask user if we should create it
    sprintf(message, gCtx->Res("DOESNT_EXIST"), gCtx->opt->mDestination);

    sCreateDestDlg = gtk_dialog_new();
    gtk_window_set_modal(GTK_WINDOW(sCreateDestDlg), TRUE);
    label = gtk_label_new(message);
    yesButton = gtk_button_new_with_label(gCtx->Res("YES_LABEL"));
    noButton = gtk_button_new_with_label(gCtx->Res("NO_LABEL"));

    gtk_window_set_title(GTK_WINDOW(sCreateDestDlg), gCtx->opt->mTitle);
    gtk_window_set_position(GTK_WINDOW(sCreateDestDlg), GTK_WIN_POS_CENTER);
    gtk_container_add(GTK_CONTAINER(GTK_DIALOG(sCreateDestDlg)->action_area),
                      yesButton);
    gtk_container_add(GTK_CONTAINER(GTK_DIALOG(sCreateDestDlg)->action_area),
                      noButton);
    gtk_signal_connect(GTK_OBJECT(yesButton), "clicked",
                       GTK_SIGNAL_FUNC(CreateDestYes), sCreateDestDlg);
    gtk_signal_connect(GTK_OBJECT(noButton), "clicked",
                       GTK_SIGNAL_FUNC(CreateDestNo), sCreateDestDlg);

    GTK_WIDGET_SET_FLAGS(yesButton, GTK_CAN_DEFAULT);
    gtk_widget_grab_default(yesButton);

    gtk_container_add(GTK_CONTAINER(GTK_DIALOG(sCreateDestDlg)->vbox), label);
    
    gtk_widget_show_all(sCreateDestDlg);

    return E_NO_DEST;
}
Example #7
0
bool wxNotebook::InsertPage( size_t position,
                             wxNotebookPage* win,
                             const wxString& text,
                             bool select,
                             int imageId )
{
    wxCHECK_MSG( m_widget != NULL, FALSE, wxT("invalid notebook") );

    wxCHECK_MSG( win->GetParent() == this, FALSE,
               wxT("Can't add a page whose parent is not the notebook!") );

    wxCHECK_MSG( position <= GetPageCount(), FALSE,
                 _T("invalid page index in wxNotebookPage::InsertPage()") );

    // Hack Alert! (Part II): See above in wxInsertChildInNotebook callback
    // why this has to be done.  NOTE: using gtk_widget_unparent here does not
    // work as it seems to undo too much and will cause errors in the
    // gtk_notebook_insert_page below, so instead just clear the parent by
    // hand here.
    win->m_widget->parent = NULL;

    // don't receive switch page during addition
    gtk_signal_disconnect_by_func( GTK_OBJECT(m_widget),
      GTK_SIGNAL_FUNC(gtk_notebook_page_change_callback), (gpointer) this );

    if (m_themeEnabled)
        win->SetThemeEnabled(true);

    GtkNotebook *notebook = GTK_NOTEBOOK(m_widget);

    wxGtkNotebookPage *nb_page = new wxGtkNotebookPage();

    if ( position == GetPageCount() )
        m_pagesData.Append( nb_page );
    else
        m_pagesData.Insert( position, nb_page );

    m_pages.Insert(win, position);

    nb_page->m_box = gtk_hbox_new( FALSE, 1 );
    gtk_container_border_width( GTK_CONTAINER(nb_page->m_box), 2 );

    gtk_signal_connect( GTK_OBJECT(win->m_widget), "size_allocate",
      GTK_SIGNAL_FUNC(gtk_page_size_callback), (gpointer)win );

    gtk_notebook_insert_page( notebook, win->m_widget, nb_page->m_box, position );

    nb_page->m_page = (GtkNotebookPage*) g_list_last(notebook->children)->data;

    /* set the label image */
    nb_page->m_image = imageId;

    if (imageId != -1)
    {
        wxASSERT( m_imageList != NULL );

        const wxBitmap *bmp = m_imageList->GetBitmapPtr(imageId);
        GdkPixmap *pixmap = bmp->GetPixmap();
        GdkBitmap *mask = (GdkBitmap*) NULL;
        if ( bmp->GetMask() )
        {
            mask = bmp->GetMask()->GetBitmap();
        }

        GtkWidget *pixmapwid = gtk_pixmap_new (pixmap, mask );

        gtk_box_pack_start(GTK_BOX(nb_page->m_box), pixmapwid, FALSE, FALSE, m_padding);

        gtk_widget_show(pixmapwid);
    }

    /* set the label text */

    nb_page->m_text = text;
    if (nb_page->m_text.empty()) nb_page->m_text = wxEmptyString;

    nb_page->m_label = GTK_LABEL( gtk_label_new(wxGTK_CONV(nb_page->m_text)) );
    gtk_box_pack_end( GTK_BOX(nb_page->m_box), GTK_WIDGET(nb_page->m_label), FALSE, FALSE, m_padding );

    /* apply current style */
    GtkRcStyle *style = CreateWidgetStyle();
    if ( style )
    {
        gtk_widget_modify_style(GTK_WIDGET(nb_page->m_label), style);
        gtk_rc_style_unref(style);
    }

    /* show the label */
    gtk_widget_show( GTK_WIDGET(nb_page->m_label) );
    if (select && (m_pagesData.GetCount() > 1))
    {
      SetSelection( position );
    }

    gtk_signal_connect( GTK_OBJECT(m_widget), "switch_page",
      GTK_SIGNAL_FUNC(gtk_notebook_page_change_callback), (gpointer)this );

    InvalidateBestSize();
    return true;
}
Example #8
0
void InternetGo (void)
{
  if ((ifilestuff == 0) && (inet == 0))
  {
    shost = gtk_entry_get_text (GTK_ENTRY (connectentry1));
    theaddress = atoaddr (shost);
    iport = atoi (gtk_entry_get_text (GTK_ENTRY (connectentry2)));

    gtk_widget_destroy (connectwindow);
    iyesno = 0;

    bzero ((char *) &host_addr, sizeof (host_addr));
    host_addr.sin_family = AF_INET;
    host_addr.sin_addr.s_addr = inet_addr (inet_ntoa (*theaddress));
    host_addr.sin_port = htons (iport);

    if ((sockfd = socket (AF_INET, SOCK_STREAM, 0)) < 0)
    {
      Message ("Unable to open socket.", 3, 0);
    }
    itheerror = connect (sockfd, (struct sockaddr *) &host_addr, sizeof
      (host_addr));
    if (itheerror < 0)
    {
      sprintf (serrortemp, "Unable to connect to host (%s).", strerror
        (errno));
      Message (serrortemp, 3, 0);
    }
    else
    {
      fcntl (sockfd, F_SETFL, O_NONBLOCK);
      biscomputer = 0;
      sprintf (bplayername, "%s", "unknown");
      wiscomputer = 0;
      sprintf (wplayername, "%s", "unknown");
      StatusBar ();

      if (ichangestuff == 0)
      {
        Play ("open.mp3", 0);
      }

      internetwindow = gtk_window_new (GTK_WINDOW_TOPLEVEL);
      gtk_window_set_title (GTK_WINDOW (internetwindow), "Internet window");
      gtk_signal_connect (GTK_OBJECT (internetwindow), "delete_event",
        GTK_SIGNAL_FUNC (CloseSocket), NULL);
      gtk_window_set_policy (GTK_WINDOW (internetwindow), 0, 0, 1);
      gtk_container_border_width (GTK_CONTAINER (internetwindow), 0);
      gtk_widget_realize (internetwindow);

      internetbox1 = gtk_vbox_new (FALSE, 0);
      gtk_container_border_width (GTK_CONTAINER (internetbox1), 0);
      gtk_container_add (GTK_CONTAINER (internetwindow), internetbox1);
      gtk_widget_show (internetbox1);
      internetbox2 = gtk_hbox_new (FALSE, 0);
      gtk_container_border_width (GTK_CONTAINER (internetbox2), 0);
      gtk_box_pack_start (GTK_BOX (internetbox1), internetbox2, TRUE, TRUE, 5);
      gtk_widget_show (internetbox2);
      internetbox3 = gtk_vbox_new (FALSE, 0);
      gtk_container_border_width (GTK_CONTAINER (internetbox3), 0);
      gtk_box_pack_start (GTK_BOX (internetbox2), internetbox3, TRUE, TRUE, 0);
      gtk_widget_show (internetbox3);
      internettable1 = gtk_table_new (2, 1, FALSE);
      gtk_widget_show (internettable1);
      gtk_box_pack_start (GTK_BOX (internetbox3), internettable1, TRUE, TRUE,
        0);
      internettable2 = gtk_table_new (2, 3, FALSE);
      gtk_widget_show (internettable2);
      gtk_box_pack_start (GTK_BOX (internetbox3), internettable2, TRUE, TRUE,
        0);

      text = gtk_text_new (NULL, NULL);
      gtk_widget_set_usize (text, 535, 266);
      gtk_text_set_editable (GTK_TEXT (text), FALSE);
      gtk_table_attach (GTK_TABLE (internettable1), text, 0, 1, 0, 1,
        GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 5, 0);
      gtk_widget_show (text);

      vscrollbar = gtk_vscrollbar_new (GTK_TEXT (text)->vadj);
      adj = (GTK_TEXT (text))->vadj;
      gtk_table_attach (GTK_TABLE (internettable1), vscrollbar, 1, 2, 0, 1,
        GTK_FILL, GTK_EXPAND  | GTK_FILL, 5, 0);
      gtk_widget_show (vscrollbar);

      cmap = gdk_colormap_get_system ();
      color.red = 0xffff;
      color.green = 0;
      color.blue = 0;
      if (!gdk_color_alloc (cmap, &color))
      {
        Message ("Could not allocate color.", 3, 0);
      }

      gtk_widget_realize (text);

      wrapcheck = gtk_check_button_new_with_label ("wrap");
      gtk_table_attach (GTK_TABLE (internettable2), wrapcheck, 0, 1, 0, 1,
        GTK_FILL, GTK_FILL, 5, 10);
      gtk_signal_connect (GTK_OBJECT (wrapcheck), "toggled",
        GTK_SIGNAL_FUNC (ToggleWrap), text);
      gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (wrapcheck), FALSE);
      gtk_widget_show (wrapcheck);

      internetentry = gtk_entry_new_with_max_length (50);
      gtk_signal_connect (GTK_OBJECT (internetentry), "activate",
        GTK_SIGNAL_FUNC (SendData), NULL);
      gtk_table_attach (GTK_TABLE (internettable2), internetentry, 1, 2, 0, 1,
        GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 5, 10);
      gtk_widget_grab_focus (internetentry);
      gtk_widget_show (internetentry);

      inetsep = gtk_hseparator_new ();
      gtk_table_attach (GTK_TABLE (internettable2), inetsep, 0, 2, 1, 2,
        GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
      gtk_widget_show (inetsep);

      inetbutton = gtk_button_new_with_label ("Disconnect");
      gtk_signal_connect (GTK_OBJECT (inetbutton), "clicked",
        GTK_SIGNAL_FUNC (CloseSocket), NULL);
      GTK_WIDGET_SET_FLAGS (inetbutton, GTK_CAN_DEFAULT);
      gtk_window_set_default (GTK_WINDOW (internetwindow), inetbutton);
      gtk_table_attach (GTK_TABLE (internettable2), inetbutton, 0, 2, 2, 3,
        GTK_EXPAND | GTK_FILL, GTK_FILL, 2, 2);
      gtk_widget_show (inetbutton);

      gtk_widget_show (internetwindow);
      inet = 1;
      ReceiveData ();
    }
  }
}
Example #9
0
void bscope_configure (void)
{
	gdouble color[3];
	if(configure_win)
		return;

	bscope_read_config();
	color[0]=((gdouble)(bscope_cfg.color /0x10000))/256;
	color[1]=((gdouble)((bscope_cfg.color %0x10000)/0x100))/256;
	color[2]=((gdouble)(bscope_cfg.color %0x100))/256;
	
	configure_win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_container_set_border_width(GTK_CONTAINER(configure_win), 10);
	gtk_window_set_title(GTK_WINDOW(configure_win), _("Color Entry"));
	gtk_window_set_policy(GTK_WINDOW(configure_win), FALSE, FALSE, FALSE);
	gtk_window_set_position(GTK_WINDOW(configure_win), GTK_WIN_POS_MOUSE);
	gtk_signal_connect(GTK_OBJECT(configure_win), "destroy", GTK_SIGNAL_FUNC(gtk_widget_destroyed),
			   &configure_win);

	vbox = gtk_vbox_new(FALSE, 5);

	options_frame = gtk_frame_new(_("Options:"));
	gtk_container_set_border_width(GTK_CONTAINER(options_frame), 5);

	options_vbox = gtk_vbox_new(FALSE, 5);
	gtk_container_set_border_width(GTK_CONTAINER(options_vbox), 5);

	options_colorpicker = gtk_color_selection_new();
	gtk_color_selection_set_color(GTK_COLOR_SELECTION(options_colorpicker), color);
	gtk_signal_connect(GTK_OBJECT(options_colorpicker), "color_changed", GTK_SIGNAL_FUNC(color_changed), NULL);

	gtk_box_pack_start(GTK_BOX(options_vbox), options_colorpicker, FALSE, FALSE, 0);
        gtk_widget_show(options_colorpicker);
	
	
	gtk_container_add(GTK_CONTAINER(options_frame), options_vbox);
	gtk_widget_show(options_vbox);

	gtk_box_pack_start(GTK_BOX(vbox), options_frame, TRUE, TRUE, 0);
	gtk_widget_show(options_frame);

	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), NULL);
	GTK_WIDGET_SET_FLAGS(ok, GTK_CAN_DEFAULT);
	gtk_box_pack_start(GTK_BOX(bbox), ok, TRUE, TRUE, 0);
	gtk_widget_show(ok);
	

	cancel = gtk_button_new_with_label(_("Cancel"));
	gtk_signal_connect(GTK_OBJECT(cancel), "clicked",
			   GTK_SIGNAL_FUNC(configure_cancel),
			   GUINT_TO_POINTER(bscope_cfg.color));
	GTK_WIDGET_SET_FLAGS(cancel, GTK_CAN_DEFAULT);
	gtk_box_pack_start(GTK_BOX(bbox), cancel, TRUE, TRUE, 0);
	gtk_widget_show(cancel);
	gtk_widget_show(bbox);
	
	gtk_container_add(GTK_CONTAINER(configure_win), vbox);
	gtk_widget_show(vbox);
	gtk_widget_show(configure_win);
	gtk_widget_grab_default(ok);
}
Example #10
0
int l_uosopr(int metka, //0-воод и корректировка 1-выбор
             iceb_u_str *kod,iceb_u_str *naimk,GtkWidget *wpredok)
{
    uosopr_data data;
    char bros[512];
    GdkColor color;
    data.metka_rr=metka;

    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),400,-1);
//gdk_color_parse("black",&color);
//gtk_widget_modify_bg(data.window,GTK_STATE_NORMAL,&color);


    sprintf(bros,"%s %s",name_system,gettext("Список операций расходов"));

    gtk_window_set_title (GTK_WINDOW (data.window),bros);
    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)
    {
        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);
    }

    gtk_signal_connect_after(GTK_OBJECT(data.window),"key_press_event",GTK_SIGNAL_FUNC(uosopr_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("Список операций расходов"));


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

    gtk_widget_show(vbox1);
    gtk_widget_show(vbox2);

    data.label_poisk=gtk_label_new ("");
    /************
    PangoFontDescription *font_pango=pango_font_description_from_string(shrift_ravnohir.ravno());
    gtk_widget_modify_font(GTK_WIDGET(data.label_ost),font_pango);
    pango_font_description_free(font_pango);
    ***************/

    gdk_color_parse("red",&color);
    gtk_widget_modify_fg(data.label_poisk,GTK_STATE_NORMAL,&color);

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

    data.sw = gtk_scrolled_window_new (NULL, NULL);
    gtk_widget_set_usize(GTK_WIDGET(data.sw),-1,200);

    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(bros,"F2 %s",gettext("Ввести"));
    data.knopka[FK2]=gtk_button_new_with_label(bros);
    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(uosopr_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]);

    sprintf(bros,"%sF2 %s",RFK,gettext("Корректировать"));
    data.knopka[SFK2]=gtk_button_new_with_label(bros);
    gtk_box_pack_start(GTK_BOX(vbox1), data.knopka[SFK2],TRUE,TRUE, 0);
    gtk_signal_connect(GTK_OBJECT(data.knopka[SFK2]), "clicked",GTK_SIGNAL_FUNC(uosopr_knopka),&data);
    tooltips[SFK2]=gtk_tooltips_new();
    gtk_tooltips_set_tip(tooltips[SFK2],data.knopka[SFK2],gettext("Корректировка выбранной записи"),NULL);
    gtk_object_set_user_data(GTK_OBJECT(data.knopka[SFK2]),(gpointer)SFK2);
    gtk_widget_show(data.knopka[SFK2]);

    sprintf(bros,"F3 %s",gettext("Удалить"));
    data.knopka[FK3]=gtk_button_new_with_label(bros);
    gtk_box_pack_start(GTK_BOX(vbox1), data.knopka[FK3],TRUE,TRUE, 0);
    gtk_signal_connect(GTK_OBJECT(data.knopka[FK3]), "clicked",GTK_SIGNAL_FUNC(uosopr_knopka),&data);
    tooltips[FK3]=gtk_tooltips_new();
    gtk_tooltips_set_tip(tooltips[FK3],data.knopka[FK3],gettext("Удалить выбранную запись"),NULL);
    gtk_object_set_user_data(GTK_OBJECT(data.knopka[FK3]),(gpointer)FK3);
    gtk_widget_show(data.knopka[FK3]);

    sprintf(bros,"%sF3 %s",RFK,gettext("Удалить"));
    data.knopka[SFK3]=gtk_button_new_with_label(bros);
    gtk_box_pack_start(GTK_BOX(vbox1), data.knopka[SFK3],TRUE,TRUE, 0);
    gtk_signal_connect(GTK_OBJECT(data.knopka[SFK3]), "clicked",GTK_SIGNAL_FUNC(uosopr_knopka),&data);
    tooltips[SFK3]=gtk_tooltips_new();
    gtk_tooltips_set_tip(tooltips[SFK3],data.knopka[SFK3],gettext("Удалить неиспользуемые коды операций"),NULL);
    gtk_object_set_user_data(GTK_OBJECT(data.knopka[SFK3]),(gpointer)SFK3);
    gtk_widget_show(data.knopka[SFK3]);

    sprintf(bros,"F4 %s",gettext("Поиск"));
    data.knopka[FK4]=gtk_button_new_with_label(bros);
    gtk_box_pack_start(GTK_BOX(vbox1), data.knopka[FK4],TRUE,TRUE, 0);
    gtk_signal_connect(GTK_OBJECT(data.knopka[FK4]), "clicked",GTK_SIGNAL_FUNC(uosopr_knopka),&data);
    tooltips[FK4]=gtk_tooltips_new();
    gtk_tooltips_set_tip(tooltips[FK4],data.knopka[FK4],gettext("Поиск нужных записей"),NULL);
    gtk_object_set_user_data(GTK_OBJECT(data.knopka[FK4]),(gpointer)FK4);
    gtk_widget_show(data.knopka[FK4]);

    sprintf(bros,"F5 %s",gettext("Печать"));
    data.knopka[FK5]=gtk_button_new_with_label(bros);
    gtk_box_pack_start(GTK_BOX(vbox1), data.knopka[FK5],TRUE,TRUE, 0);
    gtk_signal_connect(GTK_OBJECT(data.knopka[FK5]), "clicked",GTK_SIGNAL_FUNC(uosopr_knopka),&data);
    tooltips[FK5]=gtk_tooltips_new();
    gtk_tooltips_set_tip(tooltips[FK5],data.knopka[FK5],gettext("Распечатка записей"),NULL);
    gtk_object_set_user_data(GTK_OBJECT(data.knopka[FK5]),(gpointer)FK5);
    gtk_widget_show(data.knopka[FK5]);


    sprintf(bros,"F10 %s",gettext("Выход"));
    data.knopka[FK10]=gtk_button_new_with_label(bros);
    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(uosopr_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]);

    uosopr_create_list(&data);
    gtk_widget_show(data.window);

    if(metka == 0)
        gtk_window_maximize(GTK_WINDOW(data.window));
//gtk_window_fullscreen(GTK_WINDOW(data.window));


    gtk_main();


    printf("l_uosopr end\n");
    if(wpredok != NULL)
        gdk_window_set_cursor(wpredok->window,gdk_cursor_new(ICEB_CURSOR));
    if(data.metka_voz == 0)
        if(metka == 1)
        {
            kod->new_plus(data.kodv.ravno());
            naimk->new_plus(data.naimv.ravno());
        }
    return(data.metka_voz);

}
Example #11
0
int main(int argc, char **argv)
{
struct gtkwave_dual_ipc_t *dual_ctx;
char buf[257], buf2[257];
int shmid;
GtkWidget *main_vbox, *mainwindow, *vpan;
int i;
int split_point = -1;
#ifdef __MINGW32__
char mapName[65];
HANDLE hMapFile;
#endif

GtkWidget *xsocket[2] = { NULL, NULL };

WAVE_LOCALE_FIX

if(!gtk_init_check(&argc, &argv))
        {
        printf("Could not initialize GTK!  Is DISPLAY env var/xhost set?\n\n");
	exit(255);
        }

#ifdef __CYGWIN__
fprintf(stderr, "TWINWAVE| If the viewer crashes with a Bad system call error,\n");
fprintf(stderr, "TWINWAVE| make sure that Cygserver is enabled.\n");
#endif

for(i=0;i<argc;i++)
	{
	if(!strcmp(argv[i], "+"))
		{
		split_point = i;
		break;
		}

	if(!strcmp(argv[i], "++"))
		{
		split_point = i;
		use_embedded = 0;
		break;
		}
	}

if(split_point < 0)
	{
	printf("Usage:\n------\n%s arglist1 separator arglist2\n\n"
		"The '+' between argument lists splits and creates one window.\n"
		"The '++' between argument lists splits and creates two windows.\n"
		"\n", argv[0]);
	exit(255);
	}

mainwindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(mainwindow), "TwinWave Initializing");
#ifndef MAC_INTEGRATION
gtk_widget_set_usize(GTK_WIDGET(mainwindow), 820, 800);
#else
gtk_widget_set_usize(GTK_WIDGET(mainwindow), 400,32); /* quartz doesn't retarget into mainwindow */
#endif
gtk_widget_show(mainwindow);

gtk_signal_connect(GTK_OBJECT(mainwindow), "destroy", GTK_SIGNAL_FUNC(quit_callback), "WM destroy");


xsocket[0] = gtk_socket_new ();
xsocket[1] = gtk_socket_new ();
gtk_widget_show (xsocket[0]);
gtk_widget_show (xsocket[1]);

gtk_signal_connect(GTK_OBJECT(xsocket[0]), "plug-removed", GTK_SIGNAL_FUNC(plug_removed), NULL);

main_vbox = gtk_vbox_new(FALSE, 5);
gtk_container_border_width(GTK_CONTAINER(main_vbox), 1);
gtk_container_add(GTK_CONTAINER(mainwindow), main_vbox);
gtk_widget_show(main_vbox);

vpan = gtk_vpaned_new ();
gtk_widget_show (vpan);
gtk_box_pack_start (GTK_BOX (main_vbox), vpan, TRUE, TRUE, 1);

gtk_paned_pack1 (GTK_PANED (vpan), xsocket[0], TRUE, FALSE);

gtk_signal_connect(GTK_OBJECT(xsocket[1]), "plug-removed", GTK_SIGNAL_FUNC(plug_removed), NULL);

gtk_paned_pack2 (GTK_PANED (vpan), xsocket[1], TRUE, FALSE);

#ifdef __MINGW32__
shmid = getpid();
sprintf(mapName, "twinwave%d", shmid);
hMapFile = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, 2 * sizeof(struct gtkwave_dual_ipc_t), mapName);
if(hMapFile != NULL)
        {
        dual_ctx = MapViewOfFile(hMapFile, FILE_MAP_ALL_ACCESS, 0, 0, 2 * sizeof(struct gtkwave_dual_ipc_t));

        if(dual_ctx)
               	{
               	memset(dual_ctx, 0, 2 * sizeof(struct gtkwave_dual_ipc_t));
               	memcpy(&dual_ctx[0].matchword, DUAL_MATCHWORD, 4);
               	memcpy(&dual_ctx[1].matchword, DUAL_MATCHWORD, 4);

		/* child 0 */
				{
				int idx;
				int n_items = split_point + 5;
				int slen;
				char **arglist = calloc(n_items, sizeof(char *));
				char *mylist;
				STARTUPINFO si;
				PROCESS_INFORMATION pi;
				BOOL rc;

				memset(&si, 0, sizeof(STARTUPINFO));
				memset(&pi, 0, sizeof(PROCESS_INFORMATION));

				sprintf(buf, "0+%08X", shmid);
#ifdef MINGW_USE_XID
				sprintf(buf2, "%x", gtk_socket_get_id (GTK_SOCKET(xsocket[0])));
#else
				sprintf(buf2, "%x", 0);
#endif

				arglist[0] = "gtkwave.exe";
				arglist[1] = "-D";
				arglist[2] = buf;
				arglist[3] = "-X";
				arglist[4] = buf2;

				for(i=1;i<split_point;i++)
					{
					arglist[i+4] = argv[i];
					}

				arglist[i+4] = NULL;

				slen = 1;
				for(idx=0;idx<i+4;idx++)
					{
					slen += strlen(arglist[idx]);
					slen++;
					}
				mylist = calloc(1, slen);
				for(idx=0;idx<i+4;idx++)
					{
					strcat(mylist, arglist[idx]);
					strcat(mylist, " ");
					}

				si.cb = sizeof(si);

				rc = CreateProcess(
					arglist[0],
					mylist,
					NULL,
					NULL,
					FALSE,
					0,
					NULL,
					NULL,
					&si,
					&pi);
			
				if(!rc) 
					{
					fprintf(stderr, "Child 0 failed '%s' '%s'\n", arglist[0], mylist);
					exit(255);
					}

				free(mylist);
				free(arglist);
				}

		/* child 1 */
				{
				int idx;
				int n_items = argc - split_point + 5;
				int slen;
				char **arglist = calloc(n_items, sizeof(char *));
				char *mylist;
				STARTUPINFO si;
				PROCESS_INFORMATION pi;
				BOOL rc;

				memset(&si, 0, sizeof(STARTUPINFO));
				memset(&pi, 0, sizeof(PROCESS_INFORMATION));

				sprintf(buf, "1+%08X", shmid);
#ifdef MINGW_USE_XID
				sprintf(buf2, "%x", gtk_socket_get_id (GTK_SOCKET(xsocket[1])));
#else
				sprintf(buf2, "%x", 0);
#endif

				arglist[0] = "gtkwave.exe";
				arglist[1] = "-D";
				arglist[2] = buf;
				arglist[3] = "-X";
				arglist[4] = buf2;

				for(i=split_point+1;i<argc;i++)
					{
					arglist[i-split_point+4] = argv[i];
					}

				i-=split_point;
				arglist[i+4] = NULL;

				slen = 1;
				for(idx=0;idx<i+4;idx++)
					{
					slen += strlen(arglist[idx]);
					slen++;
					}
				mylist = calloc(1, slen);
				for(idx=0;idx<i+4;idx++)
					{
					strcat(mylist, arglist[idx]);
					strcat(mylist, " ");
					}

				si.cb = sizeof(si);

				rc = CreateProcess(
					arglist[0],
					mylist,
					NULL,
					NULL,
					FALSE,
					0,
					NULL,
					NULL,
					&si,
					&pi);
			
				if(!rc) 
					{
					fprintf(stderr, "Child 1 failed '%s' '%s'\n", arglist[0], mylist);
					exit(255);
					}

				free(mylist);
				free(arglist);
				}


		for(;;)
			{
			Sleep(1000 / 5);
			while (gtk_events_pending()) gtk_main_iteration();

			if((!dual_ctx[0].viewer_is_initialized)&&(dual_ctx[1].viewer_is_initialized))
				{
				gtk_window_set_title(GTK_WINDOW(mainwindow), "TwinWave Waiting on Viewer #1");
				}
			else
			if((dual_ctx[0].viewer_is_initialized)&&(!dual_ctx[1].viewer_is_initialized))
				{
				gtk_window_set_title(GTK_WINDOW(mainwindow), "TwinWave Waiting on Viewer #2");
				}
			else
			if((dual_ctx[0].viewer_is_initialized)&&(dual_ctx[1].viewer_is_initialized))
				{
				gtk_window_set_title(GTK_WINDOW(mainwindow), "TwinWave");
				break;
				}
			}
#ifdef MINGW_USE_XID
		gtk_main();
#endif
		}
	}
#else
shmid = shmget(0, 2 * sizeof(struct gtkwave_dual_ipc_t), IPC_CREAT | 0600 );
if(shmid >=0)
	{
        struct shmid_ds ds;
                                 
        dual_ctx = shmat(shmid, NULL, 0);
        if(dual_ctx)
               	{
               	memset(dual_ctx, 0, 2 * sizeof(struct gtkwave_dual_ipc_t));
               	memcpy(&dual_ctx[0].matchword, DUAL_MATCHWORD, 4);
               	memcpy(&dual_ctx[1].matchword, DUAL_MATCHWORD, 4);
	         
#ifdef __linux__
              	shmctl(shmid, IPC_RMID, &ds); /* mark for destroy */
#endif

		if(fork())
			{
			if(fork())
				{
				struct timeval tv;
			
				for(;;)
					{
			                tv.tv_sec = 0;
		                        tv.tv_usec = 1000000 / 5;
	        	                select(0, NULL, NULL, NULL, &tv);

					while (gtk_events_pending()) gtk_main_iteration();

					if((!dual_ctx[0].viewer_is_initialized)&&(dual_ctx[1].viewer_is_initialized))
						{
						gtk_window_set_title(GTK_WINDOW(mainwindow), "TwinWave Waiting on Viewer #1");
						}
					else
					if((dual_ctx[0].viewer_is_initialized)&&(!dual_ctx[1].viewer_is_initialized))
						{
						gtk_window_set_title(GTK_WINDOW(mainwindow), "TwinWave Waiting on Viewer #2");
						}
					else
					if((dual_ctx[0].viewer_is_initialized)&&(dual_ctx[1].viewer_is_initialized))
						{
						gtk_window_set_title(GTK_WINDOW(mainwindow), "TwinWave");
						break;
						}
					}

#ifndef __linux__
				while (gtk_events_pending()) gtk_main_iteration();
				sleep(2);
		               	shmctl(shmid, IPC_RMID, &ds); /* mark for destroy */
#endif
				if(use_embedded)
					{
					gtk_main();
					}
				}
				else
				{
				int n_items = split_point + 5;
				char **arglist = calloc(n_items, sizeof(char *));

				sprintf(buf, "0+%08X", shmid);
				if(use_embedded)
					{
					sprintf(buf2, "%x", gtk_socket_get_id (GTK_SOCKET(xsocket[0])));
					}
					else
					{
					sprintf(buf2, "%x", 0);
					}

				arglist[0] = "gtkwave";
				arglist[1] = "-D";
				arglist[2] = buf;
				arglist[3] = "-X";
				arglist[4] = buf2;

				for(i=1;i<split_point;i++)
					{
					arglist[i+4] = argv[i];
					}

				arglist[i+4] = NULL;

				execvp(arglist[0], arglist);

				fprintf(stderr, "Child failed\n");
				exit(255);
				}
			}
			else			
			{
			int n_items = argc - split_point + 5;
			char **arglist = calloc(n_items, sizeof(char *));

			sprintf(buf, "1+%08X", shmid);
			if(use_embedded)
				{
				sprintf(buf2, "%x", gtk_socket_get_id (GTK_SOCKET(xsocket[1])));
				}
				else
				{
				sprintf(buf2, "%x", 0);
				}

			arglist[0] = "gtkwave";
			arglist[1] = "-D";
			arglist[2] = buf;
			arglist[3] = "-X";
			arglist[4] = buf2;

			for(i=split_point+1;i<argc;i++)
				{
				arglist[i-split_point+4] = argv[i];
				}
			i-=split_point;
			arglist[i+4] = NULL;

			execvp(arglist[0], arglist);

			fprintf(stderr, "Child failed\n");
			exit(255);
			}
		}
	}
#endif

return(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 );

 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( WidgetDestroy ),&fsFileSelect );
 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( fsOk ),"released",GTK_SIGNAL_FUNC( fs_Ok_released ),fsCombo4 );
 gtk_signal_connect( GTK_OBJECT( fsCancel ),"released",GTK_SIGNAL_FUNC( fs_Cancel_released ),NULL );
 gtk_signal_connect( GTK_OBJECT( fsFNameList ),"select_row",(GtkSignalFunc)fs_fsFNameList_select_row,NULL );

 gtk_widget_grab_focus( fsFNameList );

 return fsFileSelect;
}
Example #13
0
bool wxFontDialog::DoCreate(wxWindow *parent)
{
    m_needParent = FALSE;

    if (!PreCreation( parent, wxDefaultPosition, wxDefaultSize ) ||
            !CreateBase( parent, -1, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE,
                         wxDefaultValidator, wxT("fontdialog") ))
    {
        wxFAIL_MSG( wxT("wxFontDialog creation failed") );
        return FALSE;
    }

    wxString m_message( _("Choose font") );
    m_widget = gtk_font_selection_dialog_new( wxGTK_CONV( m_message ) );

    if (parent)
        gtk_window_set_transient_for(GTK_WINDOW(m_widget),
                                     GTK_WINDOW(parent->m_widget));

    GtkFontSelectionDialog *sel = GTK_FONT_SELECTION_DIALOG(m_widget);

    gtk_signal_connect( GTK_OBJECT(sel->ok_button), "clicked",
                        GTK_SIGNAL_FUNC(gtk_fontdialog_ok_callback), (gpointer*)this );

#ifndef __WXGTK20__
    // strange way to internationalize
    gtk_label_set( GTK_LABEL( BUTTON_CHILD(sel->ok_button) ), _("OK") );
#endif

    gtk_signal_connect( GTK_OBJECT(sel->cancel_button), "clicked",
                        GTK_SIGNAL_FUNC(gtk_fontdialog_cancel_callback), (gpointer*)this );

#ifndef __WXGTK20__
    // strange way to internationalize
    gtk_label_set( GTK_LABEL( BUTTON_CHILD(sel->cancel_button) ), _("Cancel") );
#endif

    gtk_signal_connect( GTK_OBJECT(m_widget), "delete_event",
                        GTK_SIGNAL_FUNC(gtk_fontdialog_delete_callback), (gpointer)this );

    wxFont font = m_fontData.GetInitialFont();
    if( font.Ok() )
    {
        const wxNativeFontInfo *info = font.GetNativeFontInfo();

        if ( info )
        {

#ifdef __WXGTK20__
            const wxString& fontname = info->ToString();
#else
            const wxString& fontname = info->GetXFontName();
            if ( !fontname )
                font.GetInternalFont();
#endif
            gtk_font_selection_dialog_set_font_name(sel, wxGTK_CONV(fontname));
        }
        else
        {
            // this is not supposed to happen!
            wxFAIL_MSG(_T("font is ok but no native font info?"));
        }
    }

    return TRUE;
}
Example #14
0
bool gtkgui_init(int argc,char *argv[], Stream_mixer *mix)
{

	GtkWidget *bbox=NULL;
	bool isx=false;
	int i;
	
	/* initialization */
	state=true;
	mixer=mix;
	for(i=0; i<7; i++) {
/*		channum[i]=0;*/
		blockid[i]=0;
	}
	
	/*maxpos=0;*/
	list_init(&listachan);
	list_init(&lamelist);
	list_init(&ogglist);
	pathfile=NULL;
	
	/* signal to glib we're going to use threads */
	g_thread_init(NULL);

	isx=gtk_init_check(&argc,&argv);
	if(!isx) return false;	

	isx=mixer->set_lineout(true);

	window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_window_set_title(GTK_WINDOW(window),"MuSE - Multiple Streaming Engine");
	gtk_window_set_policy(GTK_WINDOW(window), TRUE, TRUE, TRUE);
	gtk_container_set_border_width(GTK_CONTAINER(window),7);
	gtk_signal_connect(GTK_OBJECT(window),"delete_event",
					(GtkSignalFunc)gcb_exit,NULL);

	gtk_widget_realize(window);
//	load_knob_pixs(window);
	
	vbox=gtk_vbox_new(FALSE, 0);
	gtk_container_add(GTK_CONTAINER(window),vbox);
	

	fix=gtk_fixed_new();
	//gtk_container_add(GTK_CONTAINER(vbox), fix);
	gtk_box_pack_start(GTK_BOX(vbox), fix, FALSE, FALSE, 0);
	
	bbox=createbbox(bbox);
	gtk_fixed_put(GTK_FIXED(fix), bbox, 0, 0);
	/*gtk_box_pack_start(GTK_BOX(vbox), bbox, FALSE, FALSE, 0);*/ 
	if(isx)
		gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(speakout), TRUE);
	
	
	pack_new();		
	
	/*firstchanfree(channum);*/
	createch();
	putstatusbar();
	
	/*let's show window */
	gtk_widget_show_all(window);
	gtk_widget_hide(pack1.hscale);
	gtk_widget_hide(pack2.hscale);
	gtk_widget_hide(pack3.hscale);

	return true;	
}
Example #15
0
int
nsSetupTypeDlg::VerifyDiskSpace(void)
{
    int err = OK;
    int dsAvail, dsReqd;
    char dsAvailStr[128], dsReqdStr[128];
    char message[512];
    GtkWidget *noDSDlg, *label, *okButton;

    // find disk space available at destination
    dsAvail = DSAvailable();
    if (dsAvail < 0)
        return OK; // optimistic when statfs failed
                   // or we don't have statfs

    // get disk space required
    dsReqd = DSRequired();

    if (dsReqd > dsAvail)
    {
        if (gCtx->opt->mMode == nsXIOptions::MODE_DEFAULT)
        {
            // throw up not enough ds dlg
            sprintf(dsAvailStr, gCtx->Res("DS_AVAIL"), dsAvail);
            sprintf(dsReqdStr, gCtx->Res("DS_REQD"), dsReqd);
            sprintf(message, "%s\n%s\n\n%s", dsAvailStr, dsReqdStr, 
                    gCtx->Res("NO_DISK_SPACE"));

            noDSDlg = gtk_dialog_new();
            gtk_window_set_modal(GTK_WINDOW(noDSDlg), TRUE);
            label = gtk_label_new(message);
            okButton = gtk_button_new_with_label(gCtx->Res("OK_LABEL"));

            if (noDSDlg && label && okButton)
            {
                gtk_window_set_title(GTK_WINDOW(noDSDlg), gCtx->opt->mTitle);
                gtk_window_set_position(GTK_WINDOW(noDSDlg), 
                        GTK_WIN_POS_CENTER);
                gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
                gtk_misc_set_padding(GTK_MISC(label), 20, 20);
                gtk_misc_set_alignment(GTK_MISC(label), 0.5, 1);
                gtk_box_pack_start(GTK_BOX(
                        GTK_DIALOG(noDSDlg)->action_area), okButton,
                        FALSE, FALSE, 10);
                gtk_signal_connect(GTK_OBJECT(okButton), "clicked", 
                        GTK_SIGNAL_FUNC(NoDiskSpaceOK), noDSDlg);
                gtk_box_pack_start(GTK_BOX(
                        GTK_DIALOG(noDSDlg)->vbox), label, FALSE, FALSE, 10);

                GTK_WIDGET_SET_FLAGS(okButton, GTK_CAN_DEFAULT);
                gtk_widget_grab_default(okButton);

                gtk_widget_show_all(noDSDlg);
            }
        }

        err = E_NO_DISK_SPACE;
    }

    return err;
}
Example #16
0
GtkWidget *voronoi_dialog_new (gpointer data) {

	GtkWidget *vbox, *vbox2, *vbox3, *guide_box, *hbox, *hbox1, *hbox2, *frame, *frame2, *button, *wdg, *check_box, *lblmax, *lblwidth, *button_uniform, *preview_box, *scale;
	GtkObject *adj;
	GSList *group = NULL, *group1 = NULL, *group2 = NULL, *group3 = NULL;
	voronoi_struct *vs;
	voronoi_dialog_struct *vds;
	hf_wrapper_struct *hfw;
	hfw = (hf_wrapper_struct *) * (hf_wrapper_struct **) data;
	vs = hfw->hf_options->img->voronoi;
	vds = hfw->hf_options->img->voronoi_dialog;
	
	frame = options_frame_new("Cracks network");

	vbox = gtk_vbox_new(FALSE,DEF_PAD);
	gtk_widget_show(GTK_WIDGET(vbox));

	hbox = gtk_hbox_new(FALSE,DEF_PAD);
	gtk_widget_show(GTK_WIDGET(hbox));

	define_label_in_box("Average cell size", hbox, FALSE,TRUE, DEF_PAD);
 	vds->adj_cell_size = gtk_adjustment_new (
		vs->cell_size,0.0, 50.0, 0.1, 0.1, 0.0);
	define_scale_in_box(vds->adj_cell_size,hbox,1,DEF_PAD);
	gtk_signal_connect (GTK_OBJECT (vds->adj_cell_size), "value_changed", GTK_SIGNAL_FUNC (gdouble_adj_callb), (gpointer) &vs->cell_size);
	gtk_signal_connect (GTK_OBJECT (vds->adj_cell_size), "value_changed", GTK_SIGNAL_FUNC (gboolean_set_false), (gpointer) &hfw->if_calculated);

  	gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
	gtk_box_pack_start(GTK_BOX(vbox), 
		seed_dialog_new(data, vs->seed, change_voronoi_seed), 
		TRUE, TRUE, 0);
		
//	******** Distribution of cells

	//	Box for radio buttons
	vbox2 = gtk_vbox_new(FALSE,0);
	gtk_widget_show(GTK_WIDGET(vbox2));
	
	frame2 = define_frame_with_hiding_arrows ("Cell distribution", vbox2, hfw->hf_options->tools_window, FALSE);
	
	gtk_box_pack_start(GTK_BOX(vbox), frame2, TRUE, TRUE, 0);
	
	// We need a scale for the REGULAR option, for controlling the perturbation
	
	hbox = gtk_hbox_new(FALSE,DEF_PAD);
	gtk_widget_show(GTK_WIDGET(hbox));

	define_label_in_box("Random variation", hbox, FALSE,TRUE, DEF_PAD);
 	vds->adj_random_variation = gtk_adjustment_new (
		vs->random_variation,0.0, 100.0, 1, 1, 0.0);
	wdg = define_scale_in_box(vds->adj_random_variation,hbox,0,DEF_PAD);
	gtk_signal_connect (GTK_OBJECT (vds->adj_random_variation), "value_changed", GTK_SIGNAL_FUNC (gint_adj_callb), (gpointer) &vs->random_variation);
	gtk_signal_connect (GTK_OBJECT (vds->adj_random_variation), "value_changed", GTK_SIGNAL_FUNC (gboolean_set_false), (gpointer) &hfw->if_calculated);
		
	// We need a row of buttons for controlling the scale (multiple or not)
	
	hbox1 = gtk_hbox_new(FALSE,DEF_PAD);
	define_label_in_box("Scale", hbox1, FALSE,TRUE, DEF_PAD);
	gtk_widget_show(GTK_WIDGET(hbox1));
	define_radio_button_in_box_with_data (hbox1, &group1, "1X", set_scale_1x, &vs->scale, (vs->scale==SCALE_1X)) ;
	define_radio_button_in_box_with_data (hbox1, &group1, "1X+2X", set_scale_1x_2x, &vs->scale, (vs->scale==SCALE_1X_2X)) ;
	define_radio_button_in_box_with_data (hbox1, &group1, "1X+2X+4X", set_scale_1x_2x_4x, &vs->scale, (vs->scale==SCALE_1X_2X_4X)) ;
	
	button = 
	define_radio_button_in_box_with_data (vbox2, &group, "Uniform / random",
		set_uniform_distrib, &vs->distribution_type,
		(vs->distribution_type==UNIFORM)) ;
	gtk_signal_connect (GTK_OBJECT (button), "clicked", (GtkSignalFunc) hide_if_true, (gpointer) hbox);
	gtk_signal_connect (GTK_OBJECT (button), "clicked", (GtkSignalFunc) show_if_true, (gpointer) hbox1);
	button = 
	define_radio_button_in_box_with_data (vbox2, &group, "Centered / random",
		set_centered_distrib, &vs->distribution_type,
		(vs->distribution_type==CENTERED)) ;
	gtk_signal_connect (GTK_OBJECT (button), "clicked", (GtkSignalFunc) hide_if_true, (gpointer) hbox);
	gtk_signal_connect (GTK_OBJECT (button), "clicked", (GtkSignalFunc) show_if_true, (gpointer) hbox1);
	button = 
	define_radio_button_in_box_with_data (vbox2, &group, "Regular / perturbated",
		set_regular_distrib, &vs->distribution_type,
		(vs->distribution_type==REGULAR)) ;
	gtk_signal_connect (GTK_OBJECT (button), "clicked", (GtkSignalFunc) show_if_true, (gpointer) hbox);
	gtk_signal_connect (GTK_OBJECT (button), "clicked", (GtkSignalFunc) hide_if_true, (gpointer) hbox1);
	
	// At the end, We add the random variation scale for REGULAR
	// and the radio buttons for the multiple scale control

  	gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);  	gtk_box_pack_start (GTK_BOX (vbox2), hbox1, FALSE, FALSE, 0);
	
	if (vs->distribution_type!=REGULAR)
		gtk_widget_hide(GTK_WIDGET(hbox));
	else
		gtk_widget_hide(GTK_WIDGET(hbox1));
	
	/*****************************************************/
	
	// Now specify how the current HF should be used
	
	vbox2 = gtk_vbox_new(FALSE,0);
	gtk_widget_show(GTK_WIDGET(vbox2));
	
	frame2 = define_frame_with_hiding_arrows ("Use of current height field", vbox2, hfw->hf_options->tools_window, FALSE);
	gtk_box_pack_start(GTK_BOX(vbox), frame2, FALSE, FALSE, 0.5*DEF_PAD);
	
	// Vbox3: "USE AS GUIDE" dialog (for adding noise)
	
	guide_box = gtk_vbox_new(FALSE,DEF_PAD);
	gtk_widget_show(GTK_WIDGET(guide_box));
	
	check_box = define_check_button_in_box ("Gener noise anyway?", guide_box, 0, 0, 0);
	gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_box),vs->gener_noise);
	gtk_signal_connect (GTK_OBJECT(check_box), "toggled",
		GTK_SIGNAL_FUNC(toggle_check_button_callb), (gpointer) &vs->gener_noise);
	
	// Preview box
	preview_box = gtk_hbox_new(FALSE,DEF_PAD);
	gtk_widget_show(GTK_WIDGET(preview_box));
	
	vds->noise_preview =
		view_struct_new(NOISE_PREVIEW_SIZE,NOISE_PREVIEW_SIZE,(gpointer) compute_noise_preview,(gpointer)  hfw->hf_options->img);
	gtk_box_pack_start(GTK_BOX(preview_box), vds->noise_preview->area, TRUE, TRUE, DEF_PAD *0.5);
	
	vbox3 =  seed_dialog_new_lbl(hfw->hf_options->img, vs->noise_opt->seed, change_noise_seed, FALSE, VERTICAL_BOX );
	
	adj = gtk_adjustment_new (0, -4, 4, 1, 1, 0.1);
	
    	scale = gtk_hscale_new (GTK_ADJUSTMENT (adj));
	gtk_widget_set_usize(scale,75,0);
	gtk_scale_set_digits (GTK_SCALE (scale), 0); 
	gtk_box_pack_start (GTK_BOX (vbox3), scale, TRUE, TRUE, DEF_PAD*0.5); 
	gtk_widget_show (scale);
	
	gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
		GTK_SIGNAL_FUNC(gint_adj_callb), &vs->noise_opt->roughness);
	gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
		GTK_SIGNAL_FUNC(draw_area_callb), vds->noise_preview);
		
	gtk_box_pack_start(GTK_BOX(preview_box), vbox3, TRUE, TRUE, DEF_PAD*0.5);
	
	gtk_box_pack_start(GTK_BOX(guide_box), preview_box, FALSE, FALSE, 0.5*DEF_PAD);
	
	gtk_signal_connect (GTK_OBJECT (check_box), "toggled",
	       (GtkSignalFunc) show_if_true, (gpointer) preview_box);
	       	
	if (vs->gener_noise==FALSE)
		gtk_widget_hide(GTK_WIDGET(preview_box));
		
	// Scale for the noise level
	
	hbox2 = gtk_hbox_new(FALSE,DEF_PAD);
	gtk_widget_show(GTK_WIDGET(hbox2));

	define_label_in_box("Noise level", hbox2, FALSE,TRUE, DEF_PAD);
 	vds->adj_noise_level = gtk_adjustment_new (
		vs->noise_level,0.0, 100.0, 1, 1, 0.0);
	wdg = define_scale_in_box(vds->adj_noise_level,hbox2,0,DEF_PAD);
	gtk_signal_connect (GTK_OBJECT (vds->adj_noise_level), "value_changed", GTK_SIGNAL_FUNC (gint_adj_callb), (gpointer) &vs->noise_level);
	gtk_signal_connect (GTK_OBJECT (vds->adj_noise_level), "value_changed", GTK_SIGNAL_FUNC (gboolean_set_false), (gpointer) &hfw->if_calculated); 
		
	gtk_signal_connect (GTK_OBJECT (check_box), "toggled",
	       (GtkSignalFunc) show_if_true, (gpointer) hbox2);
      
	//	hbox for NOISE vs GUIDE radio buttons
	hbox = gtk_hbox_new(FALSE,0);
	gtk_widget_show(GTK_WIDGET(hbox));
	
	button = define_radio_button_in_box_with_data (hbox, &group2, "As noise",
		set_use_as_noise, &vs->hf_use, (vs->hf_use==USE_AS_NOISE)) ;
	gtk_signal_connect (GTK_OBJECT (button), "toggled",
	       (GtkSignalFunc) hide_if_true, (gpointer) check_box);
	// Always show the noise scale in that case
	gtk_signal_connect_object(GTK_OBJECT(button), "toggled",
		GTK_SIGNAL_FUNC(gtk_widget_show), (gpointer) wdg);
	       
	button = define_radio_button_in_box_with_data (hbox, &group2, "As guide",
		set_use_as_guide, &vs->hf_use, (vs->hf_use==USE_AS_GUIDE)) ;
	gtk_signal_connect (GTK_OBJECT (button), "toggled",
	       (GtkSignalFunc) show_if_true, (gpointer) guide_box);
	
	if (vs->hf_use==USE_AS_NOISE)
		gtk_widget_hide(GTK_WIDGET(guide_box));
       
  	gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0); 
	
	gtk_box_pack_start (GTK_BOX (vbox2), guide_box, FALSE, FALSE, 0);     
	
	gtk_box_pack_start (GTK_BOX (vbox2), hbox2, FALSE, FALSE, 0);
	
	/*********************** Crack width **************************/
		
	vbox2 = gtk_vbox_new(FALSE,0);
	gtk_widget_show(GTK_WIDGET(vbox2));
	
	frame2 = define_frame_with_hiding_arrows ("Crack width", vbox2, hfw->hf_options->tools_window, FALSE);
	
	gtk_box_pack_start(GTK_BOX(vbox), frame2, FALSE, FALSE, 0.5*DEF_PAD);
			
	hbox = gtk_hbox_new(FALSE,DEF_PAD);
	gtk_widget_show(GTK_WIDGET(hbox));
	
	button_uniform = define_radio_button_in_box_with_data (hbox, &group3, "Uniform", set_fixed_width, &vs->crack_width_type, vs->crack_width_type==FIXED_WIDTH) ;
	       
	button = define_radio_button_in_box_with_data (hbox, &group3, "From distance",set_from_distance, &vs->crack_width_type, vs->crack_width_type==FROM_DISTANCE) ;

	gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);
	
	// Width: in pixels for "Uniform", relative for "Varies with distance"
			
	hbox = gtk_hbox_new(FALSE,DEF_PAD);
	gtk_widget_show(GTK_WIDGET(hbox));

	define_label_in_box("Min", hbox, FALSE,TRUE, DEF_PAD);
 	vds->adj_min_width = gtk_adjustment_new (
		vs->min_width,0.0, 10.0, 1, 1, 0.0);
	wdg = define_scale_in_box(vds->adj_min_width,hbox,0,DEF_PAD);
	gtk_signal_connect (GTK_OBJECT (vds->adj_min_width), "value_changed", GTK_SIGNAL_FUNC (gint_adj_callb), (gpointer) &vs->min_width);
	gtk_signal_connect (GTK_OBJECT (vds->adj_min_width), "value_changed", GTK_SIGNAL_FUNC (gboolean_set_false), (gpointer) &hfw->if_calculated);
		  	
	gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);
		       
	gtk_signal_connect (GTK_OBJECT (button_uniform), "toggled",
	       (GtkSignalFunc) hide_if_true, (gpointer) hbox);
	if (vs->crack_width_type==FIXED_WIDTH)
		gtk_widget_hide(GTK_WIDGET(hbox));
		
	hbox = gtk_hbox_new(FALSE,DEF_PAD);
	gtk_widget_show(GTK_WIDGET(hbox));

	lblmax = define_label_in_box("Max", hbox, FALSE,TRUE, DEF_PAD);	
	lblwidth = define_label_in_box("Width", hbox, FALSE,TRUE, DEF_PAD);
 	vds->adj_max_width = gtk_adjustment_new (
		vs->max_width,0.0, 10.0, 1, 1, 0.0);
	wdg = define_scale_in_box(vds->adj_max_width,hbox,0,DEF_PAD);
	gtk_signal_connect (GTK_OBJECT (vds->adj_max_width), "value_changed", GTK_SIGNAL_FUNC (gint_adj_callb), (gpointer) &vs->max_width);
	gtk_signal_connect (GTK_OBJECT (vds->adj_max_width), "value_changed", GTK_SIGNAL_FUNC (gboolean_set_false), (gpointer) &hfw->if_calculated);
  	
	// Consistency controls (min should be <= max)
	
	gtk_signal_connect (GTK_OBJECT (vds->adj_min_width), "value_changed", GTK_SIGNAL_FUNC (check_max_width), (gpointer) hfw->hf_options->img);
	gtk_signal_connect (GTK_OBJECT (vds->adj_max_width), "value_changed", GTK_SIGNAL_FUNC (check_min_width), (gpointer) hfw->hf_options->img);
	
	gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);
		       
	gtk_signal_connect (GTK_OBJECT (button_uniform), "toggled",
	       (GtkSignalFunc) hide_if_true, (gpointer) lblmax);		       
	gtk_signal_connect (GTK_OBJECT (button_uniform), "toggled",
	       (GtkSignalFunc) show_if_true, (gpointer) lblwidth);
	       
	if (vs->crack_width_type==FIXED_WIDTH)
		gtk_widget_hide(GTK_WIDGET(lblmax));
	
	button = gtk_button_new_with_label (_("Apply"));
	gtk_signal_connect (GTK_OBJECT (button), "clicked",
	       (GtkSignalFunc) apply_voronoi_callb, data);
	gtk_widget_show(button);

	gtk_box_pack_start(GTK_BOX(vbox), align_widget(button,0.5,0.5), FALSE, FALSE, DEF_PAD);

	/************************ Edge level control ************************/
	
	hbox = gtk_hbox_new(FALSE,DEF_PAD);
	gtk_widget_show(GTK_WIDGET(hbox));

	define_label_in_box("Edge raising", hbox, FALSE,TRUE, DEF_PAD);
 	vds->adj_edges_level = gtk_adjustment_new (
		vs->edges_level,0.0, 100.0, 1, 1, 0.0);
	vds->wdg_edges_level = define_scale_in_box(vds->adj_edges_level,hbox,0,DEF_PAD);
	gtk_signal_connect (GTK_OBJECT (vds->adj_edges_level), "value_changed", GTK_SIGNAL_FUNC (gint_adj_callb), (gpointer) &vs->edges_level);
	gtk_signal_connect (GTK_OBJECT (vds->adj_edges_level), "value_changed", GTK_SIGNAL_FUNC (edges_level_callb), data);
	gtk_signal_connect (GTK_OBJECT (vds->adj_edges_level), "value_changed", GTK_SIGNAL_FUNC (gboolean_set_false), (gpointer) &hfw->if_calculated);
  	
	gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);

	// We activate when apply is clicked
	gtk_signal_connect (GTK_OBJECT (button), "clicked",
	       (GtkSignalFunc) set_sensitive_callb, (gpointer) vds->wdg_edges_level);
  
	gtk_widget_set_sensitive (GTK_WIDGET(vds->wdg_edges_level),FALSE);
	// Controls
		
	gtk_box_pack_start (GTK_BOX (vbox), reset_accept_buttons_new (data, &vds->accept), FALSE, FALSE, DEF_PAD);
	
	gtk_container_add(GTK_CONTAINER(frame), vbox);

	return frame;
}
Example #17
0
int
nsSetupTypeDlg::Show()
{
    int err = OK;
    int numSetupTypes = 0;
    int i;
    GtkWidget *stTable = NULL;
    GtkWidget *radbtns[MAX_SETUP_TYPES];
    GtkWidget *desc[MAX_SETUP_TYPES];
    nsSetupType *currST = NULL;
    GtkWidget *destTable = NULL;
    GtkWidget *frame = NULL;
    GtkWidget *hbox = NULL;

    XI_VERIFY(gCtx);
    XI_VERIFY(gCtx->notebook);

    if (mWidgetsInit == FALSE)
    {
        // create a new table and add it as a page of the notebook
        mTable = gtk_table_new(4, 1, FALSE);
        gtk_notebook_append_page(GTK_NOTEBOOK(gCtx->notebook), mTable, NULL);
        mPageNum = gtk_notebook_get_current_page(GTK_NOTEBOOK(gCtx->notebook));
        gtk_widget_show(mTable);

        // insert a static text widget in the first row
        GtkWidget *msg0 = gtk_label_new(mMsg0);
        hbox = gtk_hbox_new(FALSE, 0);
        gtk_box_pack_start(GTK_BOX(hbox), msg0, FALSE, FALSE, 0);
        gtk_widget_show(hbox);
        gtk_table_attach(GTK_TABLE(mTable), hbox, 0, 1, 1, 2,
            static_cast<GtkAttachOptions>(GTK_FILL | GTK_EXPAND),
            GTK_FILL, 20, 20);
        gtk_widget_show(msg0);

        // insert a [n x 2] heterogeneous table in the second row
        // where n = numSetupTypes
        numSetupTypes = GetNumSetupTypes();
        stTable = gtk_table_new(numSetupTypes, 4, FALSE);
        gtk_widget_show(stTable);
        gtk_table_attach(GTK_TABLE(mTable), stTable, 0, 1, 2, 3,
            static_cast<GtkAttachOptions>(GTK_EXPAND | GTK_FILL),
            static_cast<GtkAttachOptions>(GTK_EXPAND | GTK_FILL),
            20, 0);

        currST = GetSetupTypeList();
        if (!currST) return E_NO_SETUPTYPES;

        sGroup=NULL;

        // radio buttons
        for (i = 0; i < numSetupTypes; i++)
        {
            radbtns[i] = gtk_radio_button_new_with_label(sGroup,
                            currST->GetDescShort());
            sGroup = gtk_radio_button_group(GTK_RADIO_BUTTON(radbtns[i]));
            gtk_table_attach(GTK_TABLE(stTable), radbtns[i], 0, 1, i, i+1,
                static_cast<GtkAttachOptions>(GTK_FILL | GTK_EXPAND),
                static_cast<GtkAttachOptions>(GTK_FILL | GTK_EXPAND), 0, 0);
            gtk_signal_connect(GTK_OBJECT(radbtns[i]), "toggled",
                               GTK_SIGNAL_FUNC(RadBtnToggled),
                               reinterpret_cast<void *>(i));
            gtk_widget_show(radbtns[i]);

            desc[i] = gtk_label_new(currST->GetDescLong());
            gtk_label_set_justify(GTK_LABEL(desc[i]), GTK_JUSTIFY_LEFT);
            gtk_label_set_line_wrap(GTK_LABEL(desc[i]), TRUE);
            hbox = gtk_hbox_new(FALSE, 0);
            gtk_box_pack_start(GTK_BOX(hbox), desc[i], FALSE, FALSE, 0);
            gtk_widget_show(hbox);
            gtk_table_attach_defaults(GTK_TABLE(stTable), hbox, 1, 2, i, i+1);
            gtk_widget_show(desc[i]);

            currST = currST->GetNext();
        }

        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(
                                        radbtns[gCtx->opt->mSetupType]), TRUE);

        // insert a [1 x 2] heterogeneous table in the third row
        destTable = gtk_table_new(1, 2, FALSE);
        gtk_widget_show(destTable); 

        gtk_table_attach(GTK_TABLE(mTable), destTable, 0, 1, 3, 4,
            static_cast<GtkAttachOptions>(GTK_EXPAND | GTK_FILL),
            static_cast<GtkAttachOptions>(GTK_EXPAND | GTK_FILL),
            20, 5);
        frame = gtk_frame_new(gCtx->Res("DEST_DIR"));
        gtk_table_attach_defaults(GTK_TABLE(destTable), frame, 0, 2, 0, 1);
        gtk_widget_show(frame);

        if (!gCtx->opt->mDestination)
        {
            gCtx->opt->mDestination = (char*)malloc(MAXPATHLEN * sizeof(char));
            getcwd(gCtx->opt->mDestination, MAXPATHLEN);
        }
        sFolder = gtk_label_new(gCtx->opt->mDestination);
        gtk_label_set_line_wrap(GTK_LABEL(sFolder), TRUE);
        gtk_widget_show(sFolder);
        gtk_table_attach_defaults(GTK_TABLE(destTable), sFolder, 0, 1, 0, 1);

        sBrowseBtn = gtk_button_new_with_label(gCtx->Res("BROWSE"));
        gtk_widget_show(sBrowseBtn);
        gtk_table_attach(GTK_TABLE(destTable), sBrowseBtn, 1, 2, 0, 1,
            static_cast<GtkAttachOptions>(GTK_EXPAND | GTK_FILL),
            GTK_SHRINK, 10, 10);

        mWidgetsInit = TRUE;
    }
    else
    {
        gtk_notebook_set_page(GTK_NOTEBOOK(gCtx->notebook), mPageNum);
        gtk_widget_show(mTable);
    }

    // signal connect the buttons
    // NOTE: back button disfunctional in this dlg since user accepted license
    gCtx->nextID = gtk_signal_connect(GTK_OBJECT(gCtx->next), "clicked",
                   GTK_SIGNAL_FUNC(nsSetupTypeDlg::Next), gCtx->sdlg);
    sBrowseBtnID = gtk_signal_connect(GTK_OBJECT(sBrowseBtn), "clicked",
                   GTK_SIGNAL_FUNC(nsSetupTypeDlg::SelectFolder), NULL);  

    GTK_WIDGET_SET_FLAGS(gCtx->next, GTK_CAN_DEFAULT);
    gtk_widget_grab_default(gCtx->next);
    gtk_widget_grab_focus(gCtx->next);

    // set up the next button.
    gCtx->nextLabel = gtk_label_new(gCtx->Res("NEXT"));
    gtk_widget_show(gCtx->nextLabel);
    gtk_container_add(GTK_CONTAINER(gCtx->next), gCtx->nextLabel);
    gtk_widget_show(gCtx->next);

    return err;
}
Example #18
0
static int dialog_install_user(GtkWindow *main_window, 
                               char *user, int user_len, 
                               unsigned long *user_id)
{
   GtkWidget *button, *label;
   GtkWidget *user_entry, *ID_entry;
   GtkWidget *install_user_dialog;
   GtkWidget *vbox;
   GtkWidget *hbox;
   /* object data */
   struct install_dialog_data data;
   unsigned long id;
   char s_id[32];
   char *whoami;

   data.button_hit=0;

   install_user_dialog = gtk_widget_new(GTK_TYPE_WINDOW,
                                        "type", GTK_WINDOW_TOPLEVEL,
                                        "window_position", GTK_WIN_POS_MOUSE,
                                        "title", _("Install User"),
                                        NULL);
   gtk_window_set_modal(GTK_WINDOW(install_user_dialog), TRUE);
   if (main_window) {
      gtk_window_set_transient_for(GTK_WINDOW(install_user_dialog), GTK_WINDOW(main_window));
   }

   gtk_signal_connect(GTK_OBJECT(install_user_dialog), "destroy",
                      GTK_SIGNAL_FUNC(cb_destroy_dialog), install_user_dialog);

   gtk_object_set_data(GTK_OBJECT(install_user_dialog),
                       "install_dialog_data", &data);

   vbox = gtk_vbox_new(FALSE, 5);

   gtk_container_set_border_width(GTK_CONTAINER(vbox), 5);

   gtk_container_add(GTK_CONTAINER(install_user_dialog), vbox);

   hbox = gtk_hbox_new(FALSE, 0);
   gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0);
   label = gtk_label_new(_("A PalmOS(c) device needs a user name and a user ID in order to sync properly."));
   gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
   gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
   gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2);

   hbox = gtk_hbox_new(FALSE, 0);
   gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0);
   label = gtk_label_new(_("If you want to sync more than 1 PalmOS(c) device each one should have a different ID and preferably a different user name."));
   gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
   gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
   gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2);

   srandom(time(NULL));
   /* RAND_MAX is 32768 on Solaris machines for some reason.
    * If someone knows how to fix this, let me know.
    */
   if (RAND_MAX==32768) {
      id = 1+(2000000000.0*random()/(2147483647+1.0));
   } else {
      id = 1+(2000000000.0*random()/(RAND_MAX+1.0));
   }
   g_snprintf(s_id, 30, "%ld", id);

   /* User Name entry */
   
   hbox = gtk_hbox_new(FALSE, 0);
   gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0);

   /* Instruction label */
   label = gtk_label_new(_("Most people choose their name or nickname for the user name."));
   gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
   gtk_label_set_line_wrap(GTK_LABEL(label), FALSE);
   gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2);

   /* User Name */
   hbox = gtk_hbox_new(FALSE, 5);
   gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2);
   label = gtk_label_new(_("User Name"));
   user_entry = gtk_entry_new_with_max_length(128);
   entry_set_multiline_truncate(GTK_ENTRY(user_entry), TRUE);
   data.user_entry = user_entry;
   gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2);
   gtk_box_pack_start(GTK_BOX(hbox), user_entry, TRUE, TRUE, 2);

   /* Instruction label */
   hbox = gtk_hbox_new(FALSE, 0);
   gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 0);
   label = gtk_label_new(_("The ID should be a random number."));
   gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_LEFT);
   gtk_label_set_line_wrap(GTK_LABEL(label), TRUE);
   gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2);

   /* User ID */
   hbox = gtk_hbox_new(FALSE, 5);
   gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 2);
   label = gtk_label_new(_("User ID"));
   ID_entry = gtk_entry_new_with_max_length(32);
   entry_set_multiline_truncate(GTK_ENTRY(ID_entry), TRUE);
   data.ID_entry = ID_entry;
   gtk_entry_set_text(GTK_ENTRY(ID_entry), s_id);
   whoami = jp_user_or_whoami();
   if (whoami) {
      gtk_entry_set_text(GTK_ENTRY(user_entry), whoami);
      free(whoami);
   }
   gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 2);
   gtk_box_pack_start(GTK_BOX(hbox), ID_entry, TRUE, TRUE, 2);

   /* Cancel/Install buttons */
   hbox = gtk_hbutton_box_new();
   gtk_button_box_set_layout(GTK_BUTTON_BOX (hbox), GTK_BUTTONBOX_END);
   gtk_button_box_set_spacing(GTK_BUTTON_BOX(hbox), 6);
   gtk_container_set_border_width(GTK_CONTAINER(hbox), 5);
   gtk_box_pack_start(GTK_BOX(vbox), hbox, TRUE, TRUE, 2);

   button = gtk_button_new_from_stock(GTK_STOCK_CANCEL);
   gtk_signal_connect(GTK_OBJECT(button), "clicked",
                      GTK_SIGNAL_FUNC(cb_install_user_button),
                      GINT_TO_POINTER(DIALOG_SAID_2));
   gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 1);

   button = gtk_button_new_with_label(_("Install User"));
   gtk_signal_connect(GTK_OBJECT(button), "clicked",
                      GTK_SIGNAL_FUNC(cb_install_user_button),
                      GINT_TO_POINTER(DIALOG_SAID_1));
   gtk_box_pack_start(GTK_BOX(hbox), button, TRUE, TRUE, 1);
   GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT);
   gtk_widget_grab_default(button);
   gtk_widget_grab_focus(button);

   gtk_widget_show_all(install_user_dialog);

   gtk_main();
   
   g_strlcpy(user, data.user, user_len);
   *user_id = data.id;
   
   return data.button_hit;
}
Example #19
0
int
nsSetupTypeDlg::DeleteOldInst()
{
    DUMP("DeleteOldInst");

    const int MAXCHARS = 64; // Maximum chars per line in Delete Dialog
    const int MAXLINES = 20; // Maximum lines in Delete Dialog
    int err = OK;
    struct stat dummy;
    char path[MAXPATHLEN];
    GtkWidget *label = NULL;
    GtkWidget *deleteBtn = NULL; /* delete button */
    GtkWidget *cancelBtn = NULL; /* cancel button */
    char *msgPtr = NULL, *msgChunkPtr = NULL, *msgEndPtr = NULL;
    char msgChunk[MAXCHARS+1];
    char msg[MAXPATHLEN+512];
    nsLegacyCheck *currLC = NULL;

    currLC = sLegacyChecks;
    while (currLC)
    {
      memset(path, 0, MAXPATHLEN);
      ConstructPath(path, gCtx->opt->mDestination, currLC->GetFilename());
      DUMP(path);

      // check if old installation exists
      if (0 == stat(path, &dummy))
      {
          if (gCtx->opt->mMode != nsXIOptions::MODE_DEFAULT)
          {
              DeleteInstDelete((GtkWidget *)NULL, (gpointer) gCtx->sdlg);
              return OK;
          }

          // throw up delete dialog 
          sDelInstDlg = gtk_dialog_new();
          gtk_window_set_modal(GTK_WINDOW(sDelInstDlg), TRUE);
          gtk_window_set_title(GTK_WINDOW(sDelInstDlg), gCtx->opt->mTitle);
          gtk_window_set_position(GTK_WINDOW(sDelInstDlg), GTK_WIN_POS_CENTER);

          deleteBtn = gtk_button_new_with_label(gCtx->Res("DELETE_LABEL"));
          cancelBtn = gtk_button_new_with_label(gCtx->Res("CANCEL_LABEL"));

          gtk_container_add(GTK_CONTAINER(GTK_DIALOG(sDelInstDlg)->action_area), 
              deleteBtn);
          gtk_container_add(GTK_CONTAINER(GTK_DIALOG(sDelInstDlg)->action_area),
              cancelBtn);
          gtk_signal_connect(GTK_OBJECT(deleteBtn), "clicked",
                         GTK_SIGNAL_FUNC(DeleteInstDelete), sDelInstDlg);
          gtk_signal_connect(GTK_OBJECT(cancelBtn), "clicked",
                         GTK_SIGNAL_FUNC(DeleteInstCancel), sDelInstDlg);

          GTK_WIDGET_SET_FLAGS(cancelBtn, GTK_CAN_DEFAULT);
          gtk_widget_grab_default(cancelBtn);

          snprintf(msg, sizeof(msg), currLC->GetMessage(), gCtx->opt->mDestination);
          msgPtr = msg;
          msgEndPtr = msg + strlen(msg);
          // wrap message at MAXCHARS colums (or last space inside MAXCHARS)
          // stop at MAXLINES rows or stop after last char is reached
          for (int i = 0; i < MAXLINES && msgPtr < msgEndPtr; i++)
          {
              // get the next MAXCHARS chars
              memset(msgChunk, 0, MAXCHARS+1);
              strncpy(msgChunk, msgPtr, MAXCHARS);

              // find last space
              msgChunkPtr = strrchr(msgChunk, ' ');
              if (msgChunkPtr)
              {
                  *msgChunkPtr = '\0';
                  msgPtr += (msgChunkPtr - msgChunk + 1);
              }
              else
              {
                  msgPtr += MAXCHARS;
              }
              label = gtk_label_new(msgChunk);
              gtk_box_pack_start(GTK_BOX(GTK_DIALOG(sDelInstDlg)->vbox), label,
                  FALSE, FALSE, 0);
          }
          gtk_widget_show_all(sDelInstDlg);
      
          err = E_OLD_INST;
          break;
      }
      currLC = currLC->GetNext();    
    }

    return err;
}
Example #20
0
int main( int   argc, 
          char *argv[] )
{
  GtkWidget *window;
  GtkWidget *vbox;
  char buf[G_ASCII_DTOSTR_BUF_SIZE];

  GtkWidget *button;
  GtkWidget *entry;

  gtk_init (&argc, &argv);

  gdk_rgb_init();

  pos_x[0] = 100;
  pos_y[0] = 100;
  pos_x[1] = 300;
  pos_y[1] = 300;
  
  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_widget_set_name (window, "Test Input");

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

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

  /* Create the drawing area */

  drawing_area = gtk_drawing_area_new ();
  gtk_drawing_area_size (GTK_DRAWING_AREA (drawing_area), 512, 512);
  gtk_box_pack_start (GTK_BOX (vbox), drawing_area, TRUE, TRUE, 0);

  gtk_widget_show (drawing_area);

  /* Signals used to handle backing pixmap */

  gtk_signal_connect (GTK_OBJECT (drawing_area), "expose_event",
		      (GtkSignalFunc) expose_event, NULL);
  gtk_signal_connect (GTK_OBJECT(drawing_area),"configure_event",
		      (GtkSignalFunc) configure_event, NULL);

  /* Event signals */

  gtk_signal_connect (GTK_OBJECT (drawing_area), "motion_notify_event",
		      (GtkSignalFunc) motion_notify_event, NULL);
  gtk_signal_connect (GTK_OBJECT (drawing_area), "button_press_event",
		      (GtkSignalFunc) button_press_event, NULL);

  gtk_widget_set_events (drawing_area, GDK_EXPOSURE_MASK
			 | GDK_LEAVE_NOTIFY_MASK
			 | GDK_BUTTON_PRESS_MASK
			 | GDK_POINTER_MOTION_MASK
			 | GDK_POINTER_MOTION_HINT_MASK);

  
  entry = gtk_entry_new ();
  gtk_box_pack_start (GTK_BOX (vbox), entry, FALSE, FALSE, 0);

  gtk_signal_connect (GTK_OBJECT (entry), "activate",
		      GTK_SIGNAL_FUNC (change_gradient),
		      &a);
  gtk_entry_set_text  (GTK_ENTRY (entry),
		       g_ascii_dtostr (buf, G_ASCII_DTOSTR_BUF_SIZE,
				       1.0/a));
  gtk_widget_show (entry);

  entry = gtk_entry_new ();
  gtk_box_pack_start (GTK_BOX (vbox), entry, FALSE, FALSE, 0);

  gtk_signal_connect (GTK_OBJECT (entry), "activate",
		      GTK_SIGNAL_FUNC (change_gradient),
		      &b);
  gtk_entry_set_text  (GTK_ENTRY (entry),
		       g_ascii_dtostr (buf, G_ASCII_DTOSTR_BUF_SIZE,
				       1.0/b));
  gtk_widget_show (entry);

  entry = gtk_entry_new ();
  gtk_box_pack_start (GTK_BOX (vbox), entry, FALSE, FALSE, 0);

  gtk_signal_connect (GTK_OBJECT (entry), "activate",
		      GTK_SIGNAL_FUNC (change_gradient),
		      &c);
  gtk_entry_set_text  (GTK_ENTRY (entry),
		       g_ascii_dtostr (buf, G_ASCII_DTOSTR_BUF_SIZE,
				       1.0/c));
  gtk_widget_show (entry);

  entry = gtk_entry_new ();
  gtk_box_pack_start (GTK_BOX (vbox), entry, FALSE, FALSE, 0);

  gtk_signal_connect (GTK_OBJECT (entry), "activate",
		      GTK_SIGNAL_FUNC (change_spread),
		      &spread);
  gtk_entry_set_text  (GTK_ENTRY (entry),
		       g_strdup_printf ("%d", spread));
  gtk_widget_show (entry);

  
  /* .. And a quit button */
  button = gtk_button_new_with_label ("Quit");
  gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);

  gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
			     GTK_SIGNAL_FUNC (gtk_widget_destroy),
			     GTK_OBJECT (window));
  gtk_widget_show (button);

  gtk_widget_show (window);

  gtk_main ();

  return 0;
}
Example #21
0
bool wxMenu::GtkAppend(wxMenuItem *mitem, int pos)
{
    GtkWidget *menuItem;

    wxString text;
    GtkLabel* label = NULL;

    if ( mitem->IsSeparator() )
    {
        // TODO
        menuItem = gtk_menu_item_new();
    }
    else if (mitem->GetBitmap().Ok())
    {
        text = mitem->wxMenuItemBase::GetItemLabel();
        const wxBitmap *bitmap = &mitem->GetBitmap();

        // TODO
        wxUnusedVar(bitmap);
        menuItem = gtk_menu_item_new_with_label( wxGTK_CONV( text ) );
        label = GTK_LABEL( GTK_BIN(menuItem)->child );

        m_prevRadio = NULL;
    }
    else // a normal item
    {
        // text has "_" instead of "&" after mitem->SetItemLabel() so don't use it
        text =  mitem->wxMenuItemBase::GetItemLabel() ;

        switch ( mitem->GetKind() )
        {
            case wxITEM_CHECK:
            {
                menuItem = gtk_check_menu_item_new_with_label( wxGTK_CONV( text ) );
                label = GTK_LABEL( GTK_BIN(menuItem)->child );
                // set new text
                gtk_label_set_text( label, wxGTK_CONV( text ) );
                m_prevRadio = NULL;
                break;
            }

            case wxITEM_RADIO:
            {
                GSList *group = NULL;
                if ( m_prevRadio == NULL )
                {
                    // start of a new radio group
                    m_prevRadio = menuItem = gtk_radio_menu_item_new_with_label( group, wxGTK_CONV( text ) );
                    label = GTK_LABEL( GTK_BIN(menuItem)->child );
                    // set new text
                    gtk_label_set_text( label, wxGTK_CONV( text ) );
                }
                else // continue the radio group
                {
                    group = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (m_prevRadio));
                    m_prevRadio = menuItem = gtk_radio_menu_item_new_with_label( group, wxGTK_CONV( text ) );
                    label = GTK_LABEL( GTK_BIN(menuItem)->child );
                }
                break;
            }

            default:
                wxFAIL_MSG( wxT("unexpected menu item kind") );
                // fall through

            case wxITEM_NORMAL:
            {
                menuItem = gtk_menu_item_new_with_label( wxGTK_CONV( text ) );
                label = GTK_LABEL( GTK_BIN(menuItem)->child );
                m_prevRadio = NULL;
                break;
            }
        }

    }

    guint accel_key;
    GdkModifierType accel_mods;
    wxCharBuffer buf = wxGTK_CONV( GetGtkHotKey(*mitem) );

    // wxPrintf( wxT("item: %s hotkey %s\n"), mitem->GetItemLabel().c_str(), GetGtkHotKey(*mitem).c_str() );
    gtk_accelerator_parse( (const char*) buf, &accel_key, &accel_mods);
    if (accel_key != 0)
    {
        gtk_widget_add_accelerator (GTK_WIDGET(menuItem),
                                    "activate",
                                    m_accel,
                                    accel_key,
                                    accel_mods,
                                    GTK_ACCEL_VISIBLE);
    }

    if (pos == -1)
        gtk_menu_shell_append(GTK_MENU_SHELL(m_menu), menuItem);
    else
        gtk_menu_shell_insert(GTK_MENU_SHELL(m_menu), menuItem, pos);

    gtk_widget_show( menuItem );

    if ( !mitem->IsSeparator() )
    {
        wxASSERT_MSG( menuItem, wxT("invalid menuitem") );

        gtk_signal_connect( GTK_OBJECT(menuItem), "select",
                            GTK_SIGNAL_FUNC(gtk_menu_hilight_callback),
                            (gpointer)this );

        gtk_signal_connect( GTK_OBJECT(menuItem), "deselect",
                            GTK_SIGNAL_FUNC(gtk_menu_nolight_callback),
                            (gpointer)this );

        if ( mitem->IsSubMenu() && mitem->GetKind() != wxITEM_RADIO && mitem->GetKind() != wxITEM_CHECK )
        {
            gtk_menu_item_set_submenu( GTK_MENU_ITEM(menuItem), mitem->GetSubMenu()->m_menu );

            gtk_widget_show( mitem->GetSubMenu()->m_menu );
        }
        else
        {
            gtk_signal_connect( GTK_OBJECT(menuItem), "activate",
                                GTK_SIGNAL_FUNC(gtk_menu_clicked_callback),
                                (gpointer)this );
        }

        guint accel_key = gtk_label_parse_uline (GTK_LABEL(label), wxGTK_CONV( text ) );
        if (accel_key != GDK_VoidSymbol)
        {
            gtk_widget_add_accelerator (menuItem,
                                        "activate_item",
                                        gtk_menu_ensure_uline_accel_group(GTK_MENU(m_menu)),
                                        accel_key,
                                        GDK_MOD1_MASK,
                                        GTK_ACCEL_LOCKED);
        }
    }

    mitem->SetMenuItem(menuItem);

    if (ms_locked)
    {
        // This doesn't even exist!
        // gtk_widget_lock_accelerators(mitem->GetMenuItem());
    }

    return true;
}
Example #22
0
static int MicrocodeDialog()
{
    GtkWidget *infoLabel;
    GtkWidget *infoFrame, *infoTable;
    GtkWidget *crcInfoLabel, *crcDataInfoLabel, *textInfoLabel;
    GtkWidget *crcLabel = NULL, *crcDataLabel = NULL, *textLabel = NULL;
    GtkWidget *selectUcodeLabel;
    //GtkWidget *microcodeLabel;
    GtkWidget *okButton, *stopButton;
    GList *ucodeList = 0;
    char buf[1024];

    if (!g_thread_supported())
        g_thread_init( NULL );
    gdk_threads_enter();

    // create dialog
    if (microcodeWindow == 0)
    {
        microcodeWindow = gtk_dialog_new();
        gtk_signal_connect( GTK_OBJECT(microcodeWindow), "delete_event",
                            GTK_SIGNAL_FUNC(delete_question_event), (gpointer)NULL );
        sprintf( buf, "%s - unknown microcode", pluginName );
        gtk_window_set_title( GTK_WINDOW(microcodeWindow), buf );
        gtk_container_set_border_width( GTK_CONTAINER(GTK_DIALOG(microcodeWindow)->vbox), 11 );

        // ok button
        okButton = gtk_button_new_with_label( "Ok" );
        gtk_signal_connect_object( GTK_OBJECT(okButton), "clicked",
                               GTK_SIGNAL_FUNC(okButton_clicked), NULL );
        gtk_container_add( GTK_CONTAINER(GTK_DIALOG(microcodeWindow)->action_area), okButton );

        // stop button
        stopButton = gtk_button_new_with_label( "Stop" );
        gtk_signal_connect_object( GTK_OBJECT(stopButton), "clicked",
                               GTK_SIGNAL_FUNC(stopButton_clicked), NULL );
        gtk_container_add( GTK_CONTAINER(GTK_DIALOG(microcodeWindow)->action_area), stopButton );

        // info label
        infoLabel = gtk_label_new( "Unknown microcode. Please notify Orkin, including the following information:" );
        gtk_box_pack_start_defaults( GTK_BOX(GTK_DIALOG(microcodeWindow)->vbox), infoLabel );

        // info frame
        infoFrame = gtk_frame_new( "Microcode info" );
        gtk_container_set_border_width( GTK_CONTAINER(infoFrame), 7 );
        gtk_box_pack_start_defaults( GTK_BOX(GTK_DIALOG(microcodeWindow)->vbox), infoFrame );

        infoTable = gtk_table_new( 3, 2, FALSE );
        gtk_container_set_border_width( GTK_CONTAINER(infoTable), 7 );
        gtk_table_set_col_spacings( GTK_TABLE(infoTable), 3 );
        gtk_table_set_row_spacings( GTK_TABLE(infoTable), 3 );
        gtk_container_add( GTK_CONTAINER(infoFrame), infoTable );

        crcInfoLabel = gtk_label_new( "Microcode CRC:" );
        crcDataInfoLabel = gtk_label_new( "Microcode Data CRC:" );
        textInfoLabel = gtk_label_new( "Microcode Text:" );

        crcLabel = gtk_label_new( "" );
        crcDataLabel = gtk_label_new( "" );
        textLabel = gtk_label_new( "" );

        gtk_table_attach_defaults( GTK_TABLE(infoTable), crcInfoLabel, 0, 1, 0, 1 );
        gtk_table_attach_defaults( GTK_TABLE(infoTable), crcLabel, 1, 2, 0, 1 );
        gtk_table_attach_defaults( GTK_TABLE(infoTable), crcDataInfoLabel, 0, 1, 1, 2 );
        gtk_table_attach_defaults( GTK_TABLE(infoTable), crcDataLabel, 1, 2, 1, 2 );
        gtk_table_attach_defaults( GTK_TABLE(infoTable), textInfoLabel, 0, 1, 2, 3 );
        gtk_table_attach_defaults( GTK_TABLE(infoTable), textLabel, 1, 2, 2, 3 );

        selectUcodeLabel = gtk_label_new( "You can manually select the closest matching microcode." );
        for (int i = 0; i < numMicrocodeTypes; i++)
            ucodeList = g_list_append( ucodeList, gtk_list_item_new_with_label( MicrocodeTypes[i] ) );
        microcodeList = gtk_list_new();
        gtk_list_set_selection_mode( GTK_LIST(microcodeList), GTK_SELECTION_SINGLE );
        gtk_list_append_items( GTK_LIST(microcodeList), ucodeList );

        gtk_box_pack_start_defaults( GTK_BOX(GTK_DIALOG(microcodeWindow)->vbox), selectUcodeLabel );
        gtk_box_pack_start_defaults( GTK_BOX(GTK_DIALOG(microcodeWindow)->vbox), microcodeList );
    }

    snprintf( buf, 1024, "0x%8.8X", (unsigned int)uc_crc );
        if(crcLabel) gtk_label_set_text( GTK_LABEL(crcLabel), buf );
    snprintf( buf, 1024, "0x%8.8X", (unsigned int)uc_dcrc );
    if(crcDataLabel) gtk_label_set_text( GTK_LABEL(crcDataLabel), buf );
    if(textLabel) gtk_label_set_text( GTK_LABEL(textLabel), uc_str );

    selectedMicrocode = -1;
    gtk_widget_show_all( microcodeWindow );

    while (selectedMicrocode == -1)
    {
        if( gtk_main_iteration() )
            break;
        usleep( 10000 );
    }
    gdk_threads_leave();

    return selectedMicrocode;
}
Example #23
0
int main(int argc, char *argv[]){

 GtkWidget *window1;
 GtkWidget *vbox1;
 GtkWidget *scrollw1;
 GtkWidget *canvas;
 GtkPlotCanvasChild *child;
 gint page_width, page_height;
 gfloat scale = 1.;
 
 page_width = GTK_PLOT_LETTER_W * scale;
 page_height = GTK_PLOT_LETTER_H * scale;
 
 gtk_init(&argc,&argv);

 window1=gtk_window_new(GTK_WINDOW_TOPLEVEL);
 gtk_window_set_title(GTK_WINDOW(window1), "GtkPlotFlux Demo");
 gtk_widget_set_usize(window1,550,650);
 gtk_container_border_width(GTK_CONTAINER(window1),0);

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

 vbox1=gtk_vbox_new(FALSE,0);
 gtk_container_add(GTK_CONTAINER(window1),vbox1);
 gtk_widget_show(vbox1);

 scrollw1=gtk_scrolled_window_new(NULL, NULL);
 gtk_container_border_width(GTK_CONTAINER(scrollw1),0);
 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrollw1),
				GTK_POLICY_ALWAYS,GTK_POLICY_ALWAYS);
 gtk_box_pack_start(GTK_BOX(vbox1),scrollw1, TRUE, TRUE,0);
 gtk_widget_show(scrollw1);

 canvas = gtk_plot_canvas_new(page_width, page_height, 1.);
 GTK_PLOT_CANVAS_SET_FLAGS(GTK_PLOT_CANVAS(canvas), GTK_PLOT_CANVAS_DND_FLAGS);
 gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrollw1), canvas);

/*
 gdk_color_parse("light blue", &color);
 gdk_color_alloc(gtk_widget_get_colormap(canvas), &color);
 gtk_plot_canvas_set_background(GTK_PLOT_CANVAS(canvas), &color);
*/

 gtk_widget_show(canvas);

 active_plot = new_layer(canvas);
 gtk_plot_set_range(GTK_PLOT(active_plot), -1. ,1., -1., 1.4);
 gtk_plot_legends_move(GTK_PLOT(active_plot), .500, .05);
 gtk_plot_set_legends_border(GTK_PLOT(active_plot), 0, 0);
 gtk_plot_axis_hide_title(gtk_plot_get_axis(GTK_PLOT(active_plot), GTK_PLOT_AXIS_TOP));
 gtk_plot_axis_show_ticks(gtk_plot_get_axis(GTK_PLOT(active_plot), 3), 15, 3);
 gtk_plot_axis_set_ticks(gtk_plot_get_axis(GTK_PLOT(active_plot), 0), 1., 1);
 gtk_plot_axis_set_ticks(gtk_plot_get_axis(GTK_PLOT(active_plot), 1), 1., 1);
 gtk_plot_axis_set_visible(gtk_plot_get_axis(GTK_PLOT(active_plot), GTK_PLOT_AXIS_TOP), TRUE);
 gtk_plot_axis_set_visible(gtk_plot_get_axis(GTK_PLOT(active_plot), GTK_PLOT_AXIS_RIGHT), TRUE);
 gtk_plot_x0_set_visible(GTK_PLOT(active_plot), TRUE);
 gtk_plot_y0_set_visible(GTK_PLOT(active_plot), TRUE);

 gtk_plot_grids_set_visible(GTK_PLOT(active_plot), TRUE, TRUE, TRUE, TRUE);

 child = gtk_plot_canvas_plot_new(GTK_PLOT(active_plot));
 gtk_plot_canvas_put_child(GTK_PLOT_CANVAS(canvas), child, .15, .06, .65, .31);
 gtk_widget_show(active_plot);
 
 build_example1(active_plot);

 gtk_signal_connect(GTK_OBJECT(canvas), "select_item",
                    (GtkSignalFunc) select_item, NULL);

 gtk_widget_show(window1);

 gtk_plot_canvas_export_ps(GTK_PLOT_CANVAS(canvas), "demoflux.ps", 0, 0, 
                           GTK_PLOT_LETTER);
 
 gtk_main();

 return(0);
}
Example #24
0
int l_zar_dok_zap_p(int prn,class l_zar_dok_zap_rek *rek_poi,GtkWidget *wpredok)
{
class l_zar_dok_zap_p_data data;
char strsql[512];
data.rk=rek_poi;
data.prn=prn;

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_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(l_zar_dok_zap_p_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 *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);
for(int i=0; i < KOLENTER; i++)
 gtk_container_add (GTK_CONTAINER (vbox), hbox[i]);
gtk_container_add (GTK_CONTAINER (vbox), hboxknop);

GtkTooltips *tooltips_enter[KOLENTER];
GtkWidget *label;

sprintf(strsql,"%s (,,)",gettext("Табельный номер"));
data.knopka_enter[E_TABNOM]=gtk_button_new_with_label(iceb_u_toutf(strsql));
gtk_box_pack_start (GTK_BOX (hbox[E_TABNOM]), data.knopka_enter[E_TABNOM], FALSE, FALSE, 0);
gtk_signal_connect(GTK_OBJECT(data.knopka_enter[E_TABNOM]),"clicked",GTK_SIGNAL_FUNC(l_zar_dok_zap_p_e_knopka),&data);
gtk_object_set_user_data(GTK_OBJECT(data.knopka_enter[E_TABNOM]),(gpointer)E_TABNOM);
tooltips_enter[E_TABNOM]=gtk_tooltips_new();
gtk_tooltips_set_tip(tooltips_enter[E_TABNOM],data.knopka_enter[E_TABNOM],gettext("Выбор табельного номера"),NULL);

data.entry[E_TABNOM] = gtk_entry_new_with_max_length (10);
gtk_box_pack_start (GTK_BOX (hbox[E_TABNOM]), data.entry[E_TABNOM], TRUE, TRUE, 0);
gtk_signal_connect(GTK_OBJECT (data.entry[E_TABNOM]), "activate",GTK_SIGNAL_FUNC(l_zar_dok_zap_p_vvod),&data);
gtk_entry_set_text(GTK_ENTRY(data.entry[E_TABNOM]),data.rk->tabnom.ravno_toutf());
gtk_object_set_user_data(GTK_OBJECT(data.entry[E_TABNOM]),(gpointer)E_TABNOM);


if(data.prn == 1)
  sprintf(strsql,"%s (,,)",gettext("Код начисления"));
if(data.prn == 2)
  sprintf(strsql,"%s (,,)",gettext("Код удержания"));
data.knopka_enter[E_KOD_NAH]=gtk_button_new_with_label(iceb_u_toutf(strsql));
gtk_box_pack_start (GTK_BOX (hbox[E_KOD_NAH]), data.knopka_enter[E_KOD_NAH], FALSE, FALSE, 0);
gtk_signal_connect(GTK_OBJECT(data.knopka_enter[E_KOD_NAH]),"clicked",GTK_SIGNAL_FUNC(l_zar_dok_zap_p_e_knopka),&data);
gtk_object_set_user_data(GTK_OBJECT(data.knopka_enter[E_KOD_NAH]),(gpointer)E_KOD_NAH);
tooltips_enter[E_KOD_NAH]=gtk_tooltips_new();
if(data.prn == 1)
  gtk_tooltips_set_tip(tooltips_enter[E_KOD_NAH],data.knopka_enter[E_KOD_NAH],gettext("Выбор кода начисления"),NULL);
if(data.prn == 2)
  gtk_tooltips_set_tip(tooltips_enter[E_KOD_NAH],data.knopka_enter[E_KOD_NAH],gettext("Выбор кода удержания"),NULL);

data.entry[E_KOD_NAH] = gtk_entry_new_with_max_length (10);
gtk_box_pack_start (GTK_BOX (hbox[E_KOD_NAH]), data.entry[E_KOD_NAH], TRUE, TRUE, 0);
gtk_signal_connect(GTK_OBJECT (data.entry[E_KOD_NAH]), "activate",GTK_SIGNAL_FUNC(l_zar_dok_zap_p_vvod),&data);
gtk_entry_set_text(GTK_ENTRY(data.entry[E_KOD_NAH]),data.rk->kod_nah.ravno_toutf());
gtk_object_set_user_data(GTK_OBJECT(data.entry[E_KOD_NAH]),(gpointer)E_KOD_NAH);


sprintf(strsql,"%s (,,)",gettext("Счёт"));
data.knopka_enter[E_SHET]=gtk_button_new_with_label(iceb_u_toutf(strsql));
gtk_box_pack_start (GTK_BOX (hbox[E_SHET]), data.knopka_enter[E_SHET], FALSE, FALSE, 0);
gtk_signal_connect(GTK_OBJECT(data.knopka_enter[E_SHET]),"clicked",GTK_SIGNAL_FUNC(l_zar_dok_zap_p_e_knopka),&data);
gtk_object_set_user_data(GTK_OBJECT(data.knopka_enter[E_SHET]),(gpointer)E_SHET);
tooltips_enter[E_SHET]=gtk_tooltips_new();
gtk_tooltips_set_tip(tooltips_enter[E_SHET],data.knopka_enter[E_SHET],gettext("Выбор счёта в плане счетов"),NULL);

data.entry[E_SHET] = gtk_entry_new_with_max_length (10);
gtk_box_pack_start (GTK_BOX (hbox[E_SHET]), data.entry[E_SHET], TRUE, TRUE, 0);
gtk_signal_connect(GTK_OBJECT (data.entry[E_SHET]), "activate",GTK_SIGNAL_FUNC(l_zar_dok_zap_p_vvod),&data);
gtk_entry_set_text(GTK_ENTRY(data.entry[E_SHET]),data.rk->shet.ravno_toutf());
gtk_object_set_user_data(GTK_OBJECT(data.entry[E_SHET]),(gpointer)E_SHET);


label=gtk_label_new(gettext("Фамилия"));
gtk_box_pack_start (GTK_BOX (hbox[E_FIO]), label, FALSE, FALSE, 0);

data.entry[E_FIO] = gtk_entry_new_with_max_length (59);
gtk_box_pack_start (GTK_BOX (hbox[E_FIO]), data.entry[E_FIO], TRUE, TRUE, 0);
gtk_signal_connect(GTK_OBJECT (data.entry[E_FIO]), "activate",GTK_SIGNAL_FUNC(l_zar_dok_zap_p_vvod),&data);
gtk_entry_set_text(GTK_ENTRY(data.entry[E_FIO]),data.rk->fio.ravno_toutf());
gtk_object_set_user_data(GTK_OBJECT(data.entry[E_FIO]),(gpointer)E_FIO);


label=gtk_label_new(gettext("Коментарий"));
gtk_box_pack_start (GTK_BOX (hbox[E_KOMENT]), label, FALSE, FALSE, 0);

data.entry[E_KOMENT] = gtk_entry_new_with_max_length (59);
gtk_box_pack_start (GTK_BOX (hbox[E_KOMENT]), data.entry[E_KOMENT], TRUE, TRUE, 0);
gtk_signal_connect(GTK_OBJECT (data.entry[E_KOMENT]), "activate",GTK_SIGNAL_FUNC(l_zar_dok_zap_p_vvod),&data);
gtk_entry_set_text(GTK_ENTRY(data.entry[E_KOMENT]),data.rk->koment.ravno_toutf());
gtk_object_set_user_data(GTK_OBJECT(data.entry[E_KOMENT]),(gpointer)E_KOMENT);


GtkTooltips *tooltips[KOL_PFK];

sprintf(strsql,"F2 %s",gettext("Поиск"));
data.knopka[PFK2]=gtk_button_new_with_label(strsql);
tooltips[PFK2]=gtk_tooltips_new();
gtk_tooltips_set_tip(tooltips[PFK2],data.knopka[PFK2],gettext("Начать поиск нужных записей"),NULL);
gtk_signal_connect(GTK_OBJECT(data.knopka[PFK2]),"clicked",GTK_SIGNAL_FUNC(l_zar_dok_zap_p_knopka),&data);
gtk_object_set_user_data(GTK_OBJECT(data.knopka[PFK2]),(gpointer)PFK2);
gtk_box_pack_start(GTK_BOX(hboxknop), data.knopka[PFK2], TRUE, TRUE, 0);

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


sprintf(strsql,"F10 %s",gettext("Выход"));
data.knopka[PFK10]=gtk_button_new_with_label(strsql);
tooltips[PFK10]=gtk_tooltips_new();
gtk_tooltips_set_tip(tooltips[PFK10],data.knopka[PFK10],gettext("Поиск не выполнять"),NULL);
gtk_signal_connect(GTK_OBJECT(data.knopka[PFK10]),"clicked",GTK_SIGNAL_FUNC(l_zar_dok_zap_p_knopka),&data);
gtk_object_set_user_data(GTK_OBJECT(data.knopka[PFK10]),(gpointer)PFK10);
gtk_box_pack_start(GTK_BOX(hboxknop), data.knopka[PFK10], TRUE, TRUE, 0);

gtk_widget_grab_focus(data.entry[0]);

gtk_widget_show_all (data.window);

gtk_main();

if(wpredok != NULL)
  gdk_window_set_cursor(wpredok->window,gdk_cursor_new(ICEB_CURSOR));

return(data.voz);

}
Example #25
0
void ihm_config_create_window()
{
	int i;

	if (ihm_config.window!=NULL && GTK_IS_WIDGET(ihm_config.window)) { gtk_widget_show_all(ihm_config.window); return; }

	vp_os_memset(&ihm_config,0,sizeof(ihm_config));

	/* Main window */
		ihm_config.window = gtk_window_new( GTK_WINDOW_TOPLEVEL);

	/* Split the window in two halves */
		ihm_config.panes = gtk_hbox_new(FALSE, 20);
		gtk_container_add( GTK_CONTAINER(ihm_config.window), ihm_config.panes);

	/* Make two vertical frames next to each other*/
		ihm_config.config_frame = gtk_frame_new("Config");
		ihm_config.custom_config_frame = gtk_frame_new("Custom config.");
		gtk_box_pack_start(GTK_BOX(ihm_config.panes), ihm_config.config_frame ,TRUE, TRUE, 0);
		gtk_box_pack_start(GTK_BOX(ihm_config.panes), ihm_config.custom_config_frame ,TRUE, TRUE, 0);
		ihm_config.config_frame_vbox = gtk_vbox_new(FALSE,0);
		ihm_config.custom_config_frame_vbox = gtk_vbox_new(FALSE,0);
		gtk_container_add( GTK_CONTAINER(ihm_config.config_frame) , ihm_config.config_frame_vbox  );
		gtk_container_add( GTK_CONTAINER(ihm_config.custom_config_frame) , ihm_config.custom_config_frame_vbox );

	/* Config frame */
		ihm_config.get_config_button = gtk_button_new_with_label("Get configuration");
		gtk_box_pack_start(GTK_BOX(ihm_config.config_frame_vbox),ihm_config.get_config_button,FALSE, FALSE, 0);
		gtk_signal_connect(GTK_OBJECT(ihm_config.get_config_button), "clicked", G_CALLBACK(get_configuration_callback), NULL);

	/* Custom Configs frame */
		ihm_config.get_custom_configs_button = gtk_button_new_with_label("Get custom configurations list");
		gtk_signal_connect(GTK_OBJECT(ihm_config.get_custom_configs_button), "clicked", G_CALLBACK(get_custom_configurations_callback), NULL);

		ihm_config.custom_config_values[1].label = gtk_label_new("Application");
		ihm_config.custom_config_values[2].label = gtk_label_new("User profile");
		ihm_config.custom_config_values[3].label = gtk_label_new("Session");

		gtk_box_pack_start(GTK_BOX(ihm_config.custom_config_frame_vbox),ihm_config.get_custom_configs_button,FALSE, FALSE, 0);

		for (i=1;i<NB_CONFIG_CATEGORIES;i++)
		{
			ihm_config.custom_config_values[i].hbox = gtk_hbox_new(FALSE,0);
			ihm_config.custom_config_values[i].combo = gtk_combo_box_new_text();
			ihm_config.custom_config_values[i].raz_button = gtk_button_new_with_label("reset");
			gtk_box_pack_start(GTK_BOX(ihm_config.custom_config_values[i].hbox),ihm_config.custom_config_values[i].label,FALSE,FALSE,0);
			gtk_box_pack_start(GTK_BOX(ihm_config.custom_config_values[i].hbox),ihm_config.custom_config_values[i].combo,FALSE,FALSE,0);
			gtk_box_pack_start(GTK_BOX(ihm_config.custom_config_values[i].hbox),ihm_config.custom_config_values[i].raz_button,FALSE,FALSE,0);

			gtk_box_pack_start(GTK_BOX(ihm_config.custom_config_frame_vbox),ihm_config.custom_config_values[i].hbox,FALSE,FALSE,0);

			gtk_combo_box_insert_text(GTK_COMBO_BOX(ihm_config.custom_config_values[i].combo),0,"press button to retrieve list");
		}

		gtk_signal_connect(GTK_OBJECT(ihm_config.custom_config_values[1].combo), "changed", G_CALLBACK(send_custom_application_request),NULL);
		gtk_signal_connect(GTK_OBJECT(ihm_config.custom_config_values[2].combo), "changed", G_CALLBACK(send_custom_user_request),NULL);
		gtk_signal_connect(GTK_OBJECT(ihm_config.custom_config_values[3].combo), "changed", G_CALLBACK(send_custom_session_request),NULL);


		ihm_config.new_custom_configs[1].label = gtk_label_new("New application");
		ihm_config.new_custom_configs[2].label = gtk_label_new("New user profile");
		ihm_config.new_custom_configs[3].label = gtk_label_new("New session");

		for (i=1;i<NB_CONFIG_CATEGORIES;i++)
		{
			ihm_config.new_custom_configs[i].hbox = gtk_hbox_new(FALSE,0);
			ihm_config.new_custom_configs[i].entry = gtk_entry_new();
			ihm_config.new_custom_configs[i].send_button = gtk_button_new_with_label("send");
			gtk_box_pack_start(GTK_BOX(ihm_config.new_custom_configs[i].hbox),ihm_config.new_custom_configs[i].label,FALSE,FALSE,0);
			gtk_box_pack_start(GTK_BOX(ihm_config.new_custom_configs[i].hbox),ihm_config.new_custom_configs[i].entry,FALSE,FALSE,0);
			gtk_box_pack_start(GTK_BOX(ihm_config.new_custom_configs[i].hbox),ihm_config.new_custom_configs[i].send_button,FALSE,FALSE,0);

			gtk_box_pack_start(GTK_BOX(ihm_config.custom_config_frame_vbox),ihm_config.new_custom_configs[i].hbox,FALSE,FALSE,0);
		}

		gtk_signal_connect(GTK_OBJECT(ihm_config.new_custom_configs[1].send_button), "clicked", G_CALLBACK(send_new_custom_application_request),NULL);
		gtk_signal_connect(GTK_OBJECT(ihm_config.new_custom_configs[2].send_button), "clicked", G_CALLBACK(send_new_custom_user_request),NULL);
		gtk_signal_connect(GTK_OBJECT(ihm_config.new_custom_configs[3].send_button), "clicked", G_CALLBACK(send_new_custom_session_request),NULL);

		gtk_widget_show_all(ihm_config.window);
}
Example #26
0
int l_uosmo_p(class l_uosmo_rek *rek_poi,GtkWidget *wpredok)
{
    class l_uosmo_p_data data;
    char strsql[512];
    data.rk=rek_poi;


    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_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(l_uosmo_p_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 *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);
    for(int i=0; i < KOLENTER; i++)
        gtk_container_add (GTK_CONTAINER (vbox), hbox[i]);
    gtk_container_add (GTK_CONTAINER (vbox), hboxknop);


    GtkWidget *label=gtk_label_new(gettext("Код"));
    data.entry[E_KOD] = gtk_entry_new_with_max_length (10);
    gtk_box_pack_start (GTK_BOX (hbox[E_KOD]), label, FALSE, FALSE, 0);
    gtk_box_pack_start (GTK_BOX (hbox[E_KOD]), data.entry[E_KOD], TRUE, TRUE, 0);
    gtk_signal_connect(GTK_OBJECT (data.entry[E_KOD]), "activate",GTK_SIGNAL_FUNC(l_uosmo_p_vvod),&data);
    gtk_entry_set_text(GTK_ENTRY(data.entry[E_KOD]),data.rk->kod.ravno_toutf());
    gtk_object_set_user_data(GTK_OBJECT(data.entry[E_KOD]),(gpointer)E_KOD);

    label=gtk_label_new(gettext("Фамилия"));
    data.entry[E_NAIM] = gtk_entry_new_with_max_length (80);
    gtk_box_pack_start (GTK_BOX (hbox[E_NAIM]), label, FALSE, FALSE, 0);
    gtk_box_pack_start (GTK_BOX (hbox[E_NAIM]), data.entry[E_NAIM], TRUE, TRUE, 0);
    gtk_signal_connect(GTK_OBJECT (data.entry[E_NAIM]), "activate",GTK_SIGNAL_FUNC(l_uosmo_p_vvod),&data);
    gtk_entry_set_text(GTK_ENTRY(data.entry[E_NAIM]),data.rk->naim.ravno_toutf());
    gtk_object_set_user_data(GTK_OBJECT(data.entry[E_NAIM]),(gpointer)E_NAIM);



    GtkTooltips *tooltips[KOL_PFK];

    sprintf(strsql,"F2 %s",gettext("Поиск"));
    data.knopka[PFK2]=gtk_button_new_with_label(strsql);
    tooltips[PFK2]=gtk_tooltips_new();
    gtk_tooltips_set_tip(tooltips[PFK2],data.knopka[PFK2],gettext("Начать поиск нужных записей"),NULL);
    gtk_signal_connect(GTK_OBJECT(data.knopka[PFK2]),"clicked",GTK_SIGNAL_FUNC(l_uosmo_p_knopka),&data);
    gtk_object_set_user_data(GTK_OBJECT(data.knopka[PFK2]),(gpointer)PFK2);

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


    sprintf(strsql,"F10 %s",gettext("Выход"));
    data.knopka[PFK10]=gtk_button_new_with_label(strsql);
    tooltips[PFK10]=gtk_tooltips_new();
    gtk_tooltips_set_tip(tooltips[PFK10],data.knopka[PFK10],gettext("Поиск не выполнять"),NULL);
    gtk_signal_connect(GTK_OBJECT(data.knopka[PFK10]),"clicked",GTK_SIGNAL_FUNC(l_uosmo_p_knopka),&data);
    gtk_object_set_user_data(GTK_OBJECT(data.knopka[PFK10]),(gpointer)PFK10);

    gtk_box_pack_start(GTK_BOX(hboxknop), data.knopka[PFK2], TRUE, TRUE, 0);
    gtk_box_pack_start(GTK_BOX(hboxknop), data.knopka[PFK4], TRUE, TRUE, 0);
    gtk_box_pack_start(GTK_BOX(hboxknop), data.knopka[PFK10], TRUE, TRUE, 0);

    gtk_widget_grab_focus(data.entry[0]);

    gtk_widget_show_all (data.window);

    gtk_main();

    return(data.voz);

}
Example #27
0
int
main(int argc, char* argv[])
{
    /* this variable will store a pointer to the window object. */
    GtkWidget* main_window;
    /* this will store a horizontal box. */
    GtkWidget* hbox;
    /* these will store push buttons. */
    GtkWidget* button1;
    GtkWidget* button2;


    /* This is called in all GTK applications. Arguments */
    /* are parsed from the command line and are returned */
    /* to the application.                               */
    gtk_init(&argc, &argv);

    /* create a new top-level window. */
    main_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);

    /* define some of the window's attributes. */
    gtk_window_set_title(GTK_WINDOW (main_window),
                         "A Top Window For The Rest Of Us...");
    gtk_container_set_border_width(GTK_CONTAINER (main_window), 5);

    /* make the window visible. */
    gtk_widget_show(main_window);

    /* When the window is given the "delete_event" signal (this is given
     * by the window manager, usually by the "close" option, or on the
     * titlebar), we ask it to call the delete_event() function
     * as defined above. The data passed to the callback
     * function is NULL and is ignored in the callback function.
     */
    gtk_signal_connect(GTK_OBJECT (main_window), "delete_event",
                       GTK_SIGNAL_FUNC (delete_event), NULL);

    /* Here we connect the "destroy" event to a signal handler.
     * This event occurs when we call gtk_widget_destroy() on the window,
     * or if we return FALSE in the "delete_event" callback.
     */
    gtk_signal_connect(GTK_OBJECT (main_window), "destroy",
                       GTK_SIGNAL_FUNC (exit_cb), NULL);

    /* create a new horizontal box, and add to top-level window. */
    hbox = gtk_hbox_new(TRUE, 20);
    gtk_container_add(GTK_CONTAINER(main_window), hbox);
    gtk_widget_show(hbox);

    /* create a button. */
    button1 = gtk_button_new_with_label("Hello World");

    /* make the button visible. */
    gtk_widget_show(button1);

    /* pack our button inside the hbox. */
    gtk_box_pack_start(GTK_BOX(hbox), button1, FALSE, TRUE, 1);

    /* set a callback for the 'clicked' signal of the button.    */
    /* the given gpointer will be passed as the 'data' parameter */
    /* to the callback.                                          */
    gtk_signal_connect(GTK_OBJECT(button1), "clicked",
                       GTK_SIGNAL_FUNC(on_button1_clicked),
                       (gpointer)"tough");

    /* create a second button, place it in the hbox, and attach */
    /* a different callback.                                    */
    button2 = gtk_button_new_with_label("Quit");
    gtk_widget_show(button2);
    gtk_box_pack_start(GTK_BOX(hbox), button2, FALSE, TRUE, 1);
    gtk_signal_connect(GTK_OBJECT(button2), "clicked",
                       GTK_SIGNAL_FUNC(on_button2_clicked),
                       (gpointer)NULL);

    /* All GTK applications must have a gtk_main(). Control
     * ends here and waits for an event to occur (like a
     * key press or mouse event).
     */
    gtk_main();

    return(0);
}
GtkWidget*
create_TextPlotDialog (void)
{
  GtkWidget *TextPlotDialog;
  GtkWidget *dialog_vbox1;
  GtkWidget *table1;
  GtkWidget *label1;
  GtkWidget *label2;
  GtkWidget *label3;
  GtkWidget *label4;
  GtkObject *size_sb_adj;
  GtkWidget *size_sb;
  GtkObject *spacing_sb_adj;
  GtkWidget *spacing_sb;
  GtkObject *fontx_sb_adj;
  GtkWidget *fontx_sb;
  GtkObject *fonty_sb_adj;
  GtkWidget *fonty_sb;
  GtkWidget *Color;
  GtkWidget *label5;
  GtkWidget *textplot_variables;
  GtkWidget *textplot_variables_menu;
  GtkWidget *dialog_action_area1;
  GtkWidget *hbuttonbox1;
  GtkWidget *tpclose;

  TextPlotDialog = gtk_dialog_new ();
  gtk_widget_set_name (TextPlotDialog, "TextPlotDialog");
  gtk_object_set_data (GTK_OBJECT (TextPlotDialog), "TextPlotDialog", TextPlotDialog);
  gtk_window_set_title (GTK_WINDOW (TextPlotDialog), _("Text Plot Dialog"));
  GTK_WINDOW (TextPlotDialog)->type = GTK_WINDOW_DIALOG;
  gtk_window_set_policy (GTK_WINDOW (TextPlotDialog), TRUE, TRUE, FALSE);

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

  table1 = gtk_table_new (6, 2, FALSE);
  gtk_widget_set_name (table1, "table1");
  gtk_widget_ref (table1);
  gtk_object_set_data_full (GTK_OBJECT (TextPlotDialog), "table1", table1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (table1);
  gtk_box_pack_start (GTK_BOX (dialog_vbox1), table1, TRUE, TRUE, 0);
  gtk_table_set_row_spacings (GTK_TABLE (table1), 3);

  label1 = gtk_label_new (_("Size:"));
  gtk_widget_set_name (label1, "label1");
  gtk_widget_ref (label1);
  gtk_object_set_data_full (GTK_OBJECT (TextPlotDialog), "label1", label1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label1);
  gtk_table_attach (GTK_TABLE (table1), label1, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label1), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label1), 5, 0);

  label2 = gtk_label_new (_("Spacing:"));
  gtk_widget_set_name (label2, "label2");
  gtk_widget_ref (label2);
  gtk_object_set_data_full (GTK_OBJECT (TextPlotDialog), "label2", label2,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label2);
  gtk_table_attach (GTK_TABLE (table1), label2, 0, 1, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label2), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label2), 5, 0);

  label3 = gtk_label_new (_("Font Width:"));
  gtk_widget_set_name (label3, "label3");
  gtk_widget_ref (label3);
  gtk_object_set_data_full (GTK_OBJECT (TextPlotDialog), "label3", label3,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label3);
  gtk_table_attach (GTK_TABLE (table1), label3, 0, 1, 3, 4,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label3), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label3), 5, 0);

  label4 = gtk_label_new (_("Font Height:"));
  gtk_widget_set_name (label4, "label4");
  gtk_widget_ref (label4);
  gtk_object_set_data_full (GTK_OBJECT (TextPlotDialog), "label4", label4,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label4);
  gtk_table_attach (GTK_TABLE (table1), label4, 0, 1, 4, 5,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label4), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label4), 5, 0);

  size_sb_adj = gtk_adjustment_new (1, 0.01, 100, 1, 10, 10);
  size_sb = gtk_spin_button_new (GTK_ADJUSTMENT (size_sb_adj), 1, 2);
  gtk_widget_set_name (size_sb, "size_sb");
  gtk_widget_ref (size_sb);
  gtk_object_set_data_full (GTK_OBJECT (TextPlotDialog), "size_sb", size_sb,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (size_sb);
  gtk_table_attach (GTK_TABLE (table1), size_sb, 1, 2, 1, 2,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (size_sb), TRUE);

  spacing_sb_adj = gtk_adjustment_new (1, 0, 100, 1, 10, 10);
  spacing_sb = gtk_spin_button_new (GTK_ADJUSTMENT (spacing_sb_adj), 1, 0);
  gtk_widget_set_name (spacing_sb, "spacing_sb");
  gtk_widget_ref (spacing_sb);
  gtk_object_set_data_full (GTK_OBJECT (TextPlotDialog), "spacing_sb", spacing_sb,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (spacing_sb);
  gtk_table_attach (GTK_TABLE (table1), spacing_sb, 1, 2, 2, 3,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  fontx_sb_adj = gtk_adjustment_new (10, 0, 100, 1, 10, 10);
  fontx_sb = gtk_spin_button_new (GTK_ADJUSTMENT (fontx_sb_adj), 1, 0);
  gtk_widget_set_name (fontx_sb, "fontx_sb");
  gtk_widget_ref (fontx_sb);
  gtk_object_set_data_full (GTK_OBJECT (TextPlotDialog), "fontx_sb", fontx_sb,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (fontx_sb);
  gtk_table_attach (GTK_TABLE (table1), fontx_sb, 1, 2, 3, 4,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  fonty_sb_adj = gtk_adjustment_new (10, 0, 100, 1, 10, 10);
  fonty_sb = gtk_spin_button_new (GTK_ADJUSTMENT (fonty_sb_adj), 1, 0);
  gtk_widget_set_name (fonty_sb, "fonty_sb");
  gtk_widget_ref (fonty_sb);
  gtk_object_set_data_full (GTK_OBJECT (TextPlotDialog), "fonty_sb", fonty_sb,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (fonty_sb);
  gtk_table_attach (GTK_TABLE (table1), fonty_sb, 1, 2, 4, 5,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  Color = gtk_button_new_with_label (_("Color"));
  gtk_widget_set_name (Color, "Color");
  gtk_widget_ref (Color);
  gtk_object_set_data_full (GTK_OBJECT (TextPlotDialog), "Color", Color,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (Color);
  gtk_table_attach (GTK_TABLE (table1), Color, 0, 2, 5, 6,
                    (GtkAttachOptions) (0),
                    (GtkAttachOptions) (0), 0, 0);

  label5 = gtk_label_new (_("Variable:"));
  gtk_widget_set_name (label5, "label5");
  gtk_widget_ref (label5);
  gtk_object_set_data_full (GTK_OBJECT (TextPlotDialog), "label5", label5,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label5);
  gtk_table_attach (GTK_TABLE (table1), label5, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label5), 0, 0.5);
  gtk_misc_set_padding (GTK_MISC (label5), 5, 0);

  textplot_variables = gtk_option_menu_new ();
  gtk_widget_set_name (textplot_variables, "textplot_variables");
  gtk_widget_ref (textplot_variables);
  gtk_object_set_data_full (GTK_OBJECT (TextPlotDialog), "textplot_variables", textplot_variables,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (textplot_variables);
  gtk_table_attach (GTK_TABLE (table1), textplot_variables, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_widget_set_usize (textplot_variables, 150, 40);
  gtk_container_set_border_width (GTK_CONTAINER (textplot_variables), 5);
  textplot_variables_menu = gtk_menu_new ();
  gtk_option_menu_set_menu (GTK_OPTION_MENU (textplot_variables), textplot_variables_menu);

  dialog_action_area1 = GTK_DIALOG (TextPlotDialog)->action_area;
  gtk_widget_set_name (dialog_action_area1, "dialog_action_area1");
  gtk_object_set_data (GTK_OBJECT (TextPlotDialog), "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_set_name (hbuttonbox1, "hbuttonbox1");
  gtk_widget_ref (hbuttonbox1);
  gtk_object_set_data_full (GTK_OBJECT (TextPlotDialog), "hbuttonbox1", hbuttonbox1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbuttonbox1);
  gtk_box_pack_start (GTK_BOX (dialog_action_area1), hbuttonbox1, TRUE, TRUE, 0);

  tpclose = gtk_button_new_with_label (_("Close"));
  gtk_widget_set_name (tpclose, "tpclose");
  gtk_widget_ref (tpclose);
  gtk_object_set_data_full (GTK_OBJECT (TextPlotDialog), "tpclose", tpclose,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (tpclose);
  gtk_container_add (GTK_CONTAINER (hbuttonbox1), tpclose);
  GTK_WIDGET_SET_FLAGS (tpclose, GTK_CAN_DEFAULT);

  gtk_signal_connect (GTK_OBJECT (size_sb), "changed",
                      GTK_SIGNAL_FUNC (on_tp_sb_changed),
                      GINT_TO_POINTER(0));
  gtk_signal_connect (GTK_OBJECT (spacing_sb), "changed",
                      GTK_SIGNAL_FUNC (on_tp_sb_changed),
                      GINT_TO_POINTER(1));
  gtk_signal_connect (GTK_OBJECT (fontx_sb), "changed",
                      GTK_SIGNAL_FUNC (on_tp_sb_changed),
                      GINT_TO_POINTER(2));
  gtk_signal_connect (GTK_OBJECT (fonty_sb), "changed",
                      GTK_SIGNAL_FUNC (on_tp_sb_changed),
                      GINT_TO_POINTER(3));
  gtk_signal_connect (GTK_OBJECT (Color), "clicked",
                      GTK_SIGNAL_FUNC (on_Color_clicked),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (tpclose), "clicked",
                      GTK_SIGNAL_FUNC (on_tpclose_clicked),
                      NULL);

  return TextPlotDialog;
}
Example #29
0
void
editlist_gui_open (char *title1, char *title2, GSList * list, char *title, char *wmclass,
						 char *file, char *help)
{
	gchar *titles[2];
	GtkWidget *vbox, *hbox, *button;

	if (title1)
	{
		titles[0] = title1;
		titles[1] = title2;
	} else
	{
		titles[0] = _("Name");
		titles[1] = _("Command");
	}

	if (editlist_gui_window)
	{
		mg_bring_tofront (editlist_gui_window);
		return;
	}

	editlist_list = list;
	editlist_file = file;
	editlist_help = help;

	editlist_gui_window =
			  mg_create_generic_tab (wmclass, title, TRUE, FALSE,
											 editlist_gui_close, NULL, 450, 250, &vbox, 0);

	editlist_gui_list = gtkutil_clist_new (2, titles, vbox, GTK_POLICY_ALWAYS,
														editlist_gui_row_selected, 0,
														editlist_gui_row_unselected, 0,
														GTK_SELECTION_BROWSE);
	gtk_clist_set_column_width (GTK_CLIST (editlist_gui_list), 0, 90);

	hbox = gtk_hbox_new (0, 2);
	gtk_box_pack_end (GTK_BOX (vbox), hbox, 0, 0, 0);
	gtk_widget_show (hbox);

	button = gtkutil_button (hbox, GTK_STOCK_GO_UP, 0, editlist_gui_moveup,
									 0, _("Move Up"));
	gtk_widget_set_usize (button, 100, 0);

	button = gtkutil_button (hbox, GTK_STOCK_GO_DOWN, 0, editlist_gui_movedown,
									 0, _("Move Dn"));
	gtk_widget_set_usize (button, 100, 0);

	button = gtk_vseparator_new ();
	gtk_container_add (GTK_CONTAINER (hbox), button);
	gtk_widget_show (button);

	button = gtkutil_button (hbox, GTK_STOCK_CANCEL, 0, gtkutil_destroy,
									 editlist_gui_window, _("Cancel"));
	gtk_widget_set_usize (button, 100, 0);

	button = gtkutil_button (hbox, GTK_STOCK_SAVE, 0, editlist_gui_save,
									 0, _("Save"));
	gtk_widget_set_usize (button, 100, 0);

	hbox = gtk_hbox_new (0, 2);
	gtk_box_pack_end (GTK_BOX (vbox), hbox, 0, 0, 0);
	gtk_widget_show (hbox);

	button = gtkutil_button (hbox, GTK_STOCK_ADD, 0, editlist_gui_addnew,
									 0, _("Add New"));
	gtk_widget_set_usize (button, 100, 0);

	button = gtkutil_button (hbox, GTK_STOCK_REMOVE, 0, editlist_gui_delete,
									 0, _("Delete"));
	gtk_widget_set_usize (button, 100, 0);

	button = gtk_vseparator_new ();
	gtk_container_add (GTK_CONTAINER (hbox), button);
	gtk_widget_show (button);

	button = gtkutil_button (hbox, GTK_STOCK_SORT_ASCENDING, 0, editlist_gui_sort,
									 0, _("Sort"));
	gtk_widget_set_usize (button, 100, 0);

	button = gtkutil_button (hbox, GTK_STOCK_HELP, 0, editlist_gui_help,
									 0, _("Help"));
	gtk_widget_set_usize (button, 100, 0);

	if (!help)
		gtk_widget_set_sensitive (GTK_WIDGET (button), FALSE);

	hbox = gtk_hbox_new (0, 2);
	gtk_box_pack_end (GTK_BOX (vbox), hbox, 0, 0, 0);
	gtk_widget_show (hbox);

	editlist_gui_entry_name = gtk_entry_new_with_max_length (82);
	gtk_widget_set_usize (editlist_gui_entry_name, 96, 0);
	gtk_signal_connect (GTK_OBJECT (editlist_gui_entry_name), "changed",
							  GTK_SIGNAL_FUNC (editlist_gui_handle_name), 0);
	gtk_box_pack_start (GTK_BOX (hbox), editlist_gui_entry_name, 0, 0, 0);
	gtk_widget_show (editlist_gui_entry_name);

	editlist_gui_entry_cmd = gtk_entry_new_with_max_length (255);
	gtk_signal_connect (GTK_OBJECT (editlist_gui_entry_cmd), "changed",
							  GTK_SIGNAL_FUNC (editlist_gui_handle_cmd), 0);
	gtk_container_add (GTK_CONTAINER (hbox), editlist_gui_entry_cmd);
	gtk_widget_show (editlist_gui_entry_cmd);

	hbox = gtk_hbox_new (0, 2);
	gtk_box_pack_end (GTK_BOX (vbox), hbox, 0, 0, 0);
	gtk_widget_show (hbox);

	editlist_gui_load (editlist_gui_list);

	gtk_widget_show (editlist_gui_window);
}
GtkWidget*
create_preference (void)
{
  GtkWidget *preference;
  GtkWidget *vbox1;
  GtkWidget *notebook1;
  GtkWidget *vbox6;
  GtkWidget *frame9;
  GtkWidget *label36;
  GtkWidget *hseparator4;
  GtkWidget *frame10;
  GtkWidget *label37;
  GtkWidget *nonengbutton;
  GtkWidget *label16;
  GtkWidget *vbox7;
  GtkWidget *frame18;
  GtkWidget *reloadbutton;
  GtkWidget *hseparator5;
  GtkWidget *frame13;
  GtkWidget *vbox8;
  GtkWidget *hbox9;
  GtkWidget *label41;
  GtkObject *spinbutton1_adj;
  GtkWidget *spinbutton1;
  GtkWidget *button16;
  GtkWidget *button17;
  GtkWidget *label40;
  GtkWidget *frame16;
  GtkWidget *vbox10;
  GtkWidget *scrolledwindow13;
  GtkWidget *recitelist;
  GtkWidget *label58;
  GtkWidget *hbox12;
  GtkWidget *recitedb;
  GtkWidget *label25;
  GtkWidget *hseparator3;
  GtkWidget *hbox7;
  GtkWidget *button11;
  GtkWidget *label52;
  GtkWidget *label43;
  GtkWidget *label51;
  GtkWidget *debugbutton;

  preference = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  gtk_object_set_data (GTK_OBJECT (preference), "preference", preference);
  gtk_widget_set_usize (preference, 300, -2);
  gtk_window_set_title (GTK_WINDOW (preference), _("Preference"));

  vbox1 = gtk_vbox_new (FALSE, 3);
  gtk_widget_ref (vbox1);
  gtk_object_set_data_full (GTK_OBJECT (preference), "vbox1", vbox1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (vbox1);
  gtk_container_add (GTK_CONTAINER (preference), vbox1);
  gtk_container_set_border_width (GTK_CONTAINER (vbox1), 3);

  notebook1 = gtk_notebook_new ();
  gtk_widget_ref (notebook1);
  gtk_object_set_data_full (GTK_OBJECT (preference), "notebook1", notebook1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (notebook1);
  gtk_box_pack_start (GTK_BOX (vbox1), notebook1, TRUE, TRUE, 0);

  vbox6 = gtk_vbox_new (FALSE, 0);
  gtk_widget_ref (vbox6);
  gtk_object_set_data_full (GTK_OBJECT (preference), "vbox6", vbox6,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (vbox6);
  gtk_container_add (GTK_CONTAINER (notebook1), vbox6);

  frame9 = gtk_frame_new (_("MyDict"));
  gtk_widget_ref (frame9);
  gtk_object_set_data_full (GTK_OBJECT (preference), "frame9", frame9,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (frame9);
  gtk_box_pack_start (GTK_BOX (vbox6), frame9, FALSE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (frame9), 2);

  label36 = gtk_label_new (_("GNU Dict - Dictionary Framework\n- mydict-client package\nMyDict\nAuthor : Larry Cai <caiyu@yahoo.com>"));
  gtk_widget_ref (label36);
  gtk_object_set_data_full (GTK_OBJECT (preference), "label36", label36,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label36);
  gtk_container_add (GTK_CONTAINER (frame9), label36);

  hseparator4 = gtk_hseparator_new ();
  gtk_widget_ref (hseparator4);
  gtk_object_set_data_full (GTK_OBJECT (preference), "hseparator4", hseparator4,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hseparator4);
  gtk_box_pack_start (GTK_BOX (vbox6), hseparator4, FALSE, TRUE, 5);

  frame10 = gtk_frame_new (_("Techonology"));
  gtk_widget_ref (frame10);
  gtk_object_set_data_full (GTK_OBJECT (preference), "frame10", frame10,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (frame10);
  gtk_box_pack_start (GTK_BOX (vbox6), frame10, TRUE, TRUE, 0);

  label37 = gtk_label_new (_("Please visit\nhttp://sourceforge.net/projects/gnudict\nfor the Dictionary Techonology\n\nPowered by Glade & Brains\n\n\n"));
  gtk_widget_ref (label37);
  gtk_object_set_data_full (GTK_OBJECT (preference), "label37", label37,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label37);
  gtk_container_add (GTK_CONTAINER (frame10), label37);
  gtk_label_set_justify (GTK_LABEL (label37), GTK_JUSTIFY_LEFT);

  nonengbutton = gtk_toggle_button_new_with_label (_("use locale for translation"));
  gtk_widget_ref (nonengbutton);
  gtk_object_set_data_full (GTK_OBJECT (preference), "nonengbutton", nonengbutton,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (nonengbutton);
  gtk_box_pack_start (GTK_BOX (vbox6), nonengbutton, FALSE, FALSE, 0);
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (nonengbutton), TRUE);

  label16 = gtk_label_new (_("About"));
  gtk_widget_ref (label16);
  gtk_object_set_data_full (GTK_OBJECT (preference), "label16", label16,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label16);
  gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 0), label16);

  vbox7 = gtk_vbox_new (FALSE, 0);
  gtk_widget_ref (vbox7);
  gtk_object_set_data_full (GTK_OBJECT (preference), "vbox7", vbox7,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (vbox7);
  gtk_container_add (GTK_CONTAINER (notebook1), vbox7);

  frame18 = gtk_frame_new (_(" Dict"));
  gtk_widget_ref (frame18);
  gtk_object_set_data_full (GTK_OBJECT (preference), "frame18", frame18,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (frame18);
  gtk_box_pack_start (GTK_BOX (vbox7), frame18, FALSE, TRUE, 0);

  reloadbutton = gtk_button_new_with_label (_("reload my plugins"));
  gtk_widget_ref (reloadbutton);
  gtk_object_set_data_full (GTK_OBJECT (preference), "reloadbutton", reloadbutton,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (reloadbutton);
  gtk_container_add (GTK_CONTAINER (frame18), reloadbutton);
  gtk_widget_set_usize (reloadbutton, -2, 22);

  hseparator5 = gtk_hseparator_new ();
  gtk_widget_ref (hseparator5);
  gtk_object_set_data_full (GTK_OBJECT (preference), "hseparator5", hseparator5,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hseparator5);
  gtk_box_pack_start (GTK_BOX (vbox7), hseparator5, FALSE, TRUE, 0);

  frame13 = gtk_frame_new (_("Recite"));
  gtk_widget_ref (frame13);
  gtk_object_set_data_full (GTK_OBJECT (preference), "frame13", frame13,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (frame13);
  gtk_box_pack_start (GTK_BOX (vbox7), frame13, FALSE, TRUE, 0);

  vbox8 = gtk_vbox_new (FALSE, 0);
  gtk_widget_ref (vbox8);
  gtk_object_set_data_full (GTK_OBJECT (preference), "vbox8", vbox8,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (vbox8);
  gtk_container_add (GTK_CONTAINER (frame13), vbox8);

  hbox9 = gtk_hbox_new (FALSE, 0);
  gtk_widget_ref (hbox9);
  gtk_object_set_data_full (GTK_OBJECT (preference), "hbox9", hbox9,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox9);
  gtk_box_pack_start (GTK_BOX (vbox8), hbox9, FALSE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (hbox9), 1);

  label41 = gtk_label_new (_("Interval:"));
  gtk_widget_ref (label41);
  gtk_object_set_data_full (GTK_OBJECT (preference), "label41", label41,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label41);
  gtk_box_pack_start (GTK_BOX (hbox9), label41, FALSE, FALSE, 0);
  gtk_misc_set_padding (GTK_MISC (label41), 4, 0);

  spinbutton1_adj = gtk_adjustment_new (11, 0, 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 (preference), "spinbutton1", spinbutton1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (spinbutton1);
  gtk_box_pack_start (GTK_BOX (hbox9), spinbutton1, TRUE, TRUE, 0);

  button16 = gtk_button_new_with_label (_("Default"));
  gtk_widget_ref (button16);
  gtk_object_set_data_full (GTK_OBJECT (preference), "button16", button16,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button16);
  gtk_box_pack_end (GTK_BOX (hbox9), button16, FALSE, FALSE, 2);

  button17 = gtk_button_new_with_label (_("Update"));
  gtk_widget_ref (button17);
  gtk_object_set_data_full (GTK_OBJECT (preference), "button17", button17,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button17);
  gtk_box_pack_end (GTK_BOX (hbox9), button17, FALSE, FALSE, 2);

  label40 = gtk_label_new (_("seconds"));
  gtk_widget_ref (label40);
  gtk_object_set_data_full (GTK_OBJECT (preference), "label40", label40,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label40);
  gtk_box_pack_end (GTK_BOX (hbox9), label40, FALSE, FALSE, 0);

  frame16 = gtk_frame_new (_("Recite Database"));
  gtk_widget_ref (frame16);
  gtk_object_set_data_full (GTK_OBJECT (preference), "frame16", frame16,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (frame16);
  gtk_box_pack_start (GTK_BOX (vbox7), frame16, TRUE, TRUE, 0);

  vbox10 = gtk_vbox_new (FALSE, 0);
  gtk_widget_ref (vbox10);
  gtk_object_set_data_full (GTK_OBJECT (preference), "vbox10", vbox10,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (vbox10);
  gtk_container_add (GTK_CONTAINER (frame16), vbox10);

  scrolledwindow13 = gtk_scrolled_window_new (NULL, NULL);
  gtk_widget_ref (scrolledwindow13);
  gtk_object_set_data_full (GTK_OBJECT (preference), "scrolledwindow13", scrolledwindow13,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (scrolledwindow13);
  gtk_box_pack_start (GTK_BOX (vbox10), scrolledwindow13, TRUE, TRUE, 0);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow13), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);

  recitelist = gtk_clist_new (1);
  gtk_widget_ref (recitelist);
  gtk_object_set_data_full (GTK_OBJECT (preference), "recitelist", recitelist,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (recitelist);
  gtk_container_add (GTK_CONTAINER (scrolledwindow13), recitelist);
  gtk_clist_set_column_width (GTK_CLIST (recitelist), 0, 80);
  gtk_clist_column_titles_show (GTK_CLIST (recitelist));

  label58 = gtk_label_new (_("Recite database list"));
  gtk_widget_ref (label58);
  gtk_object_set_data_full (GTK_OBJECT (preference), "label58", label58,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label58);
  gtk_clist_set_column_widget (GTK_CLIST (recitelist), 0, label58);

  hbox12 = gtk_hbox_new (TRUE, 0);
  gtk_widget_ref (hbox12);
  gtk_object_set_data_full (GTK_OBJECT (preference), "hbox12", hbox12,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox12);
  gtk_box_pack_start (GTK_BOX (vbox10), hbox12, FALSE, TRUE, 0);

  recitedb = gtk_button_new_with_label (_("reload list"));
  gtk_widget_ref (recitedb);
  gtk_object_set_data_full (GTK_OBJECT (preference), "recitedb", recitedb,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (recitedb);
  gtk_box_pack_start (GTK_BOX (hbox12), recitedb, FALSE, FALSE, 0);

  label25 = gtk_label_new (_("Options"));
  gtk_widget_ref (label25);
  gtk_object_set_data_full (GTK_OBJECT (preference), "label25", label25,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label25);
  gtk_notebook_set_tab_label (GTK_NOTEBOOK (notebook1), gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook1), 1), label25);

  hseparator3 = gtk_hseparator_new ();
  gtk_widget_ref (hseparator3);
  gtk_object_set_data_full (GTK_OBJECT (preference), "hseparator3", hseparator3,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hseparator3);
  gtk_box_pack_start (GTK_BOX (vbox1), hseparator3, FALSE, TRUE, 3);

  hbox7 = gtk_hbox_new (TRUE, 5);
  gtk_widget_ref (hbox7);
  gtk_object_set_data_full (GTK_OBJECT (preference), "hbox7", hbox7,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox7);
  gtk_box_pack_start (GTK_BOX (vbox1), hbox7, FALSE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (hbox7), 3);

  button11 = gtk_button_new_with_label (_("Quit"));
  gtk_widget_ref (button11);
  gtk_object_set_data_full (GTK_OBJECT (preference), "button11", button11,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button11);
  gtk_box_pack_start (GTK_BOX (hbox7), button11, FALSE, TRUE, 0);

  label52 = gtk_label_new ("");
  gtk_widget_ref (label52);
  gtk_object_set_data_full (GTK_OBJECT (preference), "label52", label52,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label52);
  gtk_box_pack_start (GTK_BOX (hbox7), label52, FALSE, FALSE, 0);

  label43 = gtk_label_new (_("Thank you for using myDict"));
  gtk_widget_ref (label43);
  gtk_object_set_data_full (GTK_OBJECT (preference), "label43", label43,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label43);
  gtk_box_pack_start (GTK_BOX (hbox7), label43, FALSE, FALSE, 0);
  gtk_label_set_justify (GTK_LABEL (label43), GTK_JUSTIFY_LEFT);

  label51 = gtk_label_new ("");
  gtk_widget_ref (label51);
  gtk_object_set_data_full (GTK_OBJECT (preference), "label51", label51,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label51);
  gtk_box_pack_start (GTK_BOX (hbox7), label51, FALSE, FALSE, 0);

  debugbutton = gtk_toggle_button_new_with_label (_("Debug"));
  gtk_widget_ref (debugbutton);
  gtk_object_set_data_full (GTK_OBJECT (preference), "debugbutton", debugbutton,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (debugbutton);
  gtk_box_pack_start (GTK_BOX (hbox7), debugbutton, FALSE, TRUE, 0);

  gtk_signal_connect (GTK_OBJECT (nonengbutton), "toggled",
                      GTK_SIGNAL_FUNC (on_nonengbutton_toggled),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (reloadbutton), "clicked",
                      GTK_SIGNAL_FUNC (on_reloadbutton_clicked),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (button16), "clicked",
                      GTK_SIGNAL_FUNC (on_default_timer_clicked),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (button17), "clicked",
                      GTK_SIGNAL_FUNC (on_update_timer_clicked),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (recitelist), "select_row",
                      GTK_SIGNAL_FUNC (on_recitelist_select_row),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (recitedb), "clicked",
                      GTK_SIGNAL_FUNC (on_recitedb_clicked),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (button11), "clicked",
                      GTK_SIGNAL_FUNC (on_button11_clicked),
                      NULL);
  gtk_signal_connect (GTK_OBJECT (debugbutton), "toggled",
                      GTK_SIGNAL_FUNC (on_debugbutton_toggled),
                      NULL);

  return preference;
}