static void penge_block_container_raise (ClutterContainer *container, ClutterActor *actor, ClutterActor *sibling) { PengeBlockContainerPrivate *priv = GET_PRIVATE (container); priv->children = g_list_remove (priv->children, actor); if (sibling == NULL) priv->children = g_list_append (priv->children, actor); else { gint index_ = g_list_index (priv->children, sibling) + 1; priv->children = g_list_insert (priv->children, actor, index_); } clutter_actor_queue_relayout (CLUTTER_ACTOR (container)); }
void ptk_file_list_file_deleted( VFSDir* dir, VFSFileInfo* file, PtkFileList* list ) { GList* l; GtkTreePath* path; /* If there is no file info, that means the dir itself was deleted. */ if( G_UNLIKELY( ! file ) ) { /* Clear the whole list */ path = gtk_tree_path_new_from_indices(0, -1); for( l = list->files; l; l = list->files ) { gtk_tree_model_row_deleted( GTK_TREE_MODEL(list), path ); file = (VFSFileInfo*)l->data; list->files = g_list_delete_link( list->files, l ); vfs_file_info_unref( file ); --list->n_files; } gtk_tree_path_free( path ); return; } if( ! list->show_hidden && vfs_file_info_get_name(file)[0] == '.' ) return; l = g_list_find( list->files, file ); if( ! l ) return; path = gtk_tree_path_new_from_indices( g_list_index(list->files, l->data), -1 ); gtk_tree_model_row_deleted( GTK_TREE_MODEL(list), path ); gtk_tree_path_free( path ); list->files = g_list_delete_link( list->files, l ); vfs_file_info_unref( file ); --list->n_files; }
static void thumbalbum_adjust (GimvThumbView *tv, GimvThumb *thumb) { ThumbViewData *tv_data; GList *node; gint pos; g_return_if_fail (GIMV_IS_THUMB_VIEW (tv)); node = g_list_find (gimv_thumb_view_get_list(), tv); if (!node) return; tv_data = g_object_get_data (G_OBJECT (tv), THUMBALBUM_LABEL); g_return_if_fail (tv_data); pos = g_list_index (tv->thumblist, thumb); gimv_zlist_moveto (GIMV_ZLIST (tv_data->album), pos); return; }
static GtkWidgetPath* anjuta_tabber_get_path_for_child (GtkContainer* container, GtkWidget* widget) { AnjutaTabber* tabber = ANJUTA_TABBER (container); GtkWidgetPath* path; gint page_num;; gint tabber_pos; path = GTK_CONTAINER_CLASS (anjuta_tabber_parent_class)->get_path_for_child (container, widget); page_num = g_list_index (tabber->priv->children, widget); if (page_num == -1) return path; tabber_pos = gtk_widget_path_length (path) - 2; gtk_widget_path_iter_add_region (path, tabber_pos, GTK_STYLE_REGION_TAB, anjuta_tabber_get_region_flags (tabber, page_num)); return path; }
static gint gail_window_get_index_in_parent (AtkObject *accessible) { GtkWidget* widget = GTK_ACCESSIBLE (accessible)->widget; AtkObject* atk_obj = atk_get_root (); gint index = -1; if (widget == NULL) /* * State is defunct */ return -1; gail_return_val_if_fail (GTK_IS_WIDGET (widget), -1); index = ATK_OBJECT_CLASS (gail_window_parent_class)->get_index_in_parent (accessible); if (index != -1) return index; if (GTK_IS_WINDOW (widget)) { GtkWindow *window = GTK_WINDOW (widget); if (GAIL_IS_TOPLEVEL (atk_obj)) { GailToplevel* toplevel = GAIL_TOPLEVEL (atk_obj); index = g_list_index (toplevel->window_list, window); } else { int i, sibling_count = atk_object_get_n_accessible_children (atk_obj); for (i = 0; i < sibling_count && index == -1; ++i) { AtkObject *child = atk_object_ref_accessible_child (atk_obj, i); if (accessible == child) index = i; g_object_unref (G_OBJECT (child)); } } } return index; }
static void champlain_group_real_raise (ClutterContainer *container, ClutterActor *actor, ClutterActor *sibling) { ChamplainGroupPrivate *priv = CHAMPLAIN_GROUP (container)->priv; GList *link; link = g_list_find (priv->children, actor); if (link) { if (link == priv->children_end) priv->children_end = g_list_previous (priv->children_end); priv->children = g_list_delete_link (priv->children, link); } /* Raise to the top */ if (!sibling || !priv->children_end || sibling == priv->children_end->data) { if (priv->children) { priv->children_end = g_list_append (priv->children_end, actor); priv->children_end = g_list_next (priv->children_end); } else { priv->children = g_list_append (priv->children, actor); priv->children_end = priv->children; } } else { gint index_ = g_list_index (priv->children, sibling) + 1; priv->children = g_list_insert (priv->children, actor, index_); } clutter_actor_queue_redraw (CLUTTER_ACTOR (container)); }
/* Register new types of object objects. * Return true if successful, * return false if it fails, invalid arguments, or if the object * already exists */ bool qof_object_register (const QofObject *object) { g_return_val_if_fail (object_is_initialized, false); if (!object) return false; g_return_val_if_fail (object->interface_version == QOF_OBJECT_VERSION, false); if (g_list_index (object_modules, (gpointer)object) == -1) object_modules = g_list_prepend (object_modules, (gpointer)object); else return false; /* Now initialize all the known books */ if (object->book_begin && book_list) { GList *node; for (node = book_list; node; node = node->next) object->book_begin (node->data); } return true; }
static void diagram_dispose (GObject *object) { Diagram *dia = DIA_DIAGRAM(object); assert(dia->displays==NULL); if (g_list_index(open_diagrams, dia) >= 0) { dia_diagram_remove(dia); open_diagrams = g_list_remove(open_diagrams, dia); layer_dialog_update_diagram_list(); } if (dia->undo) undo_destroy(dia->undo); dia->undo = NULL; diagram_cleanup_autosave(dia); G_OBJECT_CLASS (parent_class)->dispose (object); }
static void mode_callback(GtkWidget *combo, gpointer user_data) { dt_iop_module_t *self = (dt_iop_module_t *)user_data; if(darktable.gui->reset) return; dt_iop_exposure_gui_data_t *g = (dt_iop_exposure_gui_data_t *)self->gui_data; dt_iop_exposure_params_t *p = (dt_iop_exposure_params_t *)self->params; const dt_iop_exposure_mode_t new_mode = GPOINTER_TO_UINT(g_list_nth_data(g->modes, dt_bauhaus_combobox_get(combo))); free(g->deflicker_histogram); g->deflicker_histogram = NULL; switch(new_mode) { case EXPOSURE_MODE_DEFLICKER: autoexp_disable(self); if(!dt_image_is_raw(&self->dev->image_storage)) { dt_bauhaus_combobox_set(g->mode, g_list_index(g->modes, GUINT_TO_POINTER(EXPOSURE_MODE_MANUAL))); gtk_widget_hide(GTK_WIDGET(g->mode)); break; } p->mode = EXPOSURE_MODE_DEFLICKER; gtk_stack_set_visible_child_name(GTK_STACK(g->mode_stack), "deflicker"); if(p->deflicker_histogram_source == DEFLICKER_HISTOGRAM_SOURCE_SOURCEFILE) deflicker_prepare_histogram(self, &g->deflicker_histogram, &g->deflicker_histogram_stats); break; case EXPOSURE_MODE_MANUAL: default: p->mode = EXPOSURE_MODE_MANUAL; gtk_stack_set_visible_child_name(GTK_STACK(g->mode_stack), "manual"); break; } dt_dev_add_history_item(darktable.develop, self, TRUE); }
static void info_window_sync(InfoData *id, const gchar *path) { if (!path) return; gtk_entry_set_text(GTK_ENTRY(id->name_entry), filename_from_path(path)); if (id->label_count) { gchar *buf; buf = g_strdup_printf(_("Image %d of %d"), g_list_index(id->list, (gpointer)path) + 1, g_list_length(id->list)); gtk_label_set_text(GTK_LABEL(id->label_count), buf); g_free(buf); } info_tabs_sync(id, FALSE); id->updated = FALSE; image_change_path(id->image, path, 0.0); }
void run_one_by_one(GPid pid, gint status, HookInfo* info) { if (pid != -1) { g_spawn_close_pid(pid); } if (info->jobs->data == NULL) { g_list_free_full(g_list_first(info->jobs), g_free); enter_next_stage(); return; } gint std_out, std_err; GPid child_pid; GError* error = NULL; char* argv[2]; argv[0] = info->jobs->data; argv[1] = 0; g_debug("RUN :%s\n", (char*)info->jobs->data); g_spawn_async(info->jobs_path, argv, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &child_pid, &error); if (error != NULL) { g_error("can't spawn %s: %s\n", argv[0], error->message); g_error_free(error); return; } g_child_watch_add(child_pid, (GChildWatchFunc)run_one_by_one, info); info->jobs = g_list_next(info->jobs); info->current_job_num = g_list_index(info->jobs, info->jobs->data) + 1; update_hooks_progress(info); }
static void clutter_group_real_lower (ClutterContainer *container, ClutterActor *actor, ClutterActor *sibling) { ClutterGroup *self = CLUTTER_GROUP (container); ClutterGroupPrivate *priv = self->priv; priv->children = g_list_remove (priv->children, actor); /* Push to bottom */ if (!sibling) { GList *last_item; last_item = g_list_first (priv->children); if (last_item) sibling = last_item->data; priv->children = g_list_prepend (priv->children, actor); } else { gint index_ = g_list_index (priv->children, sibling); priv->children = g_list_insert (priv->children, actor, index_); } /* See comment in group_raise for this */ if (sibling && clutter_actor_get_depth (sibling) != clutter_actor_get_depth (actor)) { clutter_actor_set_depth (actor, clutter_actor_get_depth (sibling)); } clutter_actor_queue_redraw (CLUTTER_ACTOR (container)); }
int wxNotebook::GetSelection() const { wxCHECK_MSG( m_widget != NULL, wxNOT_FOUND, wxT("invalid notebook") ); if ( m_selection == wxNOT_FOUND ) { GList *nb_pages = GTK_NOTEBOOK(m_widget)->children; if (g_list_length(nb_pages) != 0) { GtkNotebook *notebook = GTK_NOTEBOOK(m_widget); gpointer cur = notebook->cur_page; if ( cur != NULL ) { const_cast<wxNotebook *>(this)-> SetSelection(g_list_index( nb_pages, cur )); } } } return m_selection; }
int wxNotebook::GetSelection() const { wxCHECK_MSG( m_widget != NULL, -1, wxT("invalid notebook") ); if ( m_selection == -1 ) { GList *nb_pages = GTK_NOTEBOOK(m_widget)->children; if (g_list_length(nb_pages) != 0) { GtkNotebook *notebook = GTK_NOTEBOOK(m_widget); gpointer cur = notebook->cur_page; if ( cur != NULL ) { wxConstCast(this, wxNotebook)->m_selection = g_list_index( nb_pages, cur ); } } } return m_selection; }
void ACDDetailComboChange(GtkOptionMenu *optionmenu, gpointer user_data) { if (actor->IsReady() == false) return; GtkWidget *menu, *active_item; menu = GTK_OPTION_MENU(optionmenu)->menu; active_item = gtk_menu_get_active(GTK_MENU(menu)); int i = g_list_index(GTK_MENU_SHELL(menu)->children, active_item); int ID = (int)user_data; if (ID == 11) { ACDSetInitial_Radio(i, true); } else { ACDSetInitial_Radio(i, false); } if (ID == 11 || ID == 12) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rbtnDETAIL), (gboolean)true); } else if (ID == 2) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rbtnCW), (gboolean)true); } else if (ID == 3) { gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(rbtnCCW), (gboolean)true); } }
void menu_init(void) { GtkMenuShell *shell = GTK_MENU_SHELL(geany->main_widgets->editor_menu); GList *children = gtk_container_get_children(GTK_CONTAINER(shell)); GtkWidget *search2 = find_widget(shell, "search2"); popup_item = get_widget("popup_item"); menu_connect("popup_menu", &popup_menu_info, NULL); g_signal_connect(get_widget("popup_evaluate"), "button-release-event", G_CALLBACK(on_popup_evaluate_button_release), geany->main_widgets->editor_menu); if (search2) gtk_menu_shell_insert(shell, popup_item, g_list_index(children, search2) + 1); else gtk_menu_shell_append(shell, popup_item); modify_dialog = dialog_connect("modify_dialog"); modify_value_label = GTK_LABEL(get_widget("modify_value_label")); modify_value = get_widget("modify_value"); modify_text = gtk_text_view_get_buffer(GTK_TEXT_VIEW(modify_value)); modify_ok = get_widget("modify_ok"); utils_enter_to_clicked(modify_value, modify_ok); }
/** * hildon_app_menu_reorder_child: * @menu : A #HildonAppMenu * @item : A #GtkButton to move * @position : The new position to place @item (from 0 to n-1). * * Moves a #GtkButton to a new position within #HildonAppMenu. * * Since: 2.2 */ void hildon_app_menu_reorder_child (HildonAppMenu *menu, GtkButton *item, gint position) { HildonAppMenuPrivate *priv; gint old_position; g_return_if_fail (HILDON_IS_APP_MENU (menu)); g_return_if_fail (GTK_IS_BUTTON (item)); g_return_if_fail (position >= 0); priv = HILDON_APP_MENU_GET_PRIVATE (menu); old_position = g_list_index (priv->buttons, item); g_return_if_fail (old_position >= 0); /* Move the item */ priv->buttons = g_list_remove (priv->buttons, item); priv->buttons = g_list_insert (priv->buttons, item, position); hildon_app_menu_repack_items (menu, MIN (old_position, position)); }
static gboolean gail_menu_shell_is_child_selected (AtkSelection *selection, gint i) { GtkMenuShell *shell; gint j; GtkWidget *widget; widget = GTK_ACCESSIBLE (selection)->widget; if (widget == NULL) { /* State is defunct */ return FALSE; } shell = GTK_MENU_SHELL (widget); if (shell->active_menu_item == NULL) return FALSE; j = g_list_index (shell->children, shell->active_menu_item); return (j==i); }
static GtkTreePath * _dtm_get_path (GtkTreeModel *tree_model, GtkTreeIter *iter) { GtkTreePath *result; int index = 0; if (!NODE_DIAGRAM(iter) && !NODE_LAYER(iter) && !NODE_OBJECT(iter)) { /* the root path */ return gtk_tree_path_new_first (); } result = gtk_tree_path_new (); if (NODE_DIAGRAM(iter)) { GList *list = dia_open_diagrams(); gtk_tree_path_append_index (result, g_list_index (list, NODE_DIAGRAM(iter))); } if (NODE_LAYER(iter)) { g_return_val_if_fail (NODE_DIAGRAM(iter) == layer_get_parent_diagram (NODE_LAYER(iter)), NULL); index = data_layer_get_index (NODE_DIAGRAM(iter), NODE_LAYER(iter)); if (index >= 0) gtk_tree_path_append_index (result, index); } if (index >= 0 && NODE_OBJECT(iter)) { g_return_val_if_fail (NODE_LAYER(iter) == dia_object_get_parent_layer (NODE_OBJECT(iter)), NULL); index = layer_object_get_index (NODE_LAYER(iter), NODE_OBJECT(iter)); if (index >= 0) gtk_tree_path_append_index (result, index); } if (index < 0) { gtk_tree_path_free (result); return NULL; } return result; }
static void choiceSelected (GtkMenuShell *menuShell, GChoicePeerData *data) { jobject this = ((GComponentPeerData *)data)->peerGlobalRef; jobject target; JNIEnv *env; GtkWidget *active; GList *children; int index; if ((*JVM)->AttachCurrentThread (JVM, (void **) &env, NULL) != 0) return; awt_gtk_callbackEnter(); active = gtk_menu_get_active (GTK_MENU(menuShell)); children = gtk_container_children (GTK_CONTAINER(menuShell)); index = g_list_index (children, (gpointer)active); if (index != -1) { GtkOptionMenu *optionMenu; target = (*env)->GetObjectField (env, this, GCachedIDs.GComponentPeer_targetFID); (*env)->SetIntField (env, target, GCachedIDs.java_awt_Choice_selectedIndexFID, (jint)index); (*env)->CallVoidMethod (env, this, GCachedIDs.GChoicePeer_postItemEventMID, (jint)index); /* ** Workaround: ** the popup is gone now, let's set the focus back to the optionMenu */ optionMenu = GTK_OPTION_MENU(((GComponentPeerData *)data)->widget); gtk_widget_grab_focus((GtkWidget *)optionMenu); } awt_gtk_callbackLeave(); }
static void gimp_color_tool_draw (GimpDrawTool *draw_tool) { GimpColorTool *color_tool = GIMP_COLOR_TOOL (draw_tool); if (color_tool->enabled) { if (color_tool->sample_point) { GimpImage *image = gimp_display_get_image (draw_tool->display); GimpCanvasItem *item; gint index; gint x; gint y; gimp_sample_point_get_position (color_tool->sample_point, &x, &y); index = g_list_index (gimp_image_get_sample_points (image), color_tool->sample_point) + 1; item = gimp_draw_tool_add_sample_point (draw_tool, x, y, index); gimp_canvas_item_set_highlight (item, TRUE); } else if (color_tool->options->sample_average && gimp_tool_control_is_active (GIMP_TOOL (draw_tool)->control)) { gdouble radius = color_tool->options->average_radius; gimp_draw_tool_add_rectangle (draw_tool, FALSE, color_tool->center_x - radius, color_tool->center_y - radius, 2 * radius + 1, 2 * radius + 1); } } }
static gint gail_container_real_remove_gtk (GtkContainer *container, GtkWidget *widget, gpointer data) { AtkPropertyValues values = { NULL }; AtkObject* atk_parent; AtkObject *atk_child; GailContainer *gail_container; gint index; atk_parent = ATK_OBJECT (data); atk_child = gtk_widget_get_accessible (widget); if (atk_child) { g_value_init (&values.old_value, G_TYPE_POINTER); g_value_set_pointer (&values.old_value, atk_parent); values.property_name = "accessible-parent"; g_object_ref (atk_child); g_signal_emit_by_name (atk_child, "property_change::accessible-parent", &values, NULL); g_object_unref (atk_child); } gail_container = GAIL_CONTAINER (atk_parent); index = g_list_index (gail_container->children, widget); g_list_free (gail_container->children); gail_container->children = gtk_container_get_children (container); if (index >= 0 && index <= g_list_length (gail_container->children)) g_signal_emit_by_name (atk_parent, "children_changed::remove", index, atk_child, NULL); return 1; }
static void on_appicon_clicked (AstroAppicon *icon, AstroApplication *app, AstroAppview *view) { AstroAppviewPrivate *priv; AstroApplication *active_app; g_return_if_fail (ASTRO_IS_APPVIEW (view)); priv = view->priv; active_app = g_list_nth_data (priv->apps, priv->active); if (active_app == app) { g_signal_emit (view, _appview_signals[LAUNCH_APP], 0, g_list_nth_data (priv->apps, priv->active)); } else { gint new_active = g_list_index (priv->apps, app); astro_appview_advance (view, new_active - priv->active); } }
void pgpug_window_set_pane_permanent (PgpugWindow *self, PgpugPane *tab) { g_return_if_fail (PGPUG_IS_WINDOW (self)); g_return_if_fail (PGPUG_IS_PANE (tab)); /* check if the pane already set as permanent */ gint elem_index = g_list_index (self->priv->permanent_panes, tab); if (elem_index>=0){ WARN_MSG ("PgpugWindow: pane %s is already set as permanent", pgpug_pane_get_menu_text (tab)); return; } /* Increase references count to preserve pane from destroying when removed from container*/ g_object_ref (tab); self->priv->permanent_panes = g_list_append (self->priv->permanent_panes, tab); /* rebuild the View menu */ pgpug_window_rebuild_view_menu (self); }
static void tweet_overlay_lower (ClutterContainer *container, ClutterActor *actor, ClutterActor *sibling) { TweetOverlayPrivate *priv = TWEET_OVERLAY (container)->priv; priv->children = g_list_remove (priv->children, actor); /* Push to bottom */ if (!sibling) { GList *last_item; last_item = g_list_first (priv->children); if (last_item) sibling = last_item->data; priv->children = g_list_prepend (priv->children, actor); } else { gint pos; pos = g_list_index (priv->children, sibling); priv->children = g_list_insert (priv->children, actor, pos); } if (sibling && clutter_actor_get_depth (sibling) != clutter_actor_get_depth (actor)) { clutter_actor_set_depth (actor, clutter_actor_get_depth (sibling)); } }
static void gail_notebook_real_initialize (AtkObject *obj, gpointer data) { GailNotebook *notebook; GtkNotebook *gtk_notebook; gint i; ATK_OBJECT_CLASS (gail_notebook_parent_class)->initialize (obj, data); notebook = GAIL_NOTEBOOK (obj); gtk_notebook = GTK_NOTEBOOK (data); for (i = 0; i < g_list_length (gtk_notebook->children); i++) { create_notebook_page_accessible (notebook, gtk_notebook, i, FALSE, NULL); } notebook->page_count = i; notebook->selected_page = gtk_notebook_get_current_page (gtk_notebook); if (gtk_notebook->focus_tab && gtk_notebook->focus_tab->data) { notebook->focus_tab_page = g_list_index (gtk_notebook->children, gtk_notebook->focus_tab->data); } g_signal_connect (gtk_notebook, "focus", G_CALLBACK (gail_notebook_focus_cb), NULL); g_signal_connect (gtk_notebook, "page-added", G_CALLBACK (gail_notebook_page_added), NULL); g_object_weak_ref (G_OBJECT(gtk_notebook), (GWeakNotify) gail_notebook_destroyed, obj); obj->role = ATK_ROLE_PAGE_TAB_LIST; }
int dt_imageio_get_index_of_storage(dt_imageio_module_storage_t* storage) { dt_imageio_t *iio = darktable.imageio; return g_list_index(iio->plugins_storage,storage); }
int dt_imageio_get_index_of_format(dt_imageio_module_format_t* format) { dt_imageio_t *iio = darktable.imageio; return g_list_index(iio->plugins_format,format); }
void gui_init(struct dt_iop_module_t *self) { self->gui_data = malloc(sizeof(dt_iop_exposure_gui_data_t)); dt_iop_exposure_gui_data_t *g = (dt_iop_exposure_gui_data_t *)self->gui_data; dt_iop_exposure_params_t *p = (dt_iop_exposure_params_t *)self->params; g->modes = NULL; g->deflicker_histogram_sources = NULL; g->deflicker_histogram = NULL; dt_pthread_mutex_init(&g->lock, NULL); /* register hooks with current dev so that histogram can interact with this module. */ darktable.develop->proxy.exposure.module = self; darktable.develop->proxy.exposure.set_white = dt_iop_exposure_set_white; darktable.develop->proxy.exposure.get_white = dt_iop_exposure_get_white; darktable.develop->proxy.exposure.set_black = dt_iop_exposure_set_black; darktable.develop->proxy.exposure.get_black = dt_iop_exposure_get_black; self->request_color_pick = DT_REQUEST_COLORPICK_OFF; self->widget = GTK_WIDGET(gtk_box_new(GTK_ORIENTATION_VERTICAL, DT_BAUHAUS_SPACE)); g->mode = dt_bauhaus_combobox_new(self); dt_bauhaus_widget_set_label(g->mode, NULL, _("mode")); dt_bauhaus_combobox_add(g->mode, C_("mode", "manual")); g->modes = g_list_append(g->modes, GUINT_TO_POINTER(EXPOSURE_MODE_MANUAL)); dt_bauhaus_combobox_add(g->mode, _("automatic")); g->modes = g_list_append(g->modes, GUINT_TO_POINTER(EXPOSURE_MODE_DEFLICKER)); dt_bauhaus_combobox_set_default(g->mode, 0); dt_bauhaus_combobox_set(g->mode, g_list_index(g->modes, GUINT_TO_POINTER(p->mode))); gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(g->mode), TRUE, TRUE, 0); g->black = dt_bauhaus_slider_new_with_range(self, -0.1, 0.1, .001, p->black, 4); g_object_set(G_OBJECT(g->black), "tooltip-text", _("adjust the black level"), (char *)NULL); dt_bauhaus_slider_set_format(g->black, "%.4f"); dt_bauhaus_widget_set_label(g->black, NULL, _("black")); dt_bauhaus_slider_enable_soft_boundaries(g->black, -1.0, 1.0); gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(g->black), TRUE, TRUE, 0); g->mode_stack = gtk_stack_new(); gtk_stack_set_homogeneous(GTK_STACK(g->mode_stack),FALSE); gtk_box_pack_start(GTK_BOX(self->widget), g->mode_stack, TRUE, TRUE, 0); GtkWidget *vbox_manual = GTK_WIDGET(gtk_box_new(GTK_ORIENTATION_VERTICAL, DT_BAUHAUS_SPACE)); g->exposure = dt_bauhaus_slider_new_with_range(self, -3.0, 3.0, .02, p->exposure, 3); g_object_set(G_OBJECT(g->exposure), "tooltip-text", _("adjust the exposure correction"), (char *)NULL); dt_bauhaus_slider_set_format(g->exposure, "%.2fEV"); dt_bauhaus_widget_set_label(g->exposure, NULL, _("exposure")); dt_bauhaus_slider_enable_soft_boundaries(g->exposure, -18.0, 18.0); gtk_box_pack_start(GTK_BOX(vbox_manual), GTK_WIDGET(g->exposure), TRUE, TRUE, 0); GtkBox *hbox = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0)); g->autoexp = GTK_CHECK_BUTTON(gtk_check_button_new_with_label(_("auto"))); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(g->autoexp), FALSE); gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(g->autoexp), FALSE, TRUE, 0); g->autoexpp = dt_bauhaus_slider_new_with_range(self, 0.0, 0.2, .001, 0.01, 3); g_object_set(G_OBJECT(g->autoexpp), "tooltip-text", _("percentage of bright values clipped out"), (char *)NULL); gtk_widget_set_sensitive(GTK_WIDGET(g->autoexpp), TRUE); gtk_box_pack_start(GTK_BOX(hbox), GTK_WIDGET(g->autoexpp), TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox_manual), GTK_WIDGET(hbox), TRUE, TRUE, 0); gtk_widget_show_all(vbox_manual); gtk_stack_add_named(GTK_STACK(g->mode_stack), vbox_manual, "manual"); GtkWidget *vbox_deflicker = GTK_WIDGET(gtk_box_new(GTK_ORIENTATION_VERTICAL, DT_BAUHAUS_SPACE)); g->deflicker_percentile = dt_bauhaus_slider_new_with_range(self, 0, 100, .01, p->deflicker_percentile, 3); // FIXME: this needs a better tooltip! g_object_set(G_OBJECT(g->deflicker_percentile), "tooltip-text", _("percentile"), (char *)NULL); dt_bauhaus_slider_set_format(g->deflicker_percentile, "%.2f%%"); dt_bauhaus_widget_set_label(g->deflicker_percentile, NULL, _("percentile")); gtk_box_pack_start(GTK_BOX(vbox_deflicker), GTK_WIDGET(g->deflicker_percentile), TRUE, TRUE, 0); g->deflicker_target_level = dt_bauhaus_slider_new_with_range(self, -18.0, 18.0, .01, p->deflicker_target_level, 3); g_object_set(G_OBJECT(g->deflicker_target_level), "tooltip-text", _("target level"), (char *)NULL); dt_bauhaus_slider_set_format(g->deflicker_target_level, "%.2fEV"); dt_bauhaus_widget_set_label(g->deflicker_target_level, NULL, _("target level")); gtk_box_pack_start(GTK_BOX(vbox_deflicker), GTK_WIDGET(g->deflicker_target_level), TRUE, TRUE, 0); g->deflicker_histogram_source = dt_bauhaus_combobox_new(self); dt_bauhaus_widget_set_label(g->deflicker_histogram_source, NULL, _("histogram of")); dt_bauhaus_combobox_add(g->deflicker_histogram_source, _("pre-processed image")); g->deflicker_histogram_sources = g_list_append(g->deflicker_histogram_sources, GUINT_TO_POINTER(DEFLICKER_HISTOGRAM_SOURCE_THUMBNAIL)); dt_bauhaus_combobox_add(g->deflicker_histogram_source, _("source raw data")); g->deflicker_histogram_sources = g_list_append(g->deflicker_histogram_sources, GUINT_TO_POINTER(DEFLICKER_HISTOGRAM_SOURCE_SOURCEFILE)); dt_bauhaus_combobox_set_default(g->deflicker_histogram_source, DEFLICKER_HISTOGRAM_SOURCE_THUMBNAIL); dt_bauhaus_combobox_set(g->deflicker_histogram_source, g_list_index(g->modes, GUINT_TO_POINTER(p->deflicker_histogram_source))); gtk_box_pack_start(GTK_BOX(vbox_deflicker), GTK_WIDGET(g->deflicker_histogram_source), TRUE, TRUE, 0); GtkBox *hbox1 = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0)); GtkLabel *label = GTK_LABEL(gtk_label_new(_("computed EC: "))); gtk_box_pack_start(GTK_BOX(hbox1), GTK_WIDGET(label), FALSE, FALSE, 0); g->deflicker_used_EC = GTK_LABEL(gtk_label_new("")); // This gets filled in by process g_object_set(G_OBJECT(g->deflicker_used_EC), "tooltip-text", _("what exposure correction have actually been used"), (char *)NULL); gtk_box_pack_start(GTK_BOX(hbox1), GTK_WIDGET(g->deflicker_used_EC), FALSE, FALSE, 0); dt_pthread_mutex_lock(&g->lock); g->deflicker_computed_exposure = NAN; dt_pthread_mutex_unlock(&g->lock); gtk_box_pack_start(GTK_BOX(vbox_deflicker), GTK_WIDGET(hbox1), FALSE, FALSE, 0); gtk_widget_show_all(vbox_deflicker); gtk_stack_add_named(GTK_STACK(g->mode_stack), vbox_deflicker, "deflicker"); g_signal_connect(G_OBJECT(g->mode), "value-changed", G_CALLBACK(mode_callback), self); g_signal_connect(G_OBJECT(g->black), "value-changed", G_CALLBACK(black_callback), self); g_signal_connect(G_OBJECT(g->exposure), "value-changed", G_CALLBACK(exposure_callback), self); g_signal_connect(G_OBJECT(g->autoexpp), "value-changed", G_CALLBACK(autoexpp_callback), self); g_signal_connect(G_OBJECT(g->autoexp), "toggled", G_CALLBACK(autoexp_callback), self); g_signal_connect(G_OBJECT(g->deflicker_percentile), "value-changed", G_CALLBACK(deflicker_params_callback), self); g_signal_connect(G_OBJECT(g->deflicker_target_level), "value-changed", G_CALLBACK(deflicker_params_callback), self); g_signal_connect(G_OBJECT(g->deflicker_histogram_source), "value-changed", G_CALLBACK(deflicker_histogram_source_callback), self); g_signal_connect(G_OBJECT(self->widget), "draw", G_CALLBACK(draw), self); }
/* callback management */ static void register_callback(GList **list, info_update_callback cb) { if (*list && g_list_index(*list, cb) != -1) return; *list = g_list_append(*list, cb); }