Exemplo n.º 1
1
void
initialize_pref_controls(void)
{
  GtkWidget *widget;
  GtkSpinButton *spin;
  GdkColor color;
  GtkTreeModel *model;

  diag_pref = glade_xml_get_widget (appdata.xml, "diag_pref");

  /* Updates controls from values of variables */
  widget = glade_xml_get_widget (appdata.xml, "node_radius_slider");
  gtk_adjustment_set_value (GTK_RANGE (widget)->adjustment,
			    log (pref.node_radius_multiplier) / log (10));
  g_signal_emit_by_name (G_OBJECT (GTK_RANGE (widget)->adjustment),
			 "changed");
  widget = glade_xml_get_widget (appdata.xml, "link_width_slider");
  gtk_adjustment_set_value (GTK_RANGE (widget)->adjustment,
			    pref.link_node_ratio);
  g_signal_emit_by_name (GTK_OBJECT (GTK_RANGE (widget)->adjustment),
			 "changed");
  spin = GTK_SPIN_BUTTON (glade_xml_get_widget (appdata.xml, "averaging_spin"));
  gtk_spin_button_set_value (spin, pref.averaging_time);
  spin = GTK_SPIN_BUTTON (glade_xml_get_widget (appdata.xml, "refresh_spin"));
  gtk_spin_button_set_value (spin, pref.refresh_period);
  spin = GTK_SPIN_BUTTON (glade_xml_get_widget (appdata.xml, "node_to_spin"));
  gtk_spin_button_set_value (spin, pref.node_timeout_time/MILLI);
  spin = GTK_SPIN_BUTTON (glade_xml_get_widget (appdata.xml, "gui_node_to_spin"));
  gtk_spin_button_set_value (spin, pref.gui_node_timeout_time/MILLI);
  spin = GTK_SPIN_BUTTON (glade_xml_get_widget (appdata.xml, "proto_node_to_spin"));
  gtk_spin_button_set_value (spin, pref.proto_node_timeout_time/MILLI);

  spin = GTK_SPIN_BUTTON (glade_xml_get_widget (appdata.xml, "link_to_spin"));
  gtk_spin_button_set_value (spin, pref.link_timeout_time/MILLI);
  spin = GTK_SPIN_BUTTON (glade_xml_get_widget (appdata.xml, "gui_link_to_spin"));
  gtk_spin_button_set_value (spin, pref.gui_link_timeout_time/MILLI);
  spin = GTK_SPIN_BUTTON (glade_xml_get_widget (appdata.xml, "proto_link_to_spin"));
  gtk_spin_button_set_value (spin, pref.proto_link_timeout_time/MILLI);

  spin = GTK_SPIN_BUTTON (glade_xml_get_widget (appdata.xml, "proto_to_spin"));
  gtk_spin_button_set_value (spin, pref.proto_timeout_time/MILLI);

  widget = glade_xml_get_widget (appdata.xml, "diagram_only_toggle");
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget),
				pref.diagram_only);
  widget = glade_xml_get_widget (appdata.xml, "group_unk_check");
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), pref.group_unk);
  widget = glade_xml_get_widget (appdata.xml, "name_res_check");
  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), pref.name_res);
  widget = glade_xml_get_widget (appdata.xml, "stack_level");
  gtk_combo_box_set_active(GTK_COMBO_BOX(widget), pref.stack_level);
  widget = glade_xml_get_widget (appdata.xml, "size_variable");
  gtk_combo_box_set_active(GTK_COMBO_BOX(widget), pref.node_size_variable);
  widget = glade_xml_get_widget (appdata.xml, "size_mode");
  gtk_combo_box_set_active(GTK_COMBO_BOX(widget), pref.size_mode);
  widget = glade_xml_get_widget (appdata.xml, "text_font");
  gtk_font_button_set_font_name(GTK_FONT_BUTTON(widget), pref.fontname);
  widget = glade_xml_get_widget (appdata.xml, "text_color");
  if (!gdk_color_parse(pref.text_color, &color))
    gdk_color_parse("#ffff00", &color);
  gtk_color_button_set_color(GTK_COLOR_BUTTON(widget), &color);

  widget = glade_xml_get_widget (appdata.xml, "filter_combo");
  model = gtk_combo_box_get_model(GTK_COMBO_BOX(widget));
  if (!model)
    {
      GtkListStore *list_store;
      list_store=gtk_list_store_new (1, G_TYPE_STRING);
      gtk_combo_box_set_model(GTK_COMBO_BOX(widget), GTK_TREE_MODEL(list_store));
    }

  widget = glade_xml_get_widget (appdata.xml, "center_combo");
  model = gtk_combo_box_get_model(GTK_COMBO_BOX(widget));
  if (!model)
    {
      GtkListStore *list_store;
      list_store=gtk_list_store_new (1, G_TYPE_STRING);
      gtk_combo_box_set_model(GTK_COMBO_BOX(widget), GTK_TREE_MODEL(list_store));
    }

  pref_to_color_list();		/* Updates the color preferences table with pref.colors */

  /* Connects signals */
  widget = glade_xml_get_widget (appdata.xml, "diag_pref");
  g_signal_connect (G_OBJECT (widget),
		    "delete_event",
		    GTK_SIGNAL_FUNC
		    (on_cancel_pref_button_clicked ), NULL);
  widget = glade_xml_get_widget (appdata.xml, "node_radius_slider");
  g_signal_connect (G_OBJECT (GTK_RANGE (widget)->adjustment),
		    "value_changed",
		    GTK_SIGNAL_FUNC
		    (on_node_radius_slider_adjustment_changed), NULL);
  widget = glade_xml_get_widget (appdata.xml, "link_width_slider");
  g_signal_connect (G_OBJECT (GTK_RANGE (widget)->adjustment),
		    "value_changed",
		    GTK_SIGNAL_FUNC
		    (on_link_width_slider_adjustment_changed), NULL);
  widget = glade_xml_get_widget (appdata.xml, "averaging_spin");
  g_signal_connect (G_OBJECT (GTK_SPIN_BUTTON (widget)->adjustment),
		    "value_changed",
		    GTK_SIGNAL_FUNC
		    (on_averaging_spin_adjustment_changed), NULL);
  widget = glade_xml_get_widget (appdata.xml, "refresh_spin");
  g_signal_connect (G_OBJECT (GTK_SPIN_BUTTON (widget)->adjustment),
		    "value_changed",
		    GTK_SIGNAL_FUNC
		    (on_refresh_spin_adjustment_changed),
		    glade_xml_get_widget (appdata.xml, "canvas1"));
  widget = glade_xml_get_widget (appdata.xml, "node_to_spin");
  g_signal_connect (G_OBJECT (GTK_SPIN_BUTTON (widget)->adjustment),
		    "value_changed",
		    GTK_SIGNAL_FUNC
		    (on_node_to_spin_adjustment_changed), NULL);
  widget = glade_xml_get_widget (appdata.xml, "gui_node_to_spin");
  g_signal_connect (G_OBJECT (GTK_SPIN_BUTTON (widget)->adjustment),
		    "value_changed",
		    GTK_SIGNAL_FUNC
		    (on_gui_node_to_spin_adjustment_changed), NULL);
  widget = glade_xml_get_widget (appdata.xml, "proto_node_to_spin");
  g_signal_connect (G_OBJECT (GTK_SPIN_BUTTON (widget)->adjustment),
		    "value_changed",
		    GTK_SIGNAL_FUNC
		    (on_proto_node_to_spin_adjustment_changed), NULL);
  widget = glade_xml_get_widget (appdata.xml, "link_to_spin");
  g_signal_connect (G_OBJECT (GTK_SPIN_BUTTON (widget)->adjustment),
		    "value_changed",
		    GTK_SIGNAL_FUNC
		    (on_link_to_spin_adjustment_changed), NULL);
  widget = glade_xml_get_widget (appdata.xml, "gui_link_to_spin");
  g_signal_connect (G_OBJECT (GTK_SPIN_BUTTON (widget)->adjustment),
		    "value_changed",
		    GTK_SIGNAL_FUNC
		    (on_gui_link_to_spin_adjustment_changed), NULL);
  widget = glade_xml_get_widget (appdata.xml, "proto_link_to_spin");
  g_signal_connect (G_OBJECT (GTK_SPIN_BUTTON (widget)->adjustment),
		    "value_changed",
		    GTK_SIGNAL_FUNC
		    (on_proto_link_to_spin_adjustment_changed), NULL);
  widget = glade_xml_get_widget (appdata.xml, "proto_to_spin");
  g_signal_connect (G_OBJECT (GTK_SPIN_BUTTON (widget)->adjustment),
		    "value_changed",
		    GTK_SIGNAL_FUNC
		    (on_proto_to_spin_adjustment_changed), NULL);
  widget = glade_xml_get_widget (appdata.xml, "stack_level");
  g_signal_connect (G_OBJECT (widget), 
                    "changed",
		    GTK_SIGNAL_FUNC (on_stack_level_changed), NULL);
  widget = glade_xml_get_widget (appdata.xml, "size_variable");
  g_signal_connect (G_OBJECT (widget), 
                    "changed",
		    GTK_SIGNAL_FUNC (on_size_variable_changed), NULL);
  widget = glade_xml_get_widget (appdata.xml, "size_mode");
  g_signal_connect (G_OBJECT (widget), 
                    "changed",
		    GTK_SIGNAL_FUNC (on_size_mode_changed), NULL);
  widget = glade_xml_get_widget (appdata.xml, "text_font");
  g_signal_connect (G_OBJECT (widget), 
                    "font_set",
		    GTK_SIGNAL_FUNC (on_text_font_changed), NULL);
  widget = glade_xml_get_widget (appdata.xml, "text_color");
  g_signal_connect (G_OBJECT (widget), 
                    "color_set",
		    GTK_SIGNAL_FUNC (on_text_color_changed), NULL);
}
Exemplo n.º 2
0
void
view_file (char *filename, int fd, unsigned int viewedit, unsigned int del_file,
           unsigned int start_pos, unsigned int dontupload,
           char *remote_filename, gftp_window_data * wdata)
{
  GtkWidget * dialog, * view, * table, * tempwid;
  char buf[8192], *view_program, *edit_program;
  gftp_config_list_vars * tmplistvar;
  gftp_file_extensions * tempext;
  gftp_viewedit_data * newproc;
  GtkAdjustment * vadj;
  GList * templist;
  size_t stlen;
  int doclose;
  ssize_t n;
  char * non_utf8;
#if GTK_MAJOR_VERSION > 1
  GtkTextBuffer * textbuf;
  GtkTextIter iter;
#endif

  doclose = 1;
  stlen = strlen (filename);
  gftp_lookup_global_option ("ext", &tmplistvar);
  for (templist = tmplistvar->list; templist != NULL; templist = templist->next)
    {
      tempext = templist->data;
      if (stlen >= tempext->stlen &&
          strcmp (&filename[stlen - tempext->stlen], tempext->ext) == 0)
        {
          if (*tempext->view_program == '\0')
            break;
          ftp_log (gftp_logging_misc, NULL, _("Opening %s with %s\n"),
                   filename, tempext->view_program);
          fork_process (tempext->view_program, filename, fd, remote_filename,
                        viewedit, del_file, dontupload, wdata);
          return;
        }
    }

  if (wdata != NULL)
    {
      gftp_lookup_request_option (wdata->request, "view_program", &view_program);
      gftp_lookup_request_option (wdata->request, "edit_program", &edit_program);
      if ((non_utf8 = gftp_filename_from_utf8 (wdata->request, filename, NULL)) == NULL) /* freeme later! */
        non_utf8 = filename;
    }
  else
    {
      gftp_lookup_global_option ("view_program", &view_program);
      gftp_lookup_global_option ("edit_program", &edit_program);
      non_utf8 = filename;
    }

  if (viewedit && *view_program != '\0')
    {
      /* Open the file with the default file viewer */
      fork_process (view_program, filename, fd, remote_filename, viewedit,
                    del_file, dontupload, wdata);
      if (non_utf8 != filename && non_utf8)
        g_free (non_utf8);
      return;
    }
  else if (!viewedit && *edit_program != '\0')
    {
      /* Open the file with the default file editor */
      newproc = fork_process (edit_program, filename, fd, remote_filename, 
                              viewedit, del_file, dontupload, wdata);
      stat (non_utf8, &newproc->st);
      if (non_utf8 != filename && non_utf8)
        g_free (non_utf8);
      return;
    }

  ftp_log (gftp_logging_misc, NULL, _("Viewing file %s\n"), filename);

  if (fd == 0)
    {
      if ((fd = open (non_utf8, O_RDONLY)) < 0)
        {
          ftp_log (gftp_logging_error, NULL, 
                   _("View: Cannot open file %s: %s\n"), non_utf8, 
                   g_strerror (errno));
          if (non_utf8 != filename && non_utf8)
            g_free (non_utf8);
          return;
        }
      doclose = 1;
    }
  else
    {
      lseek (fd, 0, SEEK_SET);
      doclose = 0;
    }

  if (del_file)
    {
      if (unlink (non_utf8) == 0)
        ftp_log (gftp_logging_misc, NULL, _("Successfully removed %s\n"), 
                 filename);
      else
        ftp_log (gftp_logging_error, NULL,
                 _("Error: Could not remove file %s: %s\n"), filename, 
                 g_strerror (errno));
    }

  if (non_utf8 != filename && non_utf8)
    g_free (non_utf8);

#if GTK_MAJOR_VERSION == 1
  dialog = gtk_dialog_new ();
  gtk_window_set_title (GTK_WINDOW (dialog), filename);
  gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area),
                              5);
  gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (dialog)->action_area), TRUE);
#else
  dialog = gtk_dialog_new_with_buttons (filename, NULL, 0,
                                        GTK_STOCK_CLOSE,
                                        GTK_RESPONSE_CLOSE,
                                        NULL);
#endif
  gtk_window_set_wmclass (GTK_WINDOW(dialog), "fileview", "gFTP");
  gtk_container_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 5);
  gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 5);
  gtk_widget_realize (dialog);

  if (gftp_icon != NULL)
    {
      gdk_window_set_icon (dialog->window, NULL, gftp_icon->pixmap,
                           gftp_icon->bitmap);
      gdk_window_set_icon_name (dialog->window, gftp_version);
    }

  table = gtk_table_new (1, 2, FALSE);
  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), table, TRUE, TRUE, 0);

#if GTK_MAJOR_VERSION == 1
  view = gtk_text_new (NULL, NULL);
  gtk_text_set_editable (GTK_TEXT (view), FALSE);
  gtk_text_set_word_wrap (GTK_TEXT (view), TRUE);

  gtk_table_attach (GTK_TABLE (table), view, 0, 1, 0, 1,
		    GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND | GTK_SHRINK,
		    0, 0);
  gtk_widget_show (view);

  tempwid = gtk_vscrollbar_new (GTK_TEXT (view)->vadj);
  gtk_table_attach (GTK_TABLE (table), tempwid, 1, 2, 0, 1,
		    GTK_FILL, GTK_EXPAND | GTK_FILL | GTK_SHRINK, 0, 0);
  gtk_widget_show (tempwid);

  vadj = GTK_TEXT (view)->vadj;
#else
  view = gtk_text_view_new ();
  gtk_text_view_set_editable (GTK_TEXT_VIEW (view), FALSE);
  gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (view), FALSE);
  gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (view), GTK_WRAP_WORD);

  tempwid = gtk_scrolled_window_new (NULL, NULL);
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (tempwid),
                                 GTK_POLICY_AUTOMATIC,
                                 GTK_POLICY_AUTOMATIC);

  gtk_container_add (GTK_CONTAINER (tempwid), view);
  gtk_widget_show (view);

  gtk_table_attach (GTK_TABLE (table), tempwid, 0, 1, 0, 1,
		    GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND | GTK_SHRINK,
		    0, 0);
  gtk_widget_show (tempwid);

  vadj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (tempwid));
#endif
  gtk_widget_set_size_request (table, 500, 400);
  gtk_widget_show (table);

#if GTK_MAJOR_VERSION == 1
  tempwid = gtk_button_new_with_label (_("  Close  "));
  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), tempwid,
		      FALSE, FALSE, 0);
  gtk_signal_connect_object (GTK_OBJECT (tempwid), "clicked",
			     GTK_SIGNAL_FUNC (gtk_widget_destroy),
			     GTK_OBJECT (dialog));
  gtk_widget_show (tempwid);
#else
  g_signal_connect_swapped (GTK_OBJECT (dialog), "response",
                            G_CALLBACK (gtk_widget_destroy),
                            GTK_OBJECT (dialog));
#endif

  buf[sizeof (buf) - 1] = '\0';
  while ((n = read (fd, buf, sizeof (buf) - 1)) > 0)
    {
      buf[n] = '\0';
#if GTK_MAJOR_VERSION == 1
      gtk_text_insert (GTK_TEXT (view), NULL, NULL, NULL, buf, -1);
#else
      textbuf = gtk_text_view_get_buffer (GTK_TEXT_VIEW (view));
      gtk_text_buffer_get_iter_at_offset (textbuf, &iter, -1);
      gtk_text_buffer_insert (textbuf, &iter, buf, -1);
#endif
    }

  if (doclose)
    close (fd);

  gtk_widget_show (dialog);

  if (!start_pos)
    gtk_adjustment_set_value (vadj, vadj->upper);
}
Exemplo n.º 3
0
static void
gv_tool_real_activate(GvTool *tool, GvViewArea *view)
{
    GvToolClass *klass;
    
    if (tool->view)
    {
	g_warning("gv_tool_activate(): tool %s is already active on a view",
		  gtk_type_name(GTK_OBJECT_TYPE(tool)));
	return;
    }

    tool->view = view;
    gtk_object_ref(GTK_OBJECT(view));
    klass = (GvToolClass*)gtk_type_class(GTK_OBJECT_TYPE(tool));

    /* This could be done through an indirect function call which
       emits a tool signal.  Probably better but more overhead... */

    if (klass->draw)
    {
	gtk_signal_connect_object(GTK_OBJECT(view), "gldraw",
				  GTK_SIGNAL_FUNC(klass->draw),
				  GTK_OBJECT(tool));	
    }
    if (klass->button_press)
    {
	gtk_signal_connect_object(GTK_OBJECT(view), "button-press-event",
				  GTK_SIGNAL_FUNC(klass->button_press),
				  GTK_OBJECT(tool));
    }
    if (klass->button_release)
    {
	gtk_signal_connect_object(GTK_OBJECT(view), "button-release-event",
				  GTK_SIGNAL_FUNC(klass->button_release),
				  GTK_OBJECT(tool));
    }
    if (klass->motion_notify)
    {
	gtk_signal_connect_object(GTK_OBJECT(view), "motion-notify-event",
				  GTK_SIGNAL_FUNC(klass->motion_notify),
				  GTK_OBJECT(tool));
    }
    if (klass->key_press)
    {
	gtk_signal_connect_object(GTK_OBJECT(view), "key-press-event",
				  GTK_SIGNAL_FUNC(klass->key_press),
				  GTK_OBJECT(tool));
    }
    if (klass->enter_notify)
    {
	gtk_signal_connect_object(GTK_OBJECT(view), "enter-notify-event",
				  GTK_SIGNAL_FUNC(klass->enter_notify),
				  GTK_OBJECT(tool));
    }
    if (klass->leave_notify)
    {
	gtk_signal_connect_object(GTK_OBJECT(view), "leave-notify-event",
				  GTK_SIGNAL_FUNC(klass->leave_notify),
				  GTK_OBJECT(tool));
    }

    /* Install cursor for this tool */
    if (GTK_WIDGET_REALIZED(GTK_WIDGET(view)))
    {
	gdk_window_set_cursor(GTK_WIDGET(view)->window, tool->cursor);
    }
}
Exemplo n.º 4
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( fs_Destroy ), NULL );
 gtk_signal_connect( GTK_OBJECT( fsFileSelect ),"key_release_event",GTK_SIGNAL_FUNC( on_FileSelect_key_release_event ),NULL );

 gtk_signal_connect( GTK_OBJECT( fsFilterCombo ),"changed",GTK_SIGNAL_FUNC( fs_fsFilterCombo_changed ),fsFilterCombo );
 gtk_signal_connect( GTK_OBJECT( fsFilterCombo ),"activate",GTK_SIGNAL_FUNC( fs_fsFilterCombo_activate ),fsFilterCombo );
 gtk_signal_connect( GTK_OBJECT( fsPathCombo ),"changed",GTK_SIGNAL_FUNC( fs_fsPathCombo_changed ),fsPathCombo );
 gtk_signal_connect( GTK_OBJECT( fsPathCombo ),"activate",GTK_SIGNAL_FUNC( fs_fsPathCombo_activate ),fsPathCombo );
 gtk_signal_connect( GTK_OBJECT( fsUp ),"released",GTK_SIGNAL_FUNC( fs_Up_released ),fsFNameList );
 gtk_signal_connect( GTK_OBJECT( 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_signal_connect( GTK_OBJECT( fsFNameList ),"event", (GtkSignalFunc)fs_fsFNameList_event,NULL );

 gtk_widget_grab_focus( fsFNameList );

 return fsFileSelect;
}
Exemplo n.º 5
0
int main(int argc, char *argv[]){

 GtkWidget *window1;
 GtkWidget *vbox1;
 GtkWidget *scrollw1;
 GtkWidget *active_plot;
 GtkWidget *canvas;
 gint page_width, page_height;
 gfloat scale = 1.;
 GtkPlotDTnode p;
 GtkPlotDT *dtdata;
 char buffer[1000];
 FILE *f;
 gdouble xmin=1e99;
 gdouble xmax=-1e99;
 gdouble ymin=1e99;
 gdouble ymax=-1e99;
 gdouble dx,dy;
 gint num_triangles = 0;
 
 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);

 if (argc!=2) {
   fprintf(stderr,"\nUsage:\n\ttestgtkplotdt X-Y-FILE\n");
   exit(-1);
 }
 if (!(f=fopen(argv[1],"r"))) {
   fprintf(stderr,"\ncould not open file '%s' for reading\n",argv[1]);
   exit(-2);
 }
 
 /* init with nodelist size 0 */
 dtdata= GTK_PLOT_DT(gtk_plot_dt_new(0));
 if (!dtdata) exit(-1);
 /* register the progressmeter */
 dtdata->pbar= simpleprogressbar;
 
 /* read X/Y pairs from f: */
 while (fgets(buffer,1000,f)) {
   if (sscanf(buffer,"%lf %lf", &p.x, &p.y)==2) {
     /* add this node */
     gtk_plot_dt_add_node(dtdata,p);
     if (xmin>p.x) xmin= p.x;
     if (xmax<p.x) xmax= p.x;
     if (ymin>p.y) ymin= p.y;
     if (ymax<p.y) ymax= p.y;
   }
 }
 dx= (xmax-xmin)*.02;
 dy= (ymax-ymin)*.02;
 fclose(f);
 /* start the triangulation */
 fprintf(stderr,"data ranges from (%g,%g) to (%g,%g)\n",
	 xmin,ymin,xmax,ymax);
 num_triangles= gtk_plot_dt_triangulate(dtdata);

 active_plot = new_layer(canvas);
 gtk_plot_set_range(GTK_PLOT(active_plot), xmin-dx, xmax+dx, ymin-dy, ymax+dy);
 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(active_plot), GTK_PLOT_AXIS_TOP);
 gtk_plot_axis_show_ticks(GTK_PLOT(active_plot), 3, 15, 3);
 gtk_plot_axis_set_ticks(GTK_PLOT(active_plot), 0, (xmax-xmin)/10., 1);
 gtk_plot_axis_set_ticks(GTK_PLOT(active_plot), 1, (ymax-ymin)/10., 1);
 gtk_plot_axis_set_visible(GTK_PLOT(active_plot), GTK_PLOT_AXIS_TOP, TRUE);
 gtk_plot_axis_set_visible(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_canvas_add_plot(GTK_PLOT_CANVAS(canvas), GTK_PLOT(active_plot), .15, .06);
 gtk_widget_show(active_plot);

 build_example1(active_plot,dtdata, num_triangles);

 gtk_widget_show(window1);

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

 return(0);
}
Exemplo n.º 6
0
/*
 * mainline..
 */
void searchbox(char *title, GtkSignalFunc func)
{
    int i;
    GtkWidget *menu, *menuitem, *optionmenu;
    GSList *group;
    GtkWidget *small_hbox;

    GtkWidget *scrolled_win;
    GtkWidget *vbox1, *hbox, *hbox0;
    GtkWidget *button1, *button2, *button3, *button3a, *button4, *button5, *button6, *button7;
    GtkWidget *label;
    gchar *titles[]={"Matches"};
    GtkWidget *frame1, *frame2, *frameh, *frameh0;
    GtkWidget *table;
    GtkTooltips *tooltips;
    GtkAdjustment *adj;
    GtkWidget *align;

    if(is_active) 
	{
	gdk_window_raise(window->window);
	return;
	}

    is_active=1;
    cleanup=func;
    num_rows=selected_rows=0;

    /* create a new modal window */
    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_window_set_title(GTK_WINDOW (window), title);
    gtk_signal_connect(GTK_OBJECT (window), "delete_event",
                       (GtkSignalFunc) destroy_callback, NULL);

    tooltips=gtk_tooltips_new_2();

    table = gtk_table_new (256, 1, FALSE);
    gtk_widget_show (table);

    vbox1 = gtk_vbox_new (FALSE, 0);
    gtk_container_border_width (GTK_CONTAINER (vbox1), 3);
    gtk_widget_show (vbox1);
    frame1 = gtk_frame_new (NULL);
    gtk_container_border_width (GTK_CONTAINER (frame1), 3);
    gtk_widget_show(frame1);
    gtk_table_attach (GTK_TABLE (table), frame1, 0, 1, 0, 1,
                        GTK_FILL | GTK_EXPAND,
                        GTK_FILL | GTK_EXPAND | GTK_SHRINK, 1, 1);

    label=gtk_label_new("Signal Search Expression");
    gtk_widget_show(label);

    gtk_box_pack_start (GTK_BOX (vbox1), label, TRUE, TRUE, 0);

    entry = gtk_entry_new_with_max_length (256);
    gtk_signal_connect(GTK_OBJECT(entry), "activate",
		       GTK_SIGNAL_FUNC(enter_callback),
		       entry);
    gtk_entry_set_text (GTK_ENTRY (entry), searchbox_text);
    gtk_entry_select_region (GTK_ENTRY (entry),
			     0, GTK_ENTRY(entry)->text_length);
    gtk_widget_show (entry);
    gtk_tooltips_set_tip_2(tooltips, entry, 
		"Enter search expression here.  POSIX Wildcards are allowed.  Note that you may also "
		"modify the search criteria by selecting ``[W]Range'', ``[W]Strand'', or ``None'' for suffix "
		"matching.",NULL);

    gtk_box_pack_start (GTK_BOX (vbox1), entry, TRUE, TRUE, 0);

    /* Allocate memory for the data that is used later */
    pdata = calloc_2(1, sizeof(SearchProgressData) );
    pdata->value = pdata->oldvalue = 0.0;
    /* Create a centering alignment object */  
    align = gtk_alignment_new (0.5, 0.5, 0, 0);
    gtk_widget_show(align);
    /* Create a Adjustment object to hold the range of the
     * progress bar */
    adj = (GtkAdjustment *) gtk_adjustment_new (0.0, 0.0, (gfloat)((numfacs>1)?numfacs-1:1), 0, 0, 0);
    pdata->adj = adj;
    /* Create the GtkProgressBar using the adjustment */
    pdata->pbar = gtk_progress_bar_new_with_adjustment (adj);
    /* Set the format of the string that can be displayed in the
     * trough of the progress bar:
     * %p - percentage
     * %v - value
     * %l - lower range value
     * %u - upper range value */
    gtk_progress_set_format_string (GTK_PROGRESS (pdata->pbar), "(%p%%)");
    gtk_progress_set_show_text (GTK_PROGRESS (pdata->pbar), TRUE);
    gtk_widget_show(pdata->pbar);
    gtk_box_pack_start (GTK_BOX (vbox1), pdata->pbar, TRUE, TRUE, 0);

    gtk_container_add (GTK_CONTAINER (frame1), vbox1);


    frame2 = gtk_frame_new (NULL);
    gtk_container_border_width (GTK_CONTAINER (frame2), 3);
    gtk_widget_show(frame2);

    gtk_table_attach (GTK_TABLE (table), frame2, 0, 1, 1, 254,
                        GTK_FILL | GTK_EXPAND,
                        GTK_FILL | GTK_EXPAND | GTK_SHRINK, 1, 1);

    clist=gtk_clist_new_with_titles(1,titles);
    gtk_clist_column_titles_passive(GTK_CLIST(clist)); 

    gtk_clist_set_selection_mode(GTK_CLIST(clist), GTK_SELECTION_EXTENDED);
    gtk_signal_connect_object (GTK_OBJECT (clist), "select_row",
			       GTK_SIGNAL_FUNC(select_row_callback),
			       NULL);
    gtk_signal_connect_object (GTK_OBJECT (clist), "unselect_row",
			       GTK_SIGNAL_FUNC(unselect_row_callback),
			       NULL);
    gtk_widget_show (clist);

    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_widget_set_usize( GTK_WIDGET (scrolled_win), -1, 300);
    gtk_widget_show(scrolled_win);

    /* gtk_scrolled_window_add_with_viewport doesn't seen to work right here.. */
    gtk_container_add (GTK_CONTAINER (scrolled_win), clist);

    gtk_container_add (GTK_CONTAINER (frame2), scrolled_win);


    frameh0 = gtk_frame_new (NULL);
    gtk_container_border_width (GTK_CONTAINER (frameh0), 3);
    gtk_widget_show(frameh0);
    gtk_table_attach (GTK_TABLE (table), frameh0, 0, 1, 254, 255,
                        GTK_FILL | GTK_EXPAND,
                        GTK_FILL | GTK_EXPAND | GTK_SHRINK, 1, 1);


    hbox0 = gtk_hbox_new (FALSE, 1);
    gtk_widget_show (hbox0);

    button6 = gtk_button_new_with_label (" Select All ");
    gtk_container_border_width (GTK_CONTAINER (button6), 3);
    gtk_signal_connect_object (GTK_OBJECT (button6), "clicked",
			       GTK_SIGNAL_FUNC(select_all_callback),
			       GTK_OBJECT (window));
    gtk_widget_show (button6);
    gtk_tooltips_set_tip_2(tooltips, button6, 
		"Highlight all signals listed in the match window.",NULL);

    gtk_box_pack_start (GTK_BOX (hbox0), button6, TRUE, FALSE, 0);



    menu = gtk_menu_new ();
    group=NULL;

    small_hbox = gtk_hbox_new (TRUE, 0);
    gtk_widget_show (small_hbox);
    
    for(i=0;i<5;i++)
        {
        menuitem = gtk_radio_menu_item_new_with_label (group, regex_name[i]);
        group = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (menuitem));
        gtk_menu_append (GTK_MENU (menu), menuitem);
        gtk_widget_show (menuitem);
        gtk_signal_connect(GTK_OBJECT (menuitem), "activate",
                                 GTK_SIGNAL_FUNC(regex_clicked),
                                 &regex_mutex[i]);
        regex_mutex[i]=0;
        }
    
        regex_mutex[0]=1;     /* "range" */
    
        optionmenu = gtk_option_menu_new ();
        gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu), menu);
        gtk_box_pack_start (GTK_BOX (small_hbox), optionmenu, TRUE, FALSE, 0);
        gtk_widget_show (optionmenu);   
	gtk_tooltips_set_tip_2(tooltips, optionmenu,
		"You may "
		"modify the search criteria by selecting ``Range'', ``Strand'', or ``None'' for suffix "
		"matching.  This optionally matches the string you enter in the search string above with a Verilog "
		"format range (signal[7:0]), a strand (signal.1, signal.0), or with no suffix.  "
		"The ``W'' modifier for ``Range'' and ``Strand'' explicitly matches on word boundaries.  "
		"(addr matches unit.freezeaddr[63:0] for ``Range'' but only unit.addr[63:0] for ``WRange'' since addr has to be on a word boundary.  "
		"Note that when ``None'' "
		"is selected, the search string may be located anywhere in the signal name.",NULL);
    
        gtk_box_pack_start (GTK_BOX (hbox0), small_hbox, FALSE, FALSE, 0);


    button7 = gtk_button_new_with_label (" Unselect All ");
    gtk_container_border_width (GTK_CONTAINER (button7), 3);
    gtk_signal_connect_object (GTK_OBJECT (button7), "clicked",
			       GTK_SIGNAL_FUNC(unselect_all_callback),
			       GTK_OBJECT (window));
    gtk_widget_show (button7);
    gtk_tooltips_set_tip_2(tooltips, button7, 
		"Unhighlight all signals listed in the match window.",NULL);
    gtk_box_pack_start (GTK_BOX (hbox0), button7, TRUE, FALSE, 0);

    gtk_container_add (GTK_CONTAINER (frameh0), hbox0);


    frameh = gtk_frame_new (NULL);
    gtk_container_border_width (GTK_CONTAINER (frameh), 3);
    gtk_widget_show(frameh);
    gtk_table_attach (GTK_TABLE (table), frameh, 0, 1, 255, 256,
                        GTK_FILL | GTK_EXPAND,
                        GTK_FILL | GTK_EXPAND | GTK_SHRINK, 1, 1);


    hbox = gtk_hbox_new (FALSE, 1);
    gtk_widget_show (hbox);

    button1 = gtk_button_new_with_label ("Append");
    gtk_container_border_width (GTK_CONTAINER (button1), 3);
    gtk_signal_connect_object (GTK_OBJECT (button1), "clicked",
			       GTK_SIGNAL_FUNC(ok_callback),
			       GTK_OBJECT (window));
    gtk_widget_show (button1);
    gtk_tooltips_set_tip_2(tooltips, button1, 
		"Add selected signals to end of the display on the main window.",NULL);

    gtk_box_pack_start (GTK_BOX (hbox), button1, TRUE, FALSE, 0);

    button2 = gtk_button_new_with_label (" Insert ");
    gtk_container_border_width (GTK_CONTAINER (button2), 3);
    gtk_signal_connect_object (GTK_OBJECT (button2), "clicked",
			       GTK_SIGNAL_FUNC(insert_callback),
			       GTK_OBJECT (window));
    gtk_widget_show (button2);
    gtk_tooltips_set_tip_2(tooltips, button2, 
		"Add selected signals after last highlighted signal on the main window.",NULL);
    gtk_box_pack_start (GTK_BOX (hbox), button2, TRUE, FALSE, 0);

    if(vcd_explicit_zero_subscripts>=0)
	{
	button3 = gtk_button_new_with_label (" Bundle Up ");
    	gtk_container_border_width (GTK_CONTAINER (button3), 3);
    	gtk_signal_connect_object (GTK_OBJECT (button3), "clicked",
			       GTK_SIGNAL_FUNC(bundle_callback_up),
			       GTK_OBJECT (window));
    	gtk_widget_show (button3);
    	gtk_tooltips_set_tip_2(tooltips, button3, 
		"Bundle selected signals into a single bit vector with the topmost selected signal as the LSB and the lowest as the MSB.",NULL);
    	gtk_box_pack_start (GTK_BOX (hbox), button3, TRUE, FALSE, 0);

    	button3a = gtk_button_new_with_label (" Bundle Down ");
    	gtk_container_border_width (GTK_CONTAINER (button3a), 3);
    	gtk_signal_connect_object (GTK_OBJECT (button3a), "clicked",
			       GTK_SIGNAL_FUNC(bundle_callback_down),
			       GTK_OBJECT (window));
    	gtk_widget_show (button3a);
    	gtk_tooltips_set_tip_2(tooltips, button3a, 
		"Bundle selected signals into a single bit vector with the topmost selected signal as the MSB and the lowest as the LSB.",NULL);
	gtk_box_pack_start (GTK_BOX (hbox), button3a, TRUE, FALSE, 0);
	}

    button4 = gtk_button_new_with_label (" Replace ");
    gtk_container_border_width (GTK_CONTAINER (button4), 3);
    gtk_signal_connect_object (GTK_OBJECT (button4), "clicked",
			       GTK_SIGNAL_FUNC(replace_callback),
			       GTK_OBJECT (window));
    gtk_widget_show (button4);
    gtk_tooltips_set_tip_2(tooltips, button4, 
		"Replace highlighted signals on the main window with signals selected above.",NULL);
    gtk_box_pack_start (GTK_BOX (hbox), button4, TRUE, FALSE, 0);

    button5 = gtk_button_new_with_label (" Exit ");
    gtk_container_border_width (GTK_CONTAINER (button5), 3);
    gtk_signal_connect_object (GTK_OBJECT (button5), "clicked",
			       GTK_SIGNAL_FUNC(destroy_callback),
			       GTK_OBJECT (window));
    gtk_tooltips_set_tip_2(tooltips, button5, 
		"Do nothing and return to the main window.",NULL);
    gtk_widget_show (button5);
    gtk_box_pack_start (GTK_BOX (hbox), button5, TRUE, FALSE, 0);

    gtk_container_add (GTK_CONTAINER (frameh), hbox);
    gtk_container_add (GTK_CONTAINER (window), table);

    gtk_widget_show(window);

    if(strlen(searchbox_text)) enter_callback(entry,NULL);
}
Exemplo n.º 7
0
//
//      Video is in YV12 Colorspace
//
//
uint8_t DIA_getASharp(ASHARP_PARAM *param, AVDMGenericVideoStream *in)
{
        int ret;
        uint32_t l,f;
        uint32_t max=in->getInfo()->nb_frames;
        
        incoming=in;
        // Allocate space for green-ised video
        w=in->getInfo()->width;
        h=in->getInfo()->height;

        rgbbuffer=new uint32_t[w*h];

        imgdst=new ADMImage(w,h);
        imgsrc=new ADMImage(w,h);
        imgdisplay=new ADMImage(w,h);

        if(curframe<max) max=curframe;
        
        ADM_assert(in->getFrameNumberNoAlloc(max, &l, imgsrc,&f));
        // chroma is not changed by this filter
        
        memcpy(UPLANE(imgdisplay),UPLANE(imgsrc),(w*h)>>2);
        memcpy(VPLANE(imgdisplay),VPLANE(imgsrc),(w*h)>>2);
        memcpy(&myHue,param,sizeof(myHue));
        dialog=create_dialog1();
        gtk_register_dialog(dialog);

        gtk_widget_set_usize(WID(drawingarea1), w,h);

        upload();
        gtk_signal_connect(GTK_OBJECT(WID(drawingarea1)), "expose_event",
            GTK_SIGNAL_FUNC(draw),
            NULL);
//
        gtk_signal_connect(GTK_OBJECT(WID(hscale1)), "value_changed",GTK_SIGNAL_FUNC(frame_changed),   NULL);
        gtk_signal_connect(GTK_OBJECT(WID(spinbuttonT)), "value_changed",GTK_SIGNAL_FUNC(hue_changed),   NULL);
        gtk_signal_connect(GTK_OBJECT(WID(spinbuttonD)), "value_changed",GTK_SIGNAL_FUNC(hue_changed),   NULL);
        gtk_signal_connect(GTK_OBJECT(WID(spinbuttonB)), "value_changed",GTK_SIGNAL_FUNC(hue_changed),   NULL);
     //   gtk_signal_connect(GTK_OBJECT(WID(checkbuttonBF)), "value_changed",GTK_SIGNAL_FUNC(hue_changed),   NULL);
        gtk_widget_show(dialog);

        update();
        draw();
        ret=0;
        int response;
        response=gtk_dialog_run(GTK_DIALOG(dialog));

        if(response==GTK_RESPONSE_OK)
        {
            memcpy(param,&myHue,sizeof(myHue));
            ret=1;
        }
        gtk_unregister_dialog(dialog);
        gtk_widget_destroy(dialog);
    
        delete imgdst;
        delete imgsrc;
        delete imgdisplay;
        delete [] rgbbuffer;
        

        rgbbuffer=NULL;
        imgdst=NULL;
        imgsrc=NULL;
        dialog=NULL;
        imgdisplay=NULL;
        return ret;
}
Exemplo n.º 8
0
void
do_menu (GtkWidget * vbox)
{
    GtkWidget *menu_bar, *menu, *smenu;
    GtkWidget *mi;
    GtkWidget *handlebox;

    menu_bar = gtk_menu_bar_new ();

    menu = gtk_menu_item_new_with_label (_("File"));
    gtk_widget_show (menu);
    smenu = gtk_menu_new ();
    gtk_widget_show (smenu);
    gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu), smenu);

    mi = gtk_menu_item_new_with_label (_("C-Wizard"));
    gtk_signal_connect (GTK_OBJECT (mi), "activate", GTK_SIGNAL_FUNC (clist),
	NULL);
    gtk_widget_show (mi);
    gtk_menu_append (GTK_MENU (smenu), mi);


    mi = gtk_menu_item_new_with_label (_("Connect"));
    gtk_signal_connect (GTK_OBJECT (mi), "activate", GTK_SIGNAL_FUNC (cbox),
	NULL);
    gtk_widget_show (mi);
    gtk_menu_append (GTK_MENU (smenu), mi);

    mi = gtk_menu_item_new_with_label (_("Disconnect"));
    gtk_signal_connect (GTK_OBJECT (mi), "activate",
	GTK_SIGNAL_FUNC (disconnect), NULL);
    gtk_widget_show (mi);
    gtk_menu_append (GTK_MENU (smenu), mi);

    mi = gtk_menu_item_new ();
    gtk_widget_show (mi);
    gtk_menu_append (GTK_MENU (smenu), mi);

    /*
    mi = gtk_menu_item_new_with_label (_("Preferences..."));
    gtk_signal_connect (GTK_OBJECT (mi), "activate",
	GTK_SIGNAL_FUNC (show_config), NULL);
    gtk_widget_show (mi);
    gtk_menu_append (GTK_MENU (smenu), mi);
    */

    mi = gtk_menu_item_new ();
    gtk_widget_show (mi);
    gtk_menu_append (GTK_MENU (smenu), mi);

    mi = gtk_menu_item_new_with_label (_("Exit"));
    gtk_signal_connect (GTK_OBJECT (mi), "activate",
	GTK_SIGNAL_FUNC (bmud_exit), NULL);
    gtk_widget_show (mi);
    gtk_menu_append (GTK_MENU (smenu), mi);
    gtk_menu_bar_append (GTK_MENU_BAR (menu_bar), menu);

    menu = gtk_menu_item_new_with_label (_("Tools"));
    gtk_widget_show (menu);
    smenu = gtk_menu_new ();
    gtk_widget_show (smenu);
    gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu), smenu);
    mi = gtk_menu_item_new_with_label (_("Equip"));
    gtk_signal_connect (GTK_OBJECT (mi), "activate", GTK_SIGNAL_FUNC (NULL),
	NULL);
    gtk_widget_set_sensitive (GTK_WIDGET (mi), FALSE);

    gtk_widget_show (mi);
    gtk_menu_append (GTK_MENU (smenu), mi);
    mi = gtk_menu_item_new_with_label (_("Map"));
    gtk_signal_connect (GTK_OBJECT (mi), "activate", GTK_SIGNAL_FUNC (NULL),
	NULL);
    gtk_widget_set_sensitive (GTK_WIDGET (mi), FALSE);

    gtk_widget_show (mi);
    gtk_menu_append (GTK_MENU (smenu), mi);
    gtk_menu_bar_append (GTK_MENU_BAR (menu_bar), menu);

    menu = gtk_menu_item_new_with_label (_("Help"));
    gtk_widget_show (menu);
    gtk_menu_item_right_justify (GTK_MENU_ITEM (menu));
    smenu = gtk_menu_new ();
    gtk_widget_show (smenu);
    gtk_menu_item_set_submenu (GTK_MENU_ITEM (menu), smenu);
    mi = gtk_menu_item_new_with_label (_("About"));
    gtk_signal_connect (GTK_OBJECT (mi), "activate",
	GTK_SIGNAL_FUNC (do_about), NULL);
    gtk_widget_show (mi);
    gtk_menu_append (GTK_MENU (smenu), mi);
    mi = gtk_menu_item_new_with_label (_("Manual"));	/* I d'no about this one */

/*	gtk_signal_connect(GTK_OBJECT(mi),"activate",GTK_SIGNAL_FUNC(gtk_main_quit),NULL);	*/
    gtk_widget_show (mi);
    gtk_menu_append (GTK_MENU (smenu), mi);
    gtk_menu_bar_append (GTK_MENU_BAR (menu_bar), menu);

    gtk_widget_show (menu_bar);

    handlebox = gtk_handle_box_new ();
    gtk_widget_show (handlebox);
    gtk_container_add (GTK_CONTAINER (handlebox), menu_bar);
    gtk_box_pack_start (GTK_BOX (vbox), handlebox, FALSE, FALSE, 0);
    return;
}
Exemplo n.º 9
0
static void
detach_term(GtkWidget *widget, ZvtTerm *term)
{
	GtkWidget *term_window;
	GtkWidget *menu_bar;
	GtkWidget *vbox;
	GtkWidget *term_label;
	gchar *label_text;
	gint term_count;
	guint child_died_signal_id;
	guint title_change_signal;

	vbox = gtk_object_get_data(GTK_OBJECT(term), "vbox");
	term_count = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(vbox),
				"term_count"));
	child_died_signal_id = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(term),
				"child_died_signal_id"));
	gtk_signal_disconnect(GTK_OBJECT(term), child_died_signal_id);
	title_change_signal = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(term),
				"title_change_signal"));
	gtk_signal_disconnect(GTK_OBJECT(term), title_change_signal);
	term_label = gtk_object_get_data(GTK_OBJECT(term), "term_label");
	gtk_label_get(GTK_LABEL(term_label), &label_text);

	term_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_window_set_title(GTK_WINDOW(term_window), label_text);
	gtk_signal_connect(GTK_OBJECT(term_window), "delete-event",
			GTK_SIGNAL_FUNC(gtk_widget_destroy), term_window);
	gtk_widget_realize(term_window);


	menu_bar = gtk_object_get_data(GTK_OBJECT(term), "menubar");
	gtk_widget_destroy(menu_bar);

	/* Need to use ref and unref with reparent here - don't know why? */
	gtk_widget_ref(GTK_WIDGET(term));
	gtk_widget_reparent(GTK_WIDGET(term), term_window);
	gtk_widget_unref(GTK_WIDGET(term));

	gtk_signal_connect(GTK_OBJECT(term), "child_died",
			GTK_SIGNAL_FUNC(close_term_window), NULL);
	gtk_signal_connect(GTK_OBJECT(term), "title_changed",
			GTK_SIGNAL_FUNC(change_title), term_window);

	
	gtk_widget_grab_focus(GTK_WIDGET(term));

	gtk_widget_show(term_window);

	if(term_count > 1)
	{
		GList *child, *tmp;
		ZvtTerm *tmp_term;
		GtkWidget *ch;
		GtkWidget *page_label;
		GtkWidget *term_label;
		char *label_text;
		gchar buf[NAME_MAX];

		term_count--;
		gtk_object_set_data(GTK_OBJECT(vbox), "term_count",
				GUINT_TO_POINTER(term_count));
		child = GTK_BOX(vbox)->children;

		term_count = 0;
		for(tmp = child; tmp != NULL; tmp = tmp->next)
		{
			ch = ((GtkBoxChild*)(tmp->data))->widget;
			if(ZVT_IS_TERM(ch))
			{
				term_count++;
				gtk_object_set_data(GTK_OBJECT(ch), "term_number",
							GUINT_TO_POINTER(term_count));
			}
		}
		tmp_term = get_nth_zvt(GTK_NOTEBOOK(app.notebook),
				gtk_notebook_get_current_page(GTK_NOTEBOOK(app.notebook)));
		term_count = GPOINTER_TO_INT(gtk_object_get_data(GTK_OBJECT(tmp_term),
					"term_number"));
		gtk_object_set_data(GTK_OBJECT(vbox), "focus_term", 
				GUINT_TO_POINTER(term_count));
		cfg.current_term = tmp_term;
		term_label = gtk_object_get_data(GTK_OBJECT(tmp_term), "term_label");
	 	page_label = gtk_notebook_get_tab_label(GTK_NOTEBOOK(app.notebook),
		gtk_notebook_get_nth_page(GTK_NOTEBOOK(app.notebook), 
		gtk_notebook_get_current_page(GTK_NOTEBOOK(app.notebook))));
		gtk_label_get(GTK_LABEL(term_label), &label_text);
		g_snprintf(buf, sizeof(buf), "%d %s",
				gtk_notebook_get_current_page(GTK_NOTEBOOK(app.notebook)) +1,
			 label_text);
		gtk_label_set_text(GTK_LABEL(page_label), buf);


		gtk_widget_grab_focus(GTK_WIDGET(tmp_term));


	}
	else
	{
		gint page;
		gtk_widget_destroy(GTK_WIDGET(vbox));
		gtk_notebook_set_page(GTK_NOTEBOOK(app.notebook), -1);
		page = gtk_notebook_get_current_page(GTK_NOTEBOOK(app.notebook));
		if(page == 0)
		{
			cfg.term_count = 0;
			cfg.current_term = NULL;
		}
	}
}
Exemplo n.º 10
0
GtkWidget *
create_term_menu(ZvtTerm *term, gchar *command)
{
	GtkWidget *menu_bar;
	GtkWidget *menu;
	GtkWidget *menu_item;
	GtkWidget *vide_menu;
	GtkWidget *tools_menu;
	GtkWidget *term_label;
	GdkColor color = TAB_COLOR;
	GtkStyle *defstyle;
	GtkStyle *style = gtk_style_new();

	menu_bar = gtk_menu_bar_new();

	defstyle = gtk_widget_get_default_style();
	style = gtk_style_copy(defstyle);
	style->fg[0] = color;

	menu = gtk_menu_new();
	gtk_signal_connect(GTK_OBJECT(menu), "key_press_event",
			GTK_SIGNAL_FUNC(menu_key_cb), NULL);

	gtk_object_set_data(GTK_OBJECT(term), "menu_bar", menu_bar);

	
	/* The terminal is running vi */
	if(GPOINTER_TO_INT(gtk_object_get_user_data(GTK_OBJECT(term))))
	{
		add_menu_item(menu, "Open File in Buffer", create_fileselector,
				GUINT_TO_POINTER(0));
		if(strcmp(cfg.vi_clone, "vi"))
  		add_menu_item (menu, "Split Buffer & Open File", create_fileselector,
					GUINT_TO_POINTER(1));
		if(!strcmp(cfg.vi_clone, "vim"))
			add_menu_item (menu, "VSplit Buffer & Open File", create_fileselector,
					GUINT_TO_POINTER(2));
  	add_menu_separator (menu);
	}
	add_menu_item(menu, "Open File in New Term", 
			create_fileselector, GUINT_TO_POINTER(3));
  add_menu_separator (menu);
	add_menu_item(menu, "New Shell", split_zterm, NULL);
	add_menu_separator(menu);
	add_menu_item(menu, "List Pages", create_page_menu, NULL);
	add_menu_separator(menu);
	add_menu_item(menu, "Detach Term", detach_term, term);
	add_menu_separator(menu);
  add_menu_item (menu, "Cancel", NULL, NULL);
  vide_menu = add_submenu (menu_bar, "_Vide", menu);
	gtk_object_set_data(GTK_OBJECT(term), "vide_menu", vide_menu);

	menu = gtk_menu_new();
	gtk_signal_connect(GTK_OBJECT(menu), "key_press_event",
			GTK_SIGNAL_FUNC(menu_key_cb), NULL);
	add_menu_item(menu, "Look up word", lookup_word, term);
	add_menu_separator(menu);

	/* 
	add_menu_item(menu, "Compare file to..", compare_file, term);
	add_menu_separator(menu);
	*/

	/* I don't know how to visually select text in nvi and vile 
	if((!strcmp("vim", cfg.vi_clone) | (!strcmp("elvis", cfg.vi_clone))))
	{
		add_menu_item(menu, "Copy", copy_text, term);
		add_menu_separator(menu);
		add_menu_item(menu, "Paste", paste_text, term);
		add_menu_separator(menu);
	}
	*/
	add_menu_item(menu, "Cancel", NULL, NULL);
	tools_menu = add_submenu(menu_bar, "_Tools", menu);
	gtk_object_set_data(GTK_OBJECT(term), "tools_menu", tools_menu);

	/* label for filename on menubar */
	menu = gtk_menu_new();
	menu_item = gtk_menu_item_new();
	term_label = gtk_widget_new(GTK_TYPE_LABEL,
			"GtkWidget::visible", TRUE,
			"GtkWidget::parent", menu_item,
			"GtkMisc::xalign", 0, 0, NULL);
	gtk_label_set_text(GTK_LABEL(term_label), command);
	gtk_widget_set_style(GTK_WIDGET(term_label), style);
	gtk_menu_item_set_submenu(GTK_MENU_ITEM(menu_item), menu);
	gtk_menu_bar_append(GTK_MENU_BAR(menu_bar), menu_item);
	gtk_menu_item_right_justify(GTK_MENU_ITEM(menu_item));
	gtk_widget_show(menu_item);
	gtk_object_set_data(GTK_OBJECT(term), "term_label", term_label);


	return  menu_bar;


}
Exemplo n.º 11
0
/*
 * Creates a new GtkWidget of class GnomeDialog, performing any specialized
 * initialization needed for the widget to work correctly in this environment.
 * If a dialog box is used to initialize the widget, return NULL from this
 * function, and call data->callback with your new widget when it is done.
 * If the widget needs a special destroy handler, add a signal here.
 */
static GtkWidget*
gb_gnome_dialog_new (GbWidgetNewData *data)
{
  GtkWidget *new_widget, *placeholder;
  GList *elem;

  if (data->action == GB_CREATING)
    {
      /* When creating a new dialog, we add a few standard buttons, which
	 the user can change/delete easily. */
      new_widget = gnome_dialog_new (NULL,
				     GTK_STOCK_CANCEL,
				     GTK_STOCK_OK,
				     NULL);

      /* Now turn the buttons into GbWidgets so the user can edit them. */
      elem = GNOME_DIALOG (new_widget)->buttons;
      gb_widget_create_from (GTK_WIDGET (elem->data), "button");
      gtk_object_set_data (GTK_OBJECT (elem->data), GladeButtonStockIDKey,
			   GTK_STOCK_CANCEL);

      elem = elem->next;
      gb_widget_create_from (GTK_WIDGET (elem->data), "button");
      gtk_object_set_data (GTK_OBJECT (elem->data), GladeButtonStockIDKey,
			   GTK_STOCK_OK);

      /* We need to size the placeholders or the dialog is very small. */
      placeholder = editor_new_placeholder ();
      gtk_widget_set_usize (placeholder, 300, 200);
      gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (new_widget)->vbox),
			  placeholder, TRUE, TRUE, 0);
    }
  else
    {
      /* When loading we create the bare dialog with no buttons. */
      new_widget = gnome_dialog_new (NULL, NULL);
    }

  gb_widget_create_from (GNOME_DIALOG (new_widget)->vbox,
			 data->action == GB_CREATING ? "dialog-vbox" : NULL);
  gb_widget_set_child_name (GNOME_DIALOG (new_widget)->vbox, GladeChildDialogVBox);

  gb_widget_create_from (GNOME_DIALOG (new_widget)->action_area,
			 data->action == GB_CREATING ? "dialog-action_area"
						     : NULL);
  gb_widget_set_child_name (GNOME_DIALOG (new_widget)->action_area,
			    GladeChildDialogActionArea);

  /* We connect a close signal handler which always returns TRUE so that
     the built-in close functionality is skipped. */
  gtk_signal_connect (GTK_OBJECT (new_widget), "close",
		      GTK_SIGNAL_FUNC (gtk_true), NULL);

  /* Now we connect our normal delete_event handler. */
  gtk_signal_connect (GTK_OBJECT (new_widget), "delete_event",
		      GTK_SIGNAL_FUNC (editor_close_window), NULL);

  gtk_object_set_data (GTK_OBJECT (new_widget), TypeHint,
		       GINT_TO_POINTER (GLADE_TYPE_HINT_DIALOG_INDEX));

  return new_widget;
}
Exemplo n.º 12
0
int   l_mater1(iceb_u_str *kod,iceb_u_str *naim,
int skl_poi, // склад
const char *grup,
int metka_skl, //0-все 1-только материалы карточки которых есть на складе
int metka_cen, //0-с нулевой ценой не выбирать 1-выбирать с любой ценой
GtkWidget *wpredok)
{
printf("l_mater1-%s\n",naim->ravno());

class mater1_data data;
char bros[512];
GdkColor color;

data.poisk.clear_zero();

data.skl_poi=skl_poi;
data.metka_skl=metka_skl;
data.poisk.grupa.new_plus(grup);
data.metka_cen=metka_cen;

if(naim->getdlinna() > 1)
 {
  data.poisk.metka_poi=1;
  data.poisk.naim.new_plus(naim->ravno());
 }
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(mater1_key_press),&data);
gtk_signal_connect_after(GTK_OBJECT(data.window),"key_release_event",GTK_SIGNAL_FUNC(iceb_key_release),&data.kl_shift);

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

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

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

data.label_kolstr=gtk_label_new (gettext("Список материалов"));
//gdk_color_parse("green",&color);
//gtk_widget_modify_fg(data.label_kolstr,GTK_STATE_NORMAL,&color);


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

gtk_widget_show(vbox1);
gtk_widget_show(vbox2);

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

gtk_box_pack_start (GTK_BOX (vbox2),data.label_sklad,FALSE, FALSE, 0);
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),400,300);

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

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

sprintf(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(mater1_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,"F4 %s",gettext("Поиск"));
data.knopka[FK4]=gtk_button_new_with_label(bros);
gtk_signal_connect(GTK_OBJECT(data.knopka[FK4]), "clicked",GTK_SIGNAL_FUNC(mater1_knopka),&data);
gtk_box_pack_start(GTK_BOX(vbox1), data.knopka[FK4],TRUE,TRUE, 0);
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(mater1_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,"F7 %s",gettext("Остаток"));
data.knopka[FK7]=gtk_button_new_with_label(bros);
gtk_box_pack_start(GTK_BOX(vbox1), data.knopka[FK7],TRUE,TRUE, 0);
gtk_signal_connect(GTK_OBJECT(data.knopka[FK7]), "clicked",GTK_SIGNAL_FUNC(mater1_knopka),&data);
tooltips[FK7]=gtk_tooltips_new();
gtk_tooltips_set_tip(tooltips[FK7],data.knopka[FK7],gettext("Включить/выключить показ записей с остатками"),NULL);
gtk_object_set_user_data(GTK_OBJECT(data.knopka[FK7]),(gpointer)FK7);
gtk_widget_show(data.knopka[FK7]);


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


mater1_create_list(&data);

gtk_widget_grab_focus(data.knopka[FK10]);
gtk_widget_show(data.window);

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


gtk_main();

if(data.metka_voz == 0 )
 {
  kod->new_plus(data.kodv.ravno());
  naim->new_plus(data.naimv.ravno());
 }

printf("l_mater1 end\n");
if(wpredok != NULL)
  gdk_window_set_cursor(wpredok->window,gdk_cursor_new(ICEB_CURSOR));

return(data.metka_voz);

}
Exemplo n.º 13
0
GtkWidget* dialogGameFinderCreate(bool useTrack, char *title) {
  GtkWidget *dialogGameFinder;
  GtkWidget *vbox1;
  GtkWidget *hbox1;
  GtkWidget *vbox2;
  GtkWidget *frame1;
  GtkWidget *table2;
  GtkWidget *label4;
  GtkWidget *label3;
  GtkWidget *label2;
  GtkWidget *label5;
  GtkWidget *label6;
  GtkWidget *label7;
  GtkWidget *label8;
  GtkWidget *label9;
  GtkWidget *label11;
  GtkWidget *label10;
  GtkWidget *label25;
  GtkWidget *table1;
  GtkWidget *label13;
  GtkWidget *label14;
  GtkWidget *label12;

  useTracker = useTrack;

  dialogGameFinder = gtk_window_new (GTK_WINDOW_DIALOG);
  gtk_object_set_data (GTK_OBJECT (dialogGameFinder), "dialogGameFinder", dialogGameFinder);
  gtk_container_set_border_width (GTK_CONTAINER (dialogGameFinder), 15);
  gtk_window_set_title (GTK_WINDOW (dialogGameFinder), title);
  gtk_window_set_modal (GTK_WINDOW (dialogGameFinder), TRUE);
  gtk_window_set_position (GTK_WINDOW (dialogGameFinder), GTK_WIN_POS_CENTER);
  gtk_window_set_policy (GTK_WINDOW (dialogGameFinder), FALSE, FALSE, FALSE);
  vbox1 = gtk_vbox_new (FALSE, 0);
  gtk_widget_ref (vbox1);
  gtk_object_set_data_full (GTK_OBJECT (dialogGameFinder), "vbox1", vbox1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (vbox1);
  gtk_container_add (GTK_CONTAINER (dialogGameFinder), vbox1);

  hbox1 = gtk_hbox_new (FALSE, 0);
  gtk_widget_ref (hbox1);
  gtk_object_set_data_full (GTK_OBJECT (dialogGameFinder), "hbox1", hbox1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (hbox1);
  gtk_box_pack_start (GTK_BOX (vbox1), hbox1, TRUE, TRUE, 0);

  list1 = gtk_list_new ();
  gtk_widget_ref (list1);
  gtk_object_set_data_full (GTK_OBJECT (dialogGameFinder), "list1", list1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (list1);
  gtk_box_pack_start (GTK_BOX (hbox1), list1, TRUE, TRUE, 10);

  vbox2 = gtk_vbox_new (FALSE, 0);
  gtk_widget_ref (vbox2);
  gtk_object_set_data_full (GTK_OBJECT (dialogGameFinder), "vbox2", vbox2,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (vbox2);
  gtk_box_pack_start (GTK_BOX (hbox1), vbox2, TRUE, TRUE, 0);

  frame1 = gtk_frame_new ("Selected Game Information");
  gtk_widget_ref (frame1);
  gtk_object_set_data_full (GTK_OBJECT (dialogGameFinder), "frame1", frame1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (frame1);
  gtk_box_pack_start (GTK_BOX (vbox2), frame1, TRUE, TRUE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (frame1), 7);

  table2 = gtk_table_new (11, 2, FALSE);
  gtk_widget_ref (table2);
  gtk_object_set_data_full (GTK_OBJECT (dialogGameFinder), "table2", table2,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (table2);
  gtk_container_add (GTK_CONTAINER (frame1), table2);
  gtk_container_set_border_width (GTK_CONTAINER (table2), 7);

  label4 = gtk_label_new ("Version: ");
  gtk_widget_ref (label4);
  gtk_object_set_data_full (GTK_OBJECT (dialogGameFinder), "label4", label4,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label4);
  gtk_table_attach (GTK_TABLE (table2), label4, 0, 1, 3, 4,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label4), GTK_JUSTIFY_RIGHT);
  gtk_misc_set_alignment (GTK_MISC (label4), 1, 0.5);

  label3 = gtk_label_new ("Server Port: ");
  gtk_widget_ref (label3);
  gtk_object_set_data_full (GTK_OBJECT (dialogGameFinder), "label3", label3,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label3);
  gtk_table_attach (GTK_TABLE (table2), label3, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label3), GTK_JUSTIFY_RIGHT);
  gtk_misc_set_alignment (GTK_MISC (label3), 1, 0.5);

  label2 = gtk_label_new ("Server Address: ");
  gtk_widget_ref (label2);
  gtk_object_set_data_full (GTK_OBJECT (dialogGameFinder), "label2", label2,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label2);
  gtk_table_attach (GTK_TABLE (table2), label2, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_RIGHT);
  gtk_misc_set_alignment (GTK_MISC (label2), 1, 0.5);

  label5 = gtk_label_new ("Number of Players:");
  gtk_widget_ref (label5);
  gtk_object_set_data_full (GTK_OBJECT (dialogGameFinder), "label5", label5,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label5);
  gtk_table_attach (GTK_TABLE (table2), label5, 0, 1, 4, 5,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label5), GTK_JUSTIFY_RIGHT);
  gtk_misc_set_alignment (GTK_MISC (label5), 0.5, 1);

  label6 = gtk_label_new ("Game Type: ");
  gtk_widget_ref (label6);
  gtk_object_set_data_full (GTK_OBJECT (dialogGameFinder), "label6", label6,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label6);
  gtk_table_attach (GTK_TABLE (table2), label6, 0, 1, 5, 6,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label6), GTK_JUSTIFY_RIGHT);
  gtk_misc_set_alignment (GTK_MISC (label6), 1, 0.5);

  label7 = gtk_label_new ("No of free Bases: ");
  gtk_widget_ref (label7);
  gtk_object_set_data_full (GTK_OBJECT (dialogGameFinder), "label7", label7,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label7);
  gtk_table_attach (GTK_TABLE (table2), label7, 0, 1, 6, 7,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label7), 1, 0.5);

  label8 = gtk_label_new ("No of free Pillboxes: ");
  gtk_widget_ref (label8);
  gtk_object_set_data_full (GTK_OBJECT (dialogGameFinder), "label8", label8,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label8);
  gtk_table_attach (GTK_TABLE (table2), label8, 0, 1, 7, 8,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label8), 1, 0.5);

  label9 = gtk_label_new ("Hidden Mines: ");
  gtk_widget_ref (label9);
  gtk_object_set_data_full (GTK_OBJECT (dialogGameFinder), "label9", label9,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label9);
  gtk_table_attach (GTK_TABLE (table2), label9, 0, 1, 8, 9,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label9), 1, 0.5);

  label11 = gtk_label_new ("Brains: ");
  gtk_widget_ref (label11);
  gtk_object_set_data_full (GTK_OBJECT (dialogGameFinder), "label11", label11,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label11);
  gtk_table_attach (GTK_TABLE (table2), label11, 0, 1, 10, 11,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label11), 1, 0.5);

  label10 = gtk_label_new ("Password: "******"label10", label10,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label10);
  gtk_table_attach (GTK_TABLE (table2), label10, 0, 1, 9, 10,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label10), GTK_JUSTIFY_RIGHT);
  gtk_misc_set_alignment (GTK_MISC (label10), 1, 0.5);

  idc_address = gtk_label_new ("");
  gtk_widget_ref (idc_address);
  gtk_object_set_data_full (GTK_OBJECT (dialogGameFinder), "idc_address", idc_address,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (idc_address);
  gtk_table_attach (GTK_TABLE (table2), idc_address, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (idc_address), GTK_JUSTIFY_LEFT);

  idc_gamefindport = gtk_label_new ("");
  gtk_widget_ref (idc_gamefindport);
  gtk_object_set_data_full (GTK_OBJECT (dialogGameFinder), "idc_gamefindport", idc_gamefindport,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (idc_gamefindport);
  gtk_table_attach (GTK_TABLE (table2), idc_gamefindport, 1, 2, 1, 2,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  idc_gamefindversion = gtk_label_new ("");
  gtk_widget_ref (idc_gamefindversion);
  gtk_object_set_data_full (GTK_OBJECT (dialogGameFinder), "idc_gamefindversion", idc_gamefindversion,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (idc_gamefindversion);
  gtk_table_attach (GTK_TABLE (table2), idc_gamefindversion, 1, 2, 3, 4,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  idc_gamefindnumplayers = gtk_label_new ("");
  gtk_widget_ref (idc_gamefindnumplayers);
  gtk_object_set_data_full (GTK_OBJECT (dialogGameFinder), "idc_gamefindnumplayers", idc_gamefindnumplayers,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (idc_gamefindnumplayers);
  gtk_table_attach (GTK_TABLE (table2), idc_gamefindnumplayers, 1, 2, 4, 5,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  idc_gamefindtype = gtk_label_new ("");
  gtk_widget_ref (idc_gamefindtype);
  gtk_object_set_data_full (GTK_OBJECT (dialogGameFinder), "idc_gamefindtype", idc_gamefindtype,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (idc_gamefindtype);
  gtk_table_attach (GTK_TABLE (table2), idc_gamefindtype, 1, 2, 5, 6,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  idc_gamefindbases = gtk_label_new ("");
  gtk_widget_ref (idc_gamefindbases);
  gtk_object_set_data_full (GTK_OBJECT (dialogGameFinder), "idc_gamefindbases", idc_gamefindbases,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (idc_gamefindbases);
  gtk_table_attach (GTK_TABLE (table2), idc_gamefindbases, 1, 2, 6, 7,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (idc_gamefindbases), GTK_JUSTIFY_LEFT);

  idc_gamefindpills = gtk_label_new ("");
  gtk_widget_ref (idc_gamefindpills);
  gtk_object_set_data_full (GTK_OBJECT (dialogGameFinder), "idc_gamefindpills", idc_gamefindpills,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (idc_gamefindpills);
  gtk_table_attach (GTK_TABLE (table2), idc_gamefindpills, 1, 2, 7, 8,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (idc_gamefindpills), GTK_JUSTIFY_LEFT);

  idc_gamefindmines = gtk_label_new ("");
  gtk_widget_ref (idc_gamefindmines);
  gtk_object_set_data_full (GTK_OBJECT (dialogGameFinder), "idc_gamefindmines", idc_gamefindmines,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (idc_gamefindmines);
  gtk_table_attach (GTK_TABLE (table2), idc_gamefindmines, 1, 2, 8, 9,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (idc_gamefindmines), GTK_JUSTIFY_LEFT);

  idc_gamefindpass = gtk_label_new ("");
  gtk_widget_ref (idc_gamefindpass);
  gtk_object_set_data_full (GTK_OBJECT (dialogGameFinder), "idc_gamefindpass", idc_gamefindpass,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (idc_gamefindpass);
  gtk_table_attach (GTK_TABLE (table2), idc_gamefindpass, 1, 2, 9, 10,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (idc_gamefindpass), GTK_JUSTIFY_LEFT);

  idc_gamefindbrains = gtk_label_new ("");
  gtk_widget_ref (idc_gamefindbrains);
  gtk_object_set_data_full (GTK_OBJECT (dialogGameFinder), "idc_gamefindbrains", idc_gamefindbrains,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (idc_gamefindbrains);
  gtk_table_attach (GTK_TABLE (table2), idc_gamefindbrains, 1, 2, 10, 11,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (idc_gamefindbrains), GTK_JUSTIFY_LEFT);

  label25 = gtk_label_new ("Map Name: ");
  gtk_widget_ref (label25);
  gtk_object_set_data_full (GTK_OBJECT (dialogGameFinder), "label25", label25,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label25);
  gtk_table_attach (GTK_TABLE (table2), label25, 0, 1, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_label_set_justify (GTK_LABEL (label25), GTK_JUSTIFY_RIGHT);
  gtk_misc_set_alignment (GTK_MISC (label25), 1, 0.5);

  idc_gamefindmapname = gtk_label_new ("");
  gtk_widget_ref (idc_gamefindmapname);
  gtk_object_set_data_full (GTK_OBJECT (dialogGameFinder), "idc_gamefindmapname", idc_gamefindmapname,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (idc_gamefindmapname);
  gtk_table_attach (GTK_TABLE (table2), idc_gamefindmapname, 1, 2, 2, 3,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  idc_gamefindstatus = gtk_label_new ("Status: Idle");
  gtk_widget_ref (idc_gamefindstatus);
  gtk_object_set_data_full (GTK_OBJECT (dialogGameFinder), "idc_gamefindstatus", idc_gamefindstatus,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (idc_gamefindstatus);
  gtk_box_pack_start (GTK_BOX (vbox2), idc_gamefindstatus, FALSE, TRUE, 3);
  gtk_misc_set_alignment (GTK_MISC (idc_gamefindstatus), 0.04, 0.5);

  table1 = gtk_table_new (3, 4, FALSE);
  gtk_widget_ref (table1);
  gtk_object_set_data_full (GTK_OBJECT (dialogGameFinder), "table1", table1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (table1);
  gtk_box_pack_start (GTK_BOX (vbox1), table1, TRUE, TRUE, 15);

  button2 = gtk_button_new_with_label ("Join by Address");
  gtk_widget_ref (button2);
  gtk_object_set_data_full (GTK_OBJECT (dialogGameFinder), "button2", button2,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button2);
  gtk_table_attach (GTK_TABLE (table1), button2, 2, 3, 0, 1,
                    (GtkAttachOptions) (0),
                    (GtkAttachOptions) (0), 0, 0);

  button1 = gtk_button_new_with_label ("Tracker Setup");
  gtk_widget_ref (button1);
  gtk_object_set_data_full (GTK_OBJECT (dialogGameFinder), "button1", button1,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button1);
  gtk_table_attach (GTK_TABLE (table1), button1, 0, 1, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  button8 = gtk_button_new_with_label ("Set Player Name");
  gtk_widget_ref (button8);
  gtk_object_set_data_full (GTK_OBJECT (dialogGameFinder), "button8", button8,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button8);
  gtk_table_attach (GTK_TABLE (table1), button8, 0, 1, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  button9 = gtk_button_new_with_label ("Message of the Day");
  gtk_widget_ref (button9);
  gtk_object_set_data_full (GTK_OBJECT (dialogGameFinder), "button9", button9,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button9);
  gtk_table_attach (GTK_TABLE (table1), button9, 0, 1, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  button4 = gtk_button_new_with_label ("Refresh");
  gtk_widget_ref (button4);
  gtk_object_set_data_full (GTK_OBJECT (dialogGameFinder), "button4", button4,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button4);
  gtk_table_attach (GTK_TABLE (table1), button4, 2, 3, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  button6 = gtk_button_new_with_label ("New");
  gtk_widget_ref (button6);
  gtk_object_set_data_full (GTK_OBJECT (dialogGameFinder), "button6", button6,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button6);
  gtk_table_attach (GTK_TABLE (table1), button6, 2, 3, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  idc_gamefindjoin = gtk_button_new_with_label ("Join");
  gtk_widget_ref (idc_gamefindjoin);
  gtk_object_set_data_full (GTK_OBJECT (dialogGameFinder), "idc_gamefindjoin", idc_gamefindjoin,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (idc_gamefindjoin);
  gtk_table_attach (GTK_TABLE (table1), idc_gamefindjoin, 3, 4, 0, 1,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_widget_set_sensitive (idc_gamefindjoin, FALSE);

  idc_gamefindrejoin = gtk_button_new_with_label ("Rejoin");
  gtk_widget_ref (idc_gamefindrejoin);
  gtk_object_set_data_full (GTK_OBJECT (dialogGameFinder), "idc_gamefindrejoin", idc_gamefindrejoin,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (idc_gamefindrejoin);
  gtk_table_attach (GTK_TABLE (table1), idc_gamefindrejoin, 3, 4, 1, 2,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_widget_set_sensitive (idc_gamefindrejoin, FALSE);

  button7 = gtk_button_new_with_label ("Cancel");
  gtk_widget_ref (button7);
  gtk_object_set_data_full (GTK_OBJECT (dialogGameFinder), "button7", button7,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (button7);
  gtk_table_attach (GTK_TABLE (table1), button7, 3, 4, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);

  label13 = gtk_label_new ("");
  gtk_widget_ref (label13);
  gtk_object_set_data_full (GTK_OBJECT (dialogGameFinder), "label13", label13,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label13);
  gtk_table_attach (GTK_TABLE (table1), label13, 1, 2, 1, 2,
                    (GtkAttachOptions) (0),
                    (GtkAttachOptions) (0), 0, 0);

  label14 = gtk_label_new ("");
  gtk_widget_ref (label14);
  gtk_object_set_data_full (GTK_OBJECT (dialogGameFinder), "label14", label14,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label14);
  gtk_table_attach (GTK_TABLE (table1), label14, 1, 2, 2, 3,
                    (GtkAttachOptions) (0),
                    (GtkAttachOptions) (0), 0, 0);

  label12 = gtk_label_new ("                                                            ");
  gtk_widget_ref (label12);
  gtk_object_set_data_full (GTK_OBJECT (dialogGameFinder), "label12", label12,
                            (GtkDestroyNotify) gtk_widget_unref);
  gtk_widget_show (label12);
  gtk_table_attach (GTK_TABLE (table1), label12, 1, 2, 0, 1,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  /* Signals */
//  gtk_signal_connect (GTK_OBJECT(list1), "select", GTK_SIGNAL_FUNC(dialogGameFinderSelect), NULL);
  gtk_signal_connect(GTK_OBJECT(dialogGameFinder), "show", GTK_SIGNAL_FUNC(dialogGameFinderShow), 0);
  gtk_signal_connect(GTK_OBJECT(button1), "clicked", GTK_SIGNAL_FUNC(dialogGameFinderTracker), 0);
  gtk_signal_connect(GTK_OBJECT(button8), "clicked", GTK_SIGNAL_FUNC(dialogGameFinderSetName), 0);
   gtk_signal_connect(GTK_OBJECT(button4), "clicked", GTK_SIGNAL_FUNC(dialogGameFinderRefresh), 0);
  gtk_signal_connect(GTK_OBJECT(button7), "clicked", GTK_SIGNAL_FUNC(dialogGameFinderCancel), 0);
  gtk_signal_connect(GTK_OBJECT(button9), "clicked", GTK_SIGNAL_FUNC(dialogGameFinderMOTD), 0);
  gtk_signal_connect(GTK_OBJECT(dialogGameFinder), "delete_event", GTK_SIGNAL_FUNC(dialogGameFinderCancel), 0);
  gtk_signal_connect(GTK_OBJECT(idc_gamefindrejoin), "clicked", GTK_SIGNAL_FUNC(dialogGameFinderReJoin), 0);
  gtk_signal_connect(GTK_OBJECT(idc_gamefindjoin), "clicked", GTK_SIGNAL_FUNC(dialogGameFinderJoin), 0);
  gtk_signal_connect(GTK_OBJECT(button2), "clicked", GTK_SIGNAL_FUNC(dialogGameFinderJoinByAddress), 0);
  gtk_signal_connect(GTK_OBJECT(button6), "clicked", GTK_SIGNAL_FUNC(dialogGameFinderNew), 0);
  /* My Stuff */
  cg = currentGamesCreate();
  if (useTracker == TRUE) {
    strcpy(motd, langGetText(STR_DLGGAMEFINDER_REFRESHFIRST));
  } else {
    gtk_widget_set_sensitive (button1, FALSE);
    gtk_widget_set_sensitive (button9, FALSE);
  }

  dialogGameFindUs = dialogGameFinder;
  gtk_misc_set_alignment (GTK_MISC (idc_address), 0, 0.5);
  gtk_misc_set_alignment (GTK_MISC (idc_gamefindport), 0, 0.5);
  gtk_misc_set_alignment (GTK_MISC (idc_gamefindversion), 0, 0.5);
  gtk_misc_set_alignment (GTK_MISC (idc_gamefindnumplayers), 0, 0.5);
  gtk_misc_set_alignment (GTK_MISC (idc_gamefindtype), 0, 0.5);
  gtk_misc_set_alignment (GTK_MISC (idc_gamefindbases), 0, 0.5);
  gtk_misc_set_alignment (GTK_MISC (idc_gamefindmines), 0, 0.5);
  gtk_misc_set_alignment (GTK_MISC (idc_gamefindmapname), 0, 0.5);
  gtk_misc_set_alignment (GTK_MISC (idc_gamefindpills), 0, 0.5);
  gtk_misc_set_alignment (GTK_MISC (idc_gamefindpass), 0, 0.5);
  gtk_misc_set_alignment (GTK_MISC (idc_gamefindbrains), 0, 0.5);

  return dialogGameFinder;
}
Exemplo n.º 14
0
int l_klient_imp(const char *imaf,
GtkWidget *wpredok)
{
char strsql[500];
iceb_u_spisok repl_s;
class l_klient_imp_data data;

data.imafz.new_plus(imaf);

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

GtkWidget *label=NULL;

label=gtk_label_new(gettext("Импорт карточек из файла"));
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(l_klient_imp_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)l_klient_imp1,&data);

gtk_main();

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

return(data.voz);
}
Exemplo n.º 15
0
int l_dover(const char *datadov,const char *nomerdov,GtkWidget *wpredok)
{
l_dover_data data;
char bros[512];
GdkColor color;

data.datdov.new_plus(datadov);
data.nomdov.new_plus(nomerdov);
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(l_dover_key_press),&data);
gtk_signal_connect_after(GTK_OBJECT(data.window),"key_release_event",GTK_SIGNAL_FUNC(iceb_key_release),&data.kl_shift);

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

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

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

data.label_kolstr=gtk_label_new (gettext("Доверенность"));
//gdk_color_parse("green",&color);
//gtk_widget_modify_fg(data.label_kolstr,GTK_STATE_NORMAL,&color);


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

gtk_widget_show(vbox1);
gtk_widget_show(vbox2);

data.label_poisk=gtk_label_new ("");
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),400,300);

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

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

sprintf(bros,"%sF1 %s",RFK,gettext("Шапка"));
data.knopka[SFK1]=gtk_button_new_with_label(bros);
gtk_box_pack_start(GTK_BOX(vbox1), data.knopka[SFK1], TRUE, TRUE, 0);
gtk_signal_connect(GTK_OBJECT(data.knopka[SFK1]), "clicked",GTK_SIGNAL_FUNC(l_dover_knopka),&data);
tooltips[SFK1]=gtk_tooltips_new();
gtk_tooltips_set_tip(tooltips[SFK1],data.knopka[SFK1],gettext("Просмотр шапки документа"),NULL);
gtk_object_set_user_data(GTK_OBJECT(data.knopka[SFK1]),(gpointer)SFK1);
gtk_widget_show(data.knopka[SFK1]);

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(l_dover_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(l_dover_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(l_dover_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(l_dover_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,"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(l_dover_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(l_dover_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]);

l_dover_create_list(&data);

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


gtk_main();


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

return(data.metka_voz);

}
Exemplo n.º 16
0
GtkWidget * surfadd_dialog_new(gpointer hfo_ptr) {

	GtkObject *adj;
	GtkWidget *button, *table, *hbox, *vbox, *scale, *scrolled_window;
	GtkWidget *frame;
	static gboolean dummy_flag;

	gpointer data;
	hf_options_struct *hfo = (hf_options_struct *) hfo_ptr;

	if (!hfo)
		return gtk_label_new(_("No surface addition dialog"));

	data = hfo->hfw_ptr_ptr;

//	Main dialog box
	vbox = gtk_vbox_new(FALSE,0);
	gtk_widget_show(GTK_WIDGET(vbox));

//	2008-02 Now with scrolled window
	scrolled_window = gtk_scrolled_window_new (NULL, NULL);
        gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_window), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
	gtk_widget_show (scrolled_window);
	gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW(scrolled_window), vbox);

	gtk_widget_set_size_request (scrolled_window, -1, gdk_screen_get_height(gdk_screen_get_default())/3);

//	Seed
	
	gtk_box_pack_start_defaults(GTK_BOX(vbox), 
		seed_dialog_new(data, hfo->surfadd_options->seed, 
		change_surfadd_seed));

	table = gtk_table_new(4, 2, FALSE);
	gtk_widget_show(table);

//	Slope / roughness (kind of)
//	From 0 to 100%
//	100: we keep the same H for each step, even if the surfaces to add are smaller
//	50:  we divide the H by 2 for each step (default), because  the surfaces are divided by two
//	100:  we divide the H by 3 for each step.

	define_label_in_table("Slope",table, 0, 1, 0, 1, 0); 

	adj = gtk_adjustment_new (hfo->surfadd_options->slope, 0, 100, 1, 1, 0.01);

	scale = define_scale_in_table(adj,table,1,2,0,1,0,DEF_PAD*0.5);
	g_signal_connect (G_OBJECT (adj), "value_changed",
		GTK_SIGNAL_FUNC (slope_upd), data);
	g_signal_connect (G_OBJECT (scale), "button_release_event", GTK_SIGNAL_FUNC (compute_hf_callb), data);

//	Random x-y displacement scale
//	From 0 to 100 % (100 % = twice the size of the current surface to add)

	define_label_in_table("XZ Displacement ",table, 0, 1, 1, 2, 0); 

	adj = gtk_adjustment_new 
		(hfo->surfadd_options->xy_random_range, 0, 100, 1, 1, 0.01);
	scale = define_scale_in_table(adj,table,1,2,1,2,0,DEF_PAD*0.5);
	g_signal_connect (G_OBJECT (adj), "value_changed",
		GTK_SIGNAL_FUNC (xy_scale_upd), data);
	g_signal_connect (G_OBJECT (scale), "button_release_event", GTK_SIGNAL_FUNC (compute_hf_callb), data);

//	Random height displacement scale
//	From 0 to 100 % (100 % = twice the height of the current surface to add)

	define_label_in_table("H Displacement ",table, 0, 1, 2, 3, 0); 
	adj = gtk_adjustment_new 
		(hfo->surfadd_options->h_random_range, 0, 100, 1, 1, 0.01);
	scale = define_scale_in_table(adj,table,1,2,2,3,0,DEF_PAD*0.5);
	g_signal_connect (G_OBJECT (adj), "value_changed",
		GTK_SIGNAL_FUNC (h_scale_upd), data);
	g_signal_connect (G_OBJECT (scale), "button_release_event", GTK_SIGNAL_FUNC (compute_hf_callb), data);

//	Lateral density variation
//	From 0 to 100 % (100 % = twice the default density)

	define_label_in_table("Density",table, 0, 1, 3, 4, 0); 
	adj = gtk_adjustment_new 
		(hfo->surfadd_options->density, 0, 100, 1, 1, 0.01);
	scale = define_scale_in_table(adj,table,1,2,3,4,0,DEF_PAD*0.5);
	g_signal_connect (G_OBJECT (adj), "value_changed",
		GTK_SIGNAL_FUNC (density_upd), data);
	g_signal_connect (G_OBJECT (scale), "button_release_event", GTK_SIGNAL_FUNC (compute_hf_callb), data);

	hbox = gtk_hbox_new(FALSE,0);
	gtk_widget_show(hbox);

	gtk_box_pack_start_defaults(GTK_BOX(hbox), table);

	gtk_box_pack_start_defaults(GTK_BOX(vbox), hbox);

//	Filters for the primitive surface and preview
	frame = frame_new("Primitive surface", DEF_PAD*0.5);
	gtk_container_add(GTK_CONTAINER(vbox), frame);

//	HBOX will contain the shape filter dialog and the preview
	hbox = gtk_hbox_new(FALSE,0);
	gtk_widget_show(hbox);
	
	gtk_container_add(GTK_CONTAINER(frame), hbox);

//	We create the primitive surface, and the preview area at the same time
	hfo->primit_surf = hf_wrapper_new(NULL,NULL,hbox, hbox, 
		hf_options_dialog_new(hfo->tools_window,
			hbox, 
			hfo->tooltips, 
			NULL, 
			&hfo->primit_surf,
			hfo->stack,
			hfo->doc_type,
			hfo->all_docs,
			hfo->get_doc_list_from_type),
		&dummy_flag, &dummy_flag, NULL, NULL, NULL, NULL, HFPRIMITIVE);
//	Shared data:
	((hf_wrapper_struct *)hfo->primit_surf)->hf_options->dist_matrix =
			hfo->dist_matrix;

	((hf_wrapper_struct *)hfo->primit_surf)->hf_options->current_calculation = (gpointer) uniform;
	((hf_wrapper_struct *)hfo->primit_surf)->hf_options->current_callb = NULL;
	((hf_wrapper_struct *)hfo->primit_surf)->hf_options->current_options = (gpointer) hfo->uniform_value;

	set_filter_type (((hf_wrapper_struct *) hfo->primit_surf)->hf_options->creation_fd_struct, MEDIUM_FILTER_1);
	
	set_dependent_process ((hf_wrapper_struct *) hfo->primit_surf, gener_hf_from_ptr_ptr, hfo->hfw_ptr_ptr);

//	Set the merge operation to MULTIPLY:

	set_filter_merge(((hf_wrapper_struct *) hfo->primit_surf)->hf_options->creation_fd_struct, 1);

//	Frequency dialog
	gtk_box_pack_start(GTK_BOX(vbox),
		surfadd_frq_dialog_new(hfo_ptr), FALSE, FALSE,0);

	return define_options_frame_with_hiding_arrows("sum of surfaces", scrolled_window, hfo->tools_window, TRUE);
}
Exemplo n.º 17
0
static GtkWidget * surfadd_frq_dialog_new (gpointer hfo_ptr) {
//	Fine frequency control dialog
	GtkWidget *table, *vbox, *hbox, *button, *scale;
	GtkObject *adj;
	hf_options_struct *hf_options = (hf_options_struct *) hfo_ptr;
	if (!hfo_ptr)
		return gtk_label_new(_("No frequency control"));
	gpointer data = hf_options->hfw_ptr_ptr;

	table = gtk_table_new(6, 4, FALSE);
	gtk_widget_show(table);

	define_label_in_table("4096",table, 0, 1, 0, 1, 0);
 	define_label_in_table("2048",table, 0, 1, 1, 2, 0); 
	define_label_in_table("1024",table, 0, 1, 2, 3, 0);
 	define_label_in_table(" 512",table, 0, 1, 3, 4, 0); 
	define_label_in_table(" 256",table, 0, 1, 4, 5, 0);
 	define_label_in_table(" 128",table, 0, 1, 5, 6, 0);
 	define_label_in_table(" 64",table, 2, 3, 0, 1, 0);
 	define_label_in_table(" 32",table, 2, 3, 1, 2, 0); 
	define_label_in_table(" 16",table, 2, 3, 2, 3, 0);
 	define_label_in_table("  8",table, 2, 3, 3, 4, 0); 
	define_label_in_table("  4",table, 2, 3, 4, 5, 0);
 	define_label_in_table("  2",table, 2, 3, 5, 6, 0);
// 4096
	adj= gtk_adjustment_new 
		(hf_options->surfadd_options->frq_percent[11], 0, 100, 1, 1, 0.01);
	scale = define_scale_in_table(adj,table,1,2,0,1,0,DEF_PAD*0);
	// gl_preview_optimize (scale, data);
	gtk_signal_connect (GTK_OBJECT (adj ), "value_changed",
		GTK_SIGNAL_FUNC (percent_upd), 
			&hf_options->surfadd_options->frq_percent[11]);
	g_signal_connect (G_OBJECT (scale), "button_release_event", GTK_SIGNAL_FUNC (compute_hf_callb), data);
	hf_options->freq_control_adj[11] =adj;

// 2048
	adj = gtk_adjustment_new 
		(hf_options->surfadd_options->frq_percent[10], 0, 100, 1, 1, 0.01);
	scale = define_scale_in_table(adj,table,1,2,1,2,0,DEF_PAD*0);
	// gl_preview_optimize (scale, data);
	gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
		GTK_SIGNAL_FUNC (percent_upd), 
			&hf_options->surfadd_options->frq_percent[10]);
	g_signal_connect (G_OBJECT (scale), "button_release_event", GTK_SIGNAL_FUNC (compute_hf_callb), data);
	hf_options->freq_control_adj[10]  = adj;
// 1024
	adj = gtk_adjustment_new 
		(hf_options->surfadd_options->frq_percent[9], 0, 100, 1, 1, 0.01);
	scale = define_scale_in_table(adj,table,1,2,2,3,0,DEF_PAD*0);
	// gl_preview_optimize (scale, data);
	gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
		GTK_SIGNAL_FUNC (percent_upd), 
			&hf_options->surfadd_options->frq_percent[9]);
	g_signal_connect (G_OBJECT (scale), "button_release_event", GTK_SIGNAL_FUNC (compute_hf_callb), data);
	hf_options->freq_control_adj[9]  = adj;

// 512
	adj = gtk_adjustment_new 
		(hf_options->surfadd_options->frq_percent[8], 0, 100, 1, 1, 0.01);
	scale = define_scale_in_table(adj,table,1,2,3,4,0,DEF_PAD*0);
	// gl_preview_optimize (scale, data);
	gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
		GTK_SIGNAL_FUNC (percent_upd), 
			&hf_options->surfadd_options->frq_percent[8]);
	g_signal_connect (G_OBJECT (scale), "button_release_event", GTK_SIGNAL_FUNC (compute_hf_callb), data);
	hf_options->freq_control_adj[8] =adj;
// 256
	adj = gtk_adjustment_new 
		(hf_options->surfadd_options->frq_percent[7], 0, 100, 1, 1, 0.01);
	scale = define_scale_in_table(adj,table,1,2,4,5,0,DEF_PAD*0);
	// gl_preview_optimize (scale, data);
	gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
		GTK_SIGNAL_FUNC (percent_upd), 
			&hf_options->surfadd_options->frq_percent[7]);
	g_signal_connect (G_OBJECT (scale), "button_release_event", GTK_SIGNAL_FUNC (compute_hf_callb), data);
	hf_options->freq_control_adj[7] =adj;
// 128
	adj = gtk_adjustment_new 
		(hf_options->surfadd_options->frq_percent[6], 0, 100, 1, 1, 0.01);
	scale = define_scale_in_table(adj,table,1,2,5,6,0,DEF_PAD*0);
	// gl_preview_optimize (scale, data);
	gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
		GTK_SIGNAL_FUNC (percent_upd), 
			&hf_options->surfadd_options->frq_percent[6]);
	g_signal_connect (G_OBJECT (scale), "button_release_event", GTK_SIGNAL_FUNC (compute_hf_callb), data);
	hf_options->freq_control_adj[6]  =adj;

// 64
	adj = gtk_adjustment_new 
		(hf_options->surfadd_options->frq_percent[5], 0, 100, 1, 1, 0.01);
	scale = define_scale_in_table(adj,table,3,4,0,1,0,DEF_PAD*0);
	// gl_preview_optimize (scale, data);
	gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
		GTK_SIGNAL_FUNC (percent_upd), 
			&hf_options->surfadd_options->frq_percent[5]);
	g_signal_connect (G_OBJECT (scale), "button_release_event", GTK_SIGNAL_FUNC (compute_hf_callb), data);
	hf_options->freq_control_adj[5] =adj;
// 32
	adj = gtk_adjustment_new 
		(hf_options->surfadd_options->frq_percent[4], 0, 100, 1, 1, 0.01);
	scale = define_scale_in_table(adj,table,3,4,1,2,0,DEF_PAD*0);
	// gl_preview_optimize (scale, data);
	gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
		GTK_SIGNAL_FUNC (percent_upd), 
			&hf_options->surfadd_options->frq_percent[4]);
	g_signal_connect (G_OBJECT (scale), "button_release_event", GTK_SIGNAL_FUNC (compute_hf_callb), data);
	hf_options->freq_control_adj[4] =adj;
// 16
	adj = gtk_adjustment_new 
		(hf_options->surfadd_options->frq_percent[3], 0, 100, 1, 1, 0.01);
	scale = define_scale_in_table(adj,table,3,4,2,3,0,DEF_PAD*0);
	// gl_preview_optimize (scale, data);
	gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
		GTK_SIGNAL_FUNC (percent_upd), 
			&hf_options->surfadd_options->frq_percent[3]);
	g_signal_connect (G_OBJECT (scale), "button_release_event", GTK_SIGNAL_FUNC (compute_hf_callb), data);
	hf_options->freq_control_adj[3] =adj;

// 8
	adj = gtk_adjustment_new 
		(hf_options->surfadd_options->frq_percent[2], 0, 100, 1, 1, 0.01);
	scale = define_scale_in_table(adj,table,3,4,3,4,0,DEF_PAD*0);
	// gl_preview_optimize (scale, data);
	gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
		GTK_SIGNAL_FUNC (percent_upd), 
			&hf_options->surfadd_options->frq_percent[2]);
	g_signal_connect (G_OBJECT (scale), "button_release_event", GTK_SIGNAL_FUNC (compute_hf_callb), data);
	hf_options->freq_control_adj[2] = adj;
// 4
	adj = gtk_adjustment_new 
		(hf_options->surfadd_options->frq_percent[1], 0, 100, 1, 1, 0.01);
	scale = define_scale_in_table(adj,table,3,4,4,5,0,DEF_PAD*0);
	// gl_preview_optimize (scale, data);
	gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
		GTK_SIGNAL_FUNC (percent_upd), 
			&hf_options->surfadd_options->frq_percent[1]);
	g_signal_connect (G_OBJECT (scale), "button_release_event", GTK_SIGNAL_FUNC (compute_hf_callb), data);
	hf_options->freq_control_adj[1] =adj;
// 2
	adj = gtk_adjustment_new 
		(hf_options->surfadd_options->frq_percent[0], 0, 100, 1, 1, 0.01);
	scale = define_scale_in_table(adj,table,3,4,5,6,0,DEF_PAD*0);
	// gl_preview_optimize (scale, data);
	gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
		GTK_SIGNAL_FUNC (percent_upd), 
			&hf_options->surfadd_options->frq_percent[0]);
	g_signal_connect (G_OBJECT (scale), "button_release_event", GTK_SIGNAL_FUNC (compute_hf_callb), data);
	hf_options->freq_control_adj[0]  = adj;

//	Adding fast reset buttons
	vbox = gtk_vbox_new(FALSE,0);
	gtk_widget_show(vbox);

	button = gtk_button_new_with_label ("0");
	gtk_signal_connect (GTK_OBJECT (button), "clicked",
	       (GtkSignalFunc) set_freq_global, data);
	gtk_widget_show(button);
  	gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
	button = gtk_button_new_with_label ("25");
	gtk_signal_connect (GTK_OBJECT (button), "clicked",
	       (GtkSignalFunc) set_freq_global, data);
	gtk_widget_show(button);
  	gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
	button = gtk_button_new_with_label ("50");
	gtk_signal_connect (GTK_OBJECT (button), "clicked",
	       (GtkSignalFunc) set_freq_global, data);
	gtk_widget_show(button);
  	gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
	button = gtk_button_new_with_label ("75");
	gtk_signal_connect (GTK_OBJECT (button), "clicked",
	       (GtkSignalFunc) set_freq_global, data);
	gtk_widget_show(button);
  	gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
	button = gtk_button_new_with_label ("100");
	gtk_signal_connect (GTK_OBJECT (button), "clicked",
	       (GtkSignalFunc) set_freq_global, data);
	gtk_widget_show(button);
  	gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);

	hbox = gtk_hbox_new(FALSE,0);

//	The default is to hide this dialog at the beginning, because it takes room
//	gtk_widget_show(hbox);

	gtk_box_pack_start(GTK_BOX(hbox), align_widget(vbox,0.5,0.5), FALSE,FALSE, DEF_PAD*0.5);
	
	gtk_box_pack_start(GTK_BOX(hbox), table, FALSE,FALSE, 0);

	return define_frame_with_hiding_arrows("Wave length control", hbox, hf_options->tools_window, FALSE);
}
Exemplo n.º 18
0
static gboolean gui_message_big_new (const char *from, const char *subject, const char *date, const  char *account, const  char *kbytes) {
  GtkWidget *vbox, *hbox;
  GtkWidget *table;
  GtkWidget *label;
  GtkWidget *hsep;
  GtkStyle *style1;
  GtkStyle *style2;
  char *buf;
  GtkWidget *xpm;

  go = FALSE;
  gbool = TRUE;

  window = gnome_dialog_new (_("Confirm message downloading"),
      			GNOME_STOCK_BUTTON_YES, GNOME_STOCK_BUTTON_NO, NULL);
  gtk_window_set_modal (GTK_WINDOW (window), TRUE);
  gtk_window_set_transient_for (GTK_WINDOW (window), GTK_WINDOW (WMain->window));
  gnome_dialog_set_default (GNOME_DIALOG (window), 0);

  vbox = GNOME_DIALOG (window)->vbox;

  label = gtk_label_new (_("There's a message bigger than what you allowed to automatically download."));
  gtk_widget_show (label);
  gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);

  table = gtk_table_new (5, 2, FALSE);
  gtk_widget_show (table);
  gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0);
  gtk_table_set_row_spacings (GTK_TABLE (table), 2);
  gtk_table_set_col_spacings (GTK_TABLE (table), 2);

  if (from && subject && date) {
    label = gtk_label_new (_("From:"));
    gtk_widget_show (label);
    gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
	(GtkAttachOptions) (GTK_FILL),
	(GtkAttachOptions) (0), 0, 0);
    gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
    style1 = gtk_widget_get_style (label);
    style2 = gtk_style_copy (style1);
    style2->font = gdk_font_load ("-adobe-helvetica-bold-r-normal-*-*-120-*-*-p-*-iso8859-1");
    gtk_widget_set_style (label, style2);
    label = gtk_label_new (from);
    gtk_widget_show (label);
    gtk_table_attach (GTK_TABLE (table), label, 1, 2, 0, 1,
	(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
	(GtkAttachOptions) (0), 0, 0);
    gtk_misc_set_alignment (GTK_MISC (label), 7.45058e-09, 0.5);
    style1 = gtk_widget_get_style (label);
    style2 = gtk_style_copy (style1);
    style2->font = gdk_font_load ("-adobe-courier-medium-r-normal-*-*-120-*-*-m-*-iso8859-1");
    gtk_widget_set_style (label, style2);
    
    label = gtk_label_new (_("Date:"));
    gtk_widget_show (label);
    gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
	(GtkAttachOptions) (GTK_FILL),
	(GtkAttachOptions) (0), 0, 0);
    gtk_misc_set_alignment (GTK_MISC (label), 7.45058e-09, 0.5);
    style1 = gtk_widget_get_style (label);
    style2 = gtk_style_copy (style1);
    style2->font = gdk_font_load ("-adobe-helvetica-bold-r-normal-*-*-120-*-*-p-*-iso8859-1");
    gtk_widget_set_style (label, style2);
    label = gtk_label_new (date);
    gtk_widget_show (label);
    gtk_table_attach (GTK_TABLE (table), label, 1, 2, 1, 2,
	(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
	(GtkAttachOptions) (0), 0, 0);
    gtk_misc_set_alignment (GTK_MISC (label), 7.45058e-09, 0.5);
    style1 = gtk_widget_get_style (label);
    style2 = gtk_style_copy (style1);
    style2->font = gdk_font_load ("-adobe-courier-medium-r-normal-*-*-120-*-*-m-*-iso8859-1");
    gtk_widget_set_style (label, style2);
  } else {
    label = gtk_label_new (_("Since the server doesn't support advanced POP commands very little information about this message could be extracted."));
    gtk_widget_show (label);
    gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
	(GtkAttachOptions) (GTK_FILL),
	(GtkAttachOptions) (0), 0, 0);
  }
  
  label = gtk_label_new (_("Account:"));
  gtk_widget_show (label);
  gtk_table_attach (GTK_TABLE (table), label, 0, 1, 3, 4,
      (GtkAttachOptions) (GTK_FILL),
      (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label), 7.45058e-09, 0.5);
  style1 = gtk_widget_get_style (label);
  style2 = gtk_style_copy (style1);
  style2->font = gdk_font_load ("-adobe-helvetica-bold-r-normal-*-*-120-*-*-p-*-iso8859-1");
  gtk_widget_set_style (label, style2);

  if (from && subject && date) {
    label = gtk_label_new (_("Subject:"));
    gtk_widget_show (label);
    gtk_table_attach (GTK_TABLE (table), label, 0, 1, 4, 5,
	(GtkAttachOptions) (GTK_FILL),
	(GtkAttachOptions) (0), 0, 0);
    gtk_misc_set_alignment (GTK_MISC (label), 7.45058e-09, 0.5);
    style1 = gtk_widget_get_style (label);
    style2 = gtk_style_copy (style1);
    style2->font = gdk_font_load ("-adobe-helvetica-bold-r-normal-*-*-120-*-*-p-*-iso8859-1");
    gtk_widget_set_style (label, style2);
    label = gtk_label_new (subject);
    gtk_widget_show (label);
    gtk_table_attach (GTK_TABLE (table), label, 1, 2, 4, 5,
	(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
	(GtkAttachOptions) (0), 0, 0);
    gtk_misc_set_alignment (GTK_MISC (label), 7.45058e-09, 0.5);
    style1 = gtk_widget_get_style (label);
    style2 = gtk_style_copy (style1);
    style2->font = gdk_font_load ("-adobe-courier-medium-r-normal-*-*-120-*-*-m-*-iso8859-1");
    gtk_widget_set_style (label, style2);
  }
  
  label = gtk_label_new (_("Size:"));
  gtk_widget_show (label);
  gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3,
                    (GtkAttachOptions) (GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label), 7.45058e-09, 0.5);
  style1 = gtk_widget_get_style (label);
  style2 = gtk_style_copy (style1);
  style2->font = gdk_font_load ("-adobe-helvetica-bold-r-normal-*-*-120-*-*-p-*-iso8859-1");
  gtk_widget_set_style (label, style2);

  buf = g_strdup_printf ("%s (%d Kb)", kbytes, atoi (kbytes)/1024);
  label = gtk_label_new (buf);
  c2_free (buf);
  gtk_widget_show (label);
  gtk_table_attach (GTK_TABLE (table), label, 1, 2, 2, 3,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label), 7.45058e-09, 0.5);
  style1 = gtk_widget_get_style (label);
  style2 = gtk_style_copy (style1);
  style2->font = gdk_font_load ("-adobe-courier-medium-r-normal-*-*-120-*-*-m-*-iso8859-1");
  gtk_widget_set_style (label, style2); 

  label= gtk_label_new (account);
  gtk_widget_show (label);
  gtk_table_attach (GTK_TABLE (table), label, 1, 2, 3, 4,
                    (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
                    (GtkAttachOptions) (0), 0, 0);
  gtk_misc_set_alignment (GTK_MISC (label), 7.45058e-09, 0.5);
  style1 = gtk_widget_get_style (label);
  style2 = gtk_style_copy (style1);
  style2->font = gdk_font_load ("-adobe-courier-medium-r-normal-*-*-120-*-*-m-*-iso8859-1");
  gtk_widget_set_style (label, style2); 

  hsep = gtk_hseparator_new ();
  gtk_widget_show (hsep);
  gtk_box_pack_start (GTK_BOX (vbox), hsep, FALSE, TRUE, 0);

  hbox = gtk_hbox_new (FALSE, 0);
  gtk_widget_show (hbox);
  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
  
  buf = gnome_unconditional_pixmap_file("gnome-question.png");
  if (buf) {
    xpm = gnome_pixmap_new_from_file(buf);
    c2_free(buf);
    gtk_widget_show (xpm);
    gtk_box_pack_start (GTK_BOX (hbox), xpm, FALSE, FALSE, 0);
  }
  
  label = gtk_label_new (_("Do you want to download it?"));
  gtk_widget_show (label);
  gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);

  gnome_dialog_button_connect (GNOME_DIALOG (window), 0, GTK_SIGNAL_FUNC (cb), (gpointer) "Y");
  gnome_dialog_set_accelerator (GNOME_DIALOG (window), 0, GDK_Y, 0);
  gnome_dialog_button_connect (GNOME_DIALOG (window), 1, GTK_SIGNAL_FUNC (cb), (gpointer) "N");
  gnome_dialog_set_accelerator (GNOME_DIALOG (window), 1, GDK_N, 0);

  gtk_widget_show (window);

  gdk_threads_leave ();
  while (!go) usleep (500);
  gdk_threads_enter ();
  return gbool;
}
Exemplo n.º 19
0
static int Config_CreateWindow()
{
    GtkWidget *okButton, *cancelButton;
    GtkWidget *displayFrame, *texturesFrame;
    GtkWidget *displayTable, *texturesTable;
//  GtkWidget *fullscreenModeLabel, *windowedModeLabel;
    GtkWidget *videoModeLabel;
//  GtkWidget *bitdepthLabel, *resolutionLabel;
    GtkWidget *resolutionLabel;
    GtkWidget *textureDepthLabel;
    GtkWidget *textureCacheLabel;
    GList *resolutionList = NULL, *textureDepthList = NULL;
    //SDL_Rect **modes;
    //static char modeBuf[20][20];

    int i;

    // create dialog
    configWindow = gtk_dialog_new();
    gtk_signal_connect_object( GTK_OBJECT(configWindow), "delete-event",
                               GTK_SIGNAL_FUNC(gtk_widget_hide_on_delete), GTK_OBJECT(configWindow) );
    gtk_signal_connect_object( GTK_OBJECT(configWindow), "show",
                               GTK_SIGNAL_FUNC(configWindow_show), NULL );
    gtk_window_set_title( GTK_WINDOW(configWindow), pluginName );

    // 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(configWindow)->action_area), okButton );

    // cancel button
    cancelButton = gtk_button_new_with_label( "Cancel" );
    gtk_signal_connect_object( GTK_OBJECT(cancelButton), "clicked",
                               GTK_SIGNAL_FUNC(cancelButton_clicked), NULL );
    gtk_container_add( GTK_CONTAINER(GTK_DIALOG(configWindow)->action_area), cancelButton );

    // display frame
    displayFrame = gtk_frame_new( "Display" );
    gtk_container_set_border_width( GTK_CONTAINER(displayFrame), 7 );
    gtk_container_add( GTK_CONTAINER(GTK_DIALOG(configWindow)->vbox), displayFrame );

    displayTable = gtk_table_new( 6, 3, FALSE );
    gtk_container_set_border_width( GTK_CONTAINER(displayTable), 7 );
    gtk_table_set_col_spacings( GTK_TABLE(displayTable), 3 );
    gtk_table_set_row_spacings( GTK_TABLE(displayTable), 3 );
    gtk_container_add( GTK_CONTAINER(displayFrame), displayTable );

/*  fullscreenModeLabel = gtk_label_new( "Fullscreen mode" );
    windowedModeLabel = gtk_label_new( "Windowed mode" );
    bitdepthLabel = gtk_label_new( "Bit depth" );*/
    videoModeLabel = gtk_label_new( "Video mode" );
    resolutionLabel = gtk_label_new( "Resolution" );

/*  for (i = 0; i < 2; i++)
    {
        static GList *bitdepthList = NULL;
        if (!bitdepthList)
        {
            bitdepthList = g_list_append( bitdepthList, "Desktop" );
            bitdepthList = g_list_append( bitdepthList, "16 bit" );
            bitdepthList = g_list_append( bitdepthList, "32 bit" );
        }

        bitdepthCombo[i] = gtk_combo_new();
        gtk_combo_set_value_in_list( GTK_COMBO(bitdepthCombo[i]), TRUE, FALSE );
        gtk_combo_set_popdown_strings( GTK_COMBO(bitdepthCombo[i]), bitdepthList );

        resolutionCombo[i] = gtk_combo_new();
        gtk_combo_set_value_in_list( GTK_COMBO(resolutionCombo[i]), TRUE, FALSE );
    }*/

    // get video mode list
/*  modes = SDL_ListModes( NULL, SDL_HWSURFACE );//SDL_OPENGL | SDL_GL_DOUBLEBUFFER | SDL_HWPALETTE | SDL_HWSURFACE | SDL_HWACCEL );

    if (modes == (SDL_Rect **)0)
    {
        printf( "glNintendo64: No modes available!\n" );
    }
    else if (modes == (SDL_Rect **)-1)
    {
        printf( "glNintendo64: All resolutions available.\n" );
    }
    else
    {
        char buf[200];
        for (i = 0; modes[i]; i++)// ++i)
        {
            sprintf( modeBuf[i], "%d x %d", modes[i]->w, modes[i]->h );
            resolutionList = g_list_append( resolutionList, modeBuf[i] );
        }
    }*/
    resolutionList = g_list_append( resolutionList, (void *)"320 x 240" );
    resolutionList = g_list_append( resolutionList, (void *)"400 x 300" );
    resolutionList = g_list_append( resolutionList, (void *)"480 x 360" );
    resolutionList = g_list_append( resolutionList, (void *)"640 x 480" );
    resolutionList = g_list_append( resolutionList, (void *)"800 x 600" );
    resolutionList = g_list_append( resolutionList, (void *)"960 x 720" );
    resolutionList = g_list_append( resolutionList, (void *)"1024 x 768" );
    resolutionList = g_list_append( resolutionList, (void *)"1152 x 864" );
    resolutionList = g_list_append( resolutionList, (void *)"1280 x 960" );
    resolutionList = g_list_append( resolutionList, (void *)"1280 x 1024" );
    resolutionList = g_list_append( resolutionList, (void *)"1440 x 1080" );
    resolutionList = g_list_append( resolutionList, (void *)"1600 x 1200" );

    resolutionCombo = gtk_combo_new();
    gtk_combo_set_value_in_list( GTK_COMBO(resolutionCombo), TRUE, FALSE );
    gtk_combo_set_popdown_strings( GTK_COMBO(resolutionCombo), resolutionList );
    
    enableAnisotropicFilteringCheck = gtk_check_button_new_with_label( "Enable anisotropic filtering" );
    enable2xSAICheck = gtk_check_button_new_with_label( "Enable 2xSAI texture scaling" );
    forceBilinearCheck = gtk_check_button_new_with_label( "Force bilinear filtering" );
    enableFogCheck = gtk_check_button_new_with_label( "Enable fog" );
    enablePolygonStippleCheck = gtk_check_button_new_with_label( "Enable dithered alpha testing" );

/*  // row 0
    gtk_table_attach_defaults( GTK_TABLE(displayTable), bitdepthLabel, 1, 2, 0, 1 );
    gtk_table_attach_defaults( GTK_TABLE(displayTable), resolutionLabel, 2, 3, 0, 1 );

    // row 1
    gtk_table_attach_defaults( GTK_TABLE(displayTable), fullscreenModeLabel, 0, 1, 1, 2 );
    gtk_table_attach_defaults( GTK_TABLE(displayTable), bitdepthCombo[0], 1, 2, 1, 2 );
    gtk_table_attach_defaults( GTK_TABLE(displayTable), resolutionCombo[0], 2, 3, 1, 2 );

    // row 2
    gtk_table_attach_defaults( GTK_TABLE(displayTable), windowedModeLabel, 0, 1, 2, 3 );
    gtk_table_attach_defaults( GTK_TABLE(displayTable), bitdepthCombo[1], 1, 2, 2, 3 );
    gtk_table_attach_defaults( GTK_TABLE(displayTable), resolutionCombo[1], 2, 3, 2, 3 );
*/
    // row 0
    gtk_table_attach_defaults( GTK_TABLE(displayTable), resolutionLabel, 2, 3, 0, 1 );
    
    // row 1
    gtk_table_attach_defaults( GTK_TABLE(displayTable), videoModeLabel, 0, 1, 1, 2 );
    gtk_table_attach_defaults( GTK_TABLE(displayTable), resolutionCombo, 2, 3, 1, 2 );
    
    // row 3
    gtk_table_attach_defaults( GTK_TABLE(displayTable), enableFogCheck, 0, 1, 3, 4 );
    gtk_table_attach_defaults( GTK_TABLE(displayTable), forceBilinearCheck, 1, 2, 3, 4 );

    // row 4
    gtk_table_attach_defaults( GTK_TABLE(displayTable), enable2xSAICheck, 0, 1, 4, 5 );
    gtk_table_attach_defaults( GTK_TABLE(displayTable), enablePolygonStippleCheck, 1, 2, 4, 5 );
    
    // row 5
    gtk_table_attach_defaults( GTK_TABLE(displayTable), enableAnisotropicFilteringCheck, 0, 1, 5, 6);

    // textures frame
    texturesFrame = gtk_frame_new( "Textures" );
    gtk_container_set_border_width( GTK_CONTAINER(texturesFrame), 7 );
    gtk_container_add( GTK_CONTAINER(GTK_DIALOG(configWindow)->vbox), texturesFrame );

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

    textureDepthLabel = gtk_label_new( "Texture bit depth" );
    textureDepthCombo = gtk_combo_new();
    if (!textureDepthList)
    {
        i = 0;
        while (textureBitDepth[i] != 0)
        {
            textureDepthList = g_list_append( textureDepthList, (void *)textureBitDepth[i] );
            i++;
        }
    }
    gtk_combo_set_popdown_strings( GTK_COMBO(textureDepthCombo), textureDepthList );
    gtk_combo_set_value_in_list( GTK_COMBO(textureDepthCombo), TRUE, FALSE );

    textureCacheLabel = gtk_label_new( "Texture cache size (MB)" );
    textureCacheEntry = gtk_entry_new();
    gtk_entry_set_text( GTK_ENTRY(textureCacheEntry), "0" );

    enableHardwareFBCheck = gtk_check_button_new_with_label( "HW framebuffer textures (experimental)" );

    // row 0
    gtk_table_attach_defaults( GTK_TABLE(texturesTable), textureDepthLabel, 0, 1, 0, 1 );
    gtk_table_attach_defaults( GTK_TABLE(texturesTable), textureDepthCombo, 1, 2, 0, 1 );

    // row 1
    gtk_table_attach_defaults( GTK_TABLE(texturesTable), textureCacheLabel, 0, 1, 1, 2 );
    gtk_table_attach_defaults( GTK_TABLE(texturesTable), textureCacheEntry, 1, 2, 1, 2 );

    // row 2
    gtk_table_attach_defaults( GTK_TABLE(texturesTable), enableHardwareFBCheck, 0, 2, 2, 3 );

    return 0;
}
Exemplo n.º 20
0
gint
save_dialog                  (  ImageInfo       *info)
{
  GtkWidget *dlg;
  GtkWidget *toggle;
  GtkWidget *hbox;
  GtkWidget *vbox;
  GtkWidget *label;
  GtkWidget *entry;
  GtkWidget *frame;
  GtkWidget *toggle_vbox;
  GSList *group;
  gint use_none = (info->save_vals.compression == COMPRESSION_NONE);
  gint use_lzw = (info->save_vals.compression == COMPRESSION_LZW);
  gint use_packbits = (info->save_vals.compression == COMPRESSION_PACKBITS);
  gint use_deflate = (info->save_vals.compression == COMPRESSION_DEFLATE);
  gint use_sgilog = (info->save_vals.compression == COMPRESSION_SGILOG);
  gint use_pixarlog = (info->save_vals.compression == COMPRESSION_PIXARLOG);
  gint use_jpeg = (info->save_vals.compression == COMPRESSION_JPEG);
  gint use_jp2000 = (info->save_vals.compression == COMPRESSION_JP2000);
  gint use_adobe = (info->save_vals.compression == COMPRESSION_ADOBE_DEFLATE);
  gint use_lsb2msb = (info->save_vals.fillorder == FILLORDER_LSB2MSB);
  gint use_msb2lsb = (info->save_vals.fillorder == FILLORDER_MSB2LSB);
  gint use_sep_planar = (info->planar == PLANARCONFIG_SEPARATE);
  gint use_premultiply =(info->save_vals.premultiply == EXTRASAMPLE_ASSOCALPHA);
  gint use_notpremultiply = (info->save_vals.premultiply == EXTRASAMPLE_UNASSALPHA
                    || info->save_vals.premultiply == EXTRASAMPLE_UNSPECIFIED );
  gint use_icc_profile = (info->save_vals.use_icc_profile == TRUE);
  gint use_no_icc      = (info->save_vals.use_icc_profile == FALSE);
  long dircount;
  gchar text[256];

  gimp_ui_init ("save", TRUE);

  dlg = gimp_dialog_new (_("Save as Tiff"), "save",
                            gimp_standard_help_func, "filters/tiff.html",
                            GTK_WIN_POS_MOUSE,
                            FALSE, TRUE, FALSE,

                            _("OK"), ok_callback,
                            NULL, NULL, NULL, TRUE, FALSE,
                            _("Cancel"), cancel_callback,
                            NULL, 1, NULL, FALSE, TRUE,
 
                            NULL);

  gtk_signal_connect (GTK_OBJECT (dlg), "destroy",
		      (GtkSignalFunc) close_callback,
		      NULL);

  /*  attach profile  */
  //LIST_FRAME (_("ICC Profile data"))
  frame = gtk_frame_new (_("ICC Profile data"));
  gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_ETCHED_IN);
  gtk_container_border_width (GTK_CONTAINER (frame), 10);
  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), frame, FALSE, TRUE, 0);
  toggle_vbox = gtk_vbox_new (FALSE, 5);
  gtk_container_border_width (GTK_CONTAINER (toggle_vbox), 5);
  gtk_container_add (GTK_CONTAINER (frame), toggle_vbox);

  group = NULL;

  LIST_TOOGLE ( _("embedd ICC Profile"), use_icc_profile )
  LIST_TOOGLE ( _("dont attach ICC color data"), use_no_icc )

  gtk_widget_show (toggle_vbox);
  gtk_widget_show (frame);
  if (info->save_vals.use_icc_profile == -1)
    gtk_widget_set_sensitive (frame, FALSE); 

  /*  compression  */
  LIST_FRAME (_("Compression"))
  group = NULL;

  LIST_TOOGLE (_("None"), use_none)
#ifdef LZW_SUPPORT
  LIST_TOOGLE (_("LZW"), use_lzw)
#endif
#ifdef PACKBITS_SUPPORT
  LIST_TOOGLE (_("Pack Bits"), use_packbits)
#endif
/*#ifdef ZIP_SUPPORT */
  LIST_TOOGLE ( _("Deflate"), use_deflate)
/*#endif */
/*#ifdef LOGLUV_SUPPORT */
  LIST_TOOGLE (_("SGILOG (32-bit)") , use_sgilog)
  gtk_widget_set_sensitive (toggle, FALSE);
  if (info->bps >= 32 && SGILOGDATAFMT == SGILOGDATAFMT_FLOAT) {
    if (info->profile_size) {
      cmsHPROFILE p = cmsOpenProfileFromMem (info->icc_profile,
                                             info->profile_size);
      if (cmsGetColorSpace(p) == icSigXYZData
       || cmsGetColorSpace(p) == icSigRgbData)
        gtk_widget_set_sensitive (toggle, TRUE);
    }
  }
/*#endif */
#if 0
/*#ifdef PIXARLOG_SUPPORT */
  LIST_TOOGLE ( _("PixarLOG (11-bit)"), use_pixarlog)
  if (info->bps < 32 && SGILOGDATAFMT == SGILOGDATAFMT_FLOAT)
    gtk_widget_set_sensitive (toggle, FALSE); 
/*#endif */
#endif
/*#ifdef JPEG_SUPPORT */
  LIST_TOOGLE ( _("JPEG"), use_jpeg)
  if (info->bps > 8)
    gtk_widget_set_sensitive (toggle, FALSE); 
#if 0
  LIST_TOOGLE ( _("JP2000"), use_jp2000)
#endif
/*#endif */
  LIST_TOOGLE ( _("Adobe"), use_adobe)

  gtk_widget_show (toggle_vbox);
  gtk_widget_show (frame);

  /*  fillorder  */
  LIST_FRAME (_("Fill Order"))
  group = NULL;

  LIST_TOOGLE ( _("LSB to MSB"), use_lsb2msb )
  LIST_TOOGLE ( _("MSB to LSB"), use_msb2lsb )

  gtk_widget_show (toggle_vbox);
  gtk_widget_show (frame);

  /*  premultiply  */
  LIST_FRAME (_("Transparency Computation"))
  group = NULL;

  sprintf (text,_("Premultiply Colour (associate)"));
  if ( info->photomet == PHOTOMETRIC_RGB )
    sprintf (text,"%s - Standard", text);
  LIST_TOOGLE ( text, use_premultiply )
  LIST_TOOGLE ( _("Dont Premultiply"), use_notpremultiply )

  gtk_widget_show (toggle_vbox);
  gtk_widget_show (frame);

  /* separate planes */
  hbox = gtk_hbox_new (FALSE, 1);
  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), hbox, FALSE, FALSE, 0);
  gtk_container_set_border_width (GTK_CONTAINER (hbox), 10);
  gtk_widget_show (hbox);
 
  toggle = gtk_check_button_new_with_label (_("Write Separate Planes per Channel"));
  gtk_box_pack_start (GTK_BOX (hbox), toggle, TRUE, TRUE, 0);
  gtk_widget_show (toggle);

  gtk_signal_connect (GTK_OBJECT (toggle), "toggled",
		      GTK_SIGNAL_FUNC (gimp_toggle_button_update),
		      &use_sep_planar);
  gtk_toggle_button_set_state (GTK_TOGGLE_BUTTON (toggle), use_sep_planar);

  vbox = gtk_vbox_new (FALSE, 2);
  gtk_container_set_border_width (GTK_CONTAINER (vbox), 10);
  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), vbox, FALSE, TRUE, 0);

  if (info->save_vals.premultiply == EXTRASAMPLE_UNSPECIFIED)
    gtk_widget_set_sensitive (frame, FALSE); 


  TEXT_ENTRY ( _("Artist:"), text_entry_callback , image_artist )
  TEXT_ENTRY ( _("Copyright:"), text_entry_callback , image_copyright )
  TEXT_ENTRY ( _("Comment:"), text_entry_callback , image_comment )

  gtk_widget_show (vbox);

  gtk_widget_show (frame);

  gtk_widget_show (dlg);

  gtk_main ();
  gdk_flush ();

  if (use_icc_profile)
    tsvals_.use_icc_profile = TRUE;
  else if (use_no_icc)
    tsvals_.use_icc_profile = FALSE;

  if (use_none)
    tsvals_.compression = COMPRESSION_NONE;
  else if (use_lzw)
    tsvals_.compression = COMPRESSION_LZW;
  else if (use_packbits)
    tsvals_.compression = COMPRESSION_PACKBITS;
  else if (use_deflate)
    tsvals_.compression = COMPRESSION_DEFLATE;
  else if (use_sgilog)
    tsvals_.compression = COMPRESSION_SGILOG;
  else if (use_pixarlog)
    tsvals_.compression = COMPRESSION_PIXARLOG;
  else if (use_jpeg)
    tsvals_.compression = COMPRESSION_JPEG;
  else if (use_jp2000)
    tsvals_.compression = COMPRESSION_JP2000;
  else if (use_adobe)
    tsvals_.compression = COMPRESSION_ADOBE_DEFLATE;

  if (use_lsb2msb)
    tsvals_.fillorder = FILLORDER_LSB2MSB;
  else if (use_msb2lsb)
    tsvals_.fillorder = FILLORDER_MSB2LSB;

  if(use_sep_planar)
    tsvals_.planar_separate = PLANARCONFIG_SEPARATE;
  else
    tsvals_.planar_separate = PLANARCONFIG_CONTIG;

  if (use_premultiply
   && info->save_vals.premultiply != EXTRASAMPLE_UNSPECIFIED) {
    tsvals_.premultiply = EXTRASAMPLE_ASSOCALPHA;
  } else if (use_notpremultiply
        && info->save_vals.premultiply != EXTRASAMPLE_UNSPECIFIED) {
    tsvals_.premultiply = EXTRASAMPLE_UNASSALPHA;
  }

  info = info->top;
  for (dircount=0; dircount < info->pagecount ; dircount++) {
    if (dircount > 0)
      info = info->next;
 
    info->save_vals.use_icc_profile = tsvals_.use_icc_profile;
    info->save_vals.compression = tsvals_.compression;
    info->save_vals.fillorder = tsvals_.fillorder;
    if (info->save_vals.premultiply != EXTRASAMPLE_UNSPECIFIED) {
      info->save_vals.premultiply = tsvals_.premultiply;
    }
    if (use_sgilog || use_pixarlog) {
      if (info->spp > 2)
        info->photomet = PHOTOMETRIC_LOGLUV;
      else
        info->photomet = PHOTOMETRIC_LOGL;
      if (use_sgilog)
        info->logDataFMT = SGILOGDATAFMT;
      else
        info->logDataFMT = PIXARLOGDATAFMT_FLOAT;
    }
    info->planar = tsvals_.planar_separate;
  }

  info = info->top;

  /*g_message ("%d",tsint.run); */
  return tsint.run;
}
Exemplo n.º 21
0
/* Here the fist page of the layout is created */
void create_encoding_layout(GtkWidget *table)
{
GtkWidget *preview_button, *label, *addnorm_button;
GtkWidget *bicubic_button, *player_field, *saveonexit_button;
GtkObject *adjust_scale, *adjust_scale_n;
int table_line;

table_line = 0;

  t_use_yuvplay_pipe = use_yuvplay_pipe;
  t_addoutputnorm = encoding.addoutputnorm;
  t_use_bicubic = use_bicubic; 
  t_fourpelmotion = fourpelmotion;
  t_twopelmotion = twopelmotion;
  sprintf(t_selected_player, "%s", selected_player);
  t_saveonexit = saveonexit;

  label = gtk_label_new ("Save the encoding options when exiting : ");
  gtk_table_attach_defaults (GTK_TABLE (table), 
                             label, 0, 1, table_line, table_line+1);
  gtk_misc_set_alignment(GTK_MISC(label), 0.0, GTK_MISC(label)->yalign);
  gtk_widget_show (label);
  saveonexit_button = gtk_check_button_new();
  gtk_widget_ref (saveonexit_button);
  if (saveonexit != 0)
    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (saveonexit_button), TRUE);
  gtk_signal_connect (GTK_OBJECT (saveonexit_button), "toggled",
                      GTK_SIGNAL_FUNC (set_saveonexit), NULL );
  gtk_table_attach_defaults (GTK_TABLE (table), 
                            saveonexit_button, 1, 2, table_line, table_line+1);
  gtk_widget_show (saveonexit_button);
  table_line++;

  label = gtk_label_new ("Show video while encoding : ");
  gtk_table_attach_defaults (GTK_TABLE (table), 
                             label, 0, 1, table_line, table_line+1);
  gtk_misc_set_alignment(GTK_MISC(label), 0.0, GTK_MISC(label)->yalign);
  gtk_widget_show (label);
  preview_button = gtk_check_button_new();
  gtk_widget_ref (preview_button);
  if (use_yuvplay_pipe) 
    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (preview_button), TRUE);
  gtk_signal_connect (GTK_OBJECT (preview_button), "toggled",
                      GTK_SIGNAL_FUNC (set_encoding_preview), NULL );
  gtk_table_attach_defaults (GTK_TABLE (table), 
                             preview_button, 1, 2, table_line, table_line+1);
  gtk_widget_show (preview_button);
  table_line++;

  label = gtk_label_new ("Add norm when using yuvscaler : ");
  gtk_table_attach_defaults (GTK_TABLE (table), 
                             label, 0, 1, table_line, table_line+1);
  gtk_misc_set_alignment(GTK_MISC(label), 0.0, GTK_MISC(label)->yalign);
  gtk_widget_show (label);
  addnorm_button = gtk_check_button_new();
  gtk_widget_ref (addnorm_button);
  if (encoding.addoutputnorm) 
    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (addnorm_button), TRUE);
  gtk_signal_connect (GTK_OBJECT (addnorm_button), "toggled",
                      GTK_SIGNAL_FUNC (set_addoutputnorm), NULL );
  gtk_table_attach_defaults (GTK_TABLE (table), 
                             addnorm_button, 1, 2, table_line, table_line+1);
  gtk_widget_show (addnorm_button);
  table_line++;
  
  label = gtk_label_new ("Always use bicubic for scaling : ");
  gtk_table_attach_defaults (GTK_TABLE (table), 
                             label, 0, 1, table_line, table_line+1);
  gtk_misc_set_alignment(GTK_MISC(label), 0.0, GTK_MISC(label)->yalign);
  gtk_widget_show (label);
  bicubic_button = gtk_check_button_new();
//  gtk_widget_ref (bicubic_button);
  if (use_bicubic)  /* <- Does the preset of the values -v */
    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (bicubic_button), TRUE);
  gtk_signal_connect (GTK_OBJECT (bicubic_button), "toggled",
                      GTK_SIGNAL_FUNC (set_bicubicuse), NULL );
  gtk_table_attach_defaults (GTK_TABLE (table), 
                             bicubic_button, 1, 2, table_line, table_line+1);
  gtk_widget_show (bicubic_button);
  table_line++;

  label = gtk_label_new (" 4*4-pel subsampled motion comp : ");
  gtk_table_attach_defaults (GTK_TABLE (table), 
                             label, 0, 1, table_line, table_line+1);
  gtk_misc_set_alignment(GTK_MISC(label), 0.0, GTK_MISC(label)->yalign);
  gtk_widget_show (label);

  adjust_scale = gtk_adjustment_new (1.0, 1.0, 5.0, 1, 1.0, 1.0);

  fourpel_scale = gtk_hscale_new (GTK_ADJUSTMENT (adjust_scale));
  gtk_scale_set_value_pos (GTK_SCALE(fourpel_scale), GTK_POS_LEFT);
  gtk_scale_set_digits (GTK_SCALE (fourpel_scale),0);
  gtk_signal_connect (GTK_OBJECT (adjust_scale), "value_changed",
                         GTK_SIGNAL_FUNC (change_four), adjust_scale);
  gtk_table_attach_defaults (GTK_TABLE (table),
                            fourpel_scale, 1, 2, table_line, table_line+1);
  gtk_widget_show (fourpel_scale);
  gtk_adjustment_set_value (GTK_ADJUSTMENT (adjust_scale), t_fourpelmotion);
  table_line++;

  label = gtk_label_new (" 2*2-pel subsampled motion comp : ");
  gtk_table_attach_defaults (GTK_TABLE (table), 
                             label, 0, 1, table_line, table_line+1);
  gtk_misc_set_alignment(GTK_MISC(label), 0.0, GTK_MISC(label)->yalign);
  gtk_widget_show (label);

  adjust_scale_n = gtk_adjustment_new (1.0, 1.0, 5.0, 1, 1.0, 1.0);
  twopel_scale = gtk_hscale_new (GTK_ADJUSTMENT (adjust_scale_n));
  gtk_scale_set_value_pos (GTK_SCALE(twopel_scale), GTK_POS_LEFT);
  gtk_scale_set_digits (GTK_SCALE (twopel_scale),0);
  gtk_signal_connect (GTK_OBJECT (adjust_scale_n), "value_changed",
                         GTK_SIGNAL_FUNC (change_two), adjust_scale_n);
  gtk_table_attach_defaults (GTK_TABLE (table),
                            twopel_scale, 1, 2, table_line, table_line+1);
  gtk_widget_show (twopel_scale);
  gtk_adjustment_set_value (GTK_ADJUSTMENT (adjust_scale_n), t_twopelmotion);
  table_line++;

  label = gtk_label_new (" Player and options for playback : ");
  gtk_table_attach_defaults (GTK_TABLE (table), 
                             label, 0, 1, table_line, table_line+1);
  gtk_misc_set_alignment(GTK_MISC(label), 0.0, GTK_MISC(label)->yalign);
  gtk_widget_show (label);
  
  player_field = gtk_entry_new ();
  gtk_entry_set_text(GTK_ENTRY(player_field), selected_player); 
  gtk_signal_connect(GTK_OBJECT(player_field), "changed",
                     GTK_SIGNAL_FUNC(player_callback), player_field);
  gtk_table_attach_defaults (GTK_TABLE (table), 
                             player_field, 1, 2, table_line, table_line+1);
  gtk_widget_show (player_field);
}
Exemplo n.º 22
0
  /* --- gui functions --- */

#if GIMP_MAJOR_VERSION >= 1  /* GIMP */
static gint   save_dialog    (  ImageInfo       *info)
{
  GtkWidget *dlg;
  GtkWidget *vbox;
  GtkWidget *frame;
  GtkWidget *hbox;
  GtkWidget *label;
  GtkWidget *entry;

#if GIMP_MINOR_VERSION > 2
  dlg = gimp_dialog_new ( _("Save as TIFF"), "tiff",
                         NULL, 0,
			 gimp_standard_help_func, "filters/tiff.html",

                         GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
                         GTK_STOCK_OK,     GTK_RESPONSE_OK,

                         NULL);
#else
  dlg = gimp_dialog_new ( _("Save as TIFF"), "tiff",
			 gimp_standard_help_func, "filters/tiff.html",
			 GTK_WIN_POS_MOUSE,
			 FALSE, TRUE, FALSE,

			 _("OK"), save_ok_callback,
			 NULL, NULL, NULL, TRUE, FALSE,
			 _("Cancel"), gtk_widget_destroy,
			 NULL, 1, NULL, FALSE, TRUE,

			 NULL);

  gtk_signal_connect (GTK_OBJECT (dlg), "destroy",
		      GTK_SIGNAL_FUNC (gtk_main_quit),
		      NULL);
#endif

  vbox = gtk_vbox_new (FALSE, 4);
  gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), vbox, FALSE, TRUE, 0);

  /*  compression  */
#if GIMP_MINOR_VERSION > 2
  frame = gimp_int_radio_group_new (TRUE, _("Compression"),
                                    G_CALLBACK (gimp_radio_button_update),
                                    &tsvals_.compression, tsvals.compression,

                                    _("_None"),      COMPRESSION_NONE,     NULL,
                                    _("_LZW"),       COMPRESSION_LZW,      NULL,
                                    _("_Pack Bits"), COMPRESSION_PACKBITS, NULL,
                                    _("_Deflate"),   COMPRESSION_DEFLATE,  NULL,
                                    _("_JPEG"),      COMPRESSION_JPEG,     NULL,
                                    _("_JP2000"),    COMPRESSION_JP2000,   NULL,
                                    _("_Adobe"),     COMPRESSION_ADOBE_DEFLATE,     NULL,

				    NULL);
  gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
  gtk_widget_show (frame);
  frame = gimp_int_radio_group_new (TRUE, _("Fill Order"),
                                    G_CALLBACK (gimp_radio_button_update),
                                    &tsvals_.fillorder, tsvals.fillorder,

                                    _("_LSB to MSB"),FILLORDER_LSB2MSB,    NULL,
                                    _("_MSB to LSB"),FILLORDER_MSB2LSB,    NULL,

				    NULL);
#else
  frame =
    gimp_radio_group_new2 (TRUE, _("Compression"),
			   gimp_radio_button_update,
			   &tsvals_.compression, GINT_TO_POINTER (tsvals.compression),

			   _("None"),      GINT_TO_POINTER (COMPRESSION_NONE), NULL,
			   _("LZW"),       GINT_TO_POINTER (COMPRESSION_LZW), NULL,
			   _("Pack Bits"), GINT_TO_POINTER (COMPRESSION_PACKBITS), NULL,
			   _("Deflate"),   GINT_TO_POINTER (COMPRESSION_DEFLATE), NULL,
			   _("JPEG"),      GINT_TO_POINTER (COMPRESSION_JPEG), NULL,
			   _("JP2000"),      GINT_TO_POINTER (COMPRESSION_JP2000), NULL,
			   _("Adobe"),      GINT_TO_POINTER (COMPRESSION_ADOBE_DEFLATE), NULL,

			   NULL);
  gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
  gtk_widget_show (frame);
  frame =
    gimp_radio_group_new2 (TRUE, _("Fill Order"),
			   gimp_radio_button_update,
			   &tsvals_.fillorder, GINT_TO_POINTER (tsvals.fillorder),

                           _("LSB to MSB"),      FILLORDER_LSB2MSB,    NULL,
                           _("MSB to LSB"),      FILLORDER_MSB2LSB,    NULL,

			   NULL);
#endif

  gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
  gtk_widget_show (frame);

  /* comment entry */
  hbox = gtk_hbox_new (FALSE, 4);
  gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
  gtk_widget_show (hbox);

  label = gtk_label_new ( _("Comment:"));
  gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
  gtk_widget_show (label);

  entry = gtk_entry_new ();
  gtk_widget_show (entry);
  gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
  if (image_comment && strlen (image_comment) > 1)
    gtk_entry_set_text (GTK_ENTRY (entry), image_comment);
#if GIMP_MINOR_VERSION <= 2
  gtk_signal_connect (GTK_OBJECT (entry), "changed",
                      GTK_SIGNAL_FUNC (text_entry_callback),
                      image_comment);
#endif
  gtk_widget_show (frame);

  gtk_widget_show (vbox);
  gtk_widget_show (dlg);

#if GIMP_MINOR_VERSION > 2
  tsint.run = (gimp_dialog_run (GIMP_DIALOG (dlg)) == GTK_RESPONSE_OK);
#else
  gtk_main ();
#endif
  gdk_flush ();

  return tsint.run;
}
Exemplo n.º 23
0
GtkWidget *createMainWindow( void )
{
  GtkWidget *app;//!< Main container
  GtkWidget *buttonCalc, *buttonClose; 
  GtkWidget *labelHeader;
  GtkWidget *label;
  GtkWidget *boxResistors, *boxConnType;
  GtkWidget *hbox, *vbox;

  // Create new Gnome application
  app = gnome_app_new("gnome1","Menus, menus, menus");

  // Set window properties
  gtk_window_set_title(GTK_WINDOW(app), "Den mest fantastiska elektronikkalkylatorn");
  gtk_window_set_position(GTK_WINDOW(app), GTK_WIN_POS_CENTER);
  gtk_window_set_default_size(GTK_WINDOW(app), 300, 200);
  gnome_app_create_menus( GNOME_APP(app), menubar);

  // Labels
  labelHeader = gtk_label_new("Räkna ut resistansen v1.0");
  label       = gtk_label_new("Typ av koppling:");

  // Entry
  entryNr = gtk_spin_button_new_with_range(1,3,1);
  entryV  = gtk_spin_button_new_with_range(56.34,10000,0.01);
  entryR1 = gtk_spin_button_new_with_range(1234.5 ,1000000000,0.1);
  entryR2 = gtk_spin_button_new_with_range(4321.0,1000000000,0.1);
  entryR3 = gtk_spin_button_new_with_range(5555.5,1000000000,0.1);
  
  // Buttons
  buttonCalc    = gtk_button_new_with_label("Räkna ut");
  buttonClose   = gtk_button_new_with_label("Avsluta");
  radioSerial   = gtk_radio_button_new(NULL);
  radioParalell = gtk_radio_button_new_from_widget( GTK_RADIO_BUTTON( radioSerial ));

  // Set callback functions
  g_signal_connect( GTK_OBJECT (app), "destroy", GTK_SIGNAL_FUNC (closeApp), NULL );
  g_signal_connect( GTK_OBJECT (buttonCalc), "clicked", GTK_SIGNAL_FUNC (buttonClicked), NULL );
  g_signal_connect( GTK_OBJECT (buttonClose), "clicked", GTK_SIGNAL_FUNC (closeApp), NULL );

  // Boxes
  boxResistors = gtk_vbox_new(FALSE, 5);
  boxConnType = gtk_vbox_new(TRUE, 5);
  hbox = gtk_hbox_new(TRUE, 5);
  vbox = gtk_vbox_new(FALSE, 10);

  // Packing boxes and adding labels
  gtk_box_pack_start(GTK_BOX(boxConnType), label, TRUE, FALSE, 5);
  addWidgetWithLabel( GTK_CONTAINER( boxConnType ), "Seriell", radioSerial );
  addWidgetWithLabel( GTK_CONTAINER( boxConnType ), "Parallell", radioParalell );
  addWidgetWithLabel( GTK_CONTAINER( boxConnType ), "Spänning (V):", entryV );
  gtk_box_pack_start(GTK_BOX(boxConnType), buttonClose, TRUE, FALSE, 5);

  addWidgetWithLabel( GTK_CONTAINER(boxResistors), "Antal resistorer:", entryNr);
  addWidgetWithLabel( GTK_CONTAINER(boxResistors), "Resistor #1:", entryR1);
  addWidgetWithLabel( GTK_CONTAINER(boxResistors), "Resistor #2:", entryR2);
  addWidgetWithLabel( GTK_CONTAINER(boxResistors), "Resistor #3:", entryR3);

  gtk_box_pack_start(GTK_BOX(boxResistors), buttonCalc, TRUE, FALSE, 5);
  
  gtk_box_pack_start(GTK_BOX(hbox), boxConnType, FALSE, FALSE, 5);
  gtk_box_pack_start(GTK_BOX(hbox), boxResistors, FALSE, FALSE, 5);

  // Add containers to gnome application
  gnome_app_set_contents( GNOME_APP(app), hbox);

  // Return Gnome app
  return app;
}
Exemplo n.º 24
0
int GTcreatewidget(Gwidget_t * parent, Gwidget_t * widget,
		   int attrn, Gwattr_t * attrp)
{

    PIXsize_t ps;
    char *s;
    int ai;
    int color;
    GdkColor c;

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

    WTU->func = NULL;
    ps.x = ps.y = MINTWSIZE;
    s = "oneline";

    for (ai = 0; ai < attrn; ai++) {
	switch (attrp[ai].id) {
	case G_ATTRSIZE:
	    GETSIZE(attrp[ai].u.s, ps, MINTWSIZE);
	    break;
	case G_ATTRBORDERWIDTH:
	    break;
	case G_ATTRTEXT:
	    break;
	case G_ATTRAPPENDTEXT:
	    Gerr(POS, G_ERRCANNOTSETATTR1, "appendtext");
	    return -1;
	case G_ATTRMODE:
	    s = attrp[ai].u.t;
	    break;
	case G_ATTRCOLOR:
	    color = attrp[ai].u.c.index;
	    if (color != 0 && color != 1) {
		Gerr(POS, G_ERRBADCOLORINDEX, color);
		return -1;
	    }
	    c.red = attrp[ai].u.c.r * 257;
	    c.green = attrp[ai].u.c.g * 257;
	    c.blue = attrp[ai].u.c.b * 257;
/*	                    if (XAllocColor (
			        Gdisplay, DefaultColormap (Gdisplay, Gscreenn), &c
		            )) {
		                if (color == 0)
		                    ADD2ARGS (XtNbackground, c.pixel);
		                else
		                    ADD2ARGS (XtNforeground, c.pixel);
		            }
*/ break;
	case G_ATTRWINDOWID:
	    Gerr(POS, G_ERRCANNOTSETATTR1, "windowid");
	    return -1;
	case G_ATTRNEWLINECB:
	    WTU->func = (Gtwnewlinecb) attrp[ai].u.func;
	    break;
	case G_ATTRUSERDATA:
	    widget->udata = attrp[ai].u.u;
	    break;
	default:
	    Gerr(POS, G_ERRBADATTRID, attrp[ai].id);
	    return -1;
	}
    }

    widget->w = gtk_text_new(NULL, NULL);
    gtk_text_set_editable(widget->w, TRUE);
    gtk_box_pack_start(GTK_BOX(parent->w), widget->w, TRUE, TRUE, 0);

    gtk_signal_connect(GTK_OBJECT(widget->w), "key_press_event",
		       GTK_SIGNAL_FUNC(keyevent), NULL);
    gtk_widget_show(widget->w);

    return 0;
}
Exemplo n.º 25
0
/*
 * mainline..
 */
void ttrans_searchbox(char *title)
{
    int i;

    GtkWidget *scrolled_win;
    GtkWidget *vbox1, *hbox, *hbox0;
    GtkWidget *button1, *button5, *button6;
    gchar *titles[]={"Transaction Process Filter Select"};
    GtkWidget *frame2, *frameh, *frameh0;
    GtkWidget *table;
    GtkTooltips *tooltips;
    GtkWidget *label;
    GtkWidget *entry;

    if(GLOBALS->is_active_ttranslate_c_2) 
	{
	gdk_window_raise(GLOBALS->window_ttranslate_c_5->window);
	return;
	}

    GLOBALS->is_active_ttranslate_c_2=1;
    GLOBALS->current_filter_ttranslate_c_1 = 0;

    /* create a new modal window */
    GLOBALS->window_ttranslate_c_5 = gtk_window_new(GLOBALS->disable_window_manager ? GTK_WINDOW_POPUP : GTK_WINDOW_TOPLEVEL);
    install_focus_cb(GLOBALS->window_ttranslate_c_5, ((char *)&GLOBALS->window_ttranslate_c_5) - ((char *)GLOBALS));

    gtk_window_set_title(GTK_WINDOW (GLOBALS->window_ttranslate_c_5), title);
    gtkwave_signal_connect(GTK_OBJECT (GLOBALS->window_ttranslate_c_5), "delete_event",(GtkSignalFunc) destroy_callback, NULL);

    tooltips=gtk_tooltips_new_2();

    table = gtk_table_new (256, 1, FALSE);
    gtk_widget_show (table);

    vbox1 = gtk_vbox_new (FALSE, 0);
    gtk_container_border_width (GTK_CONTAINER (vbox1), 3);
    gtk_widget_show (vbox1);


    frame2 = gtk_frame_new (NULL);
    gtk_container_border_width (GTK_CONTAINER (frame2), 3);
    gtk_widget_show(frame2);

    gtk_table_attach (GTK_TABLE (table), frame2, 0, 1, 0, 253,
                        GTK_FILL | GTK_EXPAND,
                        GTK_FILL | GTK_EXPAND | GTK_SHRINK, 1, 1);

    GLOBALS->clist_ttranslate_c_2=gtk_clist_new_with_titles(1,titles);
    gtk_clist_column_titles_passive(GTK_CLIST(GLOBALS->clist_ttranslate_c_2)); 

    gtk_clist_set_selection_mode(GTK_CLIST(GLOBALS->clist_ttranslate_c_2), GTK_SELECTION_EXTENDED);
    gtkwave_signal_connect_object (GTK_OBJECT (GLOBALS->clist_ttranslate_c_2), "select_row",GTK_SIGNAL_FUNC(select_row_callback),NULL);
    gtkwave_signal_connect_object (GTK_OBJECT (GLOBALS->clist_ttranslate_c_2), "unselect_row",GTK_SIGNAL_FUNC(unselect_row_callback),NULL);

    for(i=0;i<GLOBALS->num_ttrans_filters;i++)
	{
	gtk_clist_append(GTK_CLIST(GLOBALS->clist_ttranslate_c_2),(gchar **)&(GLOBALS->ttranssel_filter[i+1]));
	}
    gtk_clist_set_column_width(GTK_CLIST(GLOBALS->clist_ttranslate_c_2),0,gtk_clist_optimal_column_width(GTK_CLIST(GLOBALS->clist_ttranslate_c_2),0));

    gtk_widget_show (GLOBALS->clist_ttranslate_c_2);

    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_widget_set_usize( GTK_WIDGET (scrolled_win), -1, 300);
    gtk_widget_show(scrolled_win);

    /* gtk_scrolled_window_add_with_viewport doesn't seen to work right here.. */
    gtk_container_add (GTK_CONTAINER (scrolled_win), GLOBALS->clist_ttranslate_c_2);

    gtk_container_add (GTK_CONTAINER (frame2), scrolled_win);


    frameh0 = gtk_frame_new (NULL);
    gtk_container_border_width (GTK_CONTAINER (frameh0), 3);
    gtk_widget_show(frameh0);
    gtk_table_attach (GTK_TABLE (table), frameh0, 0, 1, 253, 254,
                        GTK_FILL | GTK_EXPAND,
                        GTK_FILL | GTK_EXPAND | GTK_SHRINK, 1, 1);


    hbox0 = gtk_hbox_new (FALSE, 1);
    gtk_widget_show (hbox0);

    button6 = gtk_button_new_with_label (" Add Trans Filter to List ");
    gtk_container_border_width (GTK_CONTAINER (button6), 3);
    gtkwave_signal_connect_object (GTK_OBJECT (button6), "clicked",GTK_SIGNAL_FUNC(add_filter_callback),GTK_OBJECT (GLOBALS->window_ttranslate_c_5));
    gtk_widget_show (button6);
    gtk_tooltips_set_tip_2(tooltips, button6, 
		"Bring up a file requester to add a transaction process filter to the filter select window.",NULL);

    gtk_box_pack_start (GTK_BOX (hbox0), button6, TRUE, FALSE, 0);
    gtk_container_add (GTK_CONTAINER (frameh0), hbox0);

    	/* args entry box */
	{
	Trptr t=GLOBALS->traces.first; 
	while(t) 
	        {
		if(t->flags&TR_HIGHLIGHT)
			{
			if(t->transaction_args)
				{
				if(GLOBALS->ttranslate_args) free_2(GLOBALS->ttranslate_args);
				GLOBALS->ttranslate_args = strdup_2(t->transaction_args);
				break;
				}
	                }

	        t=t->t_next;
	        }      

    	frameh0 = gtk_frame_new (NULL);
    	gtk_container_border_width (GTK_CONTAINER (frameh0), 3);
    	gtk_widget_show(frameh0);
    	gtk_table_attach (GTK_TABLE (table), frameh0, 0, 1, 254, 255, 
                        GTK_FILL | GTK_EXPAND,
                        GTK_FILL | GTK_EXPAND | GTK_SHRINK, 1, 1);
        
	label=gtk_label_new("Args:");
	entry=gtk_entry_new_with_max_length(1025);
    
	gtk_entry_set_text(GTK_ENTRY(entry), GLOBALS->ttranslate_args ? GLOBALS->ttranslate_args : "");
	gtk_signal_connect (GTK_OBJECT (entry), "activate",GTK_SIGNAL_FUNC (args_entry_callback), entry);
	gtk_signal_connect (GTK_OBJECT (entry), "changed",GTK_SIGNAL_FUNC (args_entry_callback), entry);
	hbox0=gtk_hbox_new(FALSE, 0);
	gtk_box_pack_start(GTK_BOX(hbox0), label, FALSE, FALSE, 0);
	gtk_widget_show(label);
	gtk_box_pack_start(GTK_BOX(hbox0), entry, TRUE, TRUE, 0);
	gtk_widget_show(entry);
	gtk_widget_show(hbox0);

	gtk_container_add (GTK_CONTAINER (frameh0), hbox0);
	}

    /* bottom OK/Cancel part */
    frameh = gtk_frame_new (NULL);
    gtk_container_border_width (GTK_CONTAINER (frameh), 3);
    gtk_widget_show(frameh);
    gtk_table_attach (GTK_TABLE (table), frameh, 0, 1, 255, 256,
                        GTK_FILL | GTK_EXPAND,
                        GTK_FILL | GTK_EXPAND | GTK_SHRINK, 1, 1);


    hbox = gtk_hbox_new (FALSE, 1);
    gtk_widget_show (hbox);

    button1 = gtk_button_new_with_label (" OK ");
    gtk_container_border_width (GTK_CONTAINER (button1), 3);
    gtkwave_signal_connect_object (GTK_OBJECT (button1), "clicked",GTK_SIGNAL_FUNC(ok_callback),GTK_OBJECT (GLOBALS->window_ttranslate_c_5));
    gtk_widget_show (button1);
    gtk_tooltips_set_tip_2(tooltips, button1, 
		"Add selected signals to end of the display on the main window.",NULL);

    gtk_box_pack_start (GTK_BOX (hbox), button1, TRUE, FALSE, 0);

    button5 = gtk_button_new_with_label (" Cancel ");
    gtk_container_border_width (GTK_CONTAINER (button5), 3);
    gtkwave_signal_connect_object (GTK_OBJECT (button5), "clicked",GTK_SIGNAL_FUNC(destroy_callback),GTK_OBJECT (GLOBALS->window_ttranslate_c_5));
    gtk_tooltips_set_tip_2(tooltips, button5, 
		"Do nothing and return to the main window.",NULL);
    gtk_widget_show (button5);
    gtk_box_pack_start (GTK_BOX (hbox), button5, TRUE, FALSE, 0);

    gtk_container_add (GTK_CONTAINER (frameh), hbox);
    gtk_container_add (GTK_CONTAINER (GLOBALS->window_ttranslate_c_5), table);

    gtk_widget_set_usize(GTK_WIDGET(GLOBALS->window_ttranslate_c_5), 400, 400);
    gtk_widget_show(GLOBALS->window_ttranslate_c_5);
}
Exemplo n.º 26
0
bool wxClipboard::AddData( wxDataObject *data )
{
    wxCHECK_MSG( m_open, FALSE, wxT("clipboard not open") );

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

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

    m_data = data;

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

    // primary selection or clipboard
    GdkAtom clipboard = m_usePrimary ? (GdkAtom)GDK_SELECTION_PRIMARY
                                     : g_clipboardAtom;


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

//        printf( "added %s\n", 
//                    gdk_atom_name( array[i].GetFormatId() ) );
                    
        gtk_selection_add_target( GTK_WIDGET(m_clipboardWidget),
                                  clipboard,
                                  array[i],
                                  0 );  /* what is info ? */
    }

    delete[] array;

    gtk_signal_connect( GTK_OBJECT(m_clipboardWidget),
                        "selection_get",
                        GTK_SIGNAL_FUNC(selection_handler),
                        (gpointer) NULL );

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

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

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

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

    return res;
}
Exemplo n.º 27
0
char* get_filename_from_dialog(const char* filenamechoice, int action) {
  gchar* save_filename;
  char* filename_return;
  char* ret_val = NULL;
#ifdef USE_GTK_FILE_CHOOSER
  GtkWidget* file_selection_dialog =
    gtk_file_chooser_dialog_new("Please select a place to download to",
				GTK_WINDOW(main_window), //meaningless?
				action,
				GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
				GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
				NULL);
  if (filenamechoice != NULL)
    gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(file_selection_dialog), filenamechoice);
  if (gtk_dialog_run(GTK_DIALOG(file_selection_dialog)) == GTK_RESPONSE_ACCEPT) {
    save_filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(file_selection_dialog));
    filename_return = (char*)malloc(strlen(save_filename) + 1);
    if (filename_return == NULL) { //no memory left, maybe
      return NULL; //just give up
    }
    strcpy(filename_return, save_filename);
    gtk_widget_destroy(file_selection_dialog);
    return filename_return;
  } else { //user cancelled
    gtk_widget_destroy(file_selection_dialog);
    
    return NULL;
  }
#else
  GtkFileSelection* file_selection_box =  gtk_file_selection_new("Choose a file");
  gboolean confirmed = FALSE;
  /*  g_signal_connect (GTK_FILE_SELECTION(file_selection_box)->ok_button,
		    "clicked",
		    G_CALLBACK(store_filename),
		    file_selection_box);*/

  
  //  gtk_window_set_modal(GTK_WINDOW(file_selection_box), TRUE);

  gtk_signal_connect (GTK_OBJECT (file_selection_box), "delete_event",
		      GTK_SIGNAL_FUNC(gtk_main_quit), NULL);
  gtk_signal_connect (GTK_OBJECT (file_selection_box->ok_button), "clicked",
		      GTK_SIGNAL_FUNC(file_selection_ok),
		      &confirmed);
  gtk_signal_connect (GTK_OBJECT (file_selection_box->cancel_button), "clicked",
		      GTK_SIGNAL_FUNC(gtk_main_quit), NULL);



  gtk_window_set_modal (GTK_WINDOW (file_selection_box), TRUE);

  gtk_widget_show(GTK_WIDGET(file_selection_box));
  
  gtk_grab_add (GTK_WIDGET (file_selection_box));
  gtk_main ();
  if (confirmed) {
    ret_val = store_filename(file_selection_box);
  } else {
    ret_val = NULL;
  }
  gtk_widget_destroy(file_selection_box);
  return ret_val;
#endif
}
Exemplo n.º 28
0
GtkWidget *build_admin_interface(GtkWidget * vbox)
{
	GtkWidget *hbox;
	GtkWidget *frame;
	GtkWidget *table;
	GtkWidget *label;
	GtkObject *adj;
	GtkWidget *start_btn;
	GtkWidget *scroll_win;
	GtkWidget *message_text;

	static gchar *titles[2];

	if (!vbox)
		vbox = gtk_vbox_new(FALSE, 0);

	if (!titles[0]) {
		titles[0] = _("Name");
		titles[1] = _("Location");
	}

	gtk_widget_show(vbox);
	gtk_container_border_width(GTK_CONTAINER(vbox), 5);

	hbox = gtk_hbox_new(FALSE, 5);
	gtk_widget_show(hbox);
	gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0);

	frame = gtk_frame_new(_("Server Parameters"));
	gtk_widget_show(frame);
	gtk_box_pack_start(GTK_BOX(hbox), frame, FALSE, TRUE, 0);

	table = gtk_table_new(6, 3, FALSE);
	gtk_widget_show(table);
	gtk_container_add(GTK_CONTAINER(frame), table);
	gtk_container_border_width(GTK_CONTAINER(table), 3);
	gtk_table_set_row_spacings(GTK_TABLE(table), 3);
	gtk_table_set_col_spacings(GTK_TABLE(table), 5);

	label = gtk_label_new(_("Game Name"));
	gtk_widget_show(label);
	gtk_table_attach(GTK_TABLE(table), label, 0, 1, 0, 1,
			 (GtkAttachOptions) GTK_FILL,
			 (GtkAttachOptions) GTK_EXPAND | GTK_FILL, 0, 0);
	gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);

	game_combo = gtk_combo_new();
	gtk_editable_set_editable(GTK_EDITABLE
				  (GTK_COMBO(game_combo)->entry), FALSE);
	gtk_widget_set_usize(game_combo, 100, -1);
	gtk_signal_connect(GTK_OBJECT(GTK_COMBO(game_combo)->list),
			   "select_child",
			   GTK_SIGNAL_FUNC(game_select_cb), NULL);
	gtk_widget_show(game_combo);
	gtk_table_attach(GTK_TABLE(table), game_combo, 1, 3, 0, 1,
			 (GtkAttachOptions) GTK_FILL,
			 (GtkAttachOptions) GTK_EXPAND | GTK_FILL, 0, 0);

	label = gtk_label_new(_("Map Terrain"));
	gtk_widget_show(label);
	gtk_table_attach(GTK_TABLE(table), label, 0, 1, 1, 2,
			 (GtkAttachOptions) GTK_FILL,
			 (GtkAttachOptions) GTK_EXPAND | GTK_FILL, 0, 0);
	gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);

	terrain_toggle = gtk_toggle_button_new_with_label("");
	gtk_widget_show(terrain_toggle);
	gtk_table_attach(GTK_TABLE(table), terrain_toggle, 1, 2, 1, 2,
			 (GtkAttachOptions) GTK_FILL,
			 (GtkAttachOptions) GTK_EXPAND | GTK_FILL, 0, 0);
	gtk_signal_connect(GTK_OBJECT(terrain_toggle), "toggled",
			   GTK_SIGNAL_FUNC(terrain_toggle_cb), NULL);

	label = gtk_label_new(_("Number of Players"));
	gtk_widget_show(label);
	gtk_table_attach(GTK_TABLE(table), label, 0, 1, 2, 3,
			 (GtkAttachOptions) GTK_FILL,
			 (GtkAttachOptions) GTK_EXPAND | GTK_FILL, 0, 0);
	gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);

	adj = gtk_adjustment_new(0, 2, MAX_PLAYERS, 1, 1, 0);
	players_spin = gtk_spin_button_new(GTK_ADJUSTMENT(adj), 1, 0);
	gtk_widget_show(players_spin);
	gtk_table_attach(GTK_TABLE(table), players_spin, 1, 2, 2, 3,
			 (GtkAttachOptions) GTK_FILL,
			 (GtkAttachOptions) GTK_EXPAND | GTK_FILL, 0, 0);
	gtk_signal_connect(GTK_OBJECT(players_spin), "changed",
			   GTK_SIGNAL_FUNC(players_spin_changed_cb), NULL);

	label = gtk_label_new(_("Victory Point Target"));
	gtk_widget_show(label);
	gtk_table_attach(GTK_TABLE(table), label, 0, 1, 3, 4,
			 (GtkAttachOptions) GTK_FILL,
			 (GtkAttachOptions) GTK_EXPAND | GTK_FILL, 0, 0);
	gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);

	adj = gtk_adjustment_new(10, 5, 20, 1, 5, 0);
	victory_spin = gtk_spin_button_new(GTK_ADJUSTMENT(adj), 1, 0);
	gtk_widget_show(victory_spin);
	gtk_table_attach(GTK_TABLE(table), victory_spin, 1, 2, 3, 4,
			 (GtkAttachOptions) GTK_FILL,
			 (GtkAttachOptions) GTK_EXPAND | GTK_FILL, 0, 0);
	gtk_signal_connect(GTK_OBJECT(victory_spin), "changed",
			   GTK_SIGNAL_FUNC(victory_spin_changed_cb), NULL);

	label = gtk_label_new(_("Register Server"));
	gtk_widget_show(label);
	gtk_table_attach(GTK_TABLE(table), label, 0, 1, 4, 5,
			 (GtkAttachOptions) GTK_FILL,
			 (GtkAttachOptions) GTK_EXPAND | GTK_FILL, 0, 0);
	gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);

	register_toggle = gtk_toggle_button_new_with_label(_("No"));
	gtk_widget_show(register_toggle);
	gtk_table_attach(GTK_TABLE(table), register_toggle, 1, 2, 4, 5,
			 (GtkAttachOptions) GTK_FILL,
			 (GtkAttachOptions) GTK_EXPAND | GTK_FILL, 0, 0);
	gtk_signal_connect(GTK_OBJECT(register_toggle), "toggled",
			   GTK_SIGNAL_FUNC(register_toggle_cb), NULL);
	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(register_toggle),
				     TRUE);
	/* gtk_toggle_button_toggled(GTK_TOGGLE_BUTTON(register_toggle)); */

	label = gtk_label_new("Server Port");
	gtk_widget_show(label);
	gtk_table_attach(GTK_TABLE(table), label, 0, 1, 5, 6,
			 (GtkAttachOptions) GTK_FILL,
			 (GtkAttachOptions) GTK_EXPAND | GTK_FILL, 0, 0);
	gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5);

	adj = gtk_adjustment_new(server_port_int, 1024, 32767, 1, 10, 0);
	port_spin = gtk_spin_button_new(GTK_ADJUSTMENT(adj), 1, 0);
	gtk_widget_show(port_spin);
	gtk_table_attach(GTK_TABLE(table), port_spin, 1, 2, 5, 6,
			 (GtkAttachOptions) GTK_FILL,
			 (GtkAttachOptions) GTK_EXPAND | GTK_FILL, 0, 0);
	gtk_widget_set_usize(port_spin, 60, -1);
	gtk_signal_connect(GTK_OBJECT(port_spin), "changed",
			   GTK_SIGNAL_FUNC(port_spin_changed_cb), NULL);

	start_btn = gtk_button_new_with_label(_("Start Server"));
	gtk_widget_show(start_btn);
	gtk_table_attach(GTK_TABLE(table), start_btn, 0, 2, 6, 7,
			 (GtkAttachOptions) GTK_FILL,
			 (GtkAttachOptions) GTK_EXPAND | GTK_FILL, 0, 0);
	gtk_signal_connect(GTK_OBJECT(start_btn), "clicked",
			   GTK_SIGNAL_FUNC(start_clicked_cb), NULL);

	frame = gtk_frame_new(_("Players Connected"));
	gtk_widget_show(frame);
	gtk_box_pack_start(GTK_BOX(hbox), frame, TRUE, TRUE, 0);
	gtk_widget_set_usize(frame, 250, -1);

	scroll_win = gtk_scrolled_window_new(NULL, NULL);
	gtk_widget_show(scroll_win);
	gtk_container_add(GTK_CONTAINER(frame), scroll_win);
	gtk_container_border_width(GTK_CONTAINER(scroll_win), 3);
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll_win),
				       GTK_POLICY_AUTOMATIC,
				       GTK_POLICY_AUTOMATIC);

	clist = gtk_clist_new_with_titles(2, titles);
	gtk_widget_show(clist);
	gtk_container_add(GTK_CONTAINER(scroll_win), clist);
	gtk_clist_set_column_width(GTK_CLIST(clist), 0, 80);
	gtk_clist_set_column_width(GTK_CLIST(clist), 1, 80);
	gtk_clist_column_titles_show(GTK_CLIST(clist));
	gtk_clist_column_titles_passive(GTK_CLIST(clist));

	frame = gtk_frame_new(_("Messages"));
	gtk_widget_show(frame);
	gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0);

	scroll_win = gtk_scrolled_window_new(NULL, NULL);
	gtk_widget_show(scroll_win);
	gtk_container_add(GTK_CONTAINER(frame), scroll_win);
	gtk_container_border_width(GTK_CONTAINER(scroll_win), 3);
	gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll_win),
				       GTK_POLICY_AUTOMATIC,
				       GTK_POLICY_AUTOMATIC);

	return vbox;
}
Exemplo n.º 29
0
void l_prov_usl(short dd,short md,short gd,
int podr,
int tipz,
const char *nomdok,
const char *nomdokp,
const char *kontr,
const char *kodop,
int lnds,
double sumad,//Сумма по документа
double sumkor, //Сумма корректировки к документа
float pnds,
GtkWidget *wpredok)
{
class prov_usl_data data;
char strsql[512];
SQL_str row;
SQLCURSOR cur;
iceb_u_str shet_suma;
sprintf(data.imaf_prot,"uslpr%d.tmp",getpid());

prosprusw(1,podr,dd,md,gd,nomdok,tipz,lnds,kodop,pnds,NULL,wpredok);
prosprusw(2,podr,dd,md,gd,nomdok,tipz,lnds,kodop,pnds,&shet_suma,wpredok);

data.tipz=tipz;
data.dd=dd;
data.md=md;
data.gd=gd;
data.nomdok.plus(nomdok);
data.podr=podr;
strcpy(data.metkasys,gettext("УСЛ"));
data.kontr.plus(kontr);
data.kodop.plus(kodop);
data.lnds=lnds;
data.nomdokp.plus(nomdokp);
data.sumkor=sumkor;
data.pnds=pnds;

//Читаем наименование склада
sprintf(strsql,"select naik from Sklad where kod=%d",podr);
if(iceb_sql_readkey(strsql,&row,&cur,wpredok) == 1)
 data.naim_podr.new_plus(row[0]);

//Читаем наименование операции
if(tipz == 1)
  sprintf(strsql,"select naik from Usloper1 where kod='%s'",kodop);
if(tipz == 2)
  sprintf(strsql,"select naik from Usloper2 where kod='%s'",kodop);
if(iceb_sql_readkey(strsql,&row,&cur,wpredok) == 1)
 data.naim_kodop.new_plus(row[0]);

//Читаем наименование контрагента
sprintf(strsql,"select naikon from Kontragent where kodkon='%s'",kontr);
if(iceb_sql_readkey(strsql,&row,&cur,wpredok) == 1)
 data.naim_kontr.new_plus(row[0]);


data.window = gtk_window_new (GTK_WINDOW_TOPLEVEL);

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

sprintf(strsql,"%s %s",name_system,
gettext("Работа с проводками (учёт услуг)"));

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

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


if(wpredok != NULL)
 {
  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(prov_usl_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);

data.label_sheta=gtk_label_new (shet_suma.ravno_toutf());
PangoFontDescription *font_pango=pango_font_description_from_string(shrift_ravnohir.ravno());
gtk_widget_modify_font(GTK_WIDGET(data.label_sheta),font_pango);
pango_font_description_free(font_pango);

gtk_box_pack_start (GTK_BOX (hbox), vbox1, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox), vbox2, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (hbox),data.label_sheta,FALSE, FALSE, 0);
gtk_widget_show_all(hbox);

data.label_kolstr=gtk_label_new ("");

iceb_u_str stroka;

prov_usl_sapka_menu(&data);



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

gtk_widget_show(vbox1);
gtk_widget_show(vbox2);


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

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

GtkWidget *hboxradio = gtk_hbox_new (TRUE, 0);

//Вставляем радиокнопки
GSList *group;

data.radiobutton[0]=gtk_radio_button_new_with_label(NULL,gettext("Дебет"));
//  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data.radiobutton[0]),TRUE); //Устанавливем активной кнопку
gtk_box_pack_start (GTK_BOX (hboxradio),data.radiobutton[0], TRUE, TRUE, 0);
gtk_signal_connect(GTK_OBJECT(data.radiobutton[0]), "clicked",GTK_SIGNAL_FUNC(prov_usl_radio0),&data);
//gtk_object_set_user_data(GTK_OBJECT(data.radiobutton0),(gpointer)"0");

group=gtk_radio_button_group(GTK_RADIO_BUTTON(data.radiobutton[0]));

sprintf(strsql,"%s",gettext("Кредит"));
data.radiobutton[1]=gtk_radio_button_new_with_label(group,strsql);
//  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data.radiobutton[1]),TRUE); //Устанавливем активной кнопку
gtk_signal_connect(GTK_OBJECT(data.radiobutton[1]), "clicked",GTK_SIGNAL_FUNC(prov_usl_radio1),&data);
gtk_box_pack_start (GTK_BOX (hboxradio),data.radiobutton[1], TRUE, TRUE, 0);

group=gtk_radio_button_group(GTK_RADIO_BUTTON(data.radiobutton[1]));

sprintf(strsql,"%s",gettext("Все"));
data.radiobutton[2]=gtk_radio_button_new_with_label(group,strsql);
//  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(data.radiobutton[2]),TRUE); //Устанавливем активной кнопку
gtk_signal_connect(GTK_OBJECT(data.radiobutton[2]), "clicked",GTK_SIGNAL_FUNC(prov_usl_radio2),&data);
gtk_box_pack_start (GTK_BOX (hboxradio),data.radiobutton[2], TRUE, TRUE, 0);

gtk_box_pack_start(GTK_BOX (vbox2), hboxradio, FALSE,FALSE, 0);
gtk_widget_show_all(hboxradio);

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

sprintf(strsql,"F2 %s",gettext("Ввести"));
data.knopka[FK2]=gtk_button_new_with_label(strsql);
gtk_signal_connect(GTK_OBJECT(data.knopka[FK2]), "clicked",GTK_SIGNAL_FUNC(prov_usl_knopka),&data);
gtk_box_pack_start(GTK_BOX(vbox1), data.knopka[FK2],TRUE,TRUE, 0);
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(strsql,"%sF2 %s",RFK,gettext("Корректировать"));
data.knopka[SFK2]=gtk_button_new_with_label(strsql);
gtk_signal_connect(GTK_OBJECT(data.knopka[SFK2]), "clicked",GTK_SIGNAL_FUNC(prov_usl_knopka),&data);
gtk_box_pack_start(GTK_BOX(vbox1), data.knopka[SFK2],TRUE,TRUE, 0);
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(strsql,"F3 %s",gettext("Удалить"));
data.knopka[FK3]=gtk_button_new_with_label(strsql);
gtk_signal_connect(GTK_OBJECT(data.knopka[FK3]), "clicked",GTK_SIGNAL_FUNC(prov_usl_knopka),&data);
gtk_box_pack_start(GTK_BOX(vbox1), data.knopka[FK3],TRUE,TRUE, 0);
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(strsql,"%sF3 %s",RFK,gettext("Удалить"));
data.knopka[SFK3]=gtk_button_new_with_label(strsql);
gtk_signal_connect(GTK_OBJECT(data.knopka[SFK3]), "clicked",GTK_SIGNAL_FUNC(prov_usl_knopka),&data);
gtk_box_pack_start(GTK_BOX(vbox1), data.knopka[SFK3],TRUE,TRUE, 0);
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(strsql,"F4 %s",gettext("Проводки"));
data.knopka[FK4]=gtk_button_new_with_label(strsql);
gtk_signal_connect(GTK_OBJECT(data.knopka[FK4]), "clicked",GTK_SIGNAL_FUNC(prov_usl_knopka),&data);
gtk_box_pack_start(GTK_BOX(vbox1), data.knopka[FK4],TRUE,TRUE, 0);
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(strsql,"%sF4 %s",RFK,gettext("Просмотр"));
data.knopka[SFK4]=gtk_button_new_with_label(strsql);
gtk_signal_connect(GTK_OBJECT(data.knopka[SFK4]), "clicked",GTK_SIGNAL_FUNC(prov_usl_knopka),&data);
gtk_box_pack_start(GTK_BOX(vbox1), data.knopka[SFK4],TRUE,TRUE, 0);
tooltips[SFK4]=gtk_tooltips_new();
gtk_tooltips_set_tip(tooltips[SFK4],data.knopka[SFK4],gettext("Просмотр протокола хода автоматичного виконання проводок"),NULL);
gtk_object_set_user_data(GTK_OBJECT(data.knopka[SFK4]),(gpointer)SFK4);
gtk_widget_show(data.knopka[SFK4]);

sprintf(strsql,"F5 %s",gettext("Настройка"));
data.knopka[FK5]=gtk_button_new_with_label(strsql);
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(prov_usl_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(strsql,"%sF5 %s",RFK,gettext("Печать"));
data.knopka[SFK5]=gtk_button_new_with_label(strsql);
gtk_box_pack_start(GTK_BOX(vbox1), data.knopka[SFK5],TRUE,TRUE, 0);
gtk_signal_connect(GTK_OBJECT(data.knopka[SFK5]), "clicked",GTK_SIGNAL_FUNC(prov_usl_knopka),&data);
tooltips[SFK5]=gtk_tooltips_new();
gtk_tooltips_set_tip(tooltips[SFK5],data.knopka[SFK5],gettext("Распечатка проводок"),NULL);
gtk_object_set_user_data(GTK_OBJECT(data.knopka[SFK5]),(gpointer)SFK5);
gtk_widget_show(data.knopka[SFK5]);

sprintf(strsql,"F6 %s",gettext("Проводки"));
data.knopka[FK6]=gtk_button_new_with_label(strsql);
gtk_signal_connect(GTK_OBJECT(data.knopka[FK6]), "clicked",GTK_SIGNAL_FUNC(prov_usl_knopka),&data);
gtk_box_pack_start(GTK_BOX(vbox1), data.knopka[FK6],TRUE,TRUE, 0);
tooltips[FK6]=gtk_tooltips_new();
gtk_tooltips_set_tip(tooltips[FK6],data.knopka[FK6],gettext("Автоматическое выполнение проводок с использованием списка настройки"),NULL);
gtk_object_set_user_data(GTK_OBJECT(data.knopka[FK6]),(gpointer)FK6);
gtk_widget_show(data.knopka[FK6]);

sprintf(strsql,"F9 %s",gettext("Оплата"));
data.knopka[FK9]=gtk_button_new_with_label(strsql);
gtk_signal_connect(GTK_OBJECT(data.knopka[FK9]), "clicked",GTK_SIGNAL_FUNC(prov_usl_knopka),&data);
gtk_box_pack_start(GTK_BOX(vbox1), data.knopka[FK9],TRUE,TRUE, 0);
tooltips[FK9]=gtk_tooltips_new();
gtk_tooltips_set_tip(tooltips[FK9],data.knopka[FK9],gettext("Переход в режим ввода и корректировки оплат к документу"),NULL);
gtk_object_set_user_data(GTK_OBJECT(data.knopka[FK9]),(gpointer)FK9);
gtk_widget_show(data.knopka[FK9]);

sprintf(strsql,"F10 %s",gettext("Выход"));
data.knopka[FK10]=gtk_button_new_with_label(strsql);
gtk_box_pack_start(GTK_BOX(vbox1),data.knopka[FK10],TRUE,TRUE, 0);
tooltips[FK10]=gtk_tooltips_new();
gtk_tooltips_set_tip(tooltips[FK10],data.knopka[FK10],gettext("Завершение работы в этом окне"),NULL);
gtk_signal_connect(GTK_OBJECT(data.knopka[FK10]), "clicked",GTK_SIGNAL_FUNC(prov_usl_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]);

prov_usl_create_list(&data);

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


gtk_main();

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


}
Exemplo n.º 30
0
bool wxMiniFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title,
      const wxPoint &pos, const wxSize &size,
      long style, const wxString &name )
{
    style = style | wxCAPTION;

    if ((style & wxCAPTION) || (style & wxTINY_CAPTION))
        m_miniTitle = 13;

    m_miniEdge = 3;
    m_isDragging = false;
    m_oldX = -1;
    m_oldY = -1;
    m_diffX = 0;
    m_diffY = 0;

    wxFrame::Create( parent, id, title, pos, size, style, name );

    if (m_parent && (GTK_IS_WINDOW(m_parent->m_widget)))
    {
        gtk_window_set_transient_for( GTK_WINDOW(m_widget), GTK_WINDOW(m_parent->m_widget) );
    }

    if ((style & wxSYSTEM_MENU) &&
        ((style & wxCAPTION) || (style & wxTINY_CAPTION)))
    {
        GdkBitmap *mask = NULL;
        GdkPixmap *pixmap = gdk_pixmap_create_from_xpm_d
                            (
                                wxGetRootWindow()->window,
                                &mask,
                                NULL,
                                (char **)cross_xpm
                            );

        GtkWidget *pw = gtk_pixmap_new( pixmap, mask );
        gdk_bitmap_unref( mask );
        gdk_pixmap_unref( pixmap );
        gtk_widget_show( pw );

        GtkWidget *close_button = gtk_button_new();
        gtk_container_add( GTK_CONTAINER(close_button), pw );

        gtk_pizza_put( GTK_PIZZA(m_mainWidget),
                         close_button,
                         size.x-16, 4, 11, 11 );

        gtk_widget_show( close_button );

        gtk_signal_connect( GTK_OBJECT(close_button), "clicked",
          GTK_SIGNAL_FUNC(gtk_button_clicked_callback), (gpointer*)this );
    }

    /* these are called when the borders are drawn */
    gtk_signal_connect( GTK_OBJECT(m_mainWidget), "expose_event",
        GTK_SIGNAL_FUNC(gtk_window_own_expose_callback), (gpointer)this );

    gtk_signal_connect( GTK_OBJECT(m_mainWidget), "draw",
       GTK_SIGNAL_FUNC(gtk_window_own_draw_callback), (gpointer)this );

    /* these are required for dragging the mini frame around */
    gtk_signal_connect( GTK_OBJECT(m_mainWidget), "button_press_event",
      GTK_SIGNAL_FUNC(gtk_window_button_press_callback), (gpointer)this );

    gtk_signal_connect( GTK_OBJECT(m_mainWidget), "button_release_event",
      GTK_SIGNAL_FUNC(gtk_window_button_release_callback), (gpointer)this );

    gtk_signal_connect( GTK_OBJECT(m_mainWidget), "motion_notify_event",
      GTK_SIGNAL_FUNC(gtk_window_motion_notify_callback), (gpointer)this );

    return true;
}