spiffy new widget that given a physical size, displays that size in an
* libgimpwidgets/gimpresolutionentry.[ch]: spiffy new widget that given a physical size, displays that size in an arbitrary unit, and lets you select a resolution via changing either the corresponding width and height or specifying it directly in pixels per your chosen unit. * libgimpwidgets/Makefile.am * libgimpwidgets/gimpwidgets.def * libgimpwidgets/gimpwidgets.h * libgimpwidgets/gimpwidgetstypes.h: added appropriate files, function, headers, and types, respectively * devel-docs/libgimpwidgets/libgimpwidgets.types: added gimp_resolution_entry_get_type. A section still needs to be created for it. * plug-ins/common/poppler.c (run): bugfix that accidentally wasn't merged in previous commit. * plug-ins/common/poppler.c (load_dialog): replaced resolution spinbutton with a GimpResolutionEntry.
This commit is contained in:
@ -35,6 +35,7 @@ gimp_pick_button_get_type
|
||||
gimp_pixmap_get_type
|
||||
gimp_preview_area_get_type
|
||||
gimp_preview_get_type
|
||||
gimp_resolution_entry_get_type
|
||||
gimp_scrolled_preview_get_type
|
||||
gimp_size_entry_get_type
|
||||
gimp_unit_menu_get_type
|
||||
|
@ -140,6 +140,8 @@ libgimpwidgets_2_0_la_sources = \
|
||||
gimppropwidgets.h \
|
||||
gimpquerybox.c \
|
||||
gimpquerybox.h \
|
||||
gimpresolutionentry.c \
|
||||
gimpresolutionentry.h \
|
||||
gimpscrolledpreview.c \
|
||||
gimpscrolledpreview.h \
|
||||
gimpsizeentry.c \
|
||||
@ -209,6 +211,7 @@ libgimpwidgetsinclude_HEADERS = \
|
||||
gimppreviewarea.h \
|
||||
gimppropwidgets.h \
|
||||
gimpquerybox.h \
|
||||
gimpresolutionentry.h \
|
||||
gimpscrolledpreview.h \
|
||||
gimpsizeentry.h \
|
||||
gimpstock.h \
|
||||
|
1336
libgimpwidgets/gimpresolutionentry.c
Normal file
1336
libgimpwidgets/gimpresolutionentry.c
Normal file
File diff suppressed because it is too large
Load Diff
206
libgimpwidgets/gimpresolutionentry.h
Normal file
206
libgimpwidgets/gimpresolutionentry.h
Normal file
@ -0,0 +1,206 @@
|
||||
/* LIBGIMP - The GIMP Library
|
||||
* Copyright (C) 1995-2005 Peter Mattis and Spencer Kimball
|
||||
*
|
||||
* gimpresolutionentry.h
|
||||
* Copyright (C) 1999-2005 Sven Neumann <sven@gimp.org>
|
||||
* Michael Natterer <mitch@gimp.org>
|
||||
* Nathan Summers <rock@gimp.org>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GIMP_RESOLUTION_ENTRY_H__
|
||||
#define __GIMP_RESOLUTION_ENTRY_H__
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
/* For information look into the C source or the html documentation */
|
||||
|
||||
|
||||
#define GIMP_TYPE_RESOLUTION_ENTRY (gimp_resolution_entry_get_type ())
|
||||
#define GIMP_RESOLUTION_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_RESOLUTION_ENTRY, GimpResolutionEntry))
|
||||
#define GIMP_RESOLUTION_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_RESOLUTION_ENTRY, GimpResolutionEntryClass))
|
||||
#define GIMP_IS_RESOLUTION_ENTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE (obj, GIMP_TYPE_RESOLUTION_ENTRY))
|
||||
#define GIMP_IS_RESOLUTION_ENTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_RESOLUTION_ENTRY))
|
||||
#define GIMP_RESOLUTION_ENTRY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_RESOLUTION_ENTRY, GimpResolutionEntryClass))
|
||||
|
||||
|
||||
typedef struct _GimpResolutionEntryClass GimpResolutionEntryClass;
|
||||
|
||||
typedef struct _GimpResolutionEntryField GimpResolutionEntryField;
|
||||
|
||||
struct _GimpResolutionEntryField
|
||||
{
|
||||
GimpResolutionEntry *gre;
|
||||
GimpResolutionEntryField *corresponding;
|
||||
|
||||
gboolean size;
|
||||
|
||||
GtkWidget *label;
|
||||
|
||||
guint changed_signal;
|
||||
|
||||
GtkObject *adjustment;
|
||||
GtkWidget *spinbutton;
|
||||
|
||||
gdouble phy_size;
|
||||
|
||||
gdouble value;
|
||||
gdouble min_value;
|
||||
gdouble max_value;
|
||||
|
||||
gint stop_recursion;
|
||||
};
|
||||
|
||||
|
||||
struct _GimpResolutionEntry
|
||||
{
|
||||
GtkTable parent_instance;
|
||||
|
||||
|
||||
GimpUnit size_unit;
|
||||
GimpUnit unit;
|
||||
gboolean independent;
|
||||
|
||||
GtkWidget *unitmenu;
|
||||
GtkWidget *chainbutton;
|
||||
|
||||
GimpResolutionEntryField width;
|
||||
GimpResolutionEntryField height;
|
||||
GimpResolutionEntryField x;
|
||||
GimpResolutionEntryField y;
|
||||
|
||||
};
|
||||
|
||||
struct _GimpResolutionEntryClass
|
||||
{
|
||||
GtkTableClass parent_class;
|
||||
|
||||
void (* value_changed) (GimpResolutionEntry *gse);
|
||||
void (* refval_changed) (GimpResolutionEntry *gse);
|
||||
void (* unit_changed) (GimpResolutionEntry *gse);
|
||||
|
||||
/* Padding for future expansion */
|
||||
void (* _gimp_reserved1) (void);
|
||||
void (* _gimp_reserved2) (void);
|
||||
void (* _gimp_reserved3) (void);
|
||||
void (* _gimp_reserved4) (void);
|
||||
};
|
||||
|
||||
|
||||
/* For information look into the C source or the html documentation */
|
||||
|
||||
GType gimp_resolution_entry_get_type (void) G_GNUC_CONST;
|
||||
|
||||
GtkWidget * gimp_resolution_entry_new (const gchar *width_label,
|
||||
gdouble width,
|
||||
const gchar *height_label,
|
||||
gdouble height,
|
||||
GimpUnit size_unit,
|
||||
const gchar *x_label,
|
||||
gdouble initial_x,
|
||||
const gchar *y_label,
|
||||
gdouble initial_y,
|
||||
GimpUnit intial_unit,
|
||||
gboolean independent,
|
||||
gint spinbutton_width);
|
||||
|
||||
GtkWidget * gimp_resolution_entry_attach_label (GimpResolutionEntry *gre,
|
||||
const gchar *text,
|
||||
gint row,
|
||||
gint column,
|
||||
gfloat alignment);
|
||||
|
||||
void gimp_resolution_entry_set_width_boundaries
|
||||
(GimpResolutionEntry *gre,
|
||||
gdouble lower,
|
||||
gdouble upper);
|
||||
void gimp_resolution_entry_set_height_boundaries
|
||||
(GimpResolutionEntry *gre,
|
||||
gdouble lower,
|
||||
gdouble upper);
|
||||
void gimp_resolution_entry_set_x_boundaries (GimpResolutionEntry *gre,
|
||||
gdouble lower,
|
||||
gdouble upper);
|
||||
void gimp_resolution_entry_set_y_boundaries (GimpResolutionEntry *gre,
|
||||
gdouble lower,
|
||||
gdouble upper);
|
||||
|
||||
gdouble gimp_resolution_entry_get_width (GimpResolutionEntry *gre);
|
||||
gdouble gimp_resolution_entry_get_height (GimpResolutionEntry *gre);
|
||||
|
||||
gdouble gimp_resolution_entry_get_x (GimpResolutionEntry *gre);
|
||||
gdouble gimp_resolution_entry_get_x_in_dpi (GimpResolutionEntry *gre);
|
||||
|
||||
gdouble gimp_resolution_entry_get_y (GimpResolutionEntry *gre);
|
||||
gdouble gimp_resolution_entry_get_y_in_dpi (GimpResolutionEntry *gre);
|
||||
|
||||
|
||||
void gimp_resolution_entry_set_width (GimpResolutionEntry *gre,
|
||||
gdouble value);
|
||||
void gimp_resolution_entry_set_height (GimpResolutionEntry *gre,
|
||||
gdouble value);
|
||||
|
||||
void gimp_resolution_entry_set_x (GimpResolutionEntry *gre,
|
||||
gdouble value);
|
||||
void gimp_resolution_entry_set_y (GimpResolutionEntry *gre,
|
||||
gdouble value);
|
||||
|
||||
GimpUnit gimp_resolution_entry_get_unit (GimpResolutionEntry *gre);
|
||||
void gimp_resolution_entry_set_unit (GimpResolutionEntry *gre,
|
||||
GimpUnit unit);
|
||||
|
||||
void gimp_resolution_entry_show_unit_menu
|
||||
(GimpResolutionEntry *gre,
|
||||
gboolean show);
|
||||
|
||||
void gimp_resolution_entry_set_pixel_digits
|
||||
(GimpResolutionEntry *gre,
|
||||
gint digits);
|
||||
|
||||
void gimp_resolution_entry_grab_focus (GimpResolutionEntry *gre);
|
||||
|
||||
void gimp_resolution_entry_set_activates_default
|
||||
(GimpResolutionEntry *gre,
|
||||
gboolean setting);
|
||||
|
||||
GtkWidget * gimp_resolution_entry_get_width_help_widget
|
||||
(GimpResolutionEntry *gre);
|
||||
GtkWidget * gimp_resolution_entry_get_height_help_widget
|
||||
(GimpResolutionEntry *gre);
|
||||
GtkWidget * gimp_resolution_entry_get_x_help_widget
|
||||
(GimpResolutionEntry *gre);
|
||||
GtkWidget * gimp_resolution_entry_get_y_help_widget
|
||||
(GimpResolutionEntry *gre);
|
||||
|
||||
/* signal callback convenience functions */
|
||||
void gimp_resolution_entry_update_width (GimpResolutionEntry *gre,
|
||||
gpointer data);
|
||||
void gimp_resolution_entry_update_height (GimpResolutionEntry *gre,
|
||||
gpointer data);
|
||||
|
||||
void gimp_resolution_entry_update_x (GimpResolutionEntry *gre,
|
||||
gpointer data);
|
||||
void gimp_resolution_entry_update_x_in_dpi (GimpResolutionEntry *gre,
|
||||
gpointer data);
|
||||
|
||||
void gimp_resolution_entry_update_y (GimpResolutionEntry *gre,
|
||||
gpointer data);
|
||||
void gimp_resolution_entry_update_y_in_dpi (GimpResolutionEntry *gre,
|
||||
gpointer data);
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GIMP_RESOLUTION_ENTRY_H__ */
|
@ -254,6 +254,39 @@ EXPORTS
|
||||
gimp_radio_group_new2
|
||||
gimp_radio_group_set_active
|
||||
gimp_random_seed_new
|
||||
gimp_resolution_entry_get_type
|
||||
gimp_resolution_entry_new
|
||||
gimp_resolution_entry_attach_label
|
||||
gimp_resolution_entry_set_width_boundaries
|
||||
gimp_resolution_entry_set_height_boundaries
|
||||
gimp_resolution_entry_set_x_boundaries
|
||||
gimp_resolution_entry_set_y_boundaries
|
||||
gimp_resolution_entry_get_width
|
||||
gimp_resolution_entry_get_height
|
||||
gimp_resolution_entry_get_x
|
||||
gimp_resolution_entry_get_x_in_dpi
|
||||
gimp_resolution_entry_get_y
|
||||
gimp_resolution_entry_get_y_in_dpi
|
||||
gimp_resolution_entry_set_width
|
||||
gimp_resolution_entry_set_height
|
||||
gimp_resolution_entry_set_x
|
||||
gimp_resolution_entry_set_y
|
||||
gimp_resolution_entry_get_unit
|
||||
gimp_resolution_entry_set_unit
|
||||
gimp_resolution_entry_show_unit_menu
|
||||
gimp_resolution_entry_set_pixel_digits
|
||||
gimp_resolution_entry_grab_focus
|
||||
gimp_resolution_entry_set_activates_default
|
||||
gimp_resolution_entry_get_width_help_widget
|
||||
gimp_resolution_entry_get_height_help_widget
|
||||
gimp_resolution_entry_get_x_help_widget
|
||||
gimp_resolution_entry_get_y_help_widget
|
||||
gimp_resolution_entry_update_width
|
||||
gimp_resolution_entry_update_height
|
||||
gimp_resolution_entry_update_x
|
||||
gimp_resolution_entry_update_x_in_dpi
|
||||
gimp_resolution_entry_update_y
|
||||
gimp_resolution_entry_update_y_in_dpi
|
||||
gimp_scale_entry_get_logarithmic
|
||||
gimp_scale_entry_new
|
||||
gimp_scale_entry_set_logarithmic
|
||||
|
@ -62,6 +62,7 @@
|
||||
#include <libgimpwidgets/gimppreviewarea.h>
|
||||
#include <libgimpwidgets/gimppropwidgets.h>
|
||||
#include <libgimpwidgets/gimpquerybox.h>
|
||||
#include <libgimpwidgets/gimpresolutionentry.h>
|
||||
#include <libgimpwidgets/gimpscrolledpreview.h>
|
||||
#include <libgimpwidgets/gimpsizeentry.h>
|
||||
#include <libgimpwidgets/gimpstock.h>
|
||||
|
@ -64,6 +64,7 @@ typedef struct _GimpPickButton GimpPickButton;
|
||||
typedef struct _GimpPreview GimpPreview;
|
||||
typedef struct _GimpPreviewArea GimpPreviewArea;
|
||||
typedef struct _GimpPixmap GimpPixmap;
|
||||
typedef struct _GimpResolutionEntry GimpResolutionEntry;
|
||||
typedef struct _GimpScrolledPreview GimpScrolledPreview;
|
||||
typedef struct _GimpSizeEntry GimpSizeEntry;
|
||||
typedef struct _GimpUnitMenu GimpUnitMenu;
|
||||
|
@ -35,13 +35,13 @@
|
||||
/* Structs for the load dialog */
|
||||
typedef struct
|
||||
{
|
||||
guint32 resolution;
|
||||
gdouble resolution;
|
||||
gboolean antialias;
|
||||
} PdfLoadVals;
|
||||
|
||||
static PdfLoadVals loadvals =
|
||||
{
|
||||
100, /* 100 dpi */
|
||||
100.00, /* 100 dpi */
|
||||
TRUE /* antialias */
|
||||
};
|
||||
|
||||
@ -273,7 +273,7 @@ run (const gchar *name,
|
||||
{
|
||||
poppler_page_get_size (page, &width, &height);
|
||||
|
||||
g_object_unref (buf);
|
||||
g_object_unref (page);
|
||||
}
|
||||
|
||||
buf = get_thumbnail (doc, 0, param[1].data.d_int32);
|
||||
@ -614,8 +614,7 @@ load_dialog (PopplerDocument *doc,
|
||||
GtkWidget *title;
|
||||
GtkWidget *selector;
|
||||
GtkWidget *table;
|
||||
GtkWidget *spinbutton;
|
||||
GtkObject *adj;
|
||||
GtkWidget *resolution;
|
||||
GtkWidget *toggle;
|
||||
|
||||
ThreadData thread_data;
|
||||
@ -623,6 +622,9 @@ load_dialog (PopplerDocument *doc,
|
||||
|
||||
int i;
|
||||
int n_pages;
|
||||
|
||||
gdouble width;
|
||||
gdouble height;
|
||||
|
||||
gboolean run;
|
||||
|
||||
@ -669,6 +671,9 @@ load_dialog (PopplerDocument *doc,
|
||||
gimp_page_selector_set_page_label (GIMP_PAGE_SELECTOR (selector), i,
|
||||
label);
|
||||
|
||||
if (i == 0)
|
||||
poppler_page_get_size (page, &width, &height);
|
||||
|
||||
g_object_unref (page);
|
||||
g_free (label);
|
||||
}
|
||||
@ -689,15 +694,25 @@ load_dialog (PopplerDocument *doc,
|
||||
gtk_widget_show (table);
|
||||
|
||||
/* Resolution */
|
||||
spinbutton = gimp_spin_button_new (&adj, loadvals.resolution,
|
||||
5, 1440, 1, 10, 0, 1, 0);
|
||||
gimp_table_attach_aligned (GTK_TABLE (table), 0, 0,
|
||||
"Resolution (_DPI):", 0.0, 0.5,
|
||||
spinbutton, 1, FALSE);
|
||||
g_signal_connect (adj, "value_changed",
|
||||
G_CALLBACK (gimp_int_adjustment_update),
|
||||
&loadvals.resolution);
|
||||
|
||||
resolution = gimp_resolution_entry_new ("_Width (pixels): ", width,
|
||||
"_Height (pixels): ", height,
|
||||
GIMP_UNIT_POINT,
|
||||
|
||||
"_Resolution: ", loadvals.resolution,
|
||||
"_Resolution: ", loadvals.resolution,
|
||||
GIMP_UNIT_INCH,
|
||||
|
||||
FALSE,
|
||||
0);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox), resolution, FALSE, FALSE, 0);
|
||||
gtk_widget_show (resolution);
|
||||
|
||||
g_signal_connect (resolution, "x-changed",
|
||||
G_CALLBACK (gimp_resolution_entry_update_x_in_dpi),
|
||||
&loadvals.resolution);
|
||||
|
||||
/* Antialiasing */
|
||||
toggle = gtk_check_button_new_with_mnemonic("A_ntialiasing");
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle),
|
||||
|
Reference in New Issue
Block a user