Пример #1
0
void gui_init(struct dt_iop_module_t *self)
{
  self->gui_data = malloc(sizeof(dt_iop_lowpass_gui_data_t));
  dt_iop_lowpass_gui_data_t *g = (dt_iop_lowpass_gui_data_t *)self->gui_data;
  dt_iop_lowpass_params_t *p = (dt_iop_lowpass_params_t *)self->params;

  self->widget = gtk_vbox_new(TRUE, DT_BAUHAUS_SPACE);

#if 0 // gaussian is order not user selectable here, as it does not make much sense for a lowpass filter
  GtkBox *hbox  = GTK_BOX(gtk_hbox_new(FALSE, 5));
  gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(hbox), FALSE, FALSE, 0);
  GtkWidget *label = dtgtk_reset_label_new(_("filter order"), self, &p->order, sizeof(float));
  gtk_box_pack_start(hbox, label, FALSE, FALSE, 0);
  g->order = GTK_COMBO_BOX(gtk_combo_box_new_text());
  gtk_combo_box_append_text(g->order, _("0th order"));
  gtk_combo_box_append_text(g->order, _("1st order"));
  gtk_combo_box_append_text(g->order, _("2nd order"));
  gtk_object_set(GTK_OBJECT(g->order), "tooltip-text", _("filter order of gaussian blur"), (char *)NULL);
  gtk_box_pack_start(hbox, GTK_WIDGET(g->order), TRUE, TRUE, 0);
#endif

  g->scale1 = dt_bauhaus_slider_new_with_range(self,0.1, 200.0, 0.1, p->radius, 2);
  g->scale2 = dt_bauhaus_slider_new_with_range(self,-3.0, 3.0, 0.01, p->contrast, 2);
  g->scale3 = dt_bauhaus_slider_new_with_range(self,-3.0, 3.0, 0.01, p->saturation, 2);

  dt_bauhaus_widget_set_label(g->scale1,_("radius"));
  dt_bauhaus_widget_set_label(g->scale2,_("contrast"));
  dt_bauhaus_widget_set_label(g->scale3,_("saturation"));

  g->bilat  = dt_bauhaus_combobox_new(self);
  dt_bauhaus_widget_set_label(g->bilat, _("soften with"));
  dt_bauhaus_combobox_add(g->bilat, _("gaussian"));
  dt_bauhaus_combobox_add(g->bilat, _("bilateral filter"));

  gtk_box_pack_start(GTK_BOX(self->widget), g->scale1, TRUE, TRUE, 0);
  gtk_box_pack_start(GTK_BOX(self->widget), g->bilat,  TRUE, TRUE, 0);
  gtk_box_pack_start(GTK_BOX(self->widget), g->scale2, TRUE, TRUE, 0);
  gtk_box_pack_start(GTK_BOX(self->widget), g->scale3, TRUE, TRUE, 0);
  gtk_object_set(GTK_OBJECT(g->scale1), "tooltip-text", _("radius of gaussian/bilateral blur"), (char *)NULL);
  gtk_object_set(GTK_OBJECT(g->scale2), "tooltip-text", _("contrast of lowpass filter"), (char *)NULL);
  gtk_object_set(GTK_OBJECT(g->scale3), "tooltip-text", _("color saturation of lowpass filter"), (char *)NULL);
  gtk_object_set(GTK_OBJECT(g->bilat),  "tooltip-text", _("which filter to use for blurring"), (char *)NULL);

  g_signal_connect (G_OBJECT (g->scale1), "value-changed",
                    G_CALLBACK (radius_callback), self);
  g_signal_connect (G_OBJECT (g->bilat), "value-changed",
                    G_CALLBACK (bilat_callback), self);
  g_signal_connect (G_OBJECT (g->scale2), "value-changed",
                    G_CALLBACK (contrast_callback), self);
  g_signal_connect (G_OBJECT (g->scale3), "value-changed",
                    G_CALLBACK (saturation_callback), self);
#if 0 // gaussian order not user selectable
  g_signal_connect (G_OBJECT (g->order), "changed",
                    G_CALLBACK (order_changed), self);
#endif
}
Пример #2
0
Файл: main.c Проект: chipx86/gtk
int
main (int argc, char **argv)
{
  GtkWidget *window;
  GtkWidget *notebook;
  GtkWidget *hbox;
  GtkWidget *tree;
  GtkTextTag *tag;

  gtk_init (&argc, &argv);
  
  window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
  g_signal_connect (window, "destroy",
                    G_CALLBACK (gtk_main_quit), NULL);

  hbox = gtk_hbox_new (FALSE, 0);
  gtk_container_add (GTK_CONTAINER (window), hbox);

  tree = create_tree ();
  gtk_box_pack_start (GTK_BOX (hbox), tree, FALSE, FALSE, 0);

  notebook = gtk_notebook_new ();
  gtk_box_pack_start (GTK_BOX (hbox), notebook, TRUE, TRUE, 0);

  gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
			    create_text (&info_buffer, FALSE),
			    gtk_label_new ("Info"));


  gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
			    create_text (&source_buffer, TRUE),
			    gtk_label_new ("Source"));

  tag = gtk_text_buffer_create_tag (info_buffer, "title");
  gtk_object_set (GTK_OBJECT (tag),
		 "font", "Sans 18",
		 NULL);

  tag = gtk_text_buffer_create_tag (info_buffer, "source");
  gtk_object_set (GTK_OBJECT (tag),
		  "font", "Courier 10",
		  "pixels_above_lines", 0,
		  "pixels_below_lines", 0,
		 NULL);

  gtk_window_set_default_size (GTK_WINDOW (window), 600, 400);
  gtk_widget_show_all (window);
  

  load_file (testgtk_demos[0].filename);
  
  gtk_main ();

  return 0;
}
Пример #3
0
static void hide_section_cb(GtkToggleToolButton *btn, GtkWidget *section)
{
	GtkWidget *toplevel;

	if (gtk_toggle_tool_button_get_active(btn)) {
		gtk_object_set(GTK_OBJECT(btn), "stock-id", "gtk-go-down", NULL);
		gtk_widget_show(section);
	} else {
		gtk_object_set(GTK_OBJECT(btn), "stock-id", "gtk-go-up", NULL);
		gtk_widget_hide(section);
		toplevel = gtk_widget_get_toplevel(GTK_WIDGET(btn));
		if (GTK_WIDGET_TOPLEVEL(toplevel))
			gtk_window_resize (GTK_WINDOW(toplevel), 1, 1);
	}
}
Пример #4
0
static GtkTreeViewColumn *divelist_column(struct DiveList *dl, int index, const char *title,
					data_func_t data_func, PangoAlignment align)
{
	GtkCellRenderer *renderer;
	GtkTreeViewColumn *col;
	double xalign = 0.0; /* left as default */

	renderer = gtk_cell_renderer_text_new();
	col = gtk_tree_view_column_new();

	gtk_tree_view_column_set_title(col, title);
	gtk_tree_view_column_set_sort_column_id(col, index);
	gtk_tree_view_column_set_resizable(col, TRUE);
	gtk_tree_view_column_pack_start(col, renderer, TRUE);
	if (data_func)
		gtk_tree_view_column_set_cell_data_func(col, renderer, data_func, NULL, NULL);
	else
		gtk_tree_view_column_add_attribute(col, renderer, "text", index);
	gtk_object_set(GTK_OBJECT(renderer), "alignment", align, NULL);
	switch (align) {
	case PANGO_ALIGN_LEFT:
		xalign = 0.0;
		break;
	case PANGO_ALIGN_CENTER:
		xalign = 0.5;
		break;
	case PANGO_ALIGN_RIGHT:
		xalign = 1.0;
		break;
	}
	gtk_cell_renderer_set_alignment(GTK_CELL_RENDERER(renderer), xalign, 0.5);
	gtk_tree_view_append_column(GTK_TREE_VIEW(dl->tree_view), col);
	return col;
}
Пример #5
0
/**
 * Update knot's pixbuf and set its control state.
 */
void sp_knot_update_ctrl(SPKnot *knot)
{
    if (!knot->item) {
        return;
    }

    gtk_object_set(GTK_OBJECT(knot->item), "shape", knot->shape, NULL);
    gtk_object_set(GTK_OBJECT(knot->item), "mode", knot->mode, NULL);
    gtk_object_set(GTK_OBJECT(knot->item), "size", (gdouble) knot->size, NULL);
    gtk_object_set(GTK_OBJECT(knot->item), "anchor", knot->anchor, NULL);
    if (knot->pixbuf) {
        gtk_object_set(GTK_OBJECT (knot->item), "pixbuf", knot->pixbuf, NULL);
    }

    sp_knot_set_ctrl_state(knot);
}
Пример #6
0
/**
 * Set knot control state (dragging/mouseover/normal).
 */
static void sp_knot_set_ctrl_state(SPKnot *knot)
{
    if (knot->flags & SP_KNOT_DRAGGING) {
        gtk_object_set(GTK_OBJECT (knot->item),
                       "fill_color",
                       knot->fill[SP_KNOT_STATE_DRAGGING],
                       NULL);
        gtk_object_set(GTK_OBJECT (knot->item),
                       "stroke_color",
                       knot->stroke[SP_KNOT_STATE_DRAGGING],
                       NULL);
    } else if (knot->flags & SP_KNOT_MOUSEOVER) {
        gtk_object_set(GTK_OBJECT(knot->item),
                       "fill_color",
                       knot->fill[SP_KNOT_STATE_MOUSEOVER],
                       NULL);
        gtk_object_set(GTK_OBJECT(knot->item),
                       "stroke_color",
                       knot->stroke[SP_KNOT_STATE_MOUSEOVER],
                       NULL);
    } else {
        gtk_object_set(GTK_OBJECT(knot->item),
                       "fill_color",
                        knot->fill[SP_KNOT_STATE_NORMAL],
                       NULL);
        gtk_object_set(GTK_OBJECT(knot->item),
                       "stroke_color",
                       knot->stroke[SP_KNOT_STATE_NORMAL],
                       NULL);
    }
}
Пример #7
0
GtkTreeViewColumn *tree_view_column(GtkWidget *tree_view, int index, const char *title,
				data_func_t data_func, unsigned int flags)
{
	GtkCellRenderer *renderer;
	GtkTreeViewColumn *col;
	double xalign = 0.0; /* left as default */
	PangoAlignment align;
	gboolean visible;

	align = (flags & ALIGN_LEFT) ? PANGO_ALIGN_LEFT :
		(flags & ALIGN_RIGHT) ? PANGO_ALIGN_RIGHT :
		PANGO_ALIGN_CENTER;
	visible = !(flags & INVISIBLE);

	renderer = gtk_cell_renderer_text_new();
	col = gtk_tree_view_column_new();

	gtk_tree_view_column_set_title(col, title);
	if (!(flags & UNSORTABLE))
		gtk_tree_view_column_set_sort_column_id(col, index);
	gtk_tree_view_column_set_resizable(col, TRUE);
	gtk_tree_view_column_pack_start(col, renderer, TRUE);
	if (data_func)
		gtk_tree_view_column_set_cell_data_func(col, renderer, data_func, (void *)(long)index, NULL);
	else
		gtk_tree_view_column_add_attribute(col, renderer, "text", index);
	gtk_object_set(GTK_OBJECT(renderer), "alignment", align, NULL);
	switch (align) {
	case PANGO_ALIGN_LEFT:
		xalign = 0.0;
		break;
	case PANGO_ALIGN_CENTER:
		xalign = 0.5;
		break;
	case PANGO_ALIGN_RIGHT:
		xalign = 1.0;
		break;
	}
	gtk_cell_renderer_set_alignment(GTK_CELL_RENDERER(renderer), xalign, 0.5);
	gtk_tree_view_column_set_visible(col, visible);
	gtk_tree_view_append_column(GTK_TREE_VIEW(tree_view), col);
	return col;
}
Пример #8
0
void
GtkNoCodecsUI::Show ()
{
	if (configuration.GetBooleanValue ("Codecs", "DontWarnUnsupportedCodecs")) {
		state = 1;
		return;
	}

	if (state != 0) {
		fprintf (stderr, "GtkNoCodecsUI::Show (): Can't call Show more than once.\n");
		state = 2;
		return;
	}
	
	gint label_width = 400;

	// Build HIG Dialog Box
	dialog = gtk_dialog_new_with_buttons ("Moonlight Codecs Installer", NULL, (GtkDialogFlags)
		(GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR), NULL);
	ok_button = gtk_dialog_add_button (GTK_DIALOG (dialog), "_Ok", GTK_RESPONSE_OK);
	gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK);
	
	AdaptToParentWindow ();
	gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
	gtk_object_set (GTK_OBJECT (dialog), "resizable", false, NULL);

	// HIG HBox
	GtkWidget *hbox = gtk_hbox_new (false, 12);
	gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
	gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, true, true, 0);

	// Message box icon
	icon = gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG);
	gtk_misc_set_alignment (GTK_MISC (icon), 0.5f, 0.0f);
	gtk_box_pack_start (GTK_BOX (hbox), icon, false, false, 0);

	// Contents container
	vbox = gtk_vbox_new (false, 0);
	gtk_box_set_spacing (GTK_BOX (vbox), 10);
	gtk_box_pack_start (GTK_BOX (hbox), vbox, true, true, 0);

	// Header Label
	header_label = gtk_label_new (NULL);
	SetHeader ("This page requires the Microsoft Media Pack to be installed to play multimedia content.");
	gtk_label_set_line_wrap (GTK_LABEL (header_label), true);
	gtk_label_set_justify (GTK_LABEL (header_label), GTK_JUSTIFY_LEFT);
	gtk_misc_set_alignment (GTK_MISC (header_label), 0.0f, 0.5f);
	gtk_widget_set_size_request (header_label, label_width, -1);
	gtk_box_pack_start (GTK_BOX (vbox), header_label, false, false, 0);

	// Secondary Label
	message_label = gtk_label_new (NULL);
	SetMessage ("The Microsoft Media Pack is currently unavailable for your "
                    "Operating System or Architecture.");
	gtk_label_set_line_wrap (GTK_LABEL (message_label), true);
	gtk_label_set_justify (GTK_LABEL (message_label), GTK_JUSTIFY_LEFT);
	gtk_misc_set_alignment (GTK_MISC (message_label), 0.0f, 0.5f);
	gtk_widget_set_size_request (message_label, label_width, -1);
	gtk_box_pack_start (GTK_BOX (vbox), message_label, false, false, 0);

	dont_ask = gtk_check_button_new_with_label ("Do not show me this message again");
	gtk_box_pack_start (GTK_BOX (vbox), dont_ask, false, false, 0);

	// Connect and go
	g_signal_connect (G_OBJECT (dialog), "response", G_CALLBACK (ResponseEventHandler), this);

	gtk_object_set (GTK_OBJECT (ok_button), "has-focus", true, "has-default", true, NULL);

	gtk_widget_show_all (dialog);

	ref (); // We manage our lifetime ourself
	running = true;
}
Пример #9
0
void init_tab_lua (GtkWidget *dialog, GtkWidget *tab)
{
  if(!pref_list) return; // no option registered => don't create the tab
  char tooltip[1024];
  GtkWidget  *label, *labelev;
  GtkWidget *hbox = gtk_hbox_new(5, FALSE);
  GtkWidget *vbox1 = gtk_vbox_new(5, TRUE);
  GtkWidget *vbox2 = gtk_vbox_new(5, TRUE);
  gtk_box_pack_start(GTK_BOX(hbox), vbox1, FALSE, FALSE, 0);
  gtk_box_pack_start(GTK_BOX(hbox), vbox2, FALSE, FALSE, 0);
  GtkWidget *alignment = gtk_alignment_new(0.5, 0.0, 1.0, 0.0);
  gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), 20, 20, 20, 20);
  gtk_container_add(GTK_CONTAINER(alignment), hbox);
  gtk_notebook_append_page(GTK_NOTEBOOK(tab), alignment, gtk_label_new(_("lua options")));

  pref_element* cur_elt = pref_list;
  while(cur_elt)
  {
    char pref_name[1024];
    get_pref_name(pref_name,1024,cur_elt->script,cur_elt->name);
    label = gtk_label_new(cur_elt->label);
    gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5);
    labelev = gtk_event_box_new();
    gtk_widget_add_events(labelev, GDK_BUTTON_PRESS_MASK);
    gtk_container_add(GTK_CONTAINER(labelev), label);
    switch(cur_elt->type)
    {
      case pref_string:
        cur_elt->widget = gtk_entry_new();
        gtk_entry_set_text(GTK_ENTRY(cur_elt->widget), dt_conf_get_string(pref_name));
        g_signal_connect(G_OBJECT(cur_elt->widget), "activate", G_CALLBACK(callback_string), cur_elt);
        snprintf(tooltip, 1024, _("double click to reset to `%s'"), cur_elt->string_data.default_value);
        g_signal_connect(G_OBJECT(labelev), "button-press-event", G_CALLBACK(reset_widget_string), cur_elt);
        g_signal_connect(G_OBJECT(dialog), "response", G_CALLBACK(response_callback_string), cur_elt);
        break;
      case pref_bool:
        cur_elt->widget = gtk_check_button_new();
        gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(cur_elt->widget), dt_conf_get_bool(pref_name));
        g_signal_connect(G_OBJECT(cur_elt->widget), "toggled", G_CALLBACK(callback_bool), cur_elt);
        snprintf(tooltip, 1024, _("double click to reset to `%s'"), cur_elt->bool_data.default_value?"true":"false");
        g_signal_connect(G_OBJECT(labelev), "button-press-event", G_CALLBACK(reset_widget_bool), cur_elt);
        g_signal_connect(G_OBJECT(dialog), "response", G_CALLBACK(response_callback_bool), cur_elt);
        break;
      case pref_int:
        cur_elt->widget = gtk_spin_button_new_with_range(cur_elt->int_data.min, cur_elt->int_data.max, 1);
        gtk_spin_button_set_digits(GTK_SPIN_BUTTON(cur_elt->widget), 0);
        gtk_spin_button_set_value(GTK_SPIN_BUTTON(cur_elt->widget), dt_conf_get_int(pref_name));
        g_signal_connect(G_OBJECT(cur_elt->widget), "value-changed", G_CALLBACK(callback_int), cur_elt);
        snprintf(tooltip, 1024, _("double click to reset to `%d'"), cur_elt->int_data.default_value);
        g_signal_connect(G_OBJECT(labelev), "button-press-event", G_CALLBACK(reset_widget_int), cur_elt);
        g_signal_connect(G_OBJECT(dialog), "response", G_CALLBACK(response_callback_int), cur_elt);
        break;
    }
    gtk_object_set(GTK_OBJECT(labelev),  "tooltip-text", tooltip, (char *)NULL);
    gtk_event_box_set_visible_window(GTK_EVENT_BOX(labelev), FALSE);
    gtk_object_set(GTK_OBJECT(cur_elt->widget), "tooltip-text", cur_elt->tooltip, (char *)NULL);
    gtk_box_pack_start(GTK_BOX(vbox1), labelev, FALSE, FALSE, 0);
    gtk_box_pack_start(GTK_BOX(vbox2), cur_elt->widget, FALSE, FALSE, 0);
    cur_elt = cur_elt->next;
  }
}
Пример #10
0
static void report_gui_list_clicked(report_gui_t *rg)
{
  report_gui_list_t *rgl = &(rg->list);
  GtkTreeViewColumn *column;
  GtkCellRenderer *renderer;
  GtkTreeSelection *selection;
  int i;

  if ( rgl->window == NULL ) {
    rgl->window = create_report_list_window();

    /* Create list display widget */
    rgl->view = GTK_TREE_VIEW(lookup_widget(rgl->window, "report_list_view"));

    rgl->model = gtk_list_store_new(REPORT_LIST_NCOLS,
				    /* Node Name   */      G_TYPE_STRING,
				    /* Verdict     */      GDK_TYPE_PIXBUF,
				    /* Verdict Value */    G_TYPE_INT,
				    /* Def. Crit.  */      G_TYPE_STRING,
				    /* Def. Crit. Color */ G_TYPE_STRING,
				    /* Def. Crit. Value */ G_TYPE_INT,
				    /* Criticity   */      G_TYPE_STRING,
				    /* Crit. Color */      G_TYPE_STRING,
				    /* Criticity Value */  G_TYPE_INT,
				    /* Key         */      G_TYPE_ULONG);
    rgl->model_sort = gtk_tree_model_sort_new_with_model(GTK_TREE_MODEL(rgl->model));
    gtk_tree_view_set_model(rgl->view, rgl->model_sort);

    /* Setup tree selection handler */
    report_gui_list_select_clear(rgl);
    selection = gtk_tree_view_get_selection(rgl->view);
    gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE);
    gtk_tree_selection_set_select_function(selection,
					   (GtkTreeSelectionFunc) report_gui_list_select, &(rg->list),
					   NULL);

    /* Column #0: Test Case name */
    renderer = gtk_cell_renderer_text_new();
    gtk_tree_view_insert_column_with_attributes(rgl->view, -1, "Test Case", renderer,
						"text", REPORT_LIST_COL_NAME,
						NULL);
    column = gtk_tree_view_get_column(rgl->view, 0);
    gtk_tree_view_column_set_clickable(column, TRUE);
    gtk_tree_view_column_set_sort_column_id(column, REPORT_LIST_SORT_NAME);
    gtk_tree_view_column_set_resizable(column, TRUE);
    gtk_tree_view_column_set_expand(column, TRUE);

    /* Column #1: Default criticity */
    renderer = gtk_cell_renderer_text_new();
    gtk_object_set(GTK_OBJECT(renderer), "scale", 0.7, NULL);
    gtk_tree_view_insert_column_with_attributes(rgl->view, -1, "Def. Criticity", renderer,
						"text", REPORT_LIST_COL_CRITICITY_DEFAULT,
						"foreground", REPORT_LIST_COL_CRITICITY_DEFAULT_COLOR,
						NULL);
    column = gtk_tree_view_get_column(rgl->view, 1);
    gtk_tree_view_column_set_clickable(column, TRUE);
    gtk_tree_view_column_set_sort_column_id(column, REPORT_LIST_SORT_CRITICITY);
    gtk_tree_view_column_set_resizable(column, FALSE);
    gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);

    /* Column #2: Verdict and Criticity */
    column = gtk_tree_view_column_new();
    gtk_tree_view_column_set_title(column, "Verdict");

    renderer = gtk_cell_renderer_pixbuf_new();
    gtk_tree_view_column_pack_start(column, renderer, FALSE);
    gtk_tree_view_column_add_attribute(column, renderer, "pixbuf", REPORT_LIST_COL_VERDICT);

    renderer = gtk_cell_renderer_text_new();
    gtk_object_set(GTK_OBJECT(renderer), "scale", 0.7, NULL);
    gtk_tree_view_column_pack_start(column, renderer, TRUE);
    gtk_tree_view_column_add_attribute(column, renderer, "text", REPORT_LIST_COL_CRITICITY);
    gtk_tree_view_column_add_attribute(column, renderer, "foreground", REPORT_LIST_COL_CRITICITY_COLOR);

    gtk_tree_view_column_set_clickable(column, TRUE);
    gtk_tree_view_column_set_sort_column_id(column, REPORT_LIST_SORT_VERDICT);
    gtk_tree_view_column_set_resizable(column, FALSE);
    gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
    gtk_tree_view_append_column(rgl->view, column);

    /* Setup list sort functions */
    for (i = 0; i < REPORT_LIST_NSORTS; i++)
      gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(rgl->model_sort), i,
				      (GtkTreeIterCompareFunc) report_gui_list_sort, GINT_TO_POINTER(i),
				      NULL);

    /* Setup spot buttons */
    rgl->spot_tree = lookup_widget(rgl->window, "report_list_tree");
    gtk_widget_set_sensitive(rgl->spot_tree, 0);
    gtk_signal_connect_object(GTK_OBJECT(rgl->spot_tree),
			      "clicked", (GtkSignalFunc) report_gui_list_tree_clicked, rg);

    rgl->spot_log = lookup_widget(rgl->window, "report_list_log");
    gtk_widget_set_sensitive(rgl->spot_log, 0);
    gtk_signal_connect_object(GTK_OBJECT(rgl->spot_log),
			      "clicked", (GtkSignalFunc) report_gui_list_log_clicked, rg);


    /* Setup termination events */
    gtk_signal_connect_object(GTK_OBJECT(rgl->window), "destroy",
			      (GtkSignalFunc) report_gui_list_destroyed, rg);
    gtk_signal_connect_object(GTK_OBJECT(lookup_widget(rgl->window, "report_list_close")),
                              "clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(rgl->window));

    /* Feed the list */
    report_gui_list_feed(rg);

    gtk_widget_show(rgl->window);
    gtk_tree_selection_unselect_all(selection);
  }
  else {
    gtk_window_present(GTK_WINDOW(rgl->window));
  }
}
Пример #11
0
static void tree_gui_init_treeview(tree_gui_t *gui)
{
  //GtkTooltips *tooltips;
  GtkTreeViewColumn *column;
  GtkCellRenderer *renderer;

  /* Get tooltips engine */
  //tooltips = gtk_object_get_data(GTK_OBJECT(gui->window), "tooltips");

  /* Create test tree */
  gui->tree_model = gtk_tree_store_new(TREE_GUI_NCOLS,
				       /* TREE_GUI_COL_TYPE_PIXBUF     */ GDK_TYPE_PIXBUF,
				       /* TREE_GUI_COL_NAME            */ G_TYPE_STRING,
				       /* TREE_GUI_COL_BRKPT_PIXBUF    */ GDK_TYPE_PIXBUF,
				       /* TREE_GUI_COL_BRKPT           */ G_TYPE_INT,
				       /* TREE_GUI_COL_FLAGS_PIXBUF    */ GDK_TYPE_PIXBUF,
				       /* TREE_GUI_COL_SKIP            */ G_TYPE_INT,
				       /* TREE_GUI_COL_VERDICT_PIXBUF  */ GDK_TYPE_PIXBUF,
				       /* TREE_GUI_COL_CRITICITY       */ G_TYPE_STRING,
				       /* TREE_GUI_COL_CRITICITY_COLOR */ G_TYPE_STRING,
				       /* TREE_GUI_COL_BACKGROUND      */ GDK_TYPE_COLOR,
				       /* TREE_GUI_COL_STYLE           */ PANGO_TYPE_STYLE,
				       /* TREE_GUI_COL_KEY             */ G_TYPE_ULONG,
				       /* TREE_GUI_COL_OBJECT          */ G_TYPE_POINTER);

  gui->tree_view = GTK_TREE_VIEW(lookup_widget(gui->window, "tree_view"));
  gtk_tree_view_set_model(gui->tree_view, GTK_TREE_MODEL(gui->tree_model));

  /* Setup tree selection handler */
  gui->tree_selection = gtk_tree_view_get_selection(gui->tree_view);
  gtk_tree_selection_set_mode(gui->tree_selection, GTK_SELECTION_SINGLE);
  gtk_tree_selection_set_select_function(gui->tree_selection,
					 (GtkTreeSelectionFunc) tree_gui_select, gui,
					 NULL);

  /* Set up row activation handler */
  gtk_signal_connect(GTK_OBJECT(gui->tree_view), "row-activated",
		     GTK_SIGNAL_FUNC(tree_gui_row_activated), gui);

  /* Column #0: breakpoint flag */
  renderer = gtk_cell_renderer_pixbuf_new();
  gtk_tree_view_insert_column_with_attributes(gui->tree_view, -1, "Brk", renderer,
					      "pixbuf", TREE_GUI_COL_BRKPT_PIXBUF,
					      "cell-background-gdk", TREE_GUI_COL_BACKGROUND,
					      NULL);

  /* Setup breakpoints clear button */
  column = gtk_tree_view_get_column(gui->tree_view, 0);
  gtk_tree_view_column_set_resizable(column, FALSE);
  gtk_tree_view_column_set_clickable(column, TRUE);
  // TODO: gtk_tooltips_set_tip (tooltips, w, "Clear all breakpoints", NULL);
  gtk_signal_connect_object(GTK_OBJECT(column), "clicked",
			    GTK_SIGNAL_FUNC(tree_gui_breakpoint_clear_clicked), gui);

  /* Column #1: Node pix and name */
  column = gtk_tree_view_column_new();
  gtk_tree_view_column_set_title(column, "Test Tree");
  gtk_tree_view_column_set_expand(column, TRUE);

  renderer = gtk_cell_renderer_pixbuf_new();
  gtk_tree_view_column_pack_start(column, renderer, FALSE);
  gtk_tree_view_column_add_attribute(column, renderer, "pixbuf", TREE_GUI_COL_TYPE_PIXBUF);
  gtk_tree_view_column_add_attribute(column, renderer, "cell-background-gdk", TREE_GUI_COL_BACKGROUND);

  renderer = gtk_cell_renderer_text_new();
  //gtk_object_set(GTK_OBJECT(renderer), "family", "Monospace", NULL);
  gtk_tree_view_column_pack_start(column, renderer, TRUE);
  gtk_tree_view_column_add_attribute(column, renderer, "text", TREE_GUI_COL_NAME);
  gtk_tree_view_column_add_attribute(column, renderer, "cell-background-gdk", TREE_GUI_COL_BACKGROUND);
  gtk_tree_view_column_add_attribute(column, renderer, "style", TREE_GUI_COL_STYLE);

  gtk_tree_view_column_set_resizable(column, TRUE);
  gtk_tree_view_append_column(gui->tree_view, column);
  gtk_tree_view_set_expander_column(gui->tree_view, column);

  /* Setup selection clear button */
  gtk_tree_view_column_set_clickable(column, TRUE);
  // TODO: gtk_tooltips_set_tip (tooltips, w, "Clear selection", NULL);
  gtk_signal_connect_object(GTK_OBJECT(column), "clicked",
                            GTK_SIGNAL_FUNC(tree_gui_unselect), gui);

  /* Column #2: runtime flag */
  renderer = gtk_cell_renderer_pixbuf_new();
  gtk_tree_view_insert_column_with_attributes(gui->tree_view, -1, "Flg", renderer,
					      "pixbuf", TREE_GUI_COL_FLAGS_PIXBUF,
					      "cell-background-gdk", TREE_GUI_COL_BACKGROUND,
					      NULL);

  /* Column #3: verdict and criticity */
  column = gtk_tree_view_column_new();
  gtk_tree_view_column_set_title(column, "Verdict");

  renderer = gtk_cell_renderer_pixbuf_new();
  gtk_tree_view_column_pack_start(column, renderer, FALSE);
  gtk_tree_view_column_add_attribute(column, renderer, "pixbuf", TREE_GUI_COL_VERDICT_PIXBUF);
  gtk_tree_view_column_add_attribute(column, renderer, "cell-background-gdk", TREE_GUI_COL_BACKGROUND);

  renderer = gtk_cell_renderer_text_new();
  gtk_object_set(GTK_OBJECT(renderer), "scale", 0.6, NULL);
  gtk_tree_view_column_pack_start(column, renderer, TRUE);
  gtk_tree_view_column_add_attribute(column, renderer, "text", TREE_GUI_COL_CRITICITY);
  gtk_tree_view_column_add_attribute(column, renderer, "foreground", TREE_GUI_COL_CRITICITY_COLOR);
  gtk_tree_view_column_add_attribute(column, renderer, "cell-background-gdk", TREE_GUI_COL_BACKGROUND);

  gtk_tree_view_column_set_resizable(column, FALSE);
  gtk_tree_view_column_set_sizing(column, GTK_TREE_VIEW_COLUMN_AUTOSIZE);
  gtk_tree_view_append_column(gui->tree_view, column);
}
Пример #12
0
void dt_iop_gui_init_blendif(GtkVBox *blendw, dt_iop_module_t *module)
{
  dt_iop_gui_blend_data_t *bd = (dt_iop_gui_blend_data_t*)module->blend_data;

  /* create and add blendif support if module supports it */
  if (bd->blendif_support)
  {
    char *Lab_labels[] = { "  L  ", "  a  ", "  b  ", " C ", " h " };
    char *Lab_tooltips[] = { _("sliders for L channel"), _("sliders for a channel"), _("sliders for b channel"), _("sliders for chroma channel (of LCh)"), _("sliders for hue channel (of LCh)") };
    char *rgb_labels[] = { _(" g "), _(" R "), _(" G "), _(" B "), _(" H "), _(" S "), _(" L ") };
    char *rgb_tooltips[] = { _("sliders for gray value"), _("sliders for red channel"), _("sliders for green channel"), _("sliders for blue channel"),
                             _("sliders for hue channel (of HSL)"), _("sliders for chroma channel (of HSL)"), _("sliders for value channel (of HSL)")
                           };

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

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

    bd->tab = 0;

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

    switch(bd->csp)
    {
      case iop_cs_Lab:
        maxchannels = 5;
        labels = Lab_labels;
        tooltips = Lab_tooltips;
        bd->scale_print[0] = _blendif_scale_print_L;
        bd->scale_print[1] = _blendif_scale_print_ab;
        bd->scale_print[2] = _blendif_scale_print_ab;
        bd->scale_print[3] = _blendif_scale_print_default;
        bd->scale_print[4] = _blendif_scale_print_hue;
        bd->increments[0] = 1.0f/100.0f;
        bd->increments[1] = 1.0f/256.0f;
        bd->increments[2] = 1.0f/256.0f;
        bd->increments[3] = 1.0f/100.0f;
        bd->increments[4] = 1.0f/360.0f;
        bd->channels[0][0] = DEVELOP_BLENDIF_L_in;
        bd->channels[0][1] = DEVELOP_BLENDIF_L_out;
        bd->channels[1][0] = DEVELOP_BLENDIF_A_in;
        bd->channels[1][1] = DEVELOP_BLENDIF_A_out;
        bd->channels[2][0] = DEVELOP_BLENDIF_B_in;
        bd->channels[2][1] = DEVELOP_BLENDIF_B_out;
        bd->channels[3][0] = DEVELOP_BLENDIF_C_in;
        bd->channels[3][1] = DEVELOP_BLENDIF_C_out;
        bd->channels[4][0] = DEVELOP_BLENDIF_h_in;
        bd->channels[4][1] = DEVELOP_BLENDIF_h_out;
        bd->colorstops[0] = _gradient_L;
        bd->numberstops[0] = sizeof(_gradient_L)/sizeof(dt_iop_gui_blendif_colorstop_t);
        bd->colorstops[1] = _gradient_a;
        bd->numberstops[1] = sizeof(_gradient_a)/sizeof(dt_iop_gui_blendif_colorstop_t);
        bd->colorstops[2] = _gradient_b;
        bd->numberstops[2] = sizeof(_gradient_b)/sizeof(dt_iop_gui_blendif_colorstop_t);
        bd->colorstops[3] = _gradient_chroma;
        bd->numberstops[3] = sizeof(_gradient_chroma)/sizeof(dt_iop_gui_blendif_colorstop_t);
        bd->colorstops[4] = _gradient_hue;
        bd->numberstops[4] = sizeof(_gradient_hue)/sizeof(dt_iop_gui_blendif_colorstop_t);
        break;
      case iop_cs_rgb:
        maxchannels = 7;
        labels = rgb_labels;
        tooltips = rgb_tooltips;
        bd->scale_print[0] = _blendif_scale_print_rgb;
        bd->scale_print[1] = _blendif_scale_print_rgb;
        bd->scale_print[2] = _blendif_scale_print_rgb;
        bd->scale_print[3] = _blendif_scale_print_rgb;
        bd->scale_print[4] = _blendif_scale_print_hue;
        bd->scale_print[5] = _blendif_scale_print_default;
        bd->scale_print[6] = _blendif_scale_print_L;
        bd->increments[0] = 1.0f/255.0f;
        bd->increments[1] = 1.0f/255.0f;
        bd->increments[2] = 1.0f/255.0f;
        bd->increments[3] = 1.0f/255.0f;
        bd->increments[4] = 1.0f/360.0f;
        bd->increments[5] = 1.0f/100.0f;
        bd->increments[6] = 1.0f/100.0f;
        bd->channels[0][0] = DEVELOP_BLENDIF_GRAY_in;
        bd->channels[0][1] = DEVELOP_BLENDIF_GRAY_out;
        bd->channels[1][0] = DEVELOP_BLENDIF_RED_in;
        bd->channels[1][1] = DEVELOP_BLENDIF_RED_out;
        bd->channels[2][0] = DEVELOP_BLENDIF_GREEN_in;
        bd->channels[2][1] = DEVELOP_BLENDIF_GREEN_out;
        bd->channels[3][0] = DEVELOP_BLENDIF_BLUE_in;
        bd->channels[3][1] = DEVELOP_BLENDIF_BLUE_out;
        bd->channels[4][0] = DEVELOP_BLENDIF_H_in;
        bd->channels[4][1] = DEVELOP_BLENDIF_H_out;
        bd->channels[5][0] = DEVELOP_BLENDIF_S_in;
        bd->channels[5][1] = DEVELOP_BLENDIF_S_out;
        bd->channels[6][0] = DEVELOP_BLENDIF_l_in;
        bd->channels[6][1] = DEVELOP_BLENDIF_l_out;
        bd->colorstops[0] = _gradient_gray;
        bd->numberstops[0] = sizeof(_gradient_gray)/sizeof(dt_iop_gui_blendif_colorstop_t);
        bd->colorstops[1] = _gradient_red;
        bd->numberstops[1] = sizeof(_gradient_red)/sizeof(dt_iop_gui_blendif_colorstop_t);
        bd->colorstops[2] = _gradient_green;
        bd->numberstops[2] = sizeof(_gradient_green)/sizeof(dt_iop_gui_blendif_colorstop_t);
        bd->colorstops[3] = _gradient_blue;
        bd->numberstops[3] = sizeof(_gradient_blue)/sizeof(dt_iop_gui_blendif_colorstop_t);
        bd->colorstops[4] = _gradient_HUE;
        bd->numberstops[4] = sizeof(_gradient_HUE)/sizeof(dt_iop_gui_blendif_colorstop_t);
        bd->colorstops[5] = _gradient_chroma;
        bd->numberstops[5] = sizeof(_gradient_chroma)/sizeof(dt_iop_gui_blendif_colorstop_t);
        bd->colorstops[6] = _gradient_gray;
        bd->numberstops[6] = sizeof(_gradient_gray)/sizeof(dt_iop_gui_blendif_colorstop_t);
        break;
      default:
        assert(FALSE);		// blendif not supported for RAW, which is already catched upstream; we should not get here
    }


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

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


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

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

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

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

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

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

    GtkWidget *res = dtgtk_button_new(dtgtk_cairo_paint_reset, CPF_STYLE_FLAT);
    g_object_set(G_OBJECT(res), "tooltip-text", _("reset blend mask settings"), (char *)NULL);

    bd->suppress = dtgtk_togglebutton_new(dtgtk_cairo_paint_eye_toggle, CPF_STYLE_FLAT);
    g_object_set(G_OBJECT(bd->suppress), "tooltip-text", _("temporarily switch off blend mask. only for module in focus."), (char *)NULL);

    gtk_box_pack_start(GTK_BOX(header), GTK_WIDGET(notebook), TRUE, TRUE, 0);
    gtk_box_pack_end(GTK_BOX(header), GTK_WIDGET(res), FALSE, FALSE, 0);
    gtk_box_pack_end(GTK_BOX(header), GTK_WIDGET(bd->colorpicker), FALSE, FALSE, 0);
    gtk_box_pack_end(GTK_BOX(header), GTK_WIDGET(bd->showmask), FALSE, FALSE, 0);
    gtk_box_pack_end(GTK_BOX(header), GTK_WIDGET(bd->suppress), FALSE, FALSE, 0);

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

    bd->lower_polarity = dtgtk_togglebutton_new(dtgtk_cairo_paint_plusminus, CPF_STYLE_FLAT|CPF_DO_NOT_USE_BORDER);
    g_object_set(G_OBJECT(bd->lower_polarity), "tooltip-text", _("toggle polarity. best seen by enabling 'display mask'"), (char *)NULL);

    bd->upper_polarity = dtgtk_togglebutton_new(dtgtk_cairo_paint_plusminus, CPF_STYLE_FLAT|CPF_DO_NOT_USE_BORDER);
    g_object_set(G_OBJECT(bd->upper_polarity), "tooltip-text", _("toggle polarity. best seen by enabling 'display mask'"), (char *)NULL);

    gtk_box_pack_start(GTK_BOX(upslider), GTK_WIDGET(bd->upper_slider), TRUE, TRUE, 0);
    gtk_box_pack_end(GTK_BOX(upslider), GTK_WIDGET(bd->upper_polarity), FALSE, FALSE, 0);

    gtk_box_pack_start(GTK_BOX(lowslider), GTK_WIDGET(bd->lower_slider), TRUE, TRUE, 0);
    gtk_box_pack_end(GTK_BOX(lowslider), GTK_WIDGET(bd->lower_polarity), FALSE, FALSE, 0);


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

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

    bd->radius_slider = dt_bauhaus_slider_new_with_range(module, 0.0, 50.0, 0.1, 0.0, 1);
    dt_bauhaus_widget_set_label(bd->radius_slider, _("mask blur"));
    dt_bauhaus_slider_set_format(bd->radius_slider, "%.1f");

    gtk_object_set(GTK_OBJECT(bd->blendif_enable), "tooltip-text", _("enable conditional blending"), (char *)NULL);
    gtk_object_set(GTK_OBJECT(bd->lower_slider), "tooltip-text", _("double click to reset"), (char *)NULL);
    gtk_object_set(GTK_OBJECT(bd->upper_slider), "tooltip-text", _("double click to reset"), (char *)NULL);
    gtk_object_set(GTK_OBJECT(output), "tooltip-text", ttoutput, (char *)NULL);
    gtk_object_set(GTK_OBJECT(input), "tooltip-text", ttinput, (char *)NULL);
    gtk_object_set(GTK_OBJECT(bd->radius_slider), "tooltip-text", _("radius for gaussian blur of blend mask"), (char *)NULL);


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

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

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

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

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

    g_signal_connect (G_OBJECT (bd->radius_slider), "value-changed",
                      G_CALLBACK (_blendop_blendif_radius_callback), bd);

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

    g_signal_connect (G_OBJECT(bd->colorpicker), "toggled",
                      G_CALLBACK (_blendop_blendif_pick_toggled), module);

    g_signal_connect (G_OBJECT(bd->showmask), "toggled",
                      G_CALLBACK (_blendop_blendif_showmask_toggled), module);

    g_signal_connect (G_OBJECT(res), "clicked",
                      G_CALLBACK (_blendop_blendif_reset), module);

    g_signal_connect (G_OBJECT(bd->suppress), "toggled",
                      G_CALLBACK (_blendop_blendif_suppress_toggled), module);

    g_signal_connect (G_OBJECT(bd->lower_polarity), "toggled",
                      G_CALLBACK (_blendop_blendif_polarity_callback), bd);

    g_signal_connect (G_OBJECT(bd->upper_polarity), "toggled",
                      G_CALLBACK (_blendop_blendif_polarity_callback), bd);


    gtk_box_pack_start(GTK_BOX(bd->blendif_box), GTK_WIDGET(header), TRUE, FALSE, 0);
    gtk_box_pack_start(GTK_BOX(bd->blendif_box), GTK_WIDGET(uplabel), TRUE, FALSE, 0);
    gtk_box_pack_start(GTK_BOX(bd->blendif_box), GTK_WIDGET(upslider), TRUE, FALSE, 0);
    gtk_box_pack_start(GTK_BOX(bd->blendif_box), GTK_WIDGET(lowlabel), TRUE, FALSE, 0);
    gtk_box_pack_start(GTK_BOX(bd->blendif_box), GTK_WIDGET(lowslider), TRUE, FALSE, 0);
    gtk_box_pack_start(GTK_BOX(bd->blendif_box), GTK_WIDGET(bd->radius_slider), TRUE, FALSE, 0);

    gtk_box_pack_end(GTK_BOX(blendw), GTK_WIDGET(bd->blendif_box),TRUE,TRUE,0);
    gtk_box_pack_end(GTK_BOX(blendw), GTK_WIDGET(bd->blendif_enable),TRUE,TRUE,0);

    bd->blendif_inited = 1;
  }
}
Пример #13
0
void dt_iop_gui_init_blending(GtkWidget *iopw, dt_iop_module_t *module)
{
  /* create and add blend mode if module supports it */
  if (module->flags()&IOP_FLAGS_SUPPORTS_BLENDING)
  {
    module->blend_data = g_malloc(sizeof(dt_iop_gui_blend_data_t));
    memset(module->blend_data, 0, sizeof(dt_iop_gui_blend_data_t));
    dt_iop_gui_blend_data_t *bd = (dt_iop_gui_blend_data_t*)module->blend_data;

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


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

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


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

    dt_bauhaus_combobox_set(bd->blend_modes_combo, 0);

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

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

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

    if(bd->blendif_support)
    {
      dt_iop_gui_init_blendif(GTK_VBOX(iopw), module);
    }
    bd->blend_inited = 1;
    gtk_widget_queue_draw(GTK_WIDGET(iopw));
    dt_iop_gui_update_blending(module);
  }
}
Пример #14
0
static gchar*
passphrase_mbox (const gchar *desc)
{
    gchar *the_passphrase = NULL;
    GtkWidget *vbox;
    GtkWidget *table;
    GtkWidget *pass_label;
    GtkWidget *confirm_box;
    GtkWidget *window;
    GtkWidget *pass_entry;
    GtkWidget *ok_button;
    GtkWidget *cancel_button;

    window = gtk_window_new(GTK_WINDOW_DIALOG);
    gtk_window_set_title(GTK_WINDOW(window), _("Passphrase"));
    gtk_widget_set_usize(window, 450, -1);
    gtk_container_set_border_width(GTK_CONTAINER(window), 4);
    gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
    gtk_window_set_modal(GTK_WINDOW(window), TRUE);
    gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, FALSE);
    gtk_signal_connect(GTK_OBJECT(window), "delete_event",
                       GTK_SIGNAL_FUNC(passphrase_deleted), NULL);
    gtk_signal_connect(GTK_OBJECT(window), "key_press_event",
                       GTK_SIGNAL_FUNC(passphrase_key_pressed), NULL);
    MANAGE_WINDOW_SIGNALS_CONNECT(window);
    manage_window_set_transient(GTK_WINDOW(window));

    vbox = gtk_vbox_new(FALSE, 8);
    gtk_container_add(GTK_CONTAINER(window), vbox);

    if (desc) {
        GtkWidget *label;
        label = create_description (desc);
        gtk_box_pack_start (GTK_BOX(vbox), label, TRUE, TRUE, 0);
    }

    table = gtk_table_new(2, 2, FALSE);
    gtk_box_pack_start(GTK_BOX(vbox), table, FALSE, FALSE, 0);
    gtk_container_set_border_width(GTK_CONTAINER(table), 8);
    gtk_table_set_row_spacings(GTK_TABLE(table), 12);
    gtk_table_set_col_spacings(GTK_TABLE(table), 8);


    pass_label = gtk_label_new("");
    gtk_table_attach (GTK_TABLE(table), pass_label, 0, 1, 0, 1,
                      GTK_FILL, GTK_EXPAND|GTK_FILL, 0, 0);
    gtk_misc_set_alignment (GTK_MISC (pass_label), 1, 0.5);

    pass_entry = gtk_entry_new();
    gtk_table_attach (GTK_TABLE(table), pass_entry, 1, 2, 0, 1,
                      GTK_EXPAND|GTK_SHRINK|GTK_FILL, 0, 0, 0);
    gtk_entry_set_visibility (GTK_ENTRY(pass_entry), FALSE);
    gtk_widget_grab_focus (pass_entry);


    confirm_box = gtk_hbutton_box_new ();
    gtk_button_box_set_layout (GTK_BUTTON_BOX(confirm_box), GTK_BUTTONBOX_END);
    gtk_button_box_set_spacing (GTK_BUTTON_BOX(confirm_box), 5);

    ok_button = gtk_button_new_with_label (_("OK"));
    GTK_WIDGET_SET_FLAGS (ok_button, GTK_CAN_DEFAULT);
    gtk_box_pack_start (GTK_BOX(confirm_box), ok_button, TRUE, TRUE, 0);

    cancel_button = gtk_button_new_with_label (_("Cancel"));
    GTK_WIDGET_SET_FLAGS (cancel_button, GTK_CAN_DEFAULT);
    gtk_box_pack_start(GTK_BOX(confirm_box), cancel_button, TRUE, TRUE, 0);

    gtk_box_pack_end(GTK_BOX(vbox), confirm_box, FALSE, FALSE, 0);
    gtk_widget_grab_default (ok_button);

    gtk_signal_connect(GTK_OBJECT(ok_button), "clicked",
                       GTK_SIGNAL_FUNC(passphrase_ok_cb), NULL);
    gtk_signal_connect(GTK_OBJECT(pass_entry), "activate",
                       GTK_SIGNAL_FUNC(passphrase_ok_cb), NULL);
    gtk_signal_connect(GTK_OBJECT(cancel_button), "clicked",
                       GTK_SIGNAL_FUNC(passphrase_cancel_cb), NULL);

    if (grab_all)
        gtk_object_set (GTK_OBJECT(window), "type", GTK_WINDOW_POPUP, NULL);
    gtk_window_set_position (GTK_WINDOW(window), GTK_WIN_POS_CENTER);
    if (grab_all)   
        gtk_window_set_policy (GTK_WINDOW(window), FALSE, FALSE, TRUE);
    
    gtk_widget_show_all(window);

    /* don't use XIM on entering passphrase */
    gtkut_editable_disable_im(GTK_EDITABLE(pass_entry));

    if (grab_all) {
        XGrabServer(GDK_DISPLAY());
        if ( gdk_pointer_grab ( window->window, TRUE, 0,
                                NULL, NULL, GDK_CURRENT_TIME)) {
            XUngrabServer ( GDK_DISPLAY() );
            g_warning ("OOPS: Could not grab mouse\n");
            gtk_widget_destroy (window);
            return NULL;
        }
        if ( gdk_keyboard_grab( window->window, FALSE, GDK_CURRENT_TIME )) {
            gdk_pointer_ungrab (GDK_CURRENT_TIME);
            XUngrabServer ( GDK_DISPLAY() );
            g_warning ("OOPS: Could not grab keyboard\n");
            gtk_widget_destroy (window);
            return NULL;
        }
    }

    gtk_main();

    if (grab_all) {
        XUngrabServer (GDK_DISPLAY());
        gdk_pointer_ungrab (GDK_CURRENT_TIME);
        gdk_keyboard_ungrab (GDK_CURRENT_TIME);
        gdk_flush();
    }

    manage_window_focus_out(window, NULL, NULL);

    if (pass_ack) {
        the_passphrase = gtk_entry_get_text(GTK_ENTRY(pass_entry));
        if (the_passphrase) /* Hmmm: Do we really need this? */
            the_passphrase = g_strdup (the_passphrase);
    }
    gtk_widget_destroy (window);

    return the_passphrase;
}
Пример #15
0
static void list_init_treeview(list_t *list, GtkWidget *widget)
{
  GtkTreeViewColumn *column;
  GtkCellRenderer *renderer;
  GtkCellRenderer *renderer_dt;
  int n;

  /* Create a list model */
  list->store = gtk_list_store_new(LIST_NFIELDS,
				   G_TYPE_STRING,     /* LINENO */
				   G_TYPE_STRING,     /* DATE */
				   G_TYPE_STRING,     /* TIME */
				   G_TYPE_STRING,     /* GLOBAL TS */
				   G_TYPE_STRING,     /* INTERFACE */
				   G_TYPE_STRING,     /* LOCAL TS */
				   G_TYPE_STRING,     /* TAG */
				   G_TYPE_STRING,     /* INFO */
				   G_TYPE_STRING,     /* GLOBAL DT */
				   G_TYPE_STRING,     /* LOCAL DT */
				   G_TYPE_STRING,     /* LINENO_BACKGROUND */
				   G_TYPE_STRING,     /* BACKGROUND */
				   G_TYPE_STRING,     /* FOREGROUND */
				   G_TYPE_POINTER);   /* ITEM */

  /* Create a view */
  list->tree = GTK_TREE_VIEW(gtk_tree_view_new_with_model(GTK_TREE_MODEL(list->store)));
  gtk_container_add(GTK_CONTAINER(list->scrolled), GTK_WIDGET(list->tree));
  //gtk_tree_view_set_enable_search(list->tree, TRUE);
  gtk_widget_show(GTK_WIDGET(list->tree));

  /* The view now holds a reference. We can get rid of our own reference */
  g_object_unref(G_OBJECT(list->store));

  /* Setup tree selection handler */
  list->selection = gtk_tree_view_get_selection(list->tree);
  gtk_tree_selection_set_mode(list->selection, GTK_SELECTION_MULTIPLE);
  gtk_tree_selection_set_select_function(list->selection,
					 (GtkTreeSelectionFunc) list_select, list, NULL);

  /* Col #0: Line number */
  renderer = gtk_cell_renderer_text_new();
  gtk_object_set(GTK_OBJECT(renderer), "font", "Sans Italic 7", NULL);
  gtk_object_set(GTK_OBJECT(renderer), "ypad", 0, NULL);
  gtk_object_set(GTK_OBJECT(renderer), "foreground", "#777", NULL);
  gtk_tree_view_insert_column_with_attributes(list->tree, -1, "", renderer,
					      "text", LIST_LINENO,
					      "background", LIST_LINENO_BACKGROUND,
					      NULL);
  
  /* Col #1: Date */
  renderer = gtk_cell_renderer_text_new();
  gtk_object_set(GTK_OBJECT(renderer), "font", "Monospace 9", NULL);
  gtk_object_set(GTK_OBJECT(renderer), "ypad", 0, NULL);
  n = gtk_tree_view_insert_column_with_attributes(list->tree, -1, "Date", renderer,
						  "text", LIST_DATE,
						  "background", LIST_BACKGROUND,
						  "foreground", LIST_FOREGROUND,
						  NULL);
  //column = gtk_tree_view_get_column(list->tree, n-1);
  //gtk_tree_view_column_set_visible(column, FALSE);

  /* Col #2: Time */
  gtk_tree_view_insert_column_with_attributes(list->tree, -1, "Time", renderer,
					      "text", LIST_TIME,
					      "background", LIST_BACKGROUND,
					      "foreground", LIST_FOREGROUND,
					      NULL);

  /* Col #3: Global TS */
  gtk_tree_view_insert_column_with_attributes(list->tree, -1, "Global TS", renderer,
					      "text", LIST_GLOBAL_TS,
					      "background", LIST_BACKGROUND,
					      "foreground", LIST_FOREGROUND,
					      NULL);

  /* Col #4: Global dT */
  renderer_dt = gtk_cell_renderer_text_new();
  gtk_object_set(GTK_OBJECT(renderer_dt), "font", "Sans Italic 8", NULL);
  gtk_object_set(GTK_OBJECT(renderer_dt), "ypad", 0, NULL);
  gtk_tree_view_insert_column_with_attributes(list->tree, -1, "Global dT", renderer_dt,
					      "text", LIST_GLOBAL_DT,
					      "background", LIST_BACKGROUND,
					      "foreground", LIST_FOREGROUND,
					      NULL);

  /* Col #5: Interface */
  gtk_tree_view_insert_column_with_attributes(list->tree, -1, "Interface", renderer,
					      "text", LIST_PERIPH,
					      "background", LIST_BACKGROUND,
					      "foreground", LIST_FOREGROUND,
					      NULL);

  /* Col #6: Local TS */
  gtk_tree_view_insert_column_with_attributes(list->tree, -1, "Local TS", renderer,
					      "text", LIST_LOCAL_TS,
					      "background", LIST_BACKGROUND,
					      "foreground", LIST_FOREGROUND,
					      NULL);

  /* Col #7: Local dT */
  gtk_tree_view_insert_column_with_attributes(list->tree, -1, "Local dT", renderer_dt,
					      "text", LIST_LOCAL_DT,
					      "background", LIST_BACKGROUND,
					      "foreground", LIST_FOREGROUND,
					      NULL);

  /* Col #8: Tag */
  gtk_tree_view_insert_column_with_attributes(list->tree, -1, "Tag", renderer,
					      "text", LIST_TAG,
					      "background", LIST_BACKGROUND,
					      "foreground", LIST_FOREGROUND,
					      NULL);

  /* Col #9: Info */
  n = gtk_tree_view_insert_column_with_attributes(list->tree, -1, "Info", renderer,
						  "text", LIST_INFO,
						  "background", LIST_BACKGROUND,
						  "foreground", LIST_FOREGROUND,
						  NULL);
  column = gtk_tree_view_get_column(list->tree, n-1);
  gtk_tree_view_column_set_expand(column, TRUE);
}
Пример #16
0
void dt_iop_gui_init_blendif(GtkVBox *blendw, dt_iop_module_t *module)
{
  dt_iop_gui_blend_data_t *bd = (dt_iop_gui_blend_data_t*)module->blend_data;

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

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

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

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

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


    bd->channel = 0;

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

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


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

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


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

    gtk_box_pack_end(GTK_BOX(blendw), GTK_WIDGET(bd->blendif_box),TRUE,TRUE,0);
    gtk_box_pack_end(GTK_BOX(blendw), GTK_WIDGET(bd->blendif_enable),TRUE,TRUE,0);
  }
}
Пример #17
0
/**
 * Configure GtkTreeView with the right columns bound to
 * renderers, and a data model.
 **/
static void dcc_gnome_make_proc_view (GtkTreeModel *proc_model,
                                      GtkWidget **align_return)
{
  GtkCellRenderer *text_renderer, *chart_renderer;
  GtkTreeSelection *selection;
  GtkTreeViewColumn *column;
  GtkWidget *align, *proc_scroll;

  chart_treeview = gtk_tree_view_new_with_model (proc_model);
  gtk_object_set (GTK_OBJECT (chart_treeview),
                  "headers-visible", TRUE,
                  NULL);

  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (chart_treeview));

  gtk_tree_selection_set_mode (selection, GTK_SELECTION_NONE);

  /* we can't create the gcs until the widget is first realized */
  g_signal_connect_after (chart_treeview, "realize",
                          G_CALLBACK (dcc_create_state_gcs), NULL);

  text_renderer = gtk_cell_renderer_text_new ();
  chart_renderer = dcc_cell_renderer_chart_new ();

  selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (chart_treeview));

  gtk_tree_selection_set_mode (selection, GTK_SELECTION_NONE);

  /* Host */
  column = gtk_tree_view_column_new_with_attributes
    ("Host", text_renderer,
     "text", COLUMN_HOST,
     NULL);
  gtk_tree_view_column_set_resizable (column, TRUE);
  gtk_tree_view_append_column (GTK_TREE_VIEW (chart_treeview), column);
/*   gtk_tree_view_column_set_sort_column_id (column, COLUMN_HOST); */

  column = gtk_tree_view_column_new_with_attributes
    ("Slot", text_renderer,
     "text", COLUMN_SLOT,
     NULL);
  gtk_tree_view_column_set_resizable (column, TRUE);
  gtk_tree_view_append_column (GTK_TREE_VIEW (chart_treeview), column);
 
  /* File */
  column = gtk_tree_view_column_new_with_attributes
    ("File", text_renderer,
     "text", COLUMN_FILE,
     NULL);
  gtk_tree_view_column_set_resizable (column, TRUE);
  gtk_tree_view_append_column (GTK_TREE_VIEW (chart_treeview), column);
  
  column = gtk_tree_view_column_new_with_attributes
    ("State", text_renderer,
     "text", COLUMN_STATE,
     NULL);
  gtk_tree_view_column_set_resizable (column, TRUE);
  gtk_tree_view_append_column (GTK_TREE_VIEW (chart_treeview), column);
  
  /* Tasks - for each cell, rebind the stock-id property onto that
     value from the table model */
  column = gtk_tree_view_column_new_with_attributes
    ("Tasks", chart_renderer,
     "history", COLUMN_HISTORY,
     NULL);
  gtk_tree_view_column_set_resizable (column, TRUE);
  gtk_tree_view_append_column (GTK_TREE_VIEW (chart_treeview), column);

  proc_scroll = gtk_scrolled_window_new (NULL, NULL);

  /* no horizontal scrolling; let the table stretch */
  gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (proc_scroll),
                                  GTK_POLICY_NEVER,
                                  GTK_POLICY_AUTOMATIC);
  gtk_container_add (GTK_CONTAINER (proc_scroll), chart_treeview);

  /* Expands to fill all space */
  align = gtk_alignment_new (0.0, 0.0, 1.0, 1.0);
  gtk_container_add (GTK_CONTAINER (align), proc_scroll);

  *align_return = align;
}