mirror of https://github.com/GNOME/gimp.git
Make the height of the previews in data editors configurable. Fixes bug
2007-03-17 Michael Natterer <mitch@gimp.org> Make the height of the previews in data editors configurable. Fixes bug #337757. * app/widgets/gimpdataeditor.[ch]: add member "view" which needs to be set by subclasses. Add style property "minimal-height" which defaults to 96. Add style_set() implementation which sets editor->view's height to the configured value. * app/widgets/gimpbrusheditor.[ch] * app/widgets/gimpgradienteditor.[ch] * app/widgets/gimppaletteeditor.[ch]: use data_editor->view for storing the view widget and removed own view members. Remove separate #defines for the view's default width and height, it's width follows the dialog anyway. * themes/Default/gtkrc: document the default value of 96. * themes/Small/gtkrc: set it to 64. svn path=/trunk/; revision=22137
This commit is contained in:
parent
16251836ac
commit
24a8095025
21
ChangeLog
21
ChangeLog
|
@ -1,3 +1,24 @@
|
|||
2007-03-17 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
Make the height of the previews in data editors configurable.
|
||||
Fixes bug #337757.
|
||||
|
||||
* app/widgets/gimpdataeditor.[ch]: add member "view" which needs
|
||||
to be set by subclasses. Add style property "minimal-height" which
|
||||
defaults to 96. Add style_set() implementation which sets
|
||||
editor->view's height to the configured value.
|
||||
|
||||
* app/widgets/gimpbrusheditor.[ch]
|
||||
* app/widgets/gimpgradienteditor.[ch]
|
||||
* app/widgets/gimppaletteeditor.[ch]: use data_editor->view for
|
||||
storing the view widget and removed own view members. Remove
|
||||
separate #defines for the view's default width and height, it's
|
||||
width follows the dialog anyway.
|
||||
|
||||
* themes/Default/gtkrc: document the default value of 96.
|
||||
|
||||
* themes/Small/gtkrc: set it to 64.
|
||||
|
||||
2007-03-17 Kevin Cozens <kcozens@cvs.gnome.org>
|
||||
|
||||
* plug-ins/script-fu/scripts/script-fu-compat.init: Fixed syntax
|
||||
|
|
|
@ -42,8 +42,7 @@
|
|||
#include "gimp-intl.h"
|
||||
|
||||
|
||||
#define BRUSH_VIEW_WIDTH 128
|
||||
#define BRUSH_VIEW_HEIGHT 96
|
||||
#define BRUSH_VIEW_SIZE 96
|
||||
|
||||
|
||||
/* local function prototypes */
|
||||
|
@ -105,6 +104,7 @@ gimp_brush_editor_docked_iface_init (GimpDockedInterface *iface)
|
|||
static void
|
||||
gimp_brush_editor_init (GimpBrushEditor *editor)
|
||||
{
|
||||
GimpDataEditor *data_editor = GIMP_DATA_EDITOR (editor);
|
||||
GtkWidget *frame;
|
||||
GtkWidget *box;
|
||||
gint row = 0;
|
||||
|
@ -114,17 +114,16 @@ gimp_brush_editor_init (GimpBrushEditor *editor)
|
|||
gtk_box_pack_start (GTK_BOX (editor), frame, TRUE, TRUE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
editor->view = gimp_view_new_full_by_types (NULL,
|
||||
data_editor->view = gimp_view_new_full_by_types (NULL,
|
||||
GIMP_TYPE_VIEW,
|
||||
GIMP_TYPE_BRUSH,
|
||||
BRUSH_VIEW_WIDTH,
|
||||
BRUSH_VIEW_HEIGHT, 0,
|
||||
BRUSH_VIEW_SIZE,
|
||||
BRUSH_VIEW_SIZE, 0,
|
||||
FALSE, FALSE, TRUE);
|
||||
gtk_widget_set_size_request (editor->view,
|
||||
BRUSH_VIEW_WIDTH, BRUSH_VIEW_HEIGHT);
|
||||
gimp_view_set_expand (GIMP_VIEW (editor->view), TRUE);
|
||||
gtk_container_add (GTK_CONTAINER (frame), editor->view);
|
||||
gtk_widget_show (editor->view);
|
||||
gtk_widget_set_size_request (data_editor->view, -1, BRUSH_VIEW_SIZE);
|
||||
gimp_view_set_expand (GIMP_VIEW (data_editor->view), TRUE);
|
||||
gtk_container_add (GTK_CONTAINER (frame), data_editor->view);
|
||||
gtk_widget_show (data_editor->view);
|
||||
|
||||
editor->shape_group = NULL;
|
||||
|
||||
|
@ -269,8 +268,7 @@ gimp_brush_editor_set_data (GimpDataEditor *editor,
|
|||
G_CALLBACK (gimp_brush_editor_notify_brush),
|
||||
editor);
|
||||
|
||||
gimp_view_set_viewable (GIMP_VIEW (brush_editor->view),
|
||||
(GimpViewable *) data);
|
||||
gimp_view_set_viewable (GIMP_VIEW (editor->view), GIMP_VIEWABLE (data));
|
||||
|
||||
if (editor->data && GIMP_IS_BRUSH_GENERATED (editor->data))
|
||||
{
|
||||
|
@ -302,11 +300,11 @@ static void
|
|||
gimp_brush_editor_set_context (GimpDocked *docked,
|
||||
GimpContext *context)
|
||||
{
|
||||
GimpBrushEditor *editor = GIMP_BRUSH_EDITOR (docked);
|
||||
GimpDataEditor *data_editor = GIMP_DATA_EDITOR (docked);
|
||||
|
||||
parent_docked_iface->set_context (docked, context);
|
||||
|
||||
gimp_view_renderer_set_context (GIMP_VIEW (editor->view)->renderer,
|
||||
gimp_view_renderer_set_context (GIMP_VIEW (data_editor->view)->renderer,
|
||||
context);
|
||||
}
|
||||
|
||||
|
|
|
@ -40,8 +40,6 @@ struct _GimpBrushEditor
|
|||
{
|
||||
GimpDataEditor parent_instance;
|
||||
|
||||
GtkWidget *view;
|
||||
|
||||
GtkWidget *shape_group;
|
||||
GtkWidget *options_table;
|
||||
GtkAdjustment *radius_data;
|
||||
|
|
|
@ -45,6 +45,9 @@
|
|||
#include "gimp-intl.h"
|
||||
|
||||
|
||||
#define DEFAULT_MINIMAL_HEIGHT 96
|
||||
|
||||
|
||||
enum
|
||||
{
|
||||
PROP_0,
|
||||
|
@ -69,6 +72,9 @@ static void gimp_data_editor_get_property (GObject *object,
|
|||
GParamSpec *pspec);
|
||||
static void gimp_data_editor_dispose (GObject *object);
|
||||
|
||||
static void gimp_data_editor_style_set (GtkWidget *widget,
|
||||
GtkStyle *prev_style);
|
||||
|
||||
static void gimp_data_editor_set_context (GimpDocked *docked,
|
||||
GimpContext *context);
|
||||
static void gimp_data_editor_set_aux_info (GimpDocked *docked,
|
||||
|
@ -114,12 +120,15 @@ static void
|
|||
gimp_data_editor_class_init (GimpDataEditorClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
|
||||
object_class->constructor = gimp_data_editor_constructor;
|
||||
object_class->set_property = gimp_data_editor_set_property;
|
||||
object_class->get_property = gimp_data_editor_get_property;
|
||||
object_class->dispose = gimp_data_editor_dispose;
|
||||
|
||||
widget_class->style_set = gimp_data_editor_style_set;
|
||||
|
||||
klass->set_data = gimp_data_editor_real_set_data;
|
||||
|
||||
g_object_class_install_property (object_class, PROP_DATA_FACTORY,
|
||||
|
@ -140,6 +149,14 @@ gimp_data_editor_class_init (GimpDataEditorClass *klass)
|
|||
NULL, NULL,
|
||||
GIMP_TYPE_DATA,
|
||||
GIMP_PARAM_READWRITE));
|
||||
|
||||
gtk_widget_class_install_style_property (widget_class,
|
||||
g_param_spec_int ("minimal-height",
|
||||
NULL, NULL,
|
||||
32,
|
||||
G_MAXINT,
|
||||
DEFAULT_MINIMAL_HEIGHT,
|
||||
GIMP_PARAM_READABLE));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -289,6 +306,24 @@ gimp_data_editor_dispose (GObject *object)
|
|||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_data_editor_style_set (GtkWidget *widget,
|
||||
GtkStyle *prev_style)
|
||||
{
|
||||
GimpDataEditor *editor = GIMP_DATA_EDITOR (widget);
|
||||
gint minimal_height;
|
||||
|
||||
if (GTK_WIDGET_CLASS (parent_class)->style_set)
|
||||
GTK_WIDGET_CLASS (parent_class)->style_set (widget, prev_style);
|
||||
|
||||
gtk_widget_style_get (widget,
|
||||
"minimal-height", &minimal_height,
|
||||
NULL);
|
||||
|
||||
if (editor->view)
|
||||
gtk_widget_set_size_request (editor->view, -1, minimal_height);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_data_editor_set_context (GimpDocked *docked,
|
||||
GimpContext *context)
|
||||
|
|
|
@ -49,6 +49,8 @@ struct _GimpDataEditor
|
|||
|
||||
GtkWidget *name_entry;
|
||||
|
||||
GtkWidget *view; /* filled by subclasses */
|
||||
|
||||
GtkWidget *save_button;
|
||||
GtkWidget *revert_button;
|
||||
};
|
||||
|
|
|
@ -79,8 +79,7 @@
|
|||
#define GRAD_SCROLLBAR_STEP_SIZE 0.05
|
||||
#define GRAD_SCROLLBAR_PAGE_SIZE 0.75
|
||||
|
||||
#define GRAD_VIEW_WIDTH 128
|
||||
#define GRAD_VIEW_HEIGHT 96
|
||||
#define GRAD_VIEW_SIZE 96
|
||||
#define GRAD_CONTROL_HEIGHT 14
|
||||
#define GRAD_CURRENT_COLOR_WIDTH 64
|
||||
|
||||
|
@ -290,6 +289,7 @@ gimp_gradient_editor_docked_iface_init (GimpDockedInterface *iface)
|
|||
static void
|
||||
gimp_gradient_editor_init (GimpGradientEditor *editor)
|
||||
{
|
||||
GimpDataEditor *data_editor = GIMP_DATA_EDITOR (editor);
|
||||
GtkWidget *frame;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *hbox;
|
||||
|
@ -312,29 +312,28 @@ gimp_gradient_editor_init (GimpGradientEditor *editor)
|
|||
editor->view_last_x = 0;
|
||||
editor->view_button_down = FALSE;
|
||||
|
||||
editor->view = gimp_view_new_full_by_types (NULL,
|
||||
data_editor->view = gimp_view_new_full_by_types (NULL,
|
||||
GIMP_TYPE_VIEW,
|
||||
GIMP_TYPE_GRADIENT,
|
||||
GRAD_VIEW_WIDTH,
|
||||
GRAD_VIEW_HEIGHT, 0,
|
||||
GRAD_VIEW_SIZE,
|
||||
GRAD_VIEW_SIZE, 0,
|
||||
FALSE, FALSE, FALSE);
|
||||
gtk_widget_set_size_request (editor->view,
|
||||
GRAD_VIEW_WIDTH, GRAD_VIEW_HEIGHT);
|
||||
gtk_widget_set_events (editor->view, GRAD_VIEW_EVENT_MASK);
|
||||
gimp_view_set_expand (GIMP_VIEW (editor->view), TRUE);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), editor->view, TRUE, TRUE, 0);
|
||||
gtk_widget_show (editor->view);
|
||||
gtk_widget_set_size_request (data_editor->view, -1, GRAD_VIEW_SIZE);
|
||||
gtk_widget_set_events (data_editor->view, GRAD_VIEW_EVENT_MASK);
|
||||
gimp_view_set_expand (GIMP_VIEW (data_editor->view), TRUE);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), data_editor->view, TRUE, TRUE, 0);
|
||||
gtk_widget_show (data_editor->view);
|
||||
|
||||
g_signal_connect (editor->view, "event",
|
||||
g_signal_connect (data_editor->view, "event",
|
||||
G_CALLBACK (view_events),
|
||||
editor);
|
||||
|
||||
gimp_dnd_viewable_dest_add (GTK_WIDGET (editor->view),
|
||||
gimp_dnd_viewable_dest_add (GTK_WIDGET (data_editor->view),
|
||||
GIMP_TYPE_GRADIENT,
|
||||
gradient_editor_drop_gradient,
|
||||
editor);
|
||||
|
||||
gimp_dnd_color_dest_add (GTK_WIDGET (editor->view),
|
||||
gimp_dnd_color_dest_add (GTK_WIDGET (data_editor->view),
|
||||
gradient_editor_drop_color,
|
||||
editor);
|
||||
|
||||
|
@ -351,8 +350,7 @@ gimp_gradient_editor_init (GimpGradientEditor *editor)
|
|||
editor->control_orig_pos = 0.0;
|
||||
|
||||
editor->control = gtk_drawing_area_new ();
|
||||
gtk_widget_set_size_request (editor->control,
|
||||
GRAD_VIEW_WIDTH, GRAD_CONTROL_HEIGHT);
|
||||
gtk_widget_set_size_request (editor->control, -1, GRAD_CONTROL_HEIGHT);
|
||||
gtk_widget_set_events (editor->control, GRAD_CONTROL_EVENT_MASK);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), editor->control, FALSE, FALSE, 0);
|
||||
gtk_widget_show (editor->control);
|
||||
|
@ -534,7 +532,7 @@ gimp_gradient_editor_set_data (GimpDataEditor *editor,
|
|||
G_CALLBACK (gimp_gradient_editor_gradient_dirty),
|
||||
gradient_editor);
|
||||
|
||||
gimp_view_set_viewable (GIMP_VIEW (gradient_editor->view),
|
||||
gimp_view_set_viewable (GIMP_VIEW (editor->view),
|
||||
GIMP_VIEWABLE (data));
|
||||
|
||||
control_update (gradient_editor, GIMP_GRADIENT (data), TRUE);
|
||||
|
@ -544,11 +542,11 @@ static void
|
|||
gimp_gradient_editor_set_context (GimpDocked *docked,
|
||||
GimpContext *context)
|
||||
{
|
||||
GimpGradientEditor *editor = GIMP_GRADIENT_EDITOR (docked);
|
||||
GimpDataEditor *data_editor = GIMP_DATA_EDITOR (docked);
|
||||
|
||||
parent_docked_iface->set_context (docked, context);
|
||||
|
||||
gimp_view_renderer_set_context (GIMP_VIEW (editor->view)->renderer,
|
||||
gimp_view_renderer_set_context (GIMP_VIEW (data_editor->view)->renderer,
|
||||
context);
|
||||
}
|
||||
|
||||
|
@ -779,6 +777,7 @@ static void
|
|||
gradient_editor_scrollbar_update (GtkAdjustment *adjustment,
|
||||
GimpGradientEditor *editor)
|
||||
{
|
||||
GimpDataEditor *data_editor = GIMP_DATA_EDITOR (editor);
|
||||
GimpViewRendererGradient *renderer;
|
||||
gchar *str1;
|
||||
gchar *str2;
|
||||
|
@ -795,7 +794,7 @@ gradient_editor_scrollbar_update (GtkAdjustment *adjustment,
|
|||
g_free (str1);
|
||||
g_free (str2);
|
||||
|
||||
renderer = GIMP_VIEW_RENDERER_GRADIENT (GIMP_VIEW (editor->view)->renderer);
|
||||
renderer = GIMP_VIEW_RENDERER_GRADIENT (GIMP_VIEW (data_editor->view)->renderer);
|
||||
|
||||
gimp_view_renderer_gradient_set_offsets (renderer,
|
||||
adjustment->value,
|
||||
|
@ -844,9 +843,10 @@ view_events (GtkWidget *widget,
|
|||
GdkEvent *event,
|
||||
GimpGradientEditor *editor)
|
||||
{
|
||||
GimpDataEditor *data_editor = GIMP_DATA_EDITOR (editor);
|
||||
gint x, y;
|
||||
|
||||
if (! GIMP_DATA_EDITOR (editor)->data)
|
||||
if (! data_editor->data)
|
||||
return TRUE;
|
||||
|
||||
switch (event->type)
|
||||
|
@ -859,7 +859,7 @@ view_events (GtkWidget *widget,
|
|||
{
|
||||
GdkEventMotion *mevent = (GdkEventMotion *) event;
|
||||
|
||||
gtk_widget_get_pointer (editor->view, &x, &y);
|
||||
gtk_widget_get_pointer (data_editor->view, &x, &y);
|
||||
|
||||
if (x != editor->view_last_x)
|
||||
{
|
||||
|
@ -885,7 +885,7 @@ view_events (GtkWidget *widget,
|
|||
{
|
||||
GdkEventButton *bevent = (GdkEventButton *) event;
|
||||
|
||||
gtk_widget_get_pointer (editor->view, &x, &y);
|
||||
gtk_widget_get_pointer (data_editor->view, &x, &y);
|
||||
|
||||
switch (bevent->button)
|
||||
{
|
||||
|
@ -961,7 +961,7 @@ view_events (GtkWidget *widget,
|
|||
{
|
||||
GdkEventButton *bevent = (GdkEventButton *) event;
|
||||
|
||||
gtk_widget_get_pointer (editor->view, &x, &y);
|
||||
gtk_widget_get_pointer (data_editor->view, &x, &y);
|
||||
|
||||
editor->view_last_x = x;
|
||||
editor->view_button_down = FALSE;
|
||||
|
@ -1739,7 +1739,7 @@ control_update (GimpGradientEditor *editor,
|
|||
/* See whether we have to re-create the control pixmap
|
||||
* depending on the view's width
|
||||
*/
|
||||
cwidth = editor->view->allocation.width;
|
||||
cwidth = GIMP_DATA_EDITOR (editor)->view->allocation.width;
|
||||
cheight = GRAD_CONTROL_HEIGHT;
|
||||
|
||||
if (editor->control_pixmap)
|
||||
|
|
|
@ -58,7 +58,6 @@ struct _GimpGradientEditor
|
|||
GtkWidget *hint_label3;
|
||||
GtkWidget *hint_label4;
|
||||
GtkWidget *scrollbar;
|
||||
GtkWidget *view;
|
||||
GtkWidget *control;
|
||||
|
||||
/* Zoom and scrollbar */
|
||||
|
|
|
@ -171,7 +171,7 @@ gimp_palette_editor_docked_iface_init (GimpDockedInterface *iface)
|
|||
static void
|
||||
gimp_palette_editor_init (GimpPaletteEditor *editor)
|
||||
{
|
||||
GtkWidget *scrolled_win;
|
||||
GimpDataEditor *data_editor = GIMP_DATA_EDITOR (editor);
|
||||
GtkWidget *eventbox;
|
||||
GtkWidget *alignment;
|
||||
GtkWidget *hbox;
|
||||
|
@ -183,16 +183,16 @@ gimp_palette_editor_init (GimpPaletteEditor *editor)
|
|||
editor->last_width = 0;
|
||||
editor->columns = COLUMNS;
|
||||
|
||||
editor->scrolled_window = scrolled_win = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_widget_set_size_request (scrolled_win, -1, PREVIEW_HEIGHT);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled_win),
|
||||
data_editor->view = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_widget_set_size_request (data_editor->view, -1, PREVIEW_HEIGHT);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (data_editor->view),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_box_pack_start (GTK_BOX (editor), scrolled_win, TRUE, TRUE, 0);
|
||||
gtk_widget_show (scrolled_win);
|
||||
gtk_box_pack_start (GTK_BOX (editor), data_editor->view, TRUE, TRUE, 0);
|
||||
gtk_widget_show (data_editor->view);
|
||||
|
||||
eventbox = gtk_event_box_new ();
|
||||
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolled_win),
|
||||
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (data_editor->view),
|
||||
eventbox);
|
||||
gtk_widget_show (eventbox);
|
||||
|
||||
|
@ -870,14 +870,15 @@ palette_editor_resize (GimpPaletteEditor *editor,
|
|||
static void
|
||||
palette_editor_scroll_top_left (GimpPaletteEditor *palette_editor)
|
||||
{
|
||||
GimpDataEditor *data_editor = GIMP_DATA_EDITOR (palette_editor);
|
||||
GtkAdjustment *hadj;
|
||||
GtkAdjustment *vadj;
|
||||
|
||||
if (! palette_editor->scrolled_window)
|
||||
if (! data_editor->view)
|
||||
return;
|
||||
|
||||
hadj = gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (palette_editor->scrolled_window));
|
||||
vadj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (palette_editor->scrolled_window));
|
||||
hadj = gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (data_editor->view));
|
||||
vadj = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (data_editor->view));
|
||||
|
||||
if (hadj)
|
||||
gtk_adjustment_set_value (hadj, 0.0);
|
||||
|
|
|
@ -38,7 +38,6 @@ struct _GimpPaletteEditor
|
|||
GimpDataEditor parent_instance;
|
||||
|
||||
GtkWidget *view;
|
||||
GtkWidget *scrolled_window;
|
||||
|
||||
GtkWidget *color_name;
|
||||
GtkAdjustment *columns_data;
|
||||
|
|
|
@ -51,6 +51,7 @@ style "gimp-default-style"
|
|||
GimpEditor::content_spacing = 2
|
||||
GimpEditor::button_spacing = 2
|
||||
GimpEditor::button_icon_size = menu
|
||||
GimpDataEditor::minimal_height = 96
|
||||
GtkDialog::content_area_border = 0
|
||||
GtkDialog::button_spacing = 6
|
||||
GtkDialog::action_area_border = 12
|
||||
|
|
|
@ -56,6 +56,7 @@ style "gimp-default-style"
|
|||
GimpEditor::content_spacing = 1
|
||||
GimpEditor::button_spacing = 1
|
||||
GimpEditor::button_icon_size = menu
|
||||
GimpDataEditor::minimal_height = 64
|
||||
GimpFrame::label_spacing = 2
|
||||
GtkDialog::content_area_border = 0
|
||||
GtkDialog::button_spacing = 6
|
||||
|
|
Loading…
Reference in New Issue