static gboolean gimp_container_editor_get_show_button_bar (GimpDocked *docked) { GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (docked); return gimp_docked_get_show_button_bar (GIMP_DOCKED (editor->view)); }
static void gimp_data_editor_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) { GimpDataEditor *editor = GIMP_DATA_EDITOR (object); switch (property_id) { case PROP_DATA_FACTORY: editor->data_factory = g_value_get_object (value); break; case PROP_CONTEXT: gimp_docked_set_context (GIMP_DOCKED (object), g_value_get_object (value)); break; case PROP_DATA: gimp_data_editor_set_data (editor, g_value_get_object (value)); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } }
static void gimp_brush_editor_constructed (GObject *object) { G_OBJECT_CLASS (parent_class)->constructed (object); gimp_docked_set_show_button_bar (GIMP_DOCKED (object), FALSE); }
static void gimp_container_editor_set_show_button_bar (GimpDocked *docked, gboolean show) { GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (docked); gimp_docked_set_show_button_bar (GIMP_DOCKED (editor->view), show); }
static void gimp_container_editor_set_context (GimpDocked *docked, GimpContext *context) { GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (docked); gimp_docked_set_context (GIMP_DOCKED (editor->view), context); }
static GimpUIManager * gimp_container_editor_get_menu (GimpDocked *docked, const gchar **ui_path, gpointer *popup_data) { GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (docked); return gimp_docked_get_menu (GIMP_DOCKED (editor->view), ui_path, popup_data); }
static GtkWidget * gimp_container_editor_get_preview (GimpDocked *docked, GimpContext *context, GtkIconSize size) { GimpContainerEditor *editor = GIMP_CONTAINER_EDITOR (docked); return gimp_docked_get_preview (GIMP_DOCKED (editor->view), context, size); }
static GObject * gimp_brush_editor_constructor (GType type, guint n_params, GObjectConstructParam *params) { GObject *object; object = G_OBJECT_CLASS (parent_class)->constructor (type, n_params, params); gimp_docked_set_show_button_bar (GIMP_DOCKED (object), FALSE); return object; }
static void gimp_data_editor_dispose (GObject *object) { GimpDataEditor *editor = GIMP_DATA_EDITOR (object); if (editor->data) { /* Save dirty data before we clear out */ gimp_data_editor_save_dirty (editor); gimp_data_editor_set_data (editor, NULL); } if (editor->context) gimp_docked_set_context (GIMP_DOCKED (editor), NULL); G_OBJECT_CLASS (parent_class)->dispose (object); }
static void gimp_data_editor_real_set_data (GimpDataEditor *editor, GimpData *data) { gboolean editable; if (editor->data) { gimp_data_editor_save_dirty (editor); g_signal_handlers_disconnect_by_func (editor->data, gimp_data_editor_data_name_changed, editor); g_object_unref (editor->data); } editor->data = data; if (editor->data) { g_object_ref (editor->data); g_signal_connect (editor->data, "name-changed", G_CALLBACK (gimp_data_editor_data_name_changed), editor); gtk_entry_set_text (GTK_ENTRY (editor->name_entry), gimp_object_get_name (editor->data)); } else { gtk_entry_set_text (GTK_ENTRY (editor->name_entry), ""); } editable = (editor->data && gimp_data_is_writable (editor->data)); if (editor->data_editable != editable) { editor->data_editable = editable; gtk_editable_set_editable (GTK_EDITABLE (editor->name_entry), editable); gimp_docked_title_changed (GIMP_DOCKED (editor)); } }
static void gimp_dynamics_editor_constructed (GObject *object) { GimpDataEditor *data_editor = GIMP_DATA_EDITOR (object); GimpDynamicsEditor *editor = GIMP_DYNAMICS_EDITOR (object); GimpDynamics *dynamics = editor->dynamics_model; GtkWidget *input_labels[7]; GtkWidget *vbox; GtkWidget *icon_box; GtkWidget *grid; gint n_inputs = G_N_ELEMENTS (input_labels); gint i; G_OBJECT_CLASS (parent_class)->constructed (object); vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); gtk_notebook_append_page (GTK_NOTEBOOK (editor->notebook), vbox, NULL); gtk_widget_show (vbox); icon_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6); gtk_box_pack_start (GTK_BOX (vbox), icon_box, FALSE, FALSE, 0); gtk_widget_show (icon_box); gimp_dynamics_editor_add_icon_editor (dynamics, data_editor->context->gimp, vbox); grid = gtk_grid_new (); gtk_box_pack_start (GTK_BOX (vbox), grid, FALSE, FALSE, 0); gtk_widget_show (grid); gimp_dynamics_editor_init_output_editors (dynamics, editor->view_selector, editor->notebook, grid); input_labels[0] = gtk_label_new (_("Pressure")); input_labels[1] = gtk_label_new (_("Velocity")); input_labels[2] = gtk_label_new (_("Direction")); input_labels[3] = gtk_label_new (_("Tilt")); input_labels[4] = gtk_label_new (_("Wheel/Rotation")); input_labels[5] = gtk_label_new (_("Random")); input_labels[6] = gtk_label_new (_("Fade")); for (i = 0; i < n_inputs; i++) { gtk_label_set_angle (GTK_LABEL (input_labels[i]), 90); gtk_label_set_yalign (GTK_LABEL (input_labels[i]), 1.0); gtk_grid_attach (GTK_GRID (grid), input_labels[i], i + 1, 0, 1, 1); gtk_widget_show (input_labels[i]); } gimp_int_combo_box_prepend (GIMP_INT_COMBO_BOX (editor->view_selector), GIMP_INT_STORE_VALUE, -1, GIMP_INT_STORE_LABEL, _("Mapping matrix"), GIMP_INT_STORE_USER_DATA, vbox, -1); gimp_int_combo_box_set_active (GIMP_INT_COMBO_BOX (editor->view_selector), -1); gimp_docked_set_show_button_bar (GIMP_DOCKED (object), FALSE); }
static gboolean gui_pdb_dialog_new (Gimp *gimp, GimpContext *context, GimpProgress *progress, GimpContainer *container, const gchar *title, const gchar *callback_name, const gchar *object_name, va_list args) { GType dialog_type = G_TYPE_NONE; const gchar *dialog_role = NULL; const gchar *help_id = NULL; if (gimp_container_get_children_type (container) == GIMP_TYPE_BRUSH) { dialog_type = GIMP_TYPE_BRUSH_SELECT; dialog_role = "gimp-brush-selection"; help_id = GIMP_HELP_BRUSH_DIALOG; } else if (gimp_container_get_children_type (container) == GIMP_TYPE_FONT) { dialog_type = GIMP_TYPE_FONT_SELECT; dialog_role = "gimp-font-selection"; help_id = GIMP_HELP_FONT_DIALOG; } else if (gimp_container_get_children_type (container) == GIMP_TYPE_GRADIENT) { dialog_type = GIMP_TYPE_GRADIENT_SELECT; dialog_role = "gimp-gradient-selection"; help_id = GIMP_HELP_GRADIENT_DIALOG; } else if (gimp_container_get_children_type (container) == GIMP_TYPE_PALETTE) { dialog_type = GIMP_TYPE_PALETTE_SELECT; dialog_role = "gimp-palette-selection"; help_id = GIMP_HELP_PALETTE_DIALOG; } else if (gimp_container_get_children_type (container) == GIMP_TYPE_PATTERN) { dialog_type = GIMP_TYPE_PATTERN_SELECT; dialog_role = "gimp-pattern-selection"; help_id = GIMP_HELP_PATTERN_DIALOG; } if (dialog_type != G_TYPE_NONE) { GimpObject *object = NULL; if (object_name && strlen (object_name)) object = gimp_container_get_child_by_name (container, object_name); if (! object) object = gimp_context_get_by_type (context, gimp_container_get_children_type (container)); if (object) { GParameter *params = NULL; gint n_params = 0; GtkWidget *dialog; GtkWidget *view; params = gimp_parameters_append (dialog_type, params, &n_params, "title", title, "role", dialog_role, "help-func", gimp_standard_help_func, "help-id", help_id, "pdb", gimp->pdb, "context", context, "select-type", gimp_container_get_children_type (container), "initial-object", object, "callback-name", callback_name, "menu-factory", global_menu_factory, NULL); params = gimp_parameters_append_valist (dialog_type, params, &n_params, args); dialog = g_object_newv (dialog_type, n_params, params); gimp_parameters_free (params, n_params); view = GIMP_PDB_DIALOG (dialog)->view; if (view) gimp_docked_set_show_button_bar (GIMP_DOCKED (view), FALSE); if (progress) { guint32 window_id = gimp_progress_get_window_id (progress); if (window_id) gimp_window_set_transient_for (GTK_WINDOW (dialog), window_id); } gtk_widget_show (dialog); /* workaround for bug #360106 */ { GSource *source = g_timeout_source_new (100); GClosure *closure; closure = g_cclosure_new_object (G_CALLBACK (gui_pdb_dialog_present), G_OBJECT (dialog)); g_source_set_closure (source, closure); g_source_attach (source, NULL); g_source_unref (source); } return TRUE; } } return FALSE; }
void dockable_actions_update (GimpActionGroup *group, gpointer data) { GimpDockable *dockable; GimpDockbook *dockbook; GimpDocked *docked; GimpDialogFactoryEntry *entry; GimpContainerView *view; GimpViewType view_type = -1; gboolean list_view_available = FALSE; gboolean grid_view_available = FALSE; GimpViewSize view_size = -1; GimpTabStyle tab_style = -1; gint n_pages = 0; gint n_books = 0; if (GIMP_IS_DOCKBOOK (data)) { gint page_num; dockbook = GIMP_DOCKBOOK (data); page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (dockbook)); dockable = (GimpDockable *) gtk_notebook_get_nth_page (GTK_NOTEBOOK (dockbook), page_num); } else if (GIMP_IS_DOCKABLE (data)) { dockable = GIMP_DOCKABLE (data); dockbook = dockable->dockbook; } else { return; } docked = GIMP_DOCKED (gtk_bin_get_child (GTK_BIN (dockable))); gimp_dialog_factory_from_widget (GTK_WIDGET (dockable), &entry); if (entry) { gchar *identifier; gchar *substring = NULL; identifier = g_strdup (entry->identifier); if ((substring = strstr (identifier, "grid"))) view_type = GIMP_VIEW_TYPE_GRID; else if ((substring = strstr (identifier, "list"))) view_type = GIMP_VIEW_TYPE_LIST; if (substring) { memcpy (substring, "list", 4); if (gimp_dialog_factory_find_entry (dockbook->dock->dialog_factory, identifier)) list_view_available = TRUE; memcpy (substring, "grid", 4); if (gimp_dialog_factory_find_entry (dockbook->dock->dialog_factory, identifier)) grid_view_available = TRUE; } g_free (identifier); } view = gimp_container_view_get_by_dockable (dockable); if (view) view_size = gimp_container_view_get_view_size (view, NULL); tab_style = dockable->tab_style; n_pages = gtk_notebook_get_n_pages (GTK_NOTEBOOK (dockbook)); n_books = g_list_length (dockbook->dock->dockbooks); #define SET_ACTIVE(action,active) \ gimp_action_group_set_action_active (group, action, (active) != 0) #define SET_VISIBLE(action,active) \ gimp_action_group_set_action_visible (group, action, (active) != 0) #define SET_SENSITIVE(action,sensitive) \ gimp_action_group_set_action_sensitive (group, action, (sensitive) != 0) SET_SENSITIVE ("dockable-detach-tab", n_pages > 1 || n_books > 1); SET_VISIBLE ("dockable-preview-size-menu", view_size != -1); if (view_size != -1) { if (view_size >= GIMP_VIEW_SIZE_GIGANTIC) { SET_ACTIVE ("dockable-preview-size-gigantic", TRUE); } else if (view_size >= GIMP_VIEW_SIZE_ENORMOUS) { SET_ACTIVE ("dockable-preview-size-enormous", TRUE); } else if (view_size >= GIMP_VIEW_SIZE_HUGE) { SET_ACTIVE ("dockable-preview-size-huge", TRUE); } else if (view_size >= GIMP_VIEW_SIZE_EXTRA_LARGE) { SET_ACTIVE ("dockable-preview-size-extra-large", TRUE); } else if (view_size >= GIMP_VIEW_SIZE_LARGE) { SET_ACTIVE ("dockable-preview-size-large", TRUE); } else if (view_size >= GIMP_VIEW_SIZE_MEDIUM) { SET_ACTIVE ("dockable-preview-size-medium", TRUE); } else if (view_size >= GIMP_VIEW_SIZE_SMALL) { SET_ACTIVE ("dockable-preview-size-small", TRUE); } else if (view_size >= GIMP_VIEW_SIZE_EXTRA_SMALL) { SET_ACTIVE ("dockable-preview-size-extra-small", TRUE); } else if (view_size >= GIMP_VIEW_SIZE_TINY) { SET_ACTIVE ("dockable-preview-size-tiny", TRUE); } } SET_VISIBLE ("dockable-tab-style-menu", n_pages > 1); if (n_pages > 1) { GimpDockedInterface *docked_iface = GIMP_DOCKED_GET_INTERFACE (docked); if (tab_style == GIMP_TAB_STYLE_ICON) SET_ACTIVE ("dockable-tab-style-icon", TRUE); else if (tab_style == GIMP_TAB_STYLE_PREVIEW) SET_ACTIVE ("dockable-tab-style-preview", TRUE); else if (tab_style == GIMP_TAB_STYLE_NAME) SET_ACTIVE ("dockable-tab-style-name", TRUE); else if (tab_style == GIMP_TAB_STYLE_ICON_NAME) SET_ACTIVE ("dockable-tab-style-icon-name", TRUE); else if (tab_style == GIMP_TAB_STYLE_PREVIEW_NAME) SET_ACTIVE ("dockable-tab-style-preview-name", TRUE); SET_SENSITIVE ("dockable-tab-style-preview", docked_iface->get_preview); SET_SENSITIVE ("dockable-tab-style-preview-name", docked_iface->get_preview); } SET_VISIBLE ("dockable-view-type-grid", view_type != -1); SET_VISIBLE ("dockable-view-type-list", view_type != -1); if (view_type != -1) { if (view_type == GIMP_VIEW_TYPE_LIST) SET_ACTIVE ("dockable-view-type-list", TRUE); else SET_ACTIVE ("dockable-view-type-grid", TRUE); SET_SENSITIVE ("dockable-view-type-grid", grid_view_available); SET_SENSITIVE ("dockable-view-type-list", list_view_available); } SET_VISIBLE ("dockable-show-button-bar", gimp_docked_has_button_bar (docked)); SET_ACTIVE ("dockable-show-button-bar", gimp_docked_get_show_button_bar (docked)); #undef SET_ACTIVE #undef SET_VISIBLE #undef SET_SENSITIVE }