added a stock icon for "view-zoom-1-1".
2004-05-10 Sven Neumann <sven@gimp.org> * app/actions/view-actions.c: added a stock icon for "view-zoom-1-1". * app/widgets/gimpunitcombobox.[ch]: added functions to get and set the active unit. * app/widgets/gimpunitstore.c (gimp_unit_store_tree_model_get_value): need to special case GIMP_UNIT_PIXEL. * app/display/Makefile.am * app/display/display-types.h * app/display/gimpscalecombobox.[ch]: new widget to be used in the display's statusbar. * app/display/gimpdisplayshell-cursor.[ch]: always display the cursor position, not only if the cursor is inside the image. Added new function gimp_display_shell_clear_cursor() to clear the cursor label. * app/display/gimpdisplayshell-callbacks.c: changed accordingly. * app/display/gimpstatusbar.[ch] * app/display/gimpdisplayshell.c * app/display/gimpdisplayshell-handlers.c * app/display/gimpdisplayshell-scale.c: do not explicitely resize the statusbar cursor label, connect to GimpDisplayShell::scaled instead. Added a GimpScaleComboBox to the status bar.
This commit is contained in:

committed by
Sven Neumann

parent
da0de0873f
commit
a08d648a47
29
ChangeLog
29
ChangeLog
@ -1,3 +1,32 @@
|
||||
2004-05-10 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/actions/view-actions.c: added a stock icon for "view-zoom-1-1".
|
||||
|
||||
* app/widgets/gimpunitcombobox.[ch]: added functions to get and
|
||||
set the active unit.
|
||||
|
||||
* app/widgets/gimpunitstore.c (gimp_unit_store_tree_model_get_value):
|
||||
need to special case GIMP_UNIT_PIXEL.
|
||||
|
||||
* app/display/Makefile.am
|
||||
* app/display/display-types.h
|
||||
* app/display/gimpscalecombobox.[ch]: new widget to be used in the
|
||||
display's statusbar.
|
||||
|
||||
* app/display/gimpdisplayshell-cursor.[ch]: always display the
|
||||
cursor position, not only if the cursor is inside the image. Added
|
||||
new function gimp_display_shell_clear_cursor() to clear the cursor
|
||||
label.
|
||||
|
||||
* app/display/gimpdisplayshell-callbacks.c: changed accordingly.
|
||||
|
||||
* app/display/gimpstatusbar.[ch]
|
||||
* app/display/gimpdisplayshell.c
|
||||
* app/display/gimpdisplayshell-handlers.c
|
||||
* app/display/gimpdisplayshell-scale.c: do not explicitely resize
|
||||
the statusbar cursor label, connect to GimpDisplayShell::scaled
|
||||
instead. Added a GimpScaleComboBox to the status bar.
|
||||
|
||||
2004-05-10 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
Started making the toolbox configurable.
|
||||
|
@ -204,7 +204,7 @@ static GimpRadioActionEntry view_zoom_actions[] =
|
||||
20000,
|
||||
GIMP_HELP_VIEW_ZOOM_IN },
|
||||
|
||||
{ "view-zoom-1-1", NULL,
|
||||
{ "view-zoom-1-1", GTK_STOCK_ZOOM_100,
|
||||
N_("1:1 (100%)"), "1", NULL,
|
||||
10000,
|
||||
GIMP_HELP_VIEW_ZOOM_100 },
|
||||
|
@ -64,6 +64,8 @@ libappdisplay_a_sources = \
|
||||
gimpnavigationview.h \
|
||||
gimpprogress.c \
|
||||
gimpprogress.h \
|
||||
gimpscalecombobox.c \
|
||||
gimpscalecombobox.h \
|
||||
gimpstatusbar.c \
|
||||
gimpstatusbar.h
|
||||
|
||||
|
@ -31,6 +31,7 @@ typedef struct _GimpDisplay GimpDisplay;
|
||||
typedef struct _GimpDisplayShell GimpDisplayShell;
|
||||
|
||||
typedef struct _GimpNavigationView GimpNavigationView;
|
||||
typedef struct _GimpScaleComboBox GimpScaleComboBox;
|
||||
typedef struct _GimpStatusbar GimpStatusbar;
|
||||
|
||||
typedef struct _Selection Selection;
|
||||
|
@ -67,7 +67,6 @@
|
||||
#include "gimpdisplayshell-title.h"
|
||||
#include "gimpdisplayshell-transform.h"
|
||||
#include "gimpnavigationview.h"
|
||||
#include "gimpstatusbar.h"
|
||||
|
||||
#include "gimp-intl.h"
|
||||
|
||||
@ -281,8 +280,6 @@ gimp_display_shell_canvas_realize (GtkWidget *canvas,
|
||||
gimp_display_shell_get_padding (shell, &padding_mode, &padding_color);
|
||||
gimp_display_shell_set_padding (shell, padding_mode, &padding_color);
|
||||
|
||||
gimp_statusbar_resize_cursor (GIMP_STATUSBAR (shell->statusbar));
|
||||
|
||||
gimp_display_shell_update_title (shell);
|
||||
|
||||
shell->disp_width = canvas->allocation.width;
|
||||
@ -532,7 +529,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
|
||||
return TRUE;
|
||||
|
||||
shell->proximity = FALSE;
|
||||
gimp_display_shell_update_cursor (shell, -1, -1, -1, -1);
|
||||
gimp_display_shell_clear_cursor (shell);
|
||||
|
||||
tool_manager_oper_update_active (gimp,
|
||||
&image_coords, state,
|
||||
@ -548,7 +545,7 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
|
||||
|
||||
case GDK_PROXIMITY_OUT:
|
||||
shell->proximity = FALSE;
|
||||
gimp_display_shell_update_cursor (shell, -1, -1, -1, -1);
|
||||
gimp_display_shell_clear_cursor (shell);
|
||||
|
||||
tool_manager_oper_update_active (gimp,
|
||||
&image_coords, state,
|
||||
@ -1076,8 +1073,10 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
|
||||
|
||||
switch (kevent->keyval)
|
||||
{
|
||||
case GDK_Left: case GDK_Right:
|
||||
case GDK_Up: case GDK_Down:
|
||||
case GDK_Left:
|
||||
case GDK_Right:
|
||||
case GDK_Up:
|
||||
case GDK_Down:
|
||||
if (! gimp_image_is_empty (gimage))
|
||||
{
|
||||
tool_manager_arrow_key_active (gimp,
|
||||
@ -1153,8 +1152,8 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
|
||||
break;
|
||||
|
||||
/* Update the state based on modifiers being pressed */
|
||||
case GDK_Alt_L: case GDK_Alt_R:
|
||||
case GDK_Shift_L: case GDK_Shift_R:
|
||||
case GDK_Alt_L: case GDK_Alt_R:
|
||||
case GDK_Shift_L: case GDK_Shift_R:
|
||||
case GDK_Control_L: case GDK_Control_R:
|
||||
{
|
||||
GdkModifierType key;
|
||||
@ -1210,8 +1209,8 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
|
||||
break;
|
||||
|
||||
/* Update the state based on modifiers being pressed */
|
||||
case GDK_Alt_L: case GDK_Alt_R:
|
||||
case GDK_Shift_L: case GDK_Shift_R:
|
||||
case GDK_Alt_L: case GDK_Alt_R:
|
||||
case GDK_Shift_L: case GDK_Shift_R:
|
||||
case GDK_Control_L: case GDK_Control_R:
|
||||
{
|
||||
GdkModifierType key;
|
||||
@ -1280,13 +1279,11 @@ gimp_display_shell_canvas_tool_events (GtkWidget *canvas,
|
||||
}
|
||||
|
||||
if (update_cursor)
|
||||
{
|
||||
gimp_display_shell_update_cursor (shell,
|
||||
RINT (display_coords.x),
|
||||
RINT (display_coords.y),
|
||||
RINT (image_coords.x),
|
||||
RINT (image_coords.y));
|
||||
}
|
||||
gimp_display_shell_update_cursor (shell,
|
||||
RINT (display_coords.x),
|
||||
RINT (display_coords.y),
|
||||
RINT (image_coords.x),
|
||||
RINT (image_coords.y));
|
||||
|
||||
return return_val;
|
||||
}
|
||||
|
@ -147,8 +147,8 @@ gimp_display_shell_update_cursor (GimpDisplayShell *shell,
|
||||
/* use the passed image_coords for the statusbar because they are
|
||||
* possibly snapped...
|
||||
*/
|
||||
gimp_statusbar_update_cursor (GIMP_STATUSBAR (shell->statusbar),
|
||||
image_x, image_y);
|
||||
gimp_statusbar_set_cursor (GIMP_STATUSBAR (shell->statusbar),
|
||||
image_x, image_y);
|
||||
|
||||
/* ...but use the unsnapped display_coords for the info window */
|
||||
if (display_x >= 0 && display_y >= 0)
|
||||
@ -168,6 +168,16 @@ gimp_display_shell_update_cursor (GimpDisplayShell *shell,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_display_shell_clear_cursor (GimpDisplayShell *shell)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
|
||||
|
||||
gimp_statusbar_clear_cursor (GIMP_STATUSBAR (shell->statusbar));
|
||||
|
||||
info_window_update_extended (shell->gdisp, -1, -1);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_display_shell_real_set_cursor (GimpDisplayShell *shell,
|
||||
GdkCursorType cursor_type,
|
||||
|
@ -33,6 +33,7 @@ void gimp_display_shell_update_cursor (GimpDisplayShell *shell,
|
||||
gint display_y,
|
||||
gint image_x,
|
||||
gint image_y);
|
||||
void gimp_display_shell_clear_cursor (GimpDisplayShell *shell);
|
||||
|
||||
|
||||
#endif /* __GIMP_DISPLAY_SHELL_CURSOR_H__ */
|
||||
|
@ -42,7 +42,6 @@
|
||||
#include "gimpdisplayshell-handlers.h"
|
||||
#include "gimpdisplayshell-scale.h"
|
||||
#include "gimpdisplayshell-title.h"
|
||||
#include "gimpstatusbar.h"
|
||||
|
||||
|
||||
#define GIMP_DISPLAY_UPDATE_ICON_TIMEOUT 1000
|
||||
@ -398,8 +397,6 @@ static void
|
||||
gimp_display_shell_size_changed_handler (GimpImage *gimage,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
gimp_statusbar_resize_cursor (GIMP_STATUSBAR (shell->statusbar));
|
||||
|
||||
gimp_display_shell_scale_resize (shell,
|
||||
GIMP_DISPLAY_CONFIG (gimage->gimp->config)->resize_windows_on_resize,
|
||||
TRUE);
|
||||
@ -411,8 +408,6 @@ gimp_display_shell_resolution_changed_handler (GimpImage *gimage,
|
||||
{
|
||||
gimp_display_shell_scale_setup (shell);
|
||||
gimp_display_shell_scaled (shell);
|
||||
|
||||
gimp_statusbar_resize_cursor (GIMP_STATUSBAR (shell->statusbar));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -421,8 +416,6 @@ gimp_display_shell_unit_changed_handler (GimpImage *gimage,
|
||||
{
|
||||
gimp_display_shell_scale_setup (shell);
|
||||
gimp_display_shell_scaled (shell);
|
||||
|
||||
gimp_statusbar_resize_cursor (GIMP_STATUSBAR (shell->statusbar));
|
||||
}
|
||||
|
||||
static void
|
||||
@ -580,8 +573,6 @@ gimp_display_shell_monitor_res_notify_handler (GObject *config,
|
||||
gimp_display_shell_scale_setup (shell);
|
||||
gimp_display_shell_scaled (shell);
|
||||
|
||||
gimp_statusbar_resize_cursor (GIMP_STATUSBAR (shell->statusbar));
|
||||
|
||||
gimp_display_shell_expose_full (shell);
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,6 @@
|
||||
#include "gimpdisplayshell-scale.h"
|
||||
#include "gimpdisplayshell-scroll.h"
|
||||
#include "gimpdisplayshell-title.h"
|
||||
#include "gimpstatusbar.h"
|
||||
|
||||
#include "gimp-intl.h"
|
||||
|
||||
@ -340,8 +339,6 @@ gimp_display_shell_scale_set_dot_for_dot (GimpDisplayShell *shell,
|
||||
|
||||
shell->dot_for_dot = dot_for_dot;
|
||||
|
||||
gimp_statusbar_resize_cursor (GIMP_STATUSBAR (shell->statusbar));
|
||||
|
||||
gimp_display_shell_scale_resize (shell,
|
||||
GIMP_DISPLAY_CONFIG (gimp->config)->resize_windows_on_zoom,
|
||||
TRUE);
|
||||
|
@ -971,9 +971,9 @@ gimp_display_shell_reconnect (GimpDisplayShell *shell)
|
||||
|
||||
gimp_display_shell_connect (shell);
|
||||
|
||||
gimp_statusbar_resize_cursor (GIMP_STATUSBAR (shell->statusbar));
|
||||
gimp_display_shell_scale_setup (shell);
|
||||
gimp_display_shell_expose_full (shell);
|
||||
gimp_display_shell_scaled (shell);
|
||||
|
||||
g_signal_emit (shell, display_shell_signals[RECONNECT], 0);
|
||||
}
|
||||
|
327
app/display/gimpscalecombobox.c
Normal file
327
app/display/gimpscalecombobox.c
Normal file
@ -0,0 +1,327 @@
|
||||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimpscalecombobox.c
|
||||
* Copyright (C) 2004 Sven Neumann <sven@gimp.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "display-types.h"
|
||||
|
||||
#include "gimpscalecombobox.h"
|
||||
|
||||
|
||||
#define MAX_ITEMS 10
|
||||
|
||||
enum
|
||||
{
|
||||
SCALE,
|
||||
LABEL,
|
||||
PERSISTENT,
|
||||
NUM_COLUMNS
|
||||
};
|
||||
|
||||
|
||||
static void gimp_scale_combo_box_class_init (GimpScaleComboBoxClass *klass);
|
||||
static void gimp_scale_combo_box_init (GimpScaleComboBox *combo_box);
|
||||
static void gimp_scale_combo_box_finalize (GObject *object);
|
||||
|
||||
|
||||
static GtkComboBoxClass *parent_class = NULL;
|
||||
|
||||
|
||||
GType
|
||||
gimp_scale_combo_box_get_type (void)
|
||||
{
|
||||
static GType combo_box_type = 0;
|
||||
|
||||
if (!combo_box_type)
|
||||
{
|
||||
static const GTypeInfo combo_box_info =
|
||||
{
|
||||
sizeof (GimpScaleComboBoxClass),
|
||||
NULL, /* base_init */
|
||||
NULL, /* base_finalize */
|
||||
(GClassInitFunc) gimp_scale_combo_box_class_init,
|
||||
NULL, /* class_finalize */
|
||||
NULL, /* class_data */
|
||||
sizeof (GimpScaleComboBox),
|
||||
0, /* n_preallocs */
|
||||
(GInstanceInitFunc) gimp_scale_combo_box_init
|
||||
};
|
||||
|
||||
combo_box_type = g_type_register_static (GTK_TYPE_COMBO_BOX,
|
||||
"GimpScaleComboBox",
|
||||
&combo_box_info, 0);
|
||||
}
|
||||
|
||||
return combo_box_type;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_scale_combo_box_class_init (GimpScaleComboBoxClass *klass)
|
||||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
object_class->finalize = gimp_scale_combo_box_finalize;
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_scale_combo_box_init (GimpScaleComboBox *combo_box)
|
||||
{
|
||||
GtkListStore *store;
|
||||
GtkCellRenderer *cell;
|
||||
GtkTreeIter iter;
|
||||
gint i;
|
||||
|
||||
store = gtk_list_store_new (NUM_COLUMNS,
|
||||
G_TYPE_DOUBLE,
|
||||
G_TYPE_STRING,
|
||||
G_TYPE_BOOLEAN);
|
||||
|
||||
gtk_combo_box_set_model (GTK_COMBO_BOX (combo_box), GTK_TREE_MODEL (store));
|
||||
|
||||
g_object_unref (store);
|
||||
|
||||
cell = g_object_new (GTK_TYPE_CELL_RENDERER_TEXT,
|
||||
"xalign", 1.0,
|
||||
NULL);
|
||||
gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_box), cell, TRUE);
|
||||
gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo_box), cell,
|
||||
"text", LABEL,
|
||||
NULL);
|
||||
|
||||
for (i = 8; i > 0; i /= 2)
|
||||
{
|
||||
gchar label[32];
|
||||
|
||||
g_snprintf (label, sizeof (label), "%d%%", i * 100);
|
||||
|
||||
gtk_list_store_append (store, &iter);
|
||||
gtk_list_store_set (store, &iter,
|
||||
SCALE, (gdouble) i,
|
||||
LABEL, label,
|
||||
PERSISTENT, TRUE,
|
||||
-1);
|
||||
}
|
||||
|
||||
for (i = 2; i <= 8; i *= 2)
|
||||
{
|
||||
gchar label[32];
|
||||
|
||||
g_snprintf (label, sizeof (label), "%d%%", 100 / i);
|
||||
|
||||
gtk_list_store_append (store, &iter);
|
||||
gtk_list_store_set (store, &iter,
|
||||
SCALE, 1.0 / (gdouble) i,
|
||||
LABEL, label,
|
||||
PERSISTENT, TRUE,
|
||||
-1);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_scale_combo_box_finalize (GObject *object)
|
||||
{
|
||||
GimpScaleComboBox *combo_box = GIMP_SCALE_COMBO_BOX (object);
|
||||
|
||||
if (combo_box->mru)
|
||||
{
|
||||
g_list_foreach (combo_box->mru,
|
||||
(GFunc) gtk_tree_row_reference_free, NULL);
|
||||
g_list_free (combo_box->mru);
|
||||
combo_box->mru = NULL;
|
||||
}
|
||||
|
||||
G_OBJECT_CLASS (parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_scale_combo_box_mru_add (GimpScaleComboBox *combo_box,
|
||||
GtkTreeIter *iter)
|
||||
{
|
||||
GtkTreeModel *model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo_box));
|
||||
GtkTreePath *path = gtk_tree_model_get_path (model, iter);
|
||||
GList *list;
|
||||
gboolean found;
|
||||
|
||||
for (list = combo_box->mru, found = FALSE; list && !found; list = list->next)
|
||||
{
|
||||
GtkTreePath *this = gtk_tree_row_reference_get_path (list->data);
|
||||
|
||||
if (gtk_tree_path_compare (this, path) == 0)
|
||||
{
|
||||
if (list->prev)
|
||||
{
|
||||
combo_box->mru = g_list_remove_link (combo_box->mru, list);
|
||||
combo_box->mru = g_list_concat (list, combo_box->mru);
|
||||
}
|
||||
|
||||
found = TRUE;
|
||||
}
|
||||
|
||||
gtk_tree_path_free (this);
|
||||
}
|
||||
|
||||
if (! found)
|
||||
combo_box->mru = g_list_prepend (combo_box->mru,
|
||||
gtk_tree_row_reference_new (model, path));
|
||||
|
||||
gtk_tree_path_free (path);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_scale_combo_box_mru_remove_last (GimpScaleComboBox *combo_box)
|
||||
{
|
||||
GtkTreeModel *model;
|
||||
GtkTreePath *path;
|
||||
GList *last;
|
||||
GtkTreeIter iter;
|
||||
|
||||
if (! combo_box->mru)
|
||||
return;
|
||||
|
||||
model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo_box));
|
||||
|
||||
last = g_list_last (combo_box->mru);
|
||||
path = gtk_tree_row_reference_get_path (last->data);
|
||||
|
||||
if (gtk_tree_model_get_iter (model, &iter, path))
|
||||
{
|
||||
gchar *label;
|
||||
|
||||
gtk_tree_model_get (model, &iter,
|
||||
LABEL, &label,
|
||||
-1);
|
||||
g_printerr ("removing %s\n", label);
|
||||
|
||||
gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
|
||||
gtk_tree_row_reference_free (last->data);
|
||||
combo_box->mru = g_list_delete_link (combo_box->mru, last);
|
||||
}
|
||||
|
||||
gtk_tree_path_free (path);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* gimp_scale_combo_box_new:
|
||||
*
|
||||
* Return value: a new #GimpScaleComboBox.
|
||||
**/
|
||||
GtkWidget *
|
||||
gimp_scale_combo_box_new (void)
|
||||
{
|
||||
return g_object_new (GIMP_TYPE_SCALE_COMBO_BOX, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_scale_combo_box_set_scale (GimpScaleComboBox *combo_box,
|
||||
gdouble scale)
|
||||
{
|
||||
GtkTreeModel *model;
|
||||
GtkListStore *store;
|
||||
GtkTreeIter iter;
|
||||
gboolean iter_valid;
|
||||
gboolean persistent;
|
||||
|
||||
g_return_if_fail (GIMP_IS_SCALE_COMBO_BOX (combo_box));
|
||||
|
||||
model = gtk_combo_box_get_model (GTK_COMBO_BOX (combo_box));
|
||||
store = GTK_LIST_STORE (model);
|
||||
|
||||
for (iter_valid = gtk_tree_model_get_iter_first (model, &iter);
|
||||
iter_valid;
|
||||
iter_valid = gtk_tree_model_iter_next (model, &iter))
|
||||
{
|
||||
gdouble this;
|
||||
|
||||
gtk_tree_model_get (model, &iter,
|
||||
SCALE, &this,
|
||||
-1);
|
||||
|
||||
if (this == scale)
|
||||
break;
|
||||
}
|
||||
|
||||
if (! iter_valid)
|
||||
{
|
||||
GtkTreeIter sibling;
|
||||
gchar label[32];
|
||||
|
||||
for (iter_valid = gtk_tree_model_get_iter_first (model, &sibling);
|
||||
iter_valid;
|
||||
iter_valid = gtk_tree_model_iter_next (model, &sibling))
|
||||
{
|
||||
gdouble this;
|
||||
|
||||
gtk_tree_model_get (model, &sibling,
|
||||
SCALE, &this,
|
||||
-1);
|
||||
|
||||
if (this < scale)
|
||||
break;
|
||||
}
|
||||
|
||||
g_snprintf (label, sizeof (label), "%d%%", (gint) (100.0 * scale));
|
||||
|
||||
gtk_list_store_insert_before (store, &iter,
|
||||
iter_valid ? &sibling : NULL);
|
||||
gtk_list_store_set (store, &iter,
|
||||
SCALE, scale,
|
||||
LABEL, label,
|
||||
PERSISTENT, FALSE,
|
||||
-1);
|
||||
}
|
||||
|
||||
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (combo_box), &iter);
|
||||
|
||||
gtk_tree_model_get (model, &iter,
|
||||
PERSISTENT, &persistent,
|
||||
-1);
|
||||
if (! persistent)
|
||||
{
|
||||
gimp_scale_combo_box_mru_add (combo_box, &iter);
|
||||
|
||||
if (gtk_tree_model_iter_n_children (model, NULL) > MAX_ITEMS)
|
||||
gimp_scale_combo_box_mru_remove_last (combo_box);
|
||||
}
|
||||
}
|
||||
|
||||
gdouble
|
||||
gimp_scale_combo_box_get_scale (GimpScaleComboBox *combo_box)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
gdouble scale = 1.0;
|
||||
|
||||
g_return_val_if_fail (GIMP_IS_SCALE_COMBO_BOX (combo_box), FALSE);
|
||||
|
||||
if (gtk_combo_box_get_active_iter (GTK_COMBO_BOX (combo_box), &iter))
|
||||
{
|
||||
gtk_tree_model_get (gtk_combo_box_get_model (GTK_COMBO_BOX (combo_box)),
|
||||
&iter,
|
||||
SCALE, &scale,
|
||||
-1);
|
||||
}
|
||||
|
||||
return scale;
|
||||
}
|
59
app/display/gimpscalecombobox.h
Normal file
59
app/display/gimpscalecombobox.h
Normal file
@ -0,0 +1,59 @@
|
||||
/* The GIMP -- an image manipulation program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimpscalecombobox.h
|
||||
* Copyright (C) 2004 Sven Neumann <sven@gimp.org>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GIMP_SCALE_COMBO_BOX_H__
|
||||
#define __GIMP_SCALE_COMBO_BOX_H__
|
||||
|
||||
#include <gtk/gtkcombobox.h>
|
||||
|
||||
|
||||
#define GIMP_TYPE_SCALE_COMBO_BOX (gimp_scale_combo_box_get_type ())
|
||||
#define GIMP_SCALE_COMBO_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_SCALE_COMBO_BOX, GimpScaleComboBox))
|
||||
#define GIMP_SCALE_COMBO_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_SCALE_COMBO_BOX, GimpScaleComboBoxClass))
|
||||
#define GIMP_IS_SCALE_COMBO_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_SCALE_COMBO_BOX))
|
||||
#define GIMP_IS_SCALE_COMBO_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_SCALE_COMBO_BOX))
|
||||
#define GIMP_SCALE_COMBO_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_SCALE_COMBO_BOX, GimpScaleComboBoxClass))
|
||||
|
||||
|
||||
typedef struct _GimpScaleComboBoxClass GimpScaleComboBoxClass;
|
||||
|
||||
struct _GimpScaleComboBoxClass
|
||||
{
|
||||
GtkComboBoxClass parent_instance;
|
||||
};
|
||||
|
||||
struct _GimpScaleComboBox
|
||||
{
|
||||
GtkComboBox parent_instance;
|
||||
|
||||
GList *mru;
|
||||
};
|
||||
|
||||
|
||||
GType gimp_scale_combo_box_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkWidget * gimp_scale_combo_box_new (void);
|
||||
void gimp_scale_combo_box_set_scale (GimpScaleComboBox *combo_box,
|
||||
gdouble scale);
|
||||
gdouble gimp_scale_combo_box_get_scale (GimpScaleComboBox *combo_box);
|
||||
|
||||
|
||||
#endif /* __GIMP_SCALE_COMBO_BOX_H__ */
|
@ -20,6 +20,8 @@
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "display-types.h"
|
||||
|
||||
#include "core/gimpimage.h"
|
||||
@ -30,6 +32,8 @@
|
||||
|
||||
#include "gimpdisplay.h"
|
||||
#include "gimpdisplayshell.h"
|
||||
#include "gimpdisplayshell-scale.h"
|
||||
#include "gimpscalecombobox.h"
|
||||
#include "gimpstatusbar.h"
|
||||
|
||||
#include "gimp-intl.h"
|
||||
@ -38,20 +42,21 @@
|
||||
/* maximal width of the string holding the cursor-coordinates for
|
||||
* the status line
|
||||
*/
|
||||
#define CURSOR_STR_LENGTH 256
|
||||
#define CURSOR_LEN 256
|
||||
|
||||
|
||||
static void gimp_statusbar_class_init (GimpStatusbarClass *klass);
|
||||
static void gimp_statusbar_init (GimpStatusbar *statusbar);
|
||||
static void gimp_statusbar_class_init (GimpStatusbarClass *klass);
|
||||
static void gimp_statusbar_init (GimpStatusbar *statusbar);
|
||||
|
||||
static void gimp_statusbar_update (GtkStatusbar *gtk_statusbar,
|
||||
guint context_id,
|
||||
const gchar *text);
|
||||
static void gimp_statusbar_set_cursor (GimpStatusbar *statusbar,
|
||||
gdouble x,
|
||||
gdouble y);
|
||||
static void gimp_statusbar_unit_changed (GtkWidget *combo,
|
||||
GimpStatusbar *statusbar);
|
||||
static void gimp_statusbar_update (GtkStatusbar *gtk_statusbar,
|
||||
guint context_id,
|
||||
const gchar *text);
|
||||
static void gimp_statusbar_unit_changed (GimpUnitComboBox *combo,
|
||||
GimpStatusbar *statusbar);
|
||||
static void gimp_statusbar_scale_changed (GimpScaleComboBox *combo,
|
||||
GimpStatusbar *statusbar);
|
||||
static void gimp_statusbar_shell_scaled (GimpDisplayShell *shell,
|
||||
GimpStatusbar *statusbar);
|
||||
|
||||
|
||||
static GtkStatusbarClass *parent_class = NULL;
|
||||
@ -104,6 +109,7 @@ gimp_statusbar_init (GimpStatusbar *statusbar)
|
||||
GtkStatusbar *gtk_statusbar;
|
||||
GtkBox *box;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *frame;
|
||||
GimpUnitStore *store;
|
||||
GtkShadowType shadow_type;
|
||||
|
||||
@ -116,6 +122,8 @@ gimp_statusbar_init (GimpStatusbar *statusbar)
|
||||
statusbar->cursor_format_str[0] = '\0';
|
||||
statusbar->progressid = 0;
|
||||
|
||||
gtk_box_set_spacing (box, 1);
|
||||
|
||||
gtk_widget_style_get (GTK_WIDGET (statusbar),
|
||||
"shadow_type", &shadow_type,
|
||||
NULL);
|
||||
@ -146,6 +154,19 @@ gimp_statusbar_init (GimpStatusbar *statusbar)
|
||||
G_CALLBACK (gimp_statusbar_unit_changed),
|
||||
statusbar);
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), shadow_type);
|
||||
gtk_box_pack_start (box, frame, FALSE, FALSE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
statusbar->scale_combo = gimp_scale_combo_box_new ();
|
||||
gtk_container_add (GTK_CONTAINER (frame), statusbar->scale_combo);
|
||||
gtk_widget_show (statusbar->scale_combo);
|
||||
|
||||
g_signal_connect (statusbar->scale_combo, "changed",
|
||||
G_CALLBACK (gimp_statusbar_scale_changed),
|
||||
statusbar);
|
||||
|
||||
statusbar->progressbar = gtk_progress_bar_new ();
|
||||
gtk_box_pack_start (box, statusbar->progressbar, TRUE, TRUE, 0);
|
||||
gtk_widget_show (statusbar->progressbar);
|
||||
@ -176,9 +197,7 @@ gimp_statusbar_update (GtkStatusbar *gtk_statusbar,
|
||||
guint context_id,
|
||||
const gchar *text)
|
||||
{
|
||||
GimpStatusbar *statusbar;
|
||||
|
||||
statusbar = GIMP_STATUSBAR (gtk_statusbar);
|
||||
GimpStatusbar *statusbar = GIMP_STATUSBAR (gtk_statusbar);
|
||||
|
||||
if (! text)
|
||||
text = "";
|
||||
@ -197,6 +216,10 @@ gimp_statusbar_new (GimpDisplayShell *shell)
|
||||
|
||||
statusbar->shell = shell;
|
||||
|
||||
g_signal_connect_object (shell, "scaled",
|
||||
G_CALLBACK (gimp_statusbar_shell_scaled),
|
||||
statusbar, 0);
|
||||
|
||||
return GTK_WIDGET (statusbar);
|
||||
}
|
||||
|
||||
@ -205,14 +228,29 @@ gimp_statusbar_push (GimpStatusbar *statusbar,
|
||||
const gchar *context_id,
|
||||
const gchar *message)
|
||||
{
|
||||
guint context_uint;
|
||||
GtkStatusbar *bar;
|
||||
|
||||
g_return_if_fail (GIMP_IS_STATUSBAR (statusbar));
|
||||
|
||||
context_uint = gtk_statusbar_get_context_id (GTK_STATUSBAR (statusbar),
|
||||
context_id);
|
||||
bar = GTK_STATUSBAR (statusbar);
|
||||
|
||||
gtk_statusbar_push (GTK_STATUSBAR (statusbar), context_uint, message);
|
||||
gtk_statusbar_push (bar,
|
||||
gtk_statusbar_get_context_id (bar, context_id),
|
||||
message);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_statusbar_pop (GimpStatusbar *statusbar,
|
||||
const gchar *context_id)
|
||||
{
|
||||
GtkStatusbar *bar;
|
||||
|
||||
g_return_if_fail (GIMP_IS_STATUSBAR (statusbar));
|
||||
|
||||
bar = GTK_STATUSBAR (statusbar);
|
||||
|
||||
gtk_statusbar_pop (bar,
|
||||
gtk_statusbar_get_context_id (bar, context_id));
|
||||
}
|
||||
|
||||
void
|
||||
@ -224,7 +262,7 @@ gimp_statusbar_push_coords (GimpStatusbar *statusbar,
|
||||
gdouble y)
|
||||
{
|
||||
GimpImage *gimage;
|
||||
gchar buf[CURSOR_STR_LENGTH];
|
||||
gchar buf[CURSOR_LEN];
|
||||
|
||||
g_return_if_fail (GIMP_IS_STATUSBAR (statusbar));
|
||||
g_return_if_fail (title != NULL);
|
||||
@ -255,124 +293,18 @@ gimp_statusbar_push_coords (GimpStatusbar *statusbar,
|
||||
}
|
||||
|
||||
void
|
||||
gimp_statusbar_pop (GimpStatusbar *statusbar,
|
||||
const gchar *context_id)
|
||||
{
|
||||
guint context_uint;
|
||||
|
||||
g_return_if_fail (GIMP_IS_STATUSBAR (statusbar));
|
||||
|
||||
context_uint = gtk_statusbar_get_context_id (GTK_STATUSBAR (statusbar),
|
||||
context_id);
|
||||
|
||||
gtk_statusbar_pop (GTK_STATUSBAR (statusbar), context_uint);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_statusbar_update_cursor (GimpStatusbar *statusbar,
|
||||
gdouble x,
|
||||
gdouble y)
|
||||
{
|
||||
GimpDisplayShell *shell;
|
||||
|
||||
g_return_if_fail (GIMP_IS_STATUSBAR (statusbar));
|
||||
|
||||
shell = statusbar->shell;
|
||||
|
||||
if (x < 0 ||
|
||||
y < 0 ||
|
||||
x >= shell->gdisp->gimage->width ||
|
||||
y >= shell->gdisp->gimage->height)
|
||||
{
|
||||
gtk_label_set_text (GTK_LABEL (statusbar->cursor_label), "");
|
||||
}
|
||||
else
|
||||
{
|
||||
gimp_statusbar_set_cursor (statusbar, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_statusbar_resize_cursor (GimpStatusbar *statusbar)
|
||||
{
|
||||
static PangoLayout *layout = NULL;
|
||||
|
||||
GimpDisplayShell *shell;
|
||||
GimpImage *gimage;
|
||||
GtkTreeModel *model;
|
||||
const gchar *text;
|
||||
gint cursor_label_width;
|
||||
gint diff;
|
||||
|
||||
g_return_if_fail (GIMP_IS_STATUSBAR (statusbar));
|
||||
|
||||
shell = statusbar->shell;
|
||||
gimage = shell->gdisp->gimage;
|
||||
|
||||
model = gtk_combo_box_get_model (GTK_COMBO_BOX (statusbar->unit_combo));
|
||||
gimp_unit_store_set_resolutions (GIMP_UNIT_STORE (model),
|
||||
gimage->xresolution, gimage->yresolution);
|
||||
|
||||
g_signal_handlers_block_by_func (statusbar->unit_combo,
|
||||
gimp_statusbar_unit_changed, statusbar);
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (statusbar->unit_combo),
|
||||
gimage->unit);
|
||||
g_signal_handlers_unblock_by_func (statusbar->unit_combo,
|
||||
gimp_statusbar_unit_changed, statusbar);
|
||||
|
||||
if (gimage->unit == GIMP_UNIT_PIXEL)
|
||||
{
|
||||
g_snprintf (statusbar->cursor_format_str,
|
||||
sizeof (statusbar->cursor_format_str),
|
||||
"%%s%%d%%s%%d");
|
||||
}
|
||||
else /* show real world units */
|
||||
{
|
||||
g_snprintf (statusbar->cursor_format_str,
|
||||
sizeof (statusbar->cursor_format_str),
|
||||
"%%s%%.%df%%s%%.%df",
|
||||
gimp_image_unit_get_digits (gimage),
|
||||
gimp_image_unit_get_digits (gimage));
|
||||
}
|
||||
|
||||
gimp_statusbar_set_cursor (statusbar, gimage->width, gimage->height);
|
||||
|
||||
text = gtk_label_get_text (GTK_LABEL (statusbar->cursor_label));
|
||||
|
||||
/* one static layout for all displays should be fine */
|
||||
if (! layout)
|
||||
layout = gtk_widget_create_pango_layout (statusbar->cursor_label, text);
|
||||
else
|
||||
pango_layout_set_text (layout, text, -1);
|
||||
|
||||
pango_layout_get_pixel_size (layout, &cursor_label_width, NULL);
|
||||
|
||||
cursor_label_width += 2;
|
||||
|
||||
/* find out how many pixels the label's parent frame is bigger than
|
||||
* the label itself
|
||||
*/
|
||||
diff = (statusbar->cursor_frame->allocation.width -
|
||||
statusbar->cursor_label->allocation.width);
|
||||
|
||||
gtk_widget_set_size_request (statusbar->cursor_label,
|
||||
cursor_label_width, -1);
|
||||
|
||||
/* don't resize if this is a new display */
|
||||
if (diff)
|
||||
gtk_widget_set_size_request (statusbar->cursor_frame,
|
||||
cursor_label_width + diff, -1);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_statusbar_set_cursor (GimpStatusbar *statusbar,
|
||||
gdouble x,
|
||||
gdouble y)
|
||||
{
|
||||
GimpImage *image = statusbar->shell->gdisp->gimage;
|
||||
GimpImage *image;
|
||||
GtkTreeModel *model;
|
||||
GimpUnitStore *store;
|
||||
gchar buffer[CURSOR_STR_LENGTH];
|
||||
gchar buffer[CURSOR_LEN];
|
||||
|
||||
g_return_if_fail (GIMP_IS_STATUSBAR (statusbar));
|
||||
|
||||
image = statusbar->shell->gdisp->gimage;
|
||||
|
||||
model = gtk_combo_box_get_model (GTK_COMBO_BOX (statusbar->unit_combo));
|
||||
store = GIMP_UNIT_STORE (model);
|
||||
@ -395,10 +327,99 @@ gimp_statusbar_set_cursor (GimpStatusbar *statusbar,
|
||||
gtk_label_set_text (GTK_LABEL (statusbar->cursor_label), buffer);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_statusbar_clear_cursor (GimpStatusbar *statusbar)
|
||||
{
|
||||
gtk_label_set_text (GTK_LABEL (statusbar->cursor_label), "");
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_statusbar_unit_changed (GtkWidget *combo,
|
||||
GimpStatusbar *statusbar)
|
||||
gimp_statusbar_shell_scaled (GimpDisplayShell *shell,
|
||||
GimpStatusbar *statusbar)
|
||||
{
|
||||
static PangoLayout *layout = NULL;
|
||||
|
||||
GimpImage *image;
|
||||
GtkTreeModel *model;
|
||||
const gchar *text;
|
||||
gint width;
|
||||
gint diff;
|
||||
|
||||
g_signal_handlers_block_by_func (statusbar->scale_combo,
|
||||
gimp_statusbar_scale_changed, statusbar);
|
||||
gimp_scale_combo_box_set_scale (GIMP_SCALE_COMBO_BOX (statusbar->scale_combo),
|
||||
shell->scale);
|
||||
g_signal_handlers_unblock_by_func (statusbar->scale_combo,
|
||||
gimp_statusbar_scale_changed, statusbar);
|
||||
|
||||
image = statusbar->shell->gdisp->gimage;
|
||||
|
||||
model = gtk_combo_box_get_model (GTK_COMBO_BOX (statusbar->unit_combo));
|
||||
gimp_unit_store_set_resolutions (GIMP_UNIT_STORE (model),
|
||||
image->xresolution, image->yresolution);
|
||||
|
||||
g_signal_handlers_block_by_func (statusbar->unit_combo,
|
||||
gimp_statusbar_unit_changed, statusbar);
|
||||
gimp_unit_combo_box_set_active (GIMP_UNIT_COMBO_BOX (statusbar->unit_combo),
|
||||
image->unit);
|
||||
g_signal_handlers_unblock_by_func (statusbar->unit_combo,
|
||||
gimp_statusbar_unit_changed, statusbar);
|
||||
|
||||
if (image->unit == GIMP_UNIT_PIXEL)
|
||||
{
|
||||
g_snprintf (statusbar->cursor_format_str,
|
||||
sizeof (statusbar->cursor_format_str),
|
||||
"%%s%%d%%s%%d");
|
||||
}
|
||||
else /* show real world units */
|
||||
{
|
||||
g_snprintf (statusbar->cursor_format_str,
|
||||
sizeof (statusbar->cursor_format_str),
|
||||
"%%s%%.%df%%s%%.%df",
|
||||
gimp_image_unit_get_digits (image),
|
||||
gimp_image_unit_get_digits (image));
|
||||
}
|
||||
|
||||
gimp_statusbar_set_cursor (statusbar, - image->width, - image->height);
|
||||
|
||||
text = gtk_label_get_text (GTK_LABEL (statusbar->cursor_label));
|
||||
|
||||
/* one static layout for all displays should be fine */
|
||||
if (! layout)
|
||||
layout = gtk_widget_create_pango_layout (statusbar->cursor_label, text);
|
||||
else
|
||||
pango_layout_set_text (layout, text, -1);
|
||||
|
||||
pango_layout_get_pixel_size (layout, &width, NULL);
|
||||
|
||||
/* find out how many pixels the label's parent frame is bigger than
|
||||
* the label itself
|
||||
*/
|
||||
diff = (statusbar->cursor_frame->allocation.width -
|
||||
statusbar->cursor_label->allocation.width);
|
||||
|
||||
gtk_widget_set_size_request (statusbar->cursor_label, width, -1);
|
||||
|
||||
/* don't resize if this is a new display */
|
||||
if (diff)
|
||||
gtk_widget_set_size_request (statusbar->cursor_frame, width + diff, -1);
|
||||
|
||||
gimp_statusbar_clear_cursor (statusbar);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_statusbar_unit_changed (GimpUnitComboBox *combo,
|
||||
GimpStatusbar *statusbar)
|
||||
{
|
||||
gimp_image_set_unit (statusbar->shell->gdisp->gimage,
|
||||
gtk_combo_box_get_active (GTK_COMBO_BOX (combo)));
|
||||
gimp_unit_combo_box_get_active (combo));
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_statusbar_scale_changed (GimpScaleComboBox *combo,
|
||||
GimpStatusbar *statusbar)
|
||||
{
|
||||
gimp_display_shell_scale (statusbar->shell,
|
||||
GIMP_ZOOM_TO,
|
||||
gimp_scale_combo_box_get_scale (combo));
|
||||
}
|
||||
|
@ -48,6 +48,7 @@ struct _GimpStatusbar
|
||||
GtkWidget *cursor_label;
|
||||
gchar cursor_format_str[CURSOR_FORMAT_LENGTH];
|
||||
GtkWidget *unit_combo;
|
||||
GtkWidget *scale_combo;
|
||||
|
||||
GtkWidget *progressbar;
|
||||
guint progressid;
|
||||
@ -60,26 +61,26 @@ struct _GimpStatusbarClass
|
||||
};
|
||||
|
||||
|
||||
GType gimp_statusbar_get_type (void) G_GNUC_CONST;
|
||||
GType gimp_statusbar_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkWidget * gimp_statusbar_new (GimpDisplayShell *shell);
|
||||
GtkWidget * gimp_statusbar_new (GimpDisplayShell *shell);
|
||||
|
||||
void gimp_statusbar_push (GimpStatusbar *statusbar,
|
||||
const gchar *context_id,
|
||||
const gchar *message);
|
||||
void gimp_statusbar_push_coords (GimpStatusbar *statusbar,
|
||||
const gchar *context_id,
|
||||
const gchar *title,
|
||||
gdouble x,
|
||||
const gchar *separator,
|
||||
gdouble y);
|
||||
void gimp_statusbar_pop (GimpStatusbar *statusbar,
|
||||
const gchar *context_id);
|
||||
void gimp_statusbar_push (GimpStatusbar *statusbar,
|
||||
const gchar *context_id,
|
||||
const gchar *message);
|
||||
void gimp_statusbar_push_coords (GimpStatusbar *statusbar,
|
||||
const gchar *context_id,
|
||||
const gchar *title,
|
||||
gdouble x,
|
||||
const gchar *separator,
|
||||
gdouble y);
|
||||
void gimp_statusbar_pop (GimpStatusbar *statusbar,
|
||||
const gchar *context_id);
|
||||
|
||||
void gimp_statusbar_update_cursor (GimpStatusbar *statusbar,
|
||||
gdouble x,
|
||||
gdouble y);
|
||||
void gimp_statusbar_resize_cursor (GimpStatusbar *statusbar);
|
||||
void gimp_statusbar_set_cursor (GimpStatusbar *statusbar,
|
||||
gdouble x,
|
||||
gdouble y);
|
||||
void gimp_statusbar_clear_cursor (GimpStatusbar *statusbar);
|
||||
|
||||
|
||||
G_END_DECLS
|
||||
|
@ -118,3 +118,20 @@ gimp_unit_combo_box_new_with_model (GimpUnitStore *model)
|
||||
"model", model,
|
||||
NULL);
|
||||
}
|
||||
|
||||
GimpUnit
|
||||
gimp_unit_combo_box_get_active (GimpUnitComboBox *combo)
|
||||
{
|
||||
g_return_val_if_fail (GIMP_IS_UNIT_COMBO_BOX (combo), -1);
|
||||
|
||||
return gtk_combo_box_get_active (GTK_COMBO_BOX (combo));
|
||||
}
|
||||
|
||||
void
|
||||
gimp_unit_combo_box_set_active (GimpUnitComboBox *combo,
|
||||
GimpUnit unit)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_UNIT_COMBO_BOX (combo));
|
||||
|
||||
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), unit);
|
||||
}
|
||||
|
@ -49,7 +49,11 @@ struct _GimpUnitComboBox
|
||||
GType gimp_unit_combo_box_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkWidget * gimp_unit_combo_box_new (void);
|
||||
GtkWidget * gimp_unit_combo_box_new_with_model (GimpUnitStore *model);
|
||||
GtkWidget * gimp_unit_combo_box_new_with_model (GimpUnitStore *model);
|
||||
|
||||
GimpUnit gimp_unit_combo_box_get_active (GimpUnitComboBox *combo);
|
||||
void gimp_unit_combo_box_set_active (GimpUnitComboBox *combo,
|
||||
GimpUnit unit);
|
||||
|
||||
|
||||
#endif /* __GIMP_UNIT_COMBO_BOX_H__ */
|
||||
|
@ -342,11 +342,17 @@ gimp_unit_store_tree_model_get_value (GtkTreeModel *tree_model,
|
||||
|
||||
default:
|
||||
column -= GIMP_UNIT_STORE_UNIT_COLUMNS;
|
||||
if (column < store->num_values && store->resolutions[column])
|
||||
g_value_set_double (value,
|
||||
store->values[column] *
|
||||
gimp_unit_get_factor (unit) /
|
||||
store->resolutions[column]);
|
||||
if (unit == GIMP_UNIT_PIXEL)
|
||||
{
|
||||
g_value_set_double (value, store->values[column]);
|
||||
}
|
||||
else if (store->resolutions[column])
|
||||
{
|
||||
g_value_set_double (value,
|
||||
store->values[column] *
|
||||
gimp_unit_get_factor (unit) /
|
||||
store->resolutions[column]);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user