mirror of https://github.com/GNOME/gimp.git
Hopefully synced the work on real-world-units by applying (most of)
the patches Michael Natterer has provided. Fixed a few minor and cosmetic bugs in those patches. --Sven
This commit is contained in:
parent
671e503793
commit
6a6dbd25fa
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,17 @@
|
|||
Wed Mar 3 13:24:00 MET 1999 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* gimprc.5.in
|
||||
* gimprc.in
|
||||
* libgimp/gimpunit.c
|
||||
* libgimp/gimpunit.h
|
||||
* app/file_new_dialog.c
|
||||
* app/gimprc.c
|
||||
* app/gimprc.h
|
||||
* app/preferences_dialog.c: Hopefully synced the work on
|
||||
real-world-units by applying (most of) the patches Michael
|
||||
Natterer has provided. Fixed a few minor and cosmetic bugs
|
||||
in those patches.
|
||||
|
||||
Tue Mar 2 01:24:41 MET 1999 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* libgimp/Makefile.am
|
||||
|
|
|
@ -57,14 +57,6 @@ static GUnit last_unit = UNIT_INCH;
|
|||
static GUnit last_res_unit = UNIT_INCH;
|
||||
static gboolean last_new_image = TRUE;
|
||||
|
||||
/* these are temps that should be set in gimprc eventually */
|
||||
/* FIXME */
|
||||
static float default_xresolution = 72;
|
||||
static float default_yresolution = 72;
|
||||
static GUnit default_unit = UNIT_INCH;
|
||||
|
||||
static GUnit default_res_unit = UNIT_INCH;
|
||||
|
||||
|
||||
static int new_dialog_run;
|
||||
extern TileManager *global_buf;
|
||||
|
@ -242,6 +234,13 @@ file_new_resolution_callback (GtkWidget *widget,
|
|||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (vals->resolution_sizeentry), 0, xres);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (new_xres != xres)
|
||||
xres = new_xres;
|
||||
if (new_yres != yres)
|
||||
yres = new_yres;
|
||||
}
|
||||
}
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (vals->size_sizeentry), 0,
|
||||
xres,
|
||||
|
@ -268,18 +267,15 @@ file_new_cmd_callback (GtkWidget *widget,
|
|||
GtkWidget *advanced_button;
|
||||
GSList *group;
|
||||
|
||||
/* this value is from gimprc.h */
|
||||
default_res_unit = UNIT_INCH; /* ruler_units; */
|
||||
|
||||
if(!new_dialog_run)
|
||||
{
|
||||
last_width = default_width;
|
||||
last_height = default_height;
|
||||
last_type = default_type;
|
||||
last_xresolution = default_xresolution; /* this isnt set in gimprc yet */
|
||||
last_yresolution = default_yresolution; /* this isnt set in gimprc yet */
|
||||
last_unit = default_unit; /* not in gimprc either, inches for now */
|
||||
last_res_unit = default_res_unit;
|
||||
last_xresolution = default_xresolution; /* these values are taken */
|
||||
last_yresolution = default_yresolution; /* from gimprc */
|
||||
last_unit = default_units;
|
||||
last_res_unit = default_resolution_units;
|
||||
|
||||
new_dialog_run = 1;
|
||||
}
|
||||
|
|
|
@ -46,10 +46,11 @@
|
|||
#include "tips_dialog.h"
|
||||
#include "tools.h"
|
||||
#include "undo.h"
|
||||
#include "libgimp/gimpsizeentry.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "libgimp/gimpchainbutton.h"
|
||||
#include "libgimp/gimpintl.h"
|
||||
#include "libgimp/gimpsizeentry.h"
|
||||
|
||||
|
||||
/* preferences local functions */
|
||||
|
@ -63,7 +64,7 @@ static void file_prefs_spinbutton_callback (GtkWidget *, gpointer);
|
|||
static void file_prefs_preview_size_callback (GtkWidget *, gpointer);
|
||||
static void file_prefs_mem_size_unit_callback (GtkWidget *, gpointer);
|
||||
static void file_prefs_clear_session_info_callback (GtkWidget *, gpointer);
|
||||
static void file_prefs_resolution_callback (GtkWidget *, gpointer);
|
||||
static void file_prefs_monitor_resolution_callback (GtkWidget *, gpointer);
|
||||
|
||||
/* static variables */
|
||||
static int last_type = RGB;
|
||||
|
@ -88,6 +89,10 @@ static int old_save_device_status;
|
|||
static int old_always_restore_session;
|
||||
static int old_default_width;
|
||||
static int old_default_height;
|
||||
static GUnit old_default_units;
|
||||
static float old_default_xresolution;
|
||||
static float old_default_yresolution;
|
||||
static GUnit old_default_resolution_units;
|
||||
static int old_default_type;
|
||||
static int old_stingy_memory_use;
|
||||
static int old_tile_cache_size;
|
||||
|
@ -124,9 +129,12 @@ static int edit_num_processors;
|
|||
static GtkWidget *tile_cache_size_spinbutton = NULL;
|
||||
static int divided_tile_cache_size;
|
||||
static int mem_size_unit;
|
||||
static GtkWidget *default_size_sizeentry = NULL;
|
||||
static GtkWidget *default_resolution_sizeentry = NULL;
|
||||
static GtkWidget *default_resolution_force_equal = NULL;
|
||||
static GtkWidget *resolution_xserver_label = NULL;
|
||||
static GtkWidget *resolution_sizeentry = NULL;
|
||||
static GtkWidget *resolution_force_equal = NULL;
|
||||
static GtkWidget *monitor_resolution_sizeentry = NULL;
|
||||
static GtkWidget *monitor_resolution_force_equal = NULL;
|
||||
static GtkWidget *num_processors_spinbutton = NULL;
|
||||
|
||||
/* Some information regarding preferences, compiled by Raph Levien 11/3/97.
|
||||
|
@ -161,8 +169,8 @@ static GtkWidget *num_processors_spinbutton = NULL;
|
|||
|
||||
Still no settings for default-brush, default-gradient,
|
||||
default-palette, default-pattern, gamma-correction, color-cube,
|
||||
show-rulers, ruler-units. No widget for confirm-on-close although
|
||||
a lot of stuff is there.
|
||||
show-rulers. No widget for confirm-on-close although a lot of
|
||||
stuff is there.
|
||||
|
||||
No UI feedback for the fact that some settings won't take effect
|
||||
until the next Gimp restart.
|
||||
|
@ -240,6 +248,27 @@ file_prefs_ok_callback (GtkWidget *widget,
|
|||
default_height = old_default_height;
|
||||
return;
|
||||
}
|
||||
if (default_units < UNIT_INCH ||
|
||||
default_units >= gimp_unit_get_number_of_units ())
|
||||
{
|
||||
g_message (_("Error: Default units must be withing unit range."));
|
||||
default_units = old_default_units;
|
||||
return;
|
||||
}
|
||||
if (default_xresolution < 1e-5 || default_yresolution < 1e-5)
|
||||
{
|
||||
g_message (_("Error: default resolution must not be zero."));
|
||||
default_xresolution = old_default_xresolution;
|
||||
default_yresolution = old_default_yresolution;
|
||||
return;
|
||||
}
|
||||
if (default_resolution_units < UNIT_INCH ||
|
||||
default_resolution_units >= gimp_unit_get_number_of_units ())
|
||||
{
|
||||
g_message (_("Error: Default units must be withing unit range."));
|
||||
default_resolution_units = old_default_resolution_units;
|
||||
return;
|
||||
}
|
||||
if (monitor_xres < 1e-5 || monitor_yres < 1e-5)
|
||||
{
|
||||
g_message (_("Error: monitor resolution must not be zero."));
|
||||
|
@ -256,9 +285,12 @@ file_prefs_ok_callback (GtkWidget *widget,
|
|||
|
||||
gtk_widget_destroy (dlg);
|
||||
prefs_dlg = NULL;
|
||||
default_size_sizeentry = NULL;
|
||||
default_resolution_sizeentry = NULL;
|
||||
default_resolution_force_equal = NULL;
|
||||
resolution_xserver_label = NULL;
|
||||
resolution_sizeentry = NULL;
|
||||
resolution_force_equal = NULL;
|
||||
monitor_resolution_sizeentry = NULL;
|
||||
monitor_resolution_force_equal = NULL;
|
||||
|
||||
if (show_tool_tips)
|
||||
gtk_tooltips_enable (tool_tips);
|
||||
|
@ -364,6 +396,14 @@ file_prefs_save_callback (GtkWidget *widget,
|
|||
if (default_width != old_default_width ||
|
||||
default_height != old_default_height)
|
||||
update = g_list_append (update, "default-image-size");
|
||||
if (default_units != old_default_units)
|
||||
update = g_list_append (update, "default-units");
|
||||
if (ABS(default_xresolution - old_default_xresolution) > 1e-5)
|
||||
update = g_list_append (update, "default-xresolution");
|
||||
if (ABS(default_yresolution - old_default_yresolution) > 1e-5)
|
||||
update = g_list_append (update, "default-yresolution");
|
||||
if (default_resolution_units != old_default_resolution_units)
|
||||
update = g_list_append (update, "default-resolution-units");
|
||||
if (default_type != old_default_type)
|
||||
update = g_list_append (update, "default-image-type");
|
||||
if (preview_size != old_preview_size)
|
||||
|
@ -507,9 +547,12 @@ file_prefs_cancel_callback (GtkWidget *widget,
|
|||
{
|
||||
gtk_widget_destroy (dlg);
|
||||
prefs_dlg = NULL;
|
||||
default_size_sizeentry = NULL;
|
||||
default_resolution_sizeentry = NULL;
|
||||
default_resolution_force_equal = NULL;
|
||||
resolution_xserver_label = NULL;
|
||||
resolution_sizeentry = NULL;
|
||||
resolution_force_equal = NULL;
|
||||
monitor_resolution_sizeentry = NULL;
|
||||
monitor_resolution_force_equal = NULL;
|
||||
|
||||
levels_of_undo = old_levels_of_undo;
|
||||
marching_speed = old_marching_speed;
|
||||
|
@ -526,6 +569,10 @@ file_prefs_cancel_callback (GtkWidget *widget,
|
|||
save_device_status = old_save_device_status;
|
||||
default_width = old_default_width;
|
||||
default_height = old_default_height;
|
||||
default_units = old_default_units;
|
||||
default_xresolution = old_default_xresolution;
|
||||
default_yresolution = old_default_yresolution;
|
||||
default_resolution_units = old_default_resolution_units;
|
||||
default_type = old_default_type;
|
||||
monitor_xres = old_monitor_xres;
|
||||
monitor_yres = old_monitor_yres;
|
||||
|
@ -704,12 +751,12 @@ file_prefs_res_source_callback (GtkWidget *widget,
|
|||
gtk_widget_set_sensitive (resolution_xserver_label,
|
||||
GTK_TOGGLE_BUTTON (widget)->active);
|
||||
|
||||
if (resolution_sizeentry)
|
||||
gtk_widget_set_sensitive (resolution_sizeentry,
|
||||
if (monitor_resolution_sizeentry)
|
||||
gtk_widget_set_sensitive (monitor_resolution_sizeentry,
|
||||
! GTK_TOGGLE_BUTTON (widget)->active);
|
||||
|
||||
if (resolution_force_equal)
|
||||
gtk_widget_set_sensitive (resolution_force_equal,
|
||||
if (monitor_resolution_force_equal)
|
||||
gtk_widget_set_sensitive (monitor_resolution_force_equal,
|
||||
! GTK_TOGGLE_BUTTON (widget)->active);
|
||||
|
||||
if (GTK_TOGGLE_BUTTON (widget)->active)
|
||||
|
@ -719,20 +766,30 @@ file_prefs_res_source_callback (GtkWidget *widget,
|
|||
}
|
||||
else
|
||||
{
|
||||
if (resolution_sizeentry)
|
||||
if (monitor_resolution_sizeentry)
|
||||
{
|
||||
monitor_xres =
|
||||
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (resolution_sizeentry), 0);
|
||||
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 0);
|
||||
monitor_yres =
|
||||
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (resolution_sizeentry), 1);
|
||||
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 1);
|
||||
}
|
||||
using_xserver_resolution = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
file_prefs_resolution_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
file_prefs_default_size_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
default_width = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0);
|
||||
default_height = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
|
||||
default_units = gimp_size_entry_get_unit (GIMP_SIZE_ENTRY (widget));
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
file_prefs_default_resolution_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
static float xres = 0.0;
|
||||
static float yres = 0.0;
|
||||
|
@ -742,7 +799,53 @@ file_prefs_resolution_callback (GtkWidget *widget,
|
|||
new_xres = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0);
|
||||
new_yres = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
|
||||
|
||||
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data)))
|
||||
if (gimp_chain_button_get_active (GIMP_CHAIN_BUTTON (data)))
|
||||
{
|
||||
if (new_xres != xres)
|
||||
{
|
||||
yres = new_yres = xres = new_xres;
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 1, yres);
|
||||
}
|
||||
|
||||
if (new_yres != yres)
|
||||
{
|
||||
xres = new_xres = yres = new_yres;
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 0, xres);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (new_xres != xres)
|
||||
xres = new_xres;
|
||||
if (new_yres != yres)
|
||||
yres = new_yres;
|
||||
}
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (default_size_sizeentry),
|
||||
0, xres, FALSE);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (default_size_sizeentry),
|
||||
1, yres, FALSE);
|
||||
|
||||
default_width = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (default_size_sizeentry), 0);
|
||||
default_height = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (default_size_sizeentry), 1);
|
||||
default_xresolution = xres;
|
||||
default_yresolution = yres;
|
||||
default_resolution_units = gimp_size_entry_get_unit (GIMP_SIZE_ENTRY (widget));
|
||||
}
|
||||
|
||||
static void
|
||||
file_prefs_monitor_resolution_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
static float xres = 0.0;
|
||||
static float yres = 0.0;
|
||||
float new_xres;
|
||||
float new_yres;
|
||||
|
||||
new_xres = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0);
|
||||
new_yres = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
|
||||
|
||||
if (gimp_chain_button_get_active (GIMP_CHAIN_BUTTON (data)))
|
||||
{
|
||||
if (new_xres != xres)
|
||||
{
|
||||
|
@ -898,6 +1001,10 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
old_always_restore_session = always_restore_session;
|
||||
old_default_width = default_width;
|
||||
old_default_height = default_height;
|
||||
old_default_units = default_units;
|
||||
old_default_xresolution = default_xresolution;
|
||||
old_default_yresolution = default_yresolution;
|
||||
old_default_resolution_units = default_resolution_units;
|
||||
old_default_type = default_type;
|
||||
old_stingy_memory_use = edit_stingy_memory_use;
|
||||
old_tile_cache_size = edit_tile_cache_size;
|
||||
|
@ -970,8 +1077,8 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (prefs_dlg)->vbox),
|
||||
notebook, TRUE, TRUE, 0);
|
||||
|
||||
/* Display page */
|
||||
out_frame = gtk_frame_new (_("Display settings"));
|
||||
/* New File page */
|
||||
out_frame = gtk_frame_new (_("New file settings"));
|
||||
gtk_container_border_width (GTK_CONTAINER (out_frame), 10);
|
||||
gtk_widget_show (out_frame);
|
||||
|
||||
|
@ -980,12 +1087,8 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
gtk_container_add (GTK_CONTAINER (out_frame), vbox);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
frame = gtk_frame_new (_("Default image size"));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
|
||||
frame = gtk_frame_new (_("Default image size and unit"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
abox = gtk_vbox_new (FALSE, 2);
|
||||
|
@ -993,51 +1096,82 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
gtk_container_add (GTK_CONTAINER (frame), abox);
|
||||
gtk_widget_show (abox);
|
||||
|
||||
table = gtk_table_new (2, 2, FALSE);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
|
||||
gtk_box_pack_start (GTK_BOX (abox), table, TRUE, TRUE, 0);
|
||||
gtk_widget_show (table);
|
||||
|
||||
label = gtk_label_new (_("Width: "));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
|
||||
GTK_FILL, GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
default_size_sizeentry = gimp_size_entry_new (2, default_units, "%p",
|
||||
FALSE, TRUE, 75,
|
||||
GIMP_SIZE_ENTRY_UPDATE_SIZE);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (default_size_sizeentry),
|
||||
0, default_xresolution, FALSE);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (default_size_sizeentry),
|
||||
1, default_yresolution, FALSE);
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (default_size_sizeentry), 0, 1, 32767);
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (default_size_sizeentry), 1, 1, 32767);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_size_sizeentry), 0,
|
||||
default_width);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_size_sizeentry), 1,
|
||||
default_height);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_size_sizeentry),
|
||||
_("Width"), 0, 1, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_size_sizeentry),
|
||||
_("Height"), 0, 2, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_size_sizeentry),
|
||||
_("Pixels"), 1, 4, 0.0);
|
||||
/* gtk_container_set_border_width (GTK_CONTAINER (default_size_sizeentry), 2); */
|
||||
gtk_box_pack_start (GTK_BOX (abox), default_size_sizeentry, TRUE, TRUE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (default_size_sizeentry), "unit_changed",
|
||||
(GtkSignalFunc)file_prefs_default_size_callback, NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (default_size_sizeentry), "value_changed",
|
||||
(GtkSignalFunc)file_prefs_default_size_callback, NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (default_size_sizeentry), "refval_changed",
|
||||
(GtkSignalFunc)file_prefs_default_size_callback, NULL);
|
||||
gtk_widget_show (default_size_sizeentry);
|
||||
|
||||
label = gtk_label_new (_("Height: "));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
|
||||
GTK_FILL, GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
adj = (GtkAdjustment *) gtk_adjustment_new (default_width, 1.0,
|
||||
32767.0, 1.0, 50.0, 0.0);
|
||||
spinbutton = gtk_spin_button_new (adj, 1.0, 0.0);
|
||||
gtk_spin_button_set_shadow_type (GTK_SPIN_BUTTON(spinbutton), GTK_SHADOW_NONE);
|
||||
gtk_widget_set_usize (spinbutton, 50, 0);
|
||||
gtk_table_attach (GTK_TABLE (table), spinbutton, 1, 2, 0, 1,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (spinbutton), "changed",
|
||||
(GtkSignalFunc) file_prefs_spinbutton_callback,
|
||||
&default_width);
|
||||
gtk_widget_show (spinbutton);
|
||||
frame = gtk_frame_new (_("Default image resolution and resolution unit"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
adj = (GtkAdjustment *) gtk_adjustment_new (default_height, 1.0,
|
||||
32767.0, 1.0, 50.0, 0.0);
|
||||
spinbutton = gtk_spin_button_new (adj, 1.0, 0.0);
|
||||
gtk_spin_button_set_shadow_type (GTK_SPIN_BUTTON(spinbutton), GTK_SHADOW_NONE);
|
||||
gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(spinbutton), TRUE);
|
||||
gtk_widget_set_usize (spinbutton, 50, 0);
|
||||
gtk_table_attach (GTK_TABLE (table), spinbutton, 1, 2, 1, 2,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (spinbutton), "changed",
|
||||
(GtkSignalFunc) file_prefs_spinbutton_callback,
|
||||
&default_height);
|
||||
gtk_widget_show (spinbutton);
|
||||
abox = gtk_vbox_new (FALSE, 2);
|
||||
gtk_container_border_width (GTK_CONTAINER (abox), 1);
|
||||
gtk_container_add (GTK_CONTAINER (frame), abox);
|
||||
gtk_widget_show (abox);
|
||||
|
||||
default_resolution_force_equal = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
|
||||
|
||||
default_resolution_sizeentry =
|
||||
gimp_size_entry_new (2, default_resolution_units, "%s", FALSE, TRUE, 75,
|
||||
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (default_resolution_sizeentry), 0, 1e-5, 32767);
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (default_resolution_sizeentry), 1, 1e-5, 32767);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_resolution_sizeentry), 0, default_xresolution);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_resolution_sizeentry), 1, default_yresolution);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_resolution_sizeentry), _("Horizontal"), 0, 1, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_resolution_sizeentry), _("Vertical"), 0, 2, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_resolution_sizeentry), _("dpi"), 1, 3, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_resolution_sizeentry), _("pixels per "), 2, 3, 0.0);
|
||||
gtk_signal_connect (GTK_OBJECT (default_resolution_sizeentry),
|
||||
"unit_changed",
|
||||
(GtkSignalFunc)file_prefs_default_resolution_callback,
|
||||
default_resolution_force_equal);
|
||||
gtk_signal_connect (GTK_OBJECT (default_resolution_sizeentry),
|
||||
"value_changed",
|
||||
(GtkSignalFunc)file_prefs_default_resolution_callback,
|
||||
default_resolution_force_equal);
|
||||
gtk_signal_connect (GTK_OBJECT (default_resolution_sizeentry),
|
||||
"refval_changed",
|
||||
(GtkSignalFunc)file_prefs_default_resolution_callback,
|
||||
default_resolution_force_equal);
|
||||
gtk_box_pack_start (GTK_BOX (abox), default_resolution_sizeentry,
|
||||
TRUE, TRUE, 0);
|
||||
gtk_widget_show (default_resolution_sizeentry);
|
||||
|
||||
gtk_table_attach_defaults (GTK_TABLE (default_resolution_sizeentry),
|
||||
default_resolution_force_equal, 1, 3, 3, 4);
|
||||
if (ABS (default_xresolution - default_yresolution) < 1e-5)
|
||||
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (default_resolution_force_equal),
|
||||
TRUE);
|
||||
gtk_widget_show (default_resolution_force_equal);
|
||||
|
||||
frame = gtk_frame_new (_("Default image type"));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
radio_box = gtk_vbox_new (FALSE, 1);
|
||||
|
@ -1047,7 +1181,7 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
|
||||
button = gtk_radio_button_new_with_label (NULL, _("RGB"));
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||
gtk_box_pack_start (GTK_BOX (radio_box), button, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (radio_box), button, FALSE, FALSE, 0);
|
||||
gtk_object_set_user_data (GTK_OBJECT (button), (gpointer) RGB);
|
||||
if (default_type == RGB)
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
||||
|
@ -1057,7 +1191,7 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
gtk_widget_show (button);
|
||||
button = gtk_radio_button_new_with_label (group, _("Grayscale"));
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||
gtk_box_pack_start (GTK_BOX (radio_box), button, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (radio_box), button, FALSE, FALSE, 0);
|
||||
gtk_object_set_user_data (GTK_OBJECT (button), (gpointer) GRAY);
|
||||
if (last_type == GRAY)
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
||||
|
@ -1069,6 +1203,23 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
label = gtk_label_new (_("File"));
|
||||
gtk_notebook_append_page (GTK_NOTEBOOK(notebook), out_frame, label);
|
||||
|
||||
/* Display page */
|
||||
out_frame = gtk_frame_new (_("Display settings"));
|
||||
gtk_container_border_width (GTK_CONTAINER (out_frame), 10);
|
||||
gtk_widget_show (out_frame);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 2);
|
||||
gtk_container_border_width (GTK_CONTAINER (vbox), 1);
|
||||
gtk_container_add (GTK_CONTAINER (out_frame), vbox);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
label = gtk_label_new (_("Preview size: "));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
@ -1085,7 +1236,7 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
}
|
||||
optionmenu = gtk_option_menu_new ();
|
||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu), menu);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), optionmenu, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), optionmenu, FALSE, FALSE, 0);
|
||||
gtk_widget_show (optionmenu);
|
||||
for (i = 0; i < npreview_sizes; i++)
|
||||
if (preview_size==preview_sizes[i].size)
|
||||
|
@ -1094,14 +1245,14 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
button = gtk_check_button_new_with_label(_("Cubic interpolation"));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
|
||||
cubic_interpolation);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "toggled",
|
||||
(GtkSignalFunc) file_prefs_toggle_callback,
|
||||
&cubic_interpolation);
|
||||
gtk_widget_show (button);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
frame = gtk_frame_new (_("Transparency Type"));
|
||||
|
@ -1118,7 +1269,7 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
button = gtk_radio_button_new_with_label (group, gettext(transparencies[i]));
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||
gtk_box_pack_start (GTK_BOX (radio_box), button, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (radio_box), button, FALSE, FALSE, 0);
|
||||
gtk_object_set_user_data (GTK_OBJECT (button),
|
||||
(gpointer) ((long) transparency_vals[i]));
|
||||
if (transparency_vals[i] == transparency_type)
|
||||
|
@ -1142,7 +1293,7 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
button = gtk_radio_button_new_with_label (group, gettext(checks[i]));
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||
gtk_box_pack_start (GTK_BOX (radio_box), button, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (radio_box), button, FALSE, FALSE, 0);
|
||||
gtk_object_set_user_data (GTK_OBJECT (button),
|
||||
(gpointer) ((long) check_vals[i]));
|
||||
if (check_vals[i] == transparency_size)
|
||||
|
@ -1428,9 +1579,10 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
(GtkSignalFunc) file_prefs_spinbutton_callback,
|
||||
&num_processors);
|
||||
gtk_widget_show (num_processors_spinbutton);
|
||||
#else
|
||||
num_processors_spinbutton = NULL;
|
||||
#endif /* ENABLE_MP */
|
||||
|
||||
|
||||
button = gtk_check_button_new_with_label(_("Install colormap (8-bit only)"));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
|
||||
install_cmap);
|
||||
|
@ -1604,43 +1756,48 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
gtk_container_add (GTK_CONTAINER (abox), vbox);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
resolution_force_equal = gtk_check_button_new_with_label (_("Force equal horizontal and vertical resolutions"));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (resolution_force_equal),
|
||||
TRUE);
|
||||
monitor_resolution_force_equal = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
|
||||
|
||||
resolution_sizeentry = gimp_size_entry_new (2, UNIT_INCH, "%s",
|
||||
monitor_resolution_sizeentry = gimp_size_entry_new (2, UNIT_INCH, "%s",
|
||||
FALSE, TRUE, 75,
|
||||
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (resolution_sizeentry),
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
|
||||
0, 1, 32767);
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (resolution_sizeentry),
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
|
||||
1, 1, 32767);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (resolution_sizeentry), 0,
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 0,
|
||||
monitor_xres);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (resolution_sizeentry), 1,
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 1,
|
||||
monitor_yres);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (resolution_sizeentry),
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
|
||||
_("Horizontal"), 0, 1, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (resolution_sizeentry),
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
|
||||
_("Vertical"), 0, 2, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (resolution_sizeentry),
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
|
||||
_("dpi"), 1, 3, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (resolution_sizeentry),
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
|
||||
_("pixels per "), 2, 3, 0.0);
|
||||
gtk_signal_connect (GTK_OBJECT (resolution_sizeentry), "value_changed",
|
||||
(GtkSignalFunc)file_prefs_resolution_callback,
|
||||
resolution_force_equal);
|
||||
gtk_signal_connect (GTK_OBJECT (resolution_sizeentry), "refval_changed",
|
||||
(GtkSignalFunc)file_prefs_resolution_callback,
|
||||
resolution_force_equal);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), resolution_sizeentry, TRUE, TRUE, 0);
|
||||
gtk_widget_show (resolution_sizeentry);
|
||||
gtk_signal_connect (GTK_OBJECT (monitor_resolution_sizeentry),
|
||||
"value_changed",
|
||||
(GtkSignalFunc)file_prefs_monitor_resolution_callback,
|
||||
monitor_resolution_force_equal);
|
||||
gtk_signal_connect (GTK_OBJECT (monitor_resolution_sizeentry),
|
||||
"refval_changed",
|
||||
(GtkSignalFunc)file_prefs_monitor_resolution_callback,
|
||||
monitor_resolution_force_equal);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), monitor_resolution_sizeentry,
|
||||
TRUE, TRUE, 0);
|
||||
gtk_widget_show (monitor_resolution_sizeentry);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox), resolution_force_equal, TRUE, TRUE, 0);
|
||||
gtk_widget_show (resolution_force_equal);
|
||||
|
||||
gtk_widget_set_sensitive (resolution_sizeentry, !using_xserver_resolution);
|
||||
gtk_widget_set_sensitive (resolution_force_equal,
|
||||
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (monitor_resolution_force_equal),
|
||||
TRUE);
|
||||
gtk_table_attach_defaults (GTK_TABLE (monitor_resolution_sizeentry),
|
||||
monitor_resolution_force_equal, 1, 3, 3, 4);
|
||||
gtk_widget_show (monitor_resolution_force_equal);
|
||||
|
||||
gtk_widget_set_sensitive (monitor_resolution_sizeentry,
|
||||
!using_xserver_resolution);
|
||||
gtk_widget_set_sensitive (monitor_resolution_force_equal,
|
||||
!using_xserver_resolution);
|
||||
|
||||
label = gtk_label_new (_("Monitor"));
|
||||
|
|
|
@ -57,14 +57,6 @@ static GUnit last_unit = UNIT_INCH;
|
|||
static GUnit last_res_unit = UNIT_INCH;
|
||||
static gboolean last_new_image = TRUE;
|
||||
|
||||
/* these are temps that should be set in gimprc eventually */
|
||||
/* FIXME */
|
||||
static float default_xresolution = 72;
|
||||
static float default_yresolution = 72;
|
||||
static GUnit default_unit = UNIT_INCH;
|
||||
|
||||
static GUnit default_res_unit = UNIT_INCH;
|
||||
|
||||
|
||||
static int new_dialog_run;
|
||||
extern TileManager *global_buf;
|
||||
|
@ -242,6 +234,13 @@ file_new_resolution_callback (GtkWidget *widget,
|
|||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (vals->resolution_sizeentry), 0, xres);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (new_xres != xres)
|
||||
xres = new_xres;
|
||||
if (new_yres != yres)
|
||||
yres = new_yres;
|
||||
}
|
||||
}
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (vals->size_sizeentry), 0,
|
||||
xres,
|
||||
|
@ -268,18 +267,15 @@ file_new_cmd_callback (GtkWidget *widget,
|
|||
GtkWidget *advanced_button;
|
||||
GSList *group;
|
||||
|
||||
/* this value is from gimprc.h */
|
||||
default_res_unit = UNIT_INCH; /* ruler_units; */
|
||||
|
||||
if(!new_dialog_run)
|
||||
{
|
||||
last_width = default_width;
|
||||
last_height = default_height;
|
||||
last_type = default_type;
|
||||
last_xresolution = default_xresolution; /* this isnt set in gimprc yet */
|
||||
last_yresolution = default_yresolution; /* this isnt set in gimprc yet */
|
||||
last_unit = default_unit; /* not in gimprc either, inches for now */
|
||||
last_res_unit = default_res_unit;
|
||||
last_xresolution = default_xresolution; /* these values are taken */
|
||||
last_yresolution = default_yresolution; /* from gimprc */
|
||||
last_unit = default_units;
|
||||
last_res_unit = default_resolution_units;
|
||||
|
||||
new_dialog_run = 1;
|
||||
}
|
||||
|
|
59
app/gimprc.c
59
app/gimprc.c
|
@ -114,7 +114,7 @@ int no_cursor_updating = 0;
|
|||
int preview_size = 64;
|
||||
int show_rulers = TRUE;
|
||||
int show_statusbar = TRUE;
|
||||
int ruler_units = GTK_PIXELS;
|
||||
GUnit default_units = UNIT_INCH;
|
||||
int auto_save = TRUE;
|
||||
int cubic_interpolation = FALSE;
|
||||
int confirm_on_close = TRUE;
|
||||
|
@ -124,10 +124,9 @@ int always_restore_session = FALSE;
|
|||
int default_width = 256;
|
||||
int default_height = 256;
|
||||
int default_type = RGB;
|
||||
int default_resolution = 72;
|
||||
int default_resolution_units = GTK_INCHES;
|
||||
int default_width_units = GTK_INCHES;
|
||||
int default_height_units = GTK_INCHES;
|
||||
float default_xresolution = 72.0;
|
||||
float default_yresolution = 72.0;
|
||||
GUnit default_resolution_units = UNIT_INCH;
|
||||
int show_tips = TRUE;
|
||||
int last_tip = -1;
|
||||
int show_tool_tips = TRUE;
|
||||
|
@ -152,7 +151,7 @@ static int parse_mem_size (gpointer val1p, gpointer val2p);
|
|||
static int parse_image_type (gpointer val1p, gpointer val2p);
|
||||
static int parse_color_cube (gpointer val1p, gpointer val2p);
|
||||
static int parse_preview_size (gpointer val1p, gpointer val2p);
|
||||
static int parse_ruler_units (gpointer val1p, gpointer val2p);
|
||||
static int parse_units (gpointer val1p, gpointer val2p);
|
||||
static int parse_plug_in (gpointer val1p, gpointer val2p);
|
||||
static int parse_plug_in_def (gpointer val1p, gpointer val2p);
|
||||
static int parse_device (gpointer val1p, gpointer val2p);
|
||||
|
@ -176,7 +175,7 @@ static inline char* mem_size_to_str (gpointer val1p, gpointer val2p);
|
|||
static inline char* image_type_to_str (gpointer val1p, gpointer val2p);
|
||||
static inline char* color_cube_to_str (gpointer val1p, gpointer val2p);
|
||||
static inline char* preview_size_to_str (gpointer val1p, gpointer val2p);
|
||||
static inline char* ruler_units_to_str (gpointer val1p, gpointer val2p);
|
||||
static inline char* units_to_str (gpointer val1p, gpointer val2p);
|
||||
|
||||
static char* transform_path (char *path, int destroy);
|
||||
static char* gimprc_find_token (char *token);
|
||||
|
@ -231,7 +230,7 @@ static ParseFunc funcs[] =
|
|||
{ "dont-show-rulers", TT_BOOLEAN, NULL, &show_rulers },
|
||||
{ "show-statusbar", TT_BOOLEAN, &show_statusbar, NULL },
|
||||
{ "dont-show-statusbar", TT_BOOLEAN, NULL, &show_statusbar },
|
||||
{ "ruler-units", TT_XRULERUNIT, NULL, NULL },
|
||||
{ "default-units", TT_XRULERUNIT, &default_units, NULL },
|
||||
{ "auto-save", TT_BOOLEAN, &auto_save, NULL },
|
||||
{ "dont-auto-save", TT_BOOLEAN, NULL, &auto_save },
|
||||
{ "cubic-interpolation", TT_BOOLEAN, &cubic_interpolation, NULL },
|
||||
|
@ -249,7 +248,8 @@ static ParseFunc funcs[] =
|
|||
{ "dont-show-tool-tips", TT_BOOLEAN, NULL, &show_tool_tips },
|
||||
{ "default-image-size", TT_POSITION, &default_width, &default_height },
|
||||
{ "default-image-type", TT_IMAGETYPE, &default_type, NULL },
|
||||
{ "default-resolution", TT_INT, &default_resolution, NULL },
|
||||
{ "default-xresolution", TT_FLOAT, &default_xresolution, NULL },
|
||||
{ "default-yresolution", TT_FLOAT, &default_yresolution, NULL },
|
||||
{ "default-resolution-units", TT_XRULERUNIT, &default_resolution_units, NULL },
|
||||
{ "plug-in", TT_XPLUGIN, NULL, NULL },
|
||||
{ "plug-in-def", TT_XPLUGINDEF, NULL, NULL },
|
||||
|
@ -642,7 +642,7 @@ parse_statement ()
|
|||
case TT_XPREVSIZE:
|
||||
return parse_preview_size (funcs[i].val1p, funcs[i].val2p);
|
||||
case TT_XRULERUNIT:
|
||||
return parse_ruler_units (funcs[i].val1p, funcs[i].val2p);
|
||||
return parse_units (funcs[i].val1p, funcs[i].val2p);
|
||||
case TT_XPLUGIN:
|
||||
return parse_plug_in (funcs[i].val1p, funcs[i].val2p);
|
||||
case TT_XPLUGINDEF:
|
||||
|
@ -1048,24 +1048,26 @@ parse_preview_size (gpointer val1p,
|
|||
}
|
||||
|
||||
static int
|
||||
parse_ruler_units (gpointer val1p,
|
||||
gpointer val2p)
|
||||
parse_units (gpointer val1p,
|
||||
gpointer val2p)
|
||||
{
|
||||
int token;
|
||||
int i;
|
||||
|
||||
g_assert (val1p != NULL);
|
||||
|
||||
token = peek_next_token ();
|
||||
if (!token || (token != TOKEN_SYMBOL))
|
||||
return ERROR;
|
||||
token = get_next_token ();
|
||||
|
||||
if (strcmp (token_sym, "pixels") == 0)
|
||||
ruler_units = GTK_PIXELS;
|
||||
else if (strcmp (token_sym, "inches") == 0)
|
||||
ruler_units = GTK_INCHES;
|
||||
else if (strcmp (token_sym, "centimeters") == 0)
|
||||
ruler_units = GTK_CENTIMETERS;
|
||||
else
|
||||
ruler_units = GTK_PIXELS;
|
||||
*((GUnit*)val1p) = UNIT_INCH;
|
||||
for (i=UNIT_INCH; i<gimp_unit_get_number_of_units (); i++)
|
||||
if (strcmp (token_sym, gimp_unit_get_identifier (i)) == 0)
|
||||
{
|
||||
*((GUnit*)val1p) = i;
|
||||
break;
|
||||
}
|
||||
|
||||
token = peek_next_token ();
|
||||
if (!token || (token != TOKEN_RIGHT_PAREN))
|
||||
|
@ -2005,7 +2007,7 @@ value_to_str (char *name)
|
|||
case TT_XPREVSIZE:
|
||||
return preview_size_to_str (funcs[i].val1p, funcs[i].val2p);
|
||||
case TT_XRULERUNIT:
|
||||
return ruler_units_to_str (funcs[i].val1p, funcs[i].val2p);
|
||||
return units_to_str (funcs[i].val1p, funcs[i].val2p);
|
||||
case TT_XPLUGIN:
|
||||
case TT_XPLUGINDEF:
|
||||
case TT_XMENUPATH:
|
||||
|
@ -2126,19 +2128,10 @@ preview_size_to_str (gpointer val1p,
|
|||
}
|
||||
|
||||
static inline char *
|
||||
ruler_units_to_str (gpointer val1p,
|
||||
gpointer val2p)
|
||||
units_to_str (gpointer val1p,
|
||||
gpointer val2p)
|
||||
{
|
||||
switch (ruler_units)
|
||||
{
|
||||
case GTK_INCHES:
|
||||
return g_strdup ("inches");
|
||||
case GTK_CENTIMETERS:
|
||||
return g_strdup ("centimeters");
|
||||
case GTK_PIXELS:
|
||||
return g_strdup ("pixels");
|
||||
}
|
||||
return NULL;
|
||||
return g_strdup (gimp_unit_get_identifier (*((GUnit*)val1p)));
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
|
||||
#include <glib.h>
|
||||
#include "procedural_db.h"
|
||||
#include "libgimp/gimpunit.h"
|
||||
|
||||
/* global gimprc variables */
|
||||
extern char * plug_in_path;
|
||||
|
@ -52,15 +53,16 @@ extern int allow_resize_windows;
|
|||
extern int no_cursor_updating;
|
||||
extern int preview_size;
|
||||
extern int show_rulers;
|
||||
extern int ruler_units;
|
||||
extern GUnit default_units;
|
||||
extern int show_statusbar;
|
||||
extern int auto_save;
|
||||
extern int cubic_interpolation;
|
||||
extern int confirm_on_close;
|
||||
extern int default_width, default_height;
|
||||
extern int default_type;
|
||||
extern int default_resolution;
|
||||
extern int default_resolution_units;
|
||||
extern GUnit default_resolution_units;
|
||||
extern float default_xresolution;
|
||||
extern float default_yresolution;
|
||||
extern int save_session_info;
|
||||
extern int save_device_status;
|
||||
extern int always_restore_session;
|
||||
|
|
|
@ -57,14 +57,6 @@ static GUnit last_unit = UNIT_INCH;
|
|||
static GUnit last_res_unit = UNIT_INCH;
|
||||
static gboolean last_new_image = TRUE;
|
||||
|
||||
/* these are temps that should be set in gimprc eventually */
|
||||
/* FIXME */
|
||||
static float default_xresolution = 72;
|
||||
static float default_yresolution = 72;
|
||||
static GUnit default_unit = UNIT_INCH;
|
||||
|
||||
static GUnit default_res_unit = UNIT_INCH;
|
||||
|
||||
|
||||
static int new_dialog_run;
|
||||
extern TileManager *global_buf;
|
||||
|
@ -242,6 +234,13 @@ file_new_resolution_callback (GtkWidget *widget,
|
|||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (vals->resolution_sizeentry), 0, xres);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (new_xres != xres)
|
||||
xres = new_xres;
|
||||
if (new_yres != yres)
|
||||
yres = new_yres;
|
||||
}
|
||||
}
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (vals->size_sizeentry), 0,
|
||||
xres,
|
||||
|
@ -268,18 +267,15 @@ file_new_cmd_callback (GtkWidget *widget,
|
|||
GtkWidget *advanced_button;
|
||||
GSList *group;
|
||||
|
||||
/* this value is from gimprc.h */
|
||||
default_res_unit = UNIT_INCH; /* ruler_units; */
|
||||
|
||||
if(!new_dialog_run)
|
||||
{
|
||||
last_width = default_width;
|
||||
last_height = default_height;
|
||||
last_type = default_type;
|
||||
last_xresolution = default_xresolution; /* this isnt set in gimprc yet */
|
||||
last_yresolution = default_yresolution; /* this isnt set in gimprc yet */
|
||||
last_unit = default_unit; /* not in gimprc either, inches for now */
|
||||
last_res_unit = default_res_unit;
|
||||
last_xresolution = default_xresolution; /* these values are taken */
|
||||
last_yresolution = default_yresolution; /* from gimprc */
|
||||
last_unit = default_units;
|
||||
last_res_unit = default_resolution_units;
|
||||
|
||||
new_dialog_run = 1;
|
||||
}
|
||||
|
|
|
@ -46,10 +46,11 @@
|
|||
#include "tips_dialog.h"
|
||||
#include "tools.h"
|
||||
#include "undo.h"
|
||||
#include "libgimp/gimpsizeentry.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "libgimp/gimpchainbutton.h"
|
||||
#include "libgimp/gimpintl.h"
|
||||
#include "libgimp/gimpsizeentry.h"
|
||||
|
||||
|
||||
/* preferences local functions */
|
||||
|
@ -63,7 +64,7 @@ static void file_prefs_spinbutton_callback (GtkWidget *, gpointer);
|
|||
static void file_prefs_preview_size_callback (GtkWidget *, gpointer);
|
||||
static void file_prefs_mem_size_unit_callback (GtkWidget *, gpointer);
|
||||
static void file_prefs_clear_session_info_callback (GtkWidget *, gpointer);
|
||||
static void file_prefs_resolution_callback (GtkWidget *, gpointer);
|
||||
static void file_prefs_monitor_resolution_callback (GtkWidget *, gpointer);
|
||||
|
||||
/* static variables */
|
||||
static int last_type = RGB;
|
||||
|
@ -88,6 +89,10 @@ static int old_save_device_status;
|
|||
static int old_always_restore_session;
|
||||
static int old_default_width;
|
||||
static int old_default_height;
|
||||
static GUnit old_default_units;
|
||||
static float old_default_xresolution;
|
||||
static float old_default_yresolution;
|
||||
static GUnit old_default_resolution_units;
|
||||
static int old_default_type;
|
||||
static int old_stingy_memory_use;
|
||||
static int old_tile_cache_size;
|
||||
|
@ -124,9 +129,12 @@ static int edit_num_processors;
|
|||
static GtkWidget *tile_cache_size_spinbutton = NULL;
|
||||
static int divided_tile_cache_size;
|
||||
static int mem_size_unit;
|
||||
static GtkWidget *default_size_sizeentry = NULL;
|
||||
static GtkWidget *default_resolution_sizeentry = NULL;
|
||||
static GtkWidget *default_resolution_force_equal = NULL;
|
||||
static GtkWidget *resolution_xserver_label = NULL;
|
||||
static GtkWidget *resolution_sizeentry = NULL;
|
||||
static GtkWidget *resolution_force_equal = NULL;
|
||||
static GtkWidget *monitor_resolution_sizeentry = NULL;
|
||||
static GtkWidget *monitor_resolution_force_equal = NULL;
|
||||
static GtkWidget *num_processors_spinbutton = NULL;
|
||||
|
||||
/* Some information regarding preferences, compiled by Raph Levien 11/3/97.
|
||||
|
@ -161,8 +169,8 @@ static GtkWidget *num_processors_spinbutton = NULL;
|
|||
|
||||
Still no settings for default-brush, default-gradient,
|
||||
default-palette, default-pattern, gamma-correction, color-cube,
|
||||
show-rulers, ruler-units. No widget for confirm-on-close although
|
||||
a lot of stuff is there.
|
||||
show-rulers. No widget for confirm-on-close although a lot of
|
||||
stuff is there.
|
||||
|
||||
No UI feedback for the fact that some settings won't take effect
|
||||
until the next Gimp restart.
|
||||
|
@ -240,6 +248,27 @@ file_prefs_ok_callback (GtkWidget *widget,
|
|||
default_height = old_default_height;
|
||||
return;
|
||||
}
|
||||
if (default_units < UNIT_INCH ||
|
||||
default_units >= gimp_unit_get_number_of_units ())
|
||||
{
|
||||
g_message (_("Error: Default units must be withing unit range."));
|
||||
default_units = old_default_units;
|
||||
return;
|
||||
}
|
||||
if (default_xresolution < 1e-5 || default_yresolution < 1e-5)
|
||||
{
|
||||
g_message (_("Error: default resolution must not be zero."));
|
||||
default_xresolution = old_default_xresolution;
|
||||
default_yresolution = old_default_yresolution;
|
||||
return;
|
||||
}
|
||||
if (default_resolution_units < UNIT_INCH ||
|
||||
default_resolution_units >= gimp_unit_get_number_of_units ())
|
||||
{
|
||||
g_message (_("Error: Default units must be withing unit range."));
|
||||
default_resolution_units = old_default_resolution_units;
|
||||
return;
|
||||
}
|
||||
if (monitor_xres < 1e-5 || monitor_yres < 1e-5)
|
||||
{
|
||||
g_message (_("Error: monitor resolution must not be zero."));
|
||||
|
@ -256,9 +285,12 @@ file_prefs_ok_callback (GtkWidget *widget,
|
|||
|
||||
gtk_widget_destroy (dlg);
|
||||
prefs_dlg = NULL;
|
||||
default_size_sizeentry = NULL;
|
||||
default_resolution_sizeentry = NULL;
|
||||
default_resolution_force_equal = NULL;
|
||||
resolution_xserver_label = NULL;
|
||||
resolution_sizeentry = NULL;
|
||||
resolution_force_equal = NULL;
|
||||
monitor_resolution_sizeentry = NULL;
|
||||
monitor_resolution_force_equal = NULL;
|
||||
|
||||
if (show_tool_tips)
|
||||
gtk_tooltips_enable (tool_tips);
|
||||
|
@ -364,6 +396,14 @@ file_prefs_save_callback (GtkWidget *widget,
|
|||
if (default_width != old_default_width ||
|
||||
default_height != old_default_height)
|
||||
update = g_list_append (update, "default-image-size");
|
||||
if (default_units != old_default_units)
|
||||
update = g_list_append (update, "default-units");
|
||||
if (ABS(default_xresolution - old_default_xresolution) > 1e-5)
|
||||
update = g_list_append (update, "default-xresolution");
|
||||
if (ABS(default_yresolution - old_default_yresolution) > 1e-5)
|
||||
update = g_list_append (update, "default-yresolution");
|
||||
if (default_resolution_units != old_default_resolution_units)
|
||||
update = g_list_append (update, "default-resolution-units");
|
||||
if (default_type != old_default_type)
|
||||
update = g_list_append (update, "default-image-type");
|
||||
if (preview_size != old_preview_size)
|
||||
|
@ -507,9 +547,12 @@ file_prefs_cancel_callback (GtkWidget *widget,
|
|||
{
|
||||
gtk_widget_destroy (dlg);
|
||||
prefs_dlg = NULL;
|
||||
default_size_sizeentry = NULL;
|
||||
default_resolution_sizeentry = NULL;
|
||||
default_resolution_force_equal = NULL;
|
||||
resolution_xserver_label = NULL;
|
||||
resolution_sizeentry = NULL;
|
||||
resolution_force_equal = NULL;
|
||||
monitor_resolution_sizeentry = NULL;
|
||||
monitor_resolution_force_equal = NULL;
|
||||
|
||||
levels_of_undo = old_levels_of_undo;
|
||||
marching_speed = old_marching_speed;
|
||||
|
@ -526,6 +569,10 @@ file_prefs_cancel_callback (GtkWidget *widget,
|
|||
save_device_status = old_save_device_status;
|
||||
default_width = old_default_width;
|
||||
default_height = old_default_height;
|
||||
default_units = old_default_units;
|
||||
default_xresolution = old_default_xresolution;
|
||||
default_yresolution = old_default_yresolution;
|
||||
default_resolution_units = old_default_resolution_units;
|
||||
default_type = old_default_type;
|
||||
monitor_xres = old_monitor_xres;
|
||||
monitor_yres = old_monitor_yres;
|
||||
|
@ -704,12 +751,12 @@ file_prefs_res_source_callback (GtkWidget *widget,
|
|||
gtk_widget_set_sensitive (resolution_xserver_label,
|
||||
GTK_TOGGLE_BUTTON (widget)->active);
|
||||
|
||||
if (resolution_sizeentry)
|
||||
gtk_widget_set_sensitive (resolution_sizeentry,
|
||||
if (monitor_resolution_sizeentry)
|
||||
gtk_widget_set_sensitive (monitor_resolution_sizeentry,
|
||||
! GTK_TOGGLE_BUTTON (widget)->active);
|
||||
|
||||
if (resolution_force_equal)
|
||||
gtk_widget_set_sensitive (resolution_force_equal,
|
||||
if (monitor_resolution_force_equal)
|
||||
gtk_widget_set_sensitive (monitor_resolution_force_equal,
|
||||
! GTK_TOGGLE_BUTTON (widget)->active);
|
||||
|
||||
if (GTK_TOGGLE_BUTTON (widget)->active)
|
||||
|
@ -719,20 +766,30 @@ file_prefs_res_source_callback (GtkWidget *widget,
|
|||
}
|
||||
else
|
||||
{
|
||||
if (resolution_sizeentry)
|
||||
if (monitor_resolution_sizeentry)
|
||||
{
|
||||
monitor_xres =
|
||||
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (resolution_sizeentry), 0);
|
||||
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 0);
|
||||
monitor_yres =
|
||||
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (resolution_sizeentry), 1);
|
||||
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 1);
|
||||
}
|
||||
using_xserver_resolution = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
file_prefs_resolution_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
file_prefs_default_size_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
default_width = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0);
|
||||
default_height = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
|
||||
default_units = gimp_size_entry_get_unit (GIMP_SIZE_ENTRY (widget));
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
file_prefs_default_resolution_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
static float xres = 0.0;
|
||||
static float yres = 0.0;
|
||||
|
@ -742,7 +799,53 @@ file_prefs_resolution_callback (GtkWidget *widget,
|
|||
new_xres = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0);
|
||||
new_yres = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
|
||||
|
||||
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data)))
|
||||
if (gimp_chain_button_get_active (GIMP_CHAIN_BUTTON (data)))
|
||||
{
|
||||
if (new_xres != xres)
|
||||
{
|
||||
yres = new_yres = xres = new_xres;
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 1, yres);
|
||||
}
|
||||
|
||||
if (new_yres != yres)
|
||||
{
|
||||
xres = new_xres = yres = new_yres;
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 0, xres);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (new_xres != xres)
|
||||
xres = new_xres;
|
||||
if (new_yres != yres)
|
||||
yres = new_yres;
|
||||
}
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (default_size_sizeentry),
|
||||
0, xres, FALSE);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (default_size_sizeentry),
|
||||
1, yres, FALSE);
|
||||
|
||||
default_width = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (default_size_sizeentry), 0);
|
||||
default_height = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (default_size_sizeentry), 1);
|
||||
default_xresolution = xres;
|
||||
default_yresolution = yres;
|
||||
default_resolution_units = gimp_size_entry_get_unit (GIMP_SIZE_ENTRY (widget));
|
||||
}
|
||||
|
||||
static void
|
||||
file_prefs_monitor_resolution_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
static float xres = 0.0;
|
||||
static float yres = 0.0;
|
||||
float new_xres;
|
||||
float new_yres;
|
||||
|
||||
new_xres = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0);
|
||||
new_yres = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
|
||||
|
||||
if (gimp_chain_button_get_active (GIMP_CHAIN_BUTTON (data)))
|
||||
{
|
||||
if (new_xres != xres)
|
||||
{
|
||||
|
@ -898,6 +1001,10 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
old_always_restore_session = always_restore_session;
|
||||
old_default_width = default_width;
|
||||
old_default_height = default_height;
|
||||
old_default_units = default_units;
|
||||
old_default_xresolution = default_xresolution;
|
||||
old_default_yresolution = default_yresolution;
|
||||
old_default_resolution_units = default_resolution_units;
|
||||
old_default_type = default_type;
|
||||
old_stingy_memory_use = edit_stingy_memory_use;
|
||||
old_tile_cache_size = edit_tile_cache_size;
|
||||
|
@ -970,8 +1077,8 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (prefs_dlg)->vbox),
|
||||
notebook, TRUE, TRUE, 0);
|
||||
|
||||
/* Display page */
|
||||
out_frame = gtk_frame_new (_("Display settings"));
|
||||
/* New File page */
|
||||
out_frame = gtk_frame_new (_("New file settings"));
|
||||
gtk_container_border_width (GTK_CONTAINER (out_frame), 10);
|
||||
gtk_widget_show (out_frame);
|
||||
|
||||
|
@ -980,12 +1087,8 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
gtk_container_add (GTK_CONTAINER (out_frame), vbox);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
frame = gtk_frame_new (_("Default image size"));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
|
||||
frame = gtk_frame_new (_("Default image size and unit"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
abox = gtk_vbox_new (FALSE, 2);
|
||||
|
@ -993,51 +1096,82 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
gtk_container_add (GTK_CONTAINER (frame), abox);
|
||||
gtk_widget_show (abox);
|
||||
|
||||
table = gtk_table_new (2, 2, FALSE);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
|
||||
gtk_box_pack_start (GTK_BOX (abox), table, TRUE, TRUE, 0);
|
||||
gtk_widget_show (table);
|
||||
|
||||
label = gtk_label_new (_("Width: "));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
|
||||
GTK_FILL, GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
default_size_sizeentry = gimp_size_entry_new (2, default_units, "%p",
|
||||
FALSE, TRUE, 75,
|
||||
GIMP_SIZE_ENTRY_UPDATE_SIZE);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (default_size_sizeentry),
|
||||
0, default_xresolution, FALSE);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (default_size_sizeentry),
|
||||
1, default_yresolution, FALSE);
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (default_size_sizeentry), 0, 1, 32767);
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (default_size_sizeentry), 1, 1, 32767);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_size_sizeentry), 0,
|
||||
default_width);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_size_sizeentry), 1,
|
||||
default_height);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_size_sizeentry),
|
||||
_("Width"), 0, 1, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_size_sizeentry),
|
||||
_("Height"), 0, 2, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_size_sizeentry),
|
||||
_("Pixels"), 1, 4, 0.0);
|
||||
/* gtk_container_set_border_width (GTK_CONTAINER (default_size_sizeentry), 2); */
|
||||
gtk_box_pack_start (GTK_BOX (abox), default_size_sizeentry, TRUE, TRUE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (default_size_sizeentry), "unit_changed",
|
||||
(GtkSignalFunc)file_prefs_default_size_callback, NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (default_size_sizeentry), "value_changed",
|
||||
(GtkSignalFunc)file_prefs_default_size_callback, NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (default_size_sizeentry), "refval_changed",
|
||||
(GtkSignalFunc)file_prefs_default_size_callback, NULL);
|
||||
gtk_widget_show (default_size_sizeentry);
|
||||
|
||||
label = gtk_label_new (_("Height: "));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
|
||||
GTK_FILL, GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
adj = (GtkAdjustment *) gtk_adjustment_new (default_width, 1.0,
|
||||
32767.0, 1.0, 50.0, 0.0);
|
||||
spinbutton = gtk_spin_button_new (adj, 1.0, 0.0);
|
||||
gtk_spin_button_set_shadow_type (GTK_SPIN_BUTTON(spinbutton), GTK_SHADOW_NONE);
|
||||
gtk_widget_set_usize (spinbutton, 50, 0);
|
||||
gtk_table_attach (GTK_TABLE (table), spinbutton, 1, 2, 0, 1,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (spinbutton), "changed",
|
||||
(GtkSignalFunc) file_prefs_spinbutton_callback,
|
||||
&default_width);
|
||||
gtk_widget_show (spinbutton);
|
||||
frame = gtk_frame_new (_("Default image resolution and resolution unit"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
adj = (GtkAdjustment *) gtk_adjustment_new (default_height, 1.0,
|
||||
32767.0, 1.0, 50.0, 0.0);
|
||||
spinbutton = gtk_spin_button_new (adj, 1.0, 0.0);
|
||||
gtk_spin_button_set_shadow_type (GTK_SPIN_BUTTON(spinbutton), GTK_SHADOW_NONE);
|
||||
gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(spinbutton), TRUE);
|
||||
gtk_widget_set_usize (spinbutton, 50, 0);
|
||||
gtk_table_attach (GTK_TABLE (table), spinbutton, 1, 2, 1, 2,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (spinbutton), "changed",
|
||||
(GtkSignalFunc) file_prefs_spinbutton_callback,
|
||||
&default_height);
|
||||
gtk_widget_show (spinbutton);
|
||||
abox = gtk_vbox_new (FALSE, 2);
|
||||
gtk_container_border_width (GTK_CONTAINER (abox), 1);
|
||||
gtk_container_add (GTK_CONTAINER (frame), abox);
|
||||
gtk_widget_show (abox);
|
||||
|
||||
default_resolution_force_equal = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
|
||||
|
||||
default_resolution_sizeentry =
|
||||
gimp_size_entry_new (2, default_resolution_units, "%s", FALSE, TRUE, 75,
|
||||
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (default_resolution_sizeentry), 0, 1e-5, 32767);
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (default_resolution_sizeentry), 1, 1e-5, 32767);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_resolution_sizeentry), 0, default_xresolution);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_resolution_sizeentry), 1, default_yresolution);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_resolution_sizeentry), _("Horizontal"), 0, 1, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_resolution_sizeentry), _("Vertical"), 0, 2, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_resolution_sizeentry), _("dpi"), 1, 3, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_resolution_sizeentry), _("pixels per "), 2, 3, 0.0);
|
||||
gtk_signal_connect (GTK_OBJECT (default_resolution_sizeentry),
|
||||
"unit_changed",
|
||||
(GtkSignalFunc)file_prefs_default_resolution_callback,
|
||||
default_resolution_force_equal);
|
||||
gtk_signal_connect (GTK_OBJECT (default_resolution_sizeentry),
|
||||
"value_changed",
|
||||
(GtkSignalFunc)file_prefs_default_resolution_callback,
|
||||
default_resolution_force_equal);
|
||||
gtk_signal_connect (GTK_OBJECT (default_resolution_sizeentry),
|
||||
"refval_changed",
|
||||
(GtkSignalFunc)file_prefs_default_resolution_callback,
|
||||
default_resolution_force_equal);
|
||||
gtk_box_pack_start (GTK_BOX (abox), default_resolution_sizeentry,
|
||||
TRUE, TRUE, 0);
|
||||
gtk_widget_show (default_resolution_sizeentry);
|
||||
|
||||
gtk_table_attach_defaults (GTK_TABLE (default_resolution_sizeentry),
|
||||
default_resolution_force_equal, 1, 3, 3, 4);
|
||||
if (ABS (default_xresolution - default_yresolution) < 1e-5)
|
||||
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (default_resolution_force_equal),
|
||||
TRUE);
|
||||
gtk_widget_show (default_resolution_force_equal);
|
||||
|
||||
frame = gtk_frame_new (_("Default image type"));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
radio_box = gtk_vbox_new (FALSE, 1);
|
||||
|
@ -1047,7 +1181,7 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
|
||||
button = gtk_radio_button_new_with_label (NULL, _("RGB"));
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||
gtk_box_pack_start (GTK_BOX (radio_box), button, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (radio_box), button, FALSE, FALSE, 0);
|
||||
gtk_object_set_user_data (GTK_OBJECT (button), (gpointer) RGB);
|
||||
if (default_type == RGB)
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
||||
|
@ -1057,7 +1191,7 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
gtk_widget_show (button);
|
||||
button = gtk_radio_button_new_with_label (group, _("Grayscale"));
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||
gtk_box_pack_start (GTK_BOX (radio_box), button, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (radio_box), button, FALSE, FALSE, 0);
|
||||
gtk_object_set_user_data (GTK_OBJECT (button), (gpointer) GRAY);
|
||||
if (last_type == GRAY)
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
||||
|
@ -1069,6 +1203,23 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
label = gtk_label_new (_("File"));
|
||||
gtk_notebook_append_page (GTK_NOTEBOOK(notebook), out_frame, label);
|
||||
|
||||
/* Display page */
|
||||
out_frame = gtk_frame_new (_("Display settings"));
|
||||
gtk_container_border_width (GTK_CONTAINER (out_frame), 10);
|
||||
gtk_widget_show (out_frame);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 2);
|
||||
gtk_container_border_width (GTK_CONTAINER (vbox), 1);
|
||||
gtk_container_add (GTK_CONTAINER (out_frame), vbox);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
label = gtk_label_new (_("Preview size: "));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
@ -1085,7 +1236,7 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
}
|
||||
optionmenu = gtk_option_menu_new ();
|
||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu), menu);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), optionmenu, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), optionmenu, FALSE, FALSE, 0);
|
||||
gtk_widget_show (optionmenu);
|
||||
for (i = 0; i < npreview_sizes; i++)
|
||||
if (preview_size==preview_sizes[i].size)
|
||||
|
@ -1094,14 +1245,14 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
button = gtk_check_button_new_with_label(_("Cubic interpolation"));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
|
||||
cubic_interpolation);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "toggled",
|
||||
(GtkSignalFunc) file_prefs_toggle_callback,
|
||||
&cubic_interpolation);
|
||||
gtk_widget_show (button);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
frame = gtk_frame_new (_("Transparency Type"));
|
||||
|
@ -1118,7 +1269,7 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
button = gtk_radio_button_new_with_label (group, gettext(transparencies[i]));
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||
gtk_box_pack_start (GTK_BOX (radio_box), button, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (radio_box), button, FALSE, FALSE, 0);
|
||||
gtk_object_set_user_data (GTK_OBJECT (button),
|
||||
(gpointer) ((long) transparency_vals[i]));
|
||||
if (transparency_vals[i] == transparency_type)
|
||||
|
@ -1142,7 +1293,7 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
button = gtk_radio_button_new_with_label (group, gettext(checks[i]));
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||
gtk_box_pack_start (GTK_BOX (radio_box), button, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (radio_box), button, FALSE, FALSE, 0);
|
||||
gtk_object_set_user_data (GTK_OBJECT (button),
|
||||
(gpointer) ((long) check_vals[i]));
|
||||
if (check_vals[i] == transparency_size)
|
||||
|
@ -1428,9 +1579,10 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
(GtkSignalFunc) file_prefs_spinbutton_callback,
|
||||
&num_processors);
|
||||
gtk_widget_show (num_processors_spinbutton);
|
||||
#else
|
||||
num_processors_spinbutton = NULL;
|
||||
#endif /* ENABLE_MP */
|
||||
|
||||
|
||||
button = gtk_check_button_new_with_label(_("Install colormap (8-bit only)"));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
|
||||
install_cmap);
|
||||
|
@ -1604,43 +1756,48 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
gtk_container_add (GTK_CONTAINER (abox), vbox);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
resolution_force_equal = gtk_check_button_new_with_label (_("Force equal horizontal and vertical resolutions"));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (resolution_force_equal),
|
||||
TRUE);
|
||||
monitor_resolution_force_equal = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
|
||||
|
||||
resolution_sizeentry = gimp_size_entry_new (2, UNIT_INCH, "%s",
|
||||
monitor_resolution_sizeentry = gimp_size_entry_new (2, UNIT_INCH, "%s",
|
||||
FALSE, TRUE, 75,
|
||||
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (resolution_sizeentry),
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
|
||||
0, 1, 32767);
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (resolution_sizeentry),
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
|
||||
1, 1, 32767);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (resolution_sizeentry), 0,
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 0,
|
||||
monitor_xres);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (resolution_sizeentry), 1,
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 1,
|
||||
monitor_yres);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (resolution_sizeentry),
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
|
||||
_("Horizontal"), 0, 1, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (resolution_sizeentry),
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
|
||||
_("Vertical"), 0, 2, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (resolution_sizeentry),
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
|
||||
_("dpi"), 1, 3, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (resolution_sizeentry),
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
|
||||
_("pixels per "), 2, 3, 0.0);
|
||||
gtk_signal_connect (GTK_OBJECT (resolution_sizeentry), "value_changed",
|
||||
(GtkSignalFunc)file_prefs_resolution_callback,
|
||||
resolution_force_equal);
|
||||
gtk_signal_connect (GTK_OBJECT (resolution_sizeentry), "refval_changed",
|
||||
(GtkSignalFunc)file_prefs_resolution_callback,
|
||||
resolution_force_equal);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), resolution_sizeentry, TRUE, TRUE, 0);
|
||||
gtk_widget_show (resolution_sizeentry);
|
||||
gtk_signal_connect (GTK_OBJECT (monitor_resolution_sizeentry),
|
||||
"value_changed",
|
||||
(GtkSignalFunc)file_prefs_monitor_resolution_callback,
|
||||
monitor_resolution_force_equal);
|
||||
gtk_signal_connect (GTK_OBJECT (monitor_resolution_sizeentry),
|
||||
"refval_changed",
|
||||
(GtkSignalFunc)file_prefs_monitor_resolution_callback,
|
||||
monitor_resolution_force_equal);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), monitor_resolution_sizeentry,
|
||||
TRUE, TRUE, 0);
|
||||
gtk_widget_show (monitor_resolution_sizeentry);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox), resolution_force_equal, TRUE, TRUE, 0);
|
||||
gtk_widget_show (resolution_force_equal);
|
||||
|
||||
gtk_widget_set_sensitive (resolution_sizeentry, !using_xserver_resolution);
|
||||
gtk_widget_set_sensitive (resolution_force_equal,
|
||||
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (monitor_resolution_force_equal),
|
||||
TRUE);
|
||||
gtk_table_attach_defaults (GTK_TABLE (monitor_resolution_sizeentry),
|
||||
monitor_resolution_force_equal, 1, 3, 3, 4);
|
||||
gtk_widget_show (monitor_resolution_force_equal);
|
||||
|
||||
gtk_widget_set_sensitive (monitor_resolution_sizeentry,
|
||||
!using_xserver_resolution);
|
||||
gtk_widget_set_sensitive (monitor_resolution_force_equal,
|
||||
!using_xserver_resolution);
|
||||
|
||||
label = gtk_label_new (_("Monitor"));
|
||||
|
|
|
@ -46,10 +46,11 @@
|
|||
#include "tips_dialog.h"
|
||||
#include "tools.h"
|
||||
#include "undo.h"
|
||||
#include "libgimp/gimpsizeentry.h"
|
||||
|
||||
#include "config.h"
|
||||
#include "libgimp/gimpchainbutton.h"
|
||||
#include "libgimp/gimpintl.h"
|
||||
#include "libgimp/gimpsizeentry.h"
|
||||
|
||||
|
||||
/* preferences local functions */
|
||||
|
@ -63,7 +64,7 @@ static void file_prefs_spinbutton_callback (GtkWidget *, gpointer);
|
|||
static void file_prefs_preview_size_callback (GtkWidget *, gpointer);
|
||||
static void file_prefs_mem_size_unit_callback (GtkWidget *, gpointer);
|
||||
static void file_prefs_clear_session_info_callback (GtkWidget *, gpointer);
|
||||
static void file_prefs_resolution_callback (GtkWidget *, gpointer);
|
||||
static void file_prefs_monitor_resolution_callback (GtkWidget *, gpointer);
|
||||
|
||||
/* static variables */
|
||||
static int last_type = RGB;
|
||||
|
@ -88,6 +89,10 @@ static int old_save_device_status;
|
|||
static int old_always_restore_session;
|
||||
static int old_default_width;
|
||||
static int old_default_height;
|
||||
static GUnit old_default_units;
|
||||
static float old_default_xresolution;
|
||||
static float old_default_yresolution;
|
||||
static GUnit old_default_resolution_units;
|
||||
static int old_default_type;
|
||||
static int old_stingy_memory_use;
|
||||
static int old_tile_cache_size;
|
||||
|
@ -124,9 +129,12 @@ static int edit_num_processors;
|
|||
static GtkWidget *tile_cache_size_spinbutton = NULL;
|
||||
static int divided_tile_cache_size;
|
||||
static int mem_size_unit;
|
||||
static GtkWidget *default_size_sizeentry = NULL;
|
||||
static GtkWidget *default_resolution_sizeentry = NULL;
|
||||
static GtkWidget *default_resolution_force_equal = NULL;
|
||||
static GtkWidget *resolution_xserver_label = NULL;
|
||||
static GtkWidget *resolution_sizeentry = NULL;
|
||||
static GtkWidget *resolution_force_equal = NULL;
|
||||
static GtkWidget *monitor_resolution_sizeentry = NULL;
|
||||
static GtkWidget *monitor_resolution_force_equal = NULL;
|
||||
static GtkWidget *num_processors_spinbutton = NULL;
|
||||
|
||||
/* Some information regarding preferences, compiled by Raph Levien 11/3/97.
|
||||
|
@ -161,8 +169,8 @@ static GtkWidget *num_processors_spinbutton = NULL;
|
|||
|
||||
Still no settings for default-brush, default-gradient,
|
||||
default-palette, default-pattern, gamma-correction, color-cube,
|
||||
show-rulers, ruler-units. No widget for confirm-on-close although
|
||||
a lot of stuff is there.
|
||||
show-rulers. No widget for confirm-on-close although a lot of
|
||||
stuff is there.
|
||||
|
||||
No UI feedback for the fact that some settings won't take effect
|
||||
until the next Gimp restart.
|
||||
|
@ -240,6 +248,27 @@ file_prefs_ok_callback (GtkWidget *widget,
|
|||
default_height = old_default_height;
|
||||
return;
|
||||
}
|
||||
if (default_units < UNIT_INCH ||
|
||||
default_units >= gimp_unit_get_number_of_units ())
|
||||
{
|
||||
g_message (_("Error: Default units must be withing unit range."));
|
||||
default_units = old_default_units;
|
||||
return;
|
||||
}
|
||||
if (default_xresolution < 1e-5 || default_yresolution < 1e-5)
|
||||
{
|
||||
g_message (_("Error: default resolution must not be zero."));
|
||||
default_xresolution = old_default_xresolution;
|
||||
default_yresolution = old_default_yresolution;
|
||||
return;
|
||||
}
|
||||
if (default_resolution_units < UNIT_INCH ||
|
||||
default_resolution_units >= gimp_unit_get_number_of_units ())
|
||||
{
|
||||
g_message (_("Error: Default units must be withing unit range."));
|
||||
default_resolution_units = old_default_resolution_units;
|
||||
return;
|
||||
}
|
||||
if (monitor_xres < 1e-5 || monitor_yres < 1e-5)
|
||||
{
|
||||
g_message (_("Error: monitor resolution must not be zero."));
|
||||
|
@ -256,9 +285,12 @@ file_prefs_ok_callback (GtkWidget *widget,
|
|||
|
||||
gtk_widget_destroy (dlg);
|
||||
prefs_dlg = NULL;
|
||||
default_size_sizeentry = NULL;
|
||||
default_resolution_sizeentry = NULL;
|
||||
default_resolution_force_equal = NULL;
|
||||
resolution_xserver_label = NULL;
|
||||
resolution_sizeentry = NULL;
|
||||
resolution_force_equal = NULL;
|
||||
monitor_resolution_sizeentry = NULL;
|
||||
monitor_resolution_force_equal = NULL;
|
||||
|
||||
if (show_tool_tips)
|
||||
gtk_tooltips_enable (tool_tips);
|
||||
|
@ -364,6 +396,14 @@ file_prefs_save_callback (GtkWidget *widget,
|
|||
if (default_width != old_default_width ||
|
||||
default_height != old_default_height)
|
||||
update = g_list_append (update, "default-image-size");
|
||||
if (default_units != old_default_units)
|
||||
update = g_list_append (update, "default-units");
|
||||
if (ABS(default_xresolution - old_default_xresolution) > 1e-5)
|
||||
update = g_list_append (update, "default-xresolution");
|
||||
if (ABS(default_yresolution - old_default_yresolution) > 1e-5)
|
||||
update = g_list_append (update, "default-yresolution");
|
||||
if (default_resolution_units != old_default_resolution_units)
|
||||
update = g_list_append (update, "default-resolution-units");
|
||||
if (default_type != old_default_type)
|
||||
update = g_list_append (update, "default-image-type");
|
||||
if (preview_size != old_preview_size)
|
||||
|
@ -507,9 +547,12 @@ file_prefs_cancel_callback (GtkWidget *widget,
|
|||
{
|
||||
gtk_widget_destroy (dlg);
|
||||
prefs_dlg = NULL;
|
||||
default_size_sizeentry = NULL;
|
||||
default_resolution_sizeentry = NULL;
|
||||
default_resolution_force_equal = NULL;
|
||||
resolution_xserver_label = NULL;
|
||||
resolution_sizeentry = NULL;
|
||||
resolution_force_equal = NULL;
|
||||
monitor_resolution_sizeentry = NULL;
|
||||
monitor_resolution_force_equal = NULL;
|
||||
|
||||
levels_of_undo = old_levels_of_undo;
|
||||
marching_speed = old_marching_speed;
|
||||
|
@ -526,6 +569,10 @@ file_prefs_cancel_callback (GtkWidget *widget,
|
|||
save_device_status = old_save_device_status;
|
||||
default_width = old_default_width;
|
||||
default_height = old_default_height;
|
||||
default_units = old_default_units;
|
||||
default_xresolution = old_default_xresolution;
|
||||
default_yresolution = old_default_yresolution;
|
||||
default_resolution_units = old_default_resolution_units;
|
||||
default_type = old_default_type;
|
||||
monitor_xres = old_monitor_xres;
|
||||
monitor_yres = old_monitor_yres;
|
||||
|
@ -704,12 +751,12 @@ file_prefs_res_source_callback (GtkWidget *widget,
|
|||
gtk_widget_set_sensitive (resolution_xserver_label,
|
||||
GTK_TOGGLE_BUTTON (widget)->active);
|
||||
|
||||
if (resolution_sizeentry)
|
||||
gtk_widget_set_sensitive (resolution_sizeentry,
|
||||
if (monitor_resolution_sizeentry)
|
||||
gtk_widget_set_sensitive (monitor_resolution_sizeentry,
|
||||
! GTK_TOGGLE_BUTTON (widget)->active);
|
||||
|
||||
if (resolution_force_equal)
|
||||
gtk_widget_set_sensitive (resolution_force_equal,
|
||||
if (monitor_resolution_force_equal)
|
||||
gtk_widget_set_sensitive (monitor_resolution_force_equal,
|
||||
! GTK_TOGGLE_BUTTON (widget)->active);
|
||||
|
||||
if (GTK_TOGGLE_BUTTON (widget)->active)
|
||||
|
@ -719,20 +766,30 @@ file_prefs_res_source_callback (GtkWidget *widget,
|
|||
}
|
||||
else
|
||||
{
|
||||
if (resolution_sizeentry)
|
||||
if (monitor_resolution_sizeentry)
|
||||
{
|
||||
monitor_xres =
|
||||
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (resolution_sizeentry), 0);
|
||||
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 0);
|
||||
monitor_yres =
|
||||
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (resolution_sizeentry), 1);
|
||||
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 1);
|
||||
}
|
||||
using_xserver_resolution = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
file_prefs_resolution_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
file_prefs_default_size_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
default_width = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0);
|
||||
default_height = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
|
||||
default_units = gimp_size_entry_get_unit (GIMP_SIZE_ENTRY (widget));
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
file_prefs_default_resolution_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
static float xres = 0.0;
|
||||
static float yres = 0.0;
|
||||
|
@ -742,7 +799,53 @@ file_prefs_resolution_callback (GtkWidget *widget,
|
|||
new_xres = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0);
|
||||
new_yres = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
|
||||
|
||||
if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (data)))
|
||||
if (gimp_chain_button_get_active (GIMP_CHAIN_BUTTON (data)))
|
||||
{
|
||||
if (new_xres != xres)
|
||||
{
|
||||
yres = new_yres = xres = new_xres;
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 1, yres);
|
||||
}
|
||||
|
||||
if (new_yres != yres)
|
||||
{
|
||||
xres = new_xres = yres = new_yres;
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (widget), 0, xres);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (new_xres != xres)
|
||||
xres = new_xres;
|
||||
if (new_yres != yres)
|
||||
yres = new_yres;
|
||||
}
|
||||
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (default_size_sizeentry),
|
||||
0, xres, FALSE);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (default_size_sizeentry),
|
||||
1, yres, FALSE);
|
||||
|
||||
default_width = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (default_size_sizeentry), 0);
|
||||
default_height = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (default_size_sizeentry), 1);
|
||||
default_xresolution = xres;
|
||||
default_yresolution = yres;
|
||||
default_resolution_units = gimp_size_entry_get_unit (GIMP_SIZE_ENTRY (widget));
|
||||
}
|
||||
|
||||
static void
|
||||
file_prefs_monitor_resolution_callback (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
static float xres = 0.0;
|
||||
static float yres = 0.0;
|
||||
float new_xres;
|
||||
float new_yres;
|
||||
|
||||
new_xres = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 0);
|
||||
new_yres = gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (widget), 1);
|
||||
|
||||
if (gimp_chain_button_get_active (GIMP_CHAIN_BUTTON (data)))
|
||||
{
|
||||
if (new_xres != xres)
|
||||
{
|
||||
|
@ -898,6 +1001,10 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
old_always_restore_session = always_restore_session;
|
||||
old_default_width = default_width;
|
||||
old_default_height = default_height;
|
||||
old_default_units = default_units;
|
||||
old_default_xresolution = default_xresolution;
|
||||
old_default_yresolution = default_yresolution;
|
||||
old_default_resolution_units = default_resolution_units;
|
||||
old_default_type = default_type;
|
||||
old_stingy_memory_use = edit_stingy_memory_use;
|
||||
old_tile_cache_size = edit_tile_cache_size;
|
||||
|
@ -970,8 +1077,8 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (prefs_dlg)->vbox),
|
||||
notebook, TRUE, TRUE, 0);
|
||||
|
||||
/* Display page */
|
||||
out_frame = gtk_frame_new (_("Display settings"));
|
||||
/* New File page */
|
||||
out_frame = gtk_frame_new (_("New file settings"));
|
||||
gtk_container_border_width (GTK_CONTAINER (out_frame), 10);
|
||||
gtk_widget_show (out_frame);
|
||||
|
||||
|
@ -980,12 +1087,8 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
gtk_container_add (GTK_CONTAINER (out_frame), vbox);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
frame = gtk_frame_new (_("Default image size"));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
|
||||
frame = gtk_frame_new (_("Default image size and unit"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
abox = gtk_vbox_new (FALSE, 2);
|
||||
|
@ -993,51 +1096,82 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
gtk_container_add (GTK_CONTAINER (frame), abox);
|
||||
gtk_widget_show (abox);
|
||||
|
||||
table = gtk_table_new (2, 2, FALSE);
|
||||
gtk_table_set_row_spacings (GTK_TABLE (table), 2);
|
||||
gtk_table_set_col_spacings (GTK_TABLE (table), 2);
|
||||
gtk_box_pack_start (GTK_BOX (abox), table, TRUE, TRUE, 0);
|
||||
gtk_widget_show (table);
|
||||
|
||||
label = gtk_label_new (_("Width: "));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1,
|
||||
GTK_FILL, GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
default_size_sizeentry = gimp_size_entry_new (2, default_units, "%p",
|
||||
FALSE, TRUE, 75,
|
||||
GIMP_SIZE_ENTRY_UPDATE_SIZE);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (default_size_sizeentry),
|
||||
0, default_xresolution, FALSE);
|
||||
gimp_size_entry_set_resolution (GIMP_SIZE_ENTRY (default_size_sizeentry),
|
||||
1, default_yresolution, FALSE);
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (default_size_sizeentry), 0, 1, 32767);
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (default_size_sizeentry), 1, 1, 32767);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_size_sizeentry), 0,
|
||||
default_width);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_size_sizeentry), 1,
|
||||
default_height);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_size_sizeentry),
|
||||
_("Width"), 0, 1, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_size_sizeentry),
|
||||
_("Height"), 0, 2, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_size_sizeentry),
|
||||
_("Pixels"), 1, 4, 0.0);
|
||||
/* gtk_container_set_border_width (GTK_CONTAINER (default_size_sizeentry), 2); */
|
||||
gtk_box_pack_start (GTK_BOX (abox), default_size_sizeentry, TRUE, TRUE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (default_size_sizeentry), "unit_changed",
|
||||
(GtkSignalFunc)file_prefs_default_size_callback, NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (default_size_sizeentry), "value_changed",
|
||||
(GtkSignalFunc)file_prefs_default_size_callback, NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (default_size_sizeentry), "refval_changed",
|
||||
(GtkSignalFunc)file_prefs_default_size_callback, NULL);
|
||||
gtk_widget_show (default_size_sizeentry);
|
||||
|
||||
label = gtk_label_new (_("Height: "));
|
||||
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
|
||||
gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2,
|
||||
GTK_FILL, GTK_FILL, 0, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
adj = (GtkAdjustment *) gtk_adjustment_new (default_width, 1.0,
|
||||
32767.0, 1.0, 50.0, 0.0);
|
||||
spinbutton = gtk_spin_button_new (adj, 1.0, 0.0);
|
||||
gtk_spin_button_set_shadow_type (GTK_SPIN_BUTTON(spinbutton), GTK_SHADOW_NONE);
|
||||
gtk_widget_set_usize (spinbutton, 50, 0);
|
||||
gtk_table_attach (GTK_TABLE (table), spinbutton, 1, 2, 0, 1,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (spinbutton), "changed",
|
||||
(GtkSignalFunc) file_prefs_spinbutton_callback,
|
||||
&default_width);
|
||||
gtk_widget_show (spinbutton);
|
||||
frame = gtk_frame_new (_("Default image resolution and resolution unit"));
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
adj = (GtkAdjustment *) gtk_adjustment_new (default_height, 1.0,
|
||||
32767.0, 1.0, 50.0, 0.0);
|
||||
spinbutton = gtk_spin_button_new (adj, 1.0, 0.0);
|
||||
gtk_spin_button_set_shadow_type (GTK_SPIN_BUTTON(spinbutton), GTK_SHADOW_NONE);
|
||||
gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(spinbutton), TRUE);
|
||||
gtk_widget_set_usize (spinbutton, 50, 0);
|
||||
gtk_table_attach (GTK_TABLE (table), spinbutton, 1, 2, 1, 2,
|
||||
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (spinbutton), "changed",
|
||||
(GtkSignalFunc) file_prefs_spinbutton_callback,
|
||||
&default_height);
|
||||
gtk_widget_show (spinbutton);
|
||||
abox = gtk_vbox_new (FALSE, 2);
|
||||
gtk_container_border_width (GTK_CONTAINER (abox), 1);
|
||||
gtk_container_add (GTK_CONTAINER (frame), abox);
|
||||
gtk_widget_show (abox);
|
||||
|
||||
default_resolution_force_equal = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
|
||||
|
||||
default_resolution_sizeentry =
|
||||
gimp_size_entry_new (2, default_resolution_units, "%s", FALSE, TRUE, 75,
|
||||
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (default_resolution_sizeentry), 0, 1e-5, 32767);
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (default_resolution_sizeentry), 1, 1e-5, 32767);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_resolution_sizeentry), 0, default_xresolution);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (default_resolution_sizeentry), 1, default_yresolution);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_resolution_sizeentry), _("Horizontal"), 0, 1, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_resolution_sizeentry), _("Vertical"), 0, 2, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_resolution_sizeentry), _("dpi"), 1, 3, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (default_resolution_sizeentry), _("pixels per "), 2, 3, 0.0);
|
||||
gtk_signal_connect (GTK_OBJECT (default_resolution_sizeentry),
|
||||
"unit_changed",
|
||||
(GtkSignalFunc)file_prefs_default_resolution_callback,
|
||||
default_resolution_force_equal);
|
||||
gtk_signal_connect (GTK_OBJECT (default_resolution_sizeentry),
|
||||
"value_changed",
|
||||
(GtkSignalFunc)file_prefs_default_resolution_callback,
|
||||
default_resolution_force_equal);
|
||||
gtk_signal_connect (GTK_OBJECT (default_resolution_sizeentry),
|
||||
"refval_changed",
|
||||
(GtkSignalFunc)file_prefs_default_resolution_callback,
|
||||
default_resolution_force_equal);
|
||||
gtk_box_pack_start (GTK_BOX (abox), default_resolution_sizeentry,
|
||||
TRUE, TRUE, 0);
|
||||
gtk_widget_show (default_resolution_sizeentry);
|
||||
|
||||
gtk_table_attach_defaults (GTK_TABLE (default_resolution_sizeentry),
|
||||
default_resolution_force_equal, 1, 3, 3, 4);
|
||||
if (ABS (default_xresolution - default_yresolution) < 1e-5)
|
||||
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (default_resolution_force_equal),
|
||||
TRUE);
|
||||
gtk_widget_show (default_resolution_force_equal);
|
||||
|
||||
frame = gtk_frame_new (_("Default image type"));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), frame, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
radio_box = gtk_vbox_new (FALSE, 1);
|
||||
|
@ -1047,7 +1181,7 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
|
||||
button = gtk_radio_button_new_with_label (NULL, _("RGB"));
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||
gtk_box_pack_start (GTK_BOX (radio_box), button, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (radio_box), button, FALSE, FALSE, 0);
|
||||
gtk_object_set_user_data (GTK_OBJECT (button), (gpointer) RGB);
|
||||
if (default_type == RGB)
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
||||
|
@ -1057,7 +1191,7 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
gtk_widget_show (button);
|
||||
button = gtk_radio_button_new_with_label (group, _("Grayscale"));
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||
gtk_box_pack_start (GTK_BOX (radio_box), button, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (radio_box), button, FALSE, FALSE, 0);
|
||||
gtk_object_set_user_data (GTK_OBJECT (button), (gpointer) GRAY);
|
||||
if (last_type == GRAY)
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
|
||||
|
@ -1069,6 +1203,23 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
label = gtk_label_new (_("File"));
|
||||
gtk_notebook_append_page (GTK_NOTEBOOK(notebook), out_frame, label);
|
||||
|
||||
/* Display page */
|
||||
out_frame = gtk_frame_new (_("Display settings"));
|
||||
gtk_container_border_width (GTK_CONTAINER (out_frame), 10);
|
||||
gtk_widget_show (out_frame);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 2);
|
||||
gtk_container_border_width (GTK_CONTAINER (vbox), 1);
|
||||
gtk_container_add (GTK_CONTAINER (out_frame), vbox);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
label = gtk_label_new (_("Preview size: "));
|
||||
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
@ -1085,7 +1236,7 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
}
|
||||
optionmenu = gtk_option_menu_new ();
|
||||
gtk_option_menu_set_menu (GTK_OPTION_MENU (optionmenu), menu);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), optionmenu, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), optionmenu, FALSE, FALSE, 0);
|
||||
gtk_widget_show (optionmenu);
|
||||
for (i = 0; i < npreview_sizes; i++)
|
||||
if (preview_size==preview_sizes[i].size)
|
||||
|
@ -1094,14 +1245,14 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
button = gtk_check_button_new_with_label(_("Cubic interpolation"));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
|
||||
cubic_interpolation);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "toggled",
|
||||
(GtkSignalFunc) file_prefs_toggle_callback,
|
||||
&cubic_interpolation);
|
||||
gtk_widget_show (button);
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
frame = gtk_frame_new (_("Transparency Type"));
|
||||
|
@ -1118,7 +1269,7 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
button = gtk_radio_button_new_with_label (group, gettext(transparencies[i]));
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||
gtk_box_pack_start (GTK_BOX (radio_box), button, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (radio_box), button, FALSE, FALSE, 0);
|
||||
gtk_object_set_user_data (GTK_OBJECT (button),
|
||||
(gpointer) ((long) transparency_vals[i]));
|
||||
if (transparency_vals[i] == transparency_type)
|
||||
|
@ -1142,7 +1293,7 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
{
|
||||
button = gtk_radio_button_new_with_label (group, gettext(checks[i]));
|
||||
group = gtk_radio_button_group (GTK_RADIO_BUTTON (button));
|
||||
gtk_box_pack_start (GTK_BOX (radio_box), button, TRUE, TRUE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (radio_box), button, FALSE, FALSE, 0);
|
||||
gtk_object_set_user_data (GTK_OBJECT (button),
|
||||
(gpointer) ((long) check_vals[i]));
|
||||
if (check_vals[i] == transparency_size)
|
||||
|
@ -1428,9 +1579,10 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
(GtkSignalFunc) file_prefs_spinbutton_callback,
|
||||
&num_processors);
|
||||
gtk_widget_show (num_processors_spinbutton);
|
||||
#else
|
||||
num_processors_spinbutton = NULL;
|
||||
#endif /* ENABLE_MP */
|
||||
|
||||
|
||||
button = gtk_check_button_new_with_label(_("Install colormap (8-bit only)"));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
|
||||
install_cmap);
|
||||
|
@ -1604,43 +1756,48 @@ file_pref_cmd_callback (GtkWidget *widget,
|
|||
gtk_container_add (GTK_CONTAINER (abox), vbox);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
resolution_force_equal = gtk_check_button_new_with_label (_("Force equal horizontal and vertical resolutions"));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (resolution_force_equal),
|
||||
TRUE);
|
||||
monitor_resolution_force_equal = gimp_chain_button_new (GIMP_CHAIN_BOTTOM);
|
||||
|
||||
resolution_sizeentry = gimp_size_entry_new (2, UNIT_INCH, "%s",
|
||||
monitor_resolution_sizeentry = gimp_size_entry_new (2, UNIT_INCH, "%s",
|
||||
FALSE, TRUE, 75,
|
||||
GIMP_SIZE_ENTRY_UPDATE_RESOLUTION);
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (resolution_sizeentry),
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
|
||||
0, 1, 32767);
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (resolution_sizeentry),
|
||||
gimp_size_entry_set_refval_boundaries (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
|
||||
1, 1, 32767);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (resolution_sizeentry), 0,
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 0,
|
||||
monitor_xres);
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (resolution_sizeentry), 1,
|
||||
gimp_size_entry_set_refval (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry), 1,
|
||||
monitor_yres);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (resolution_sizeentry),
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
|
||||
_("Horizontal"), 0, 1, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (resolution_sizeentry),
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
|
||||
_("Vertical"), 0, 2, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (resolution_sizeentry),
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
|
||||
_("dpi"), 1, 3, 0.0);
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (resolution_sizeentry),
|
||||
gimp_size_entry_attach_label (GIMP_SIZE_ENTRY (monitor_resolution_sizeentry),
|
||||
_("pixels per "), 2, 3, 0.0);
|
||||
gtk_signal_connect (GTK_OBJECT (resolution_sizeentry), "value_changed",
|
||||
(GtkSignalFunc)file_prefs_resolution_callback,
|
||||
resolution_force_equal);
|
||||
gtk_signal_connect (GTK_OBJECT (resolution_sizeentry), "refval_changed",
|
||||
(GtkSignalFunc)file_prefs_resolution_callback,
|
||||
resolution_force_equal);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), resolution_sizeentry, TRUE, TRUE, 0);
|
||||
gtk_widget_show (resolution_sizeentry);
|
||||
gtk_signal_connect (GTK_OBJECT (monitor_resolution_sizeentry),
|
||||
"value_changed",
|
||||
(GtkSignalFunc)file_prefs_monitor_resolution_callback,
|
||||
monitor_resolution_force_equal);
|
||||
gtk_signal_connect (GTK_OBJECT (monitor_resolution_sizeentry),
|
||||
"refval_changed",
|
||||
(GtkSignalFunc)file_prefs_monitor_resolution_callback,
|
||||
monitor_resolution_force_equal);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), monitor_resolution_sizeentry,
|
||||
TRUE, TRUE, 0);
|
||||
gtk_widget_show (monitor_resolution_sizeentry);
|
||||
|
||||
gtk_box_pack_start (GTK_BOX (vbox), resolution_force_equal, TRUE, TRUE, 0);
|
||||
gtk_widget_show (resolution_force_equal);
|
||||
|
||||
gtk_widget_set_sensitive (resolution_sizeentry, !using_xserver_resolution);
|
||||
gtk_widget_set_sensitive (resolution_force_equal,
|
||||
gimp_chain_button_set_active (GIMP_CHAIN_BUTTON (monitor_resolution_force_equal),
|
||||
TRUE);
|
||||
gtk_table_attach_defaults (GTK_TABLE (monitor_resolution_sizeentry),
|
||||
monitor_resolution_force_equal, 1, 3, 3, 4);
|
||||
gtk_widget_show (monitor_resolution_force_equal);
|
||||
|
||||
gtk_widget_set_sensitive (monitor_resolution_sizeentry,
|
||||
!using_xserver_resolution);
|
||||
gtk_widget_set_sensitive (monitor_resolution_force_equal,
|
||||
!using_xserver_resolution);
|
||||
|
||||
label = gtk_label_new (_("Monitor"));
|
||||
|
|
|
@ -154,10 +154,25 @@
|
|||
# or shift+control+r
|
||||
# (dont-show-rulers)
|
||||
|
||||
# Ruler units
|
||||
# The units of rulers can be one of: (pixels inches centimeters)
|
||||
# The default is pixels
|
||||
(ruler-units pixels)
|
||||
# Default units
|
||||
# Will be used for ruler & coordinate display
|
||||
# The units can be one of:
|
||||
# (inches centimeters points picas) plus those in your user units database
|
||||
# The default is inches
|
||||
(default-units inches)
|
||||
|
||||
# Default Resolution units
|
||||
# This is used to specify the resolution of a new image
|
||||
# The units for the resolution can be one of:
|
||||
# (inches centimeters points picas) plus those in your user units database
|
||||
# The default is inches
|
||||
(default-resolution-units inches)
|
||||
|
||||
# Default Resolution
|
||||
# This is the default resolution of a new image in dpi
|
||||
# The default is 72.0 dpi in both x and y direction
|
||||
(default-xresolution 72.0)
|
||||
(default-yresolution 72.0)
|
||||
|
||||
# Controlling statusbar visibility
|
||||
# The default behavior is to show the statusbar.
|
||||
|
|
|
@ -28,7 +28,10 @@
|
|||
.\" Sat Feb 13 23:47:36 GMT 1999 Austin Donnelly <austin@gimp.org>
|
||||
.\" * added section on path expansion, and renamed to gimprc.5.in
|
||||
.\"
|
||||
.TH GIMPRC 5 "13 Jan 1999" "Version 1.1.2"
|
||||
.\" Wed Mar 3 13:09:52 MET 1999 Sven Neumann <sven@gimp.org>
|
||||
.\" * reflect the changes that were made to the resolution stuff
|
||||
.\"
|
||||
.TH GIMPRC 5 "3 Wed 1999" "Version 1.1.2"
|
||||
.SH NAME
|
||||
gimprc \- gimp configuration file
|
||||
.SH DESCRIPTION
|
||||
|
@ -283,10 +286,6 @@ command or shift+control+s.
|
|||
.I dont-show-statusbar BOOLEAN
|
||||
Negated version of show-statusbar.
|
||||
.TP
|
||||
.I ruler-units RULERUNIT
|
||||
Set the ruler units when not in dot-for-dot mode. The units of rulers
|
||||
can be one of pixels, inches or centimeters. The default is pixels.
|
||||
.TP
|
||||
.I auto-save BOOLEAN
|
||||
Auto saving is not yet implemented! Nothing will be auto-saved, no
|
||||
matter how you set this.
|
||||
|
@ -342,11 +341,14 @@ Set the default image size in the File/New dialog.
|
|||
.I default-image-type IMAGETYPE
|
||||
Set the default image type in the File/New dialog.
|
||||
.TP
|
||||
.I default-resolution INT
|
||||
Set the default image resolution in the File/New dialog.
|
||||
.I default-xresolution FLOAT
|
||||
Set the default image width resolution in the File/New dialog.
|
||||
.TP
|
||||
.I default-yresolution FLOAT
|
||||
Set the default image height resolution in the File/New dialog.
|
||||
.TP
|
||||
.I default-resolution-units RULERUNIT
|
||||
Set the units the default-resolution setting is in.
|
||||
Set the units the default-resolution settings are in.
|
||||
.TP
|
||||
.I monitor-xresolution FLOAT
|
||||
Set the monitor's horizontal resolution, in dots per inch. If set to
|
||||
|
|
18
gimprc.5.in
18
gimprc.5.in
|
@ -28,7 +28,10 @@
|
|||
.\" Sat Feb 13 23:47:36 GMT 1999 Austin Donnelly <austin@gimp.org>
|
||||
.\" * added section on path expansion, and renamed to gimprc.5.in
|
||||
.\"
|
||||
.TH GIMPRC 5 "13 Jan 1999" "Version 1.1.2"
|
||||
.\" Wed Mar 3 13:09:52 MET 1999 Sven Neumann <sven@gimp.org>
|
||||
.\" * reflect the changes that were made to the resolution stuff
|
||||
.\"
|
||||
.TH GIMPRC 5 "3 Wed 1999" "Version 1.1.2"
|
||||
.SH NAME
|
||||
gimprc \- gimp configuration file
|
||||
.SH DESCRIPTION
|
||||
|
@ -283,10 +286,6 @@ command or shift+control+s.
|
|||
.I dont-show-statusbar BOOLEAN
|
||||
Negated version of show-statusbar.
|
||||
.TP
|
||||
.I ruler-units RULERUNIT
|
||||
Set the ruler units when not in dot-for-dot mode. The units of rulers
|
||||
can be one of pixels, inches or centimeters. The default is pixels.
|
||||
.TP
|
||||
.I auto-save BOOLEAN
|
||||
Auto saving is not yet implemented! Nothing will be auto-saved, no
|
||||
matter how you set this.
|
||||
|
@ -342,11 +341,14 @@ Set the default image size in the File/New dialog.
|
|||
.I default-image-type IMAGETYPE
|
||||
Set the default image type in the File/New dialog.
|
||||
.TP
|
||||
.I default-resolution INT
|
||||
Set the default image resolution in the File/New dialog.
|
||||
.I default-xresolution FLOAT
|
||||
Set the default image width resolution in the File/New dialog.
|
||||
.TP
|
||||
.I default-yresolution FLOAT
|
||||
Set the default image height resolution in the File/New dialog.
|
||||
.TP
|
||||
.I default-resolution-units RULERUNIT
|
||||
Set the units the default-resolution setting is in.
|
||||
Set the units the default-resolution settings are in.
|
||||
.TP
|
||||
.I monitor-xresolution FLOAT
|
||||
Set the monitor's horizontal resolution, in dots per inch. If set to
|
||||
|
|
23
gimprc.in
23
gimprc.in
|
@ -154,10 +154,25 @@
|
|||
# or shift+control+r
|
||||
# (dont-show-rulers)
|
||||
|
||||
# Ruler units
|
||||
# The units of rulers can be one of: (pixels inches centimeters)
|
||||
# The default is pixels
|
||||
(ruler-units pixels)
|
||||
# Default units
|
||||
# Will be used for ruler & coordinate display
|
||||
# The units can be one of:
|
||||
# (inches centimeters points picas) plus those in your user units database
|
||||
# The default is inches
|
||||
(default-units inches)
|
||||
|
||||
# Default Resolution units
|
||||
# This is used to specify the resolution of a new image
|
||||
# The units for the resolution can be one of:
|
||||
# (inches centimeters points picas) plus those in your user units database
|
||||
# The default is inches
|
||||
(default-resolution-units inches)
|
||||
|
||||
# Default Resolution
|
||||
# This is the default resolution of a new image in dpi
|
||||
# The default is 72.0 dpi in both x and y direction
|
||||
(default-xresolution 72.0)
|
||||
(default-yresolution 72.0)
|
||||
|
||||
# Controlling statusbar visibility
|
||||
# The default behavior is to show the statusbar.
|
||||
|
|
|
@ -13,7 +13,9 @@ INCLUDES = \
|
|||
$(GTK_CFLAGS) \
|
||||
-I$(includedir)
|
||||
|
||||
EXTRA_DIST = gimpfeatures.h.in
|
||||
EXTRA_DIST = \
|
||||
chain.xpm \
|
||||
gimpfeatures.h.in
|
||||
|
||||
lib_LTLIBRARIES = libgimp.la libgimpui.la
|
||||
noinst_LIBRARIES = libgimpi.a
|
||||
|
@ -21,23 +23,23 @@ noinst_LIBRARIES = libgimpi.a
|
|||
libgimpi_a_SOURCES = \
|
||||
gimpchainbutton.c \
|
||||
gimpchainbutton.h \
|
||||
gimpmatrix.c \
|
||||
gimpmatrix.h \
|
||||
gimpprotocol.c \
|
||||
gimpprotocol.h \
|
||||
gimpsizeentry.c \
|
||||
gimpsizeentry.h \
|
||||
gimpunit.c \
|
||||
gimpunit.h \
|
||||
gimpunitmenu.c \
|
||||
gimpunitmenu.h \
|
||||
gimpwire.c \
|
||||
gimpwire.h \
|
||||
gserialize.c \
|
||||
gserialize.h \
|
||||
parasite.c \
|
||||
parasite.h \
|
||||
parasiteF.h \
|
||||
gimpmatrix.c \
|
||||
gimpmatrix.h \
|
||||
gimpprotocol.c \
|
||||
gimpprotocol.h \
|
||||
gimpsizeentry.c \
|
||||
gimpsizeentry.h \
|
||||
gimpunit.c \
|
||||
gimpunit.h \
|
||||
gimpunitmenu.c \
|
||||
gimpunitmenu.h \
|
||||
gimpwire.c \
|
||||
gimpwire.h \
|
||||
gserialize.c \
|
||||
gserialize.h \
|
||||
parasite.c \
|
||||
parasite.h \
|
||||
parasiteF.h \
|
||||
parasiteP.h
|
||||
|
||||
if STATICLIBS
|
||||
|
|
|
@ -23,8 +23,10 @@
|
|||
/* internal structures */
|
||||
|
||||
typedef struct {
|
||||
guint delete_on_exit;
|
||||
float factor;
|
||||
gint digits;
|
||||
gchar *identifier;
|
||||
gchar *symbol;
|
||||
gchar *abbreviation;
|
||||
gchar *singular;
|
||||
|
@ -33,82 +35,267 @@ typedef struct {
|
|||
|
||||
static GimpUnitDef gimp_unit_defs[UNIT_END] =
|
||||
{
|
||||
/* 'pseudo' unit */
|
||||
{ 0.0, 0, "px", "px", N_("pixel"), N_("pixels") },
|
||||
/* pseudo unit */
|
||||
{ FALSE, 0.0, 0, "pixels", "px", "px", N_("pixel"), N_("pixels") },
|
||||
|
||||
/* 'standard' units */
|
||||
{ 1.0, 2, "''", "in", N_("inch"), N_("inches") },
|
||||
{ 2.54, 2, "cm", "cm", N_("centimeter"), N_("centimeters") },
|
||||
/* standard units */
|
||||
{ FALSE, 1.0, 2, "inches", "''", "in", N_("inch"), N_("inches") },
|
||||
{ FALSE, 2.54, 2, "centimeters", "cm", "cm", N_("centimeter"), N_("centimeters") },
|
||||
|
||||
/* 'professional' units */
|
||||
{ 72.0, 0, "pt", "pt", N_("point"), N_("points") },
|
||||
{ 6.0, 1, "pc", "pc", N_("pica"), N_("picas") },
|
||||
|
||||
/* convenience units */
|
||||
{ 25.4, 1, "mm", "mm", N_("millimeter"), N_("millimeters") },
|
||||
{ 0.0254, 4, "m", "m", N_("meter"), N_("meters") },
|
||||
{ 1.0/12.0, 4, "'", "ft", N_("foot"), N_("feet") },
|
||||
{ 1.0/36.0, 4, "yd", "yd", N_("yard"), N_("yards") }
|
||||
/* professional units */
|
||||
{ FALSE, 72.0, 0, "points", "pt", "pt", N_("point"), N_("points") },
|
||||
{ FALSE, 6.0, 1, "picas", "pc", "pc", N_("pica"), N_("picas") },
|
||||
};
|
||||
|
||||
static GSList* user_units = NULL;
|
||||
static gint number_of_user_units = 0;
|
||||
|
||||
|
||||
/* private functions */
|
||||
|
||||
GimpUnitDef *
|
||||
gimp_unit_get_user_unit (GUnit unit)
|
||||
{
|
||||
return g_slist_nth_data (user_units, unit - UNIT_END + 1);
|
||||
}
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
gint
|
||||
gimp_unit_get_number_of_units (void)
|
||||
{
|
||||
return UNIT_END + number_of_user_units;
|
||||
}
|
||||
|
||||
gint
|
||||
gimp_unit_get_number_of_built_in_units (void)
|
||||
{
|
||||
return UNIT_END;
|
||||
}
|
||||
|
||||
|
||||
GUnit
|
||||
gimp_unit_new (void)
|
||||
{
|
||||
GimpUnitDef *user_unit;
|
||||
|
||||
user_unit = g_malloc (sizeof (GimpUnitDef));
|
||||
user_unit->delete_on_exit = TRUE;
|
||||
user_unit->factor = 1.0;
|
||||
user_unit->digits = 2;
|
||||
user_unit->identifier = NULL;
|
||||
user_unit->symbol = NULL;
|
||||
user_unit->abbreviation = NULL;
|
||||
user_unit->singular = NULL;
|
||||
user_unit->plural = NULL;
|
||||
|
||||
if (user_units == NULL)
|
||||
user_units = g_slist_alloc ();
|
||||
|
||||
g_slist_append (user_units, user_unit);
|
||||
number_of_user_units++;
|
||||
|
||||
return UNIT_END + number_of_user_units - 1;
|
||||
}
|
||||
|
||||
|
||||
guint
|
||||
gimp_unit_get_deletion_flag (GUnit unit)
|
||||
{
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) &&
|
||||
(unit < (UNIT_END + number_of_user_units)), FALSE);
|
||||
|
||||
if (unit < UNIT_END)
|
||||
return FALSE;
|
||||
|
||||
return gimp_unit_get_user_unit (unit)->delete_on_exit;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_unit_set_deletion_flag (GUnit unit,
|
||||
guint deletion_flag)
|
||||
{
|
||||
g_return_if_fail ( (unit >= UNIT_END) &&
|
||||
(unit < (UNIT_END + number_of_user_units)));
|
||||
|
||||
gimp_unit_get_user_unit (unit)->delete_on_exit = deletion_flag;
|
||||
}
|
||||
|
||||
|
||||
gfloat
|
||||
gimp_unit_get_factor (GUnit unit)
|
||||
{
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) && (unit < UNIT_END),
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) &&
|
||||
(unit < (UNIT_END + number_of_user_units)),
|
||||
gimp_unit_defs[UNIT_INCH].factor );
|
||||
|
||||
return gimp_unit_defs[unit].factor;
|
||||
if (unit < UNIT_END)
|
||||
return gimp_unit_defs[unit].factor;
|
||||
|
||||
return gimp_unit_get_user_unit (unit)->factor;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_unit_set_factor (GUnit unit,
|
||||
gfloat factor)
|
||||
{
|
||||
g_return_if_fail ( (unit >= UNIT_END) &&
|
||||
(unit < (UNIT_END + number_of_user_units)));
|
||||
|
||||
gimp_unit_get_user_unit (unit)->factor = factor;
|
||||
}
|
||||
|
||||
|
||||
gint
|
||||
gimp_unit_get_digits (GUnit unit)
|
||||
{
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) && (unit < UNIT_END),
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) &&
|
||||
(unit < (UNIT_END + number_of_user_units)),
|
||||
gimp_unit_defs[UNIT_INCH].digits );
|
||||
|
||||
return gimp_unit_defs[unit].digits;
|
||||
if (unit < UNIT_END)
|
||||
return gimp_unit_defs[unit].digits;
|
||||
|
||||
return gimp_unit_get_user_unit (unit)->digits;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_unit_set_digits (GUnit unit,
|
||||
gint digits)
|
||||
{
|
||||
g_return_if_fail ( (unit >= UNIT_END) &&
|
||||
(unit < (UNIT_END + number_of_user_units)));
|
||||
|
||||
gimp_unit_get_user_unit (unit)->digits = digits;
|
||||
}
|
||||
|
||||
|
||||
const gchar *
|
||||
gimp_unit_get_identifier (GUnit unit)
|
||||
{
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) &&
|
||||
(unit < (UNIT_END + number_of_user_units)),
|
||||
gimp_unit_defs[UNIT_INCH].identifier );
|
||||
|
||||
if (unit < UNIT_END)
|
||||
return gimp_unit_defs[unit].identifier;
|
||||
|
||||
return gimp_unit_get_user_unit (unit)->identifier;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_unit_set_identifier (GUnit unit,
|
||||
gchar *identifier)
|
||||
{
|
||||
GimpUnitDef *user_unit;
|
||||
|
||||
g_return_if_fail ( (unit >= UNIT_END) &&
|
||||
(unit < (UNIT_END + number_of_user_units)));
|
||||
|
||||
user_unit = gimp_unit_get_user_unit (unit);
|
||||
if (user_unit->identifier)
|
||||
g_free (user_unit->identifier);
|
||||
user_unit->identifier = g_strdup (identifier);
|
||||
}
|
||||
|
||||
|
||||
const gchar *
|
||||
gimp_unit_get_symbol (GUnit unit)
|
||||
{
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) && (unit < UNIT_END),
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) &&
|
||||
(unit < (UNIT_END + number_of_user_units)),
|
||||
gimp_unit_defs[UNIT_INCH].symbol );
|
||||
|
||||
return gimp_unit_defs[unit].symbol;
|
||||
if (unit < UNIT_END)
|
||||
return gimp_unit_defs[unit].symbol;
|
||||
|
||||
return gimp_unit_get_user_unit (unit)->symbol;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_unit_set_symbol (GUnit unit,
|
||||
gchar *symbol)
|
||||
{
|
||||
GimpUnitDef *user_unit;
|
||||
|
||||
g_return_if_fail ( (unit >= UNIT_END) &&
|
||||
(unit < (UNIT_END + number_of_user_units)));
|
||||
|
||||
user_unit = gimp_unit_get_user_unit (unit);
|
||||
if (user_unit->symbol)
|
||||
g_free (user_unit->symbol);
|
||||
user_unit->symbol = g_strdup (symbol);
|
||||
}
|
||||
|
||||
|
||||
const gchar *
|
||||
gimp_unit_get_abbreviation (GUnit unit)
|
||||
{
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) && (unit < UNIT_END),
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) &&
|
||||
(unit < (UNIT_END + number_of_user_units)),
|
||||
gimp_unit_defs[UNIT_INCH].abbreviation );
|
||||
|
||||
return gimp_unit_defs[unit].abbreviation;
|
||||
if (unit < UNIT_END)
|
||||
return gimp_unit_defs[unit].abbreviation;
|
||||
|
||||
return gimp_unit_get_user_unit (unit)->abbreviation;
|
||||
}
|
||||
|
||||
|
||||
const gchar *
|
||||
gimp_unit_get_singular (GUnit unit)
|
||||
{
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) && (unit < UNIT_END),
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) &&
|
||||
(unit < (UNIT_END + number_of_user_units)),
|
||||
gettext(gimp_unit_defs[UNIT_INCH].singular) );
|
||||
|
||||
return gettext(gimp_unit_defs[unit].singular);
|
||||
if (unit < UNIT_END)
|
||||
return gettext(gimp_unit_defs[unit].singular);
|
||||
|
||||
return gimp_unit_get_user_unit (unit)->singular;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_unit_set_singular (GUnit unit,
|
||||
gchar *singular)
|
||||
{
|
||||
GimpUnitDef *user_unit;
|
||||
|
||||
g_return_if_fail ( (unit >= UNIT_END) &&
|
||||
(unit < (UNIT_END + number_of_user_units)));
|
||||
|
||||
user_unit = gimp_unit_get_user_unit (unit);
|
||||
if (user_unit->singular)
|
||||
g_free (user_unit->singular);
|
||||
user_unit->symbol = g_strdup (singular);
|
||||
}
|
||||
|
||||
|
||||
const gchar *
|
||||
gimp_unit_get_plural (GUnit unit)
|
||||
{
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) && (unit < UNIT_END),
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) &&
|
||||
(unit < (UNIT_END + number_of_user_units)),
|
||||
gettext(gimp_unit_defs[UNIT_INCH].plural) );
|
||||
|
||||
return gettext(gimp_unit_defs[unit].plural);
|
||||
if (unit < UNIT_END)
|
||||
return gettext(gimp_unit_defs[unit].plural);
|
||||
|
||||
return gimp_unit_get_user_unit (unit)->plural;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_unit_set_plural (GUnit unit,
|
||||
gchar *plural)
|
||||
{
|
||||
GimpUnitDef *user_unit;
|
||||
|
||||
g_return_if_fail ( (unit >= UNIT_END) &&
|
||||
(unit < (UNIT_END + number_of_user_units)));
|
||||
|
||||
user_unit = gimp_unit_get_user_unit (unit);
|
||||
if (user_unit->plural)
|
||||
g_free (user_unit->plural);
|
||||
user_unit->symbol = g_strdup (plural);
|
||||
}
|
||||
|
|
|
@ -42,26 +42,38 @@ typedef enum
|
|||
UNIT_CM = 2,
|
||||
UNIT_POINT = 3,
|
||||
UNIT_PICA = 4,
|
||||
UNIT_MM = 5,
|
||||
UNIT_METER = 6,
|
||||
UNIT_FOOT = 7,
|
||||
UNIT_YARD = 8,
|
||||
UNIT_END
|
||||
UNIT_END /* never use UNIT_END but gimp_unit_get_number_of_units() instead */
|
||||
} GUnit;
|
||||
|
||||
|
||||
#define gimp_unit_get_number_of_units() UNIT_END
|
||||
gint gimp_unit_get_number_of_units (void);
|
||||
gint gimp_unit_get_number_of_built_in_units (void);
|
||||
|
||||
/* create a new, empty user unit and returns it's ID
|
||||
*/
|
||||
GUnit gimp_unit_new (void);
|
||||
|
||||
/* the following functions fall back to inch (not pixel, as pixel is not
|
||||
* a 'real' unit) if the value passed is out of range
|
||||
*
|
||||
* trying to change built-in units will be ignored
|
||||
*/
|
||||
|
||||
/* if the deletion flag for a unit is TRUE on GIMP exit, this unit
|
||||
* will not be saved in the user units database
|
||||
*/
|
||||
guint gimp_unit_get_deletion_flag (GUnit unit);
|
||||
void gimp_unit_set_deletion_flag (GUnit unit,
|
||||
guint deletion_flag);
|
||||
|
||||
/* the meaning of 'factor' is:
|
||||
* distance_in_units == ( factor * distance_in_inches )
|
||||
*
|
||||
* returns 0 for unit == UNIT_PIXEL as we don't have resolution info here
|
||||
*/
|
||||
gfloat gimp_unit_get_factor (GUnit unit);
|
||||
gfloat gimp_unit_get_factor (GUnit unit);
|
||||
void gimp_unit_set_factor (GUnit unit,
|
||||
gfloat factor);
|
||||
|
||||
/* the following function gives a hint how many digits a spinbutton
|
||||
* should provide to get approximately the accuracy of an inch-spinbutton
|
||||
|
@ -69,12 +81,30 @@ gfloat gimp_unit_get_factor (GUnit unit);
|
|||
*
|
||||
* returns 0 for unit == UNIT_PIXEL as we don't have resolution info here
|
||||
*/
|
||||
gint gimp_unit_get_digits (GUnit unit);
|
||||
gint gimp_unit_get_digits (GUnit unit);
|
||||
void gimp_unit_set_digits (GUnit unit,
|
||||
gint digits);
|
||||
|
||||
const gchar * gimp_unit_get_symbol (GUnit unit);
|
||||
const gchar * gimp_unit_get_abbreviation (GUnit unit);
|
||||
const gchar * gimp_unit_get_singular (GUnit unit);
|
||||
const gchar * gimp_unit_get_plural (GUnit unit);
|
||||
/* this one is an untranslated string for gimprc */
|
||||
const gchar * gimp_unit_get_identifier (GUnit unit);
|
||||
void gimp_unit_set_identifier (GUnit unit,
|
||||
gchar *identifier);
|
||||
|
||||
const gchar * gimp_unit_get_symbol (GUnit unit);
|
||||
void gimp_unit_set_symbol (GUnit unit,
|
||||
gchar *symbol);
|
||||
|
||||
const gchar * gimp_unit_get_abbreviation (GUnit unit);
|
||||
void gimp_unit_set_abbreviation (GUnit unit,
|
||||
gchar *abbreviation);
|
||||
|
||||
const gchar * gimp_unit_get_singular (GUnit unit);
|
||||
void gimp_unit_set_singular (GUnit unit,
|
||||
gchar *singular);
|
||||
|
||||
const gchar * gimp_unit_get_plural (GUnit unit);
|
||||
void gimp_unit_set_plural (GUnit unit,
|
||||
gchar *plural);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -23,8 +23,10 @@
|
|||
/* internal structures */
|
||||
|
||||
typedef struct {
|
||||
guint delete_on_exit;
|
||||
float factor;
|
||||
gint digits;
|
||||
gchar *identifier;
|
||||
gchar *symbol;
|
||||
gchar *abbreviation;
|
||||
gchar *singular;
|
||||
|
@ -33,82 +35,267 @@ typedef struct {
|
|||
|
||||
static GimpUnitDef gimp_unit_defs[UNIT_END] =
|
||||
{
|
||||
/* 'pseudo' unit */
|
||||
{ 0.0, 0, "px", "px", N_("pixel"), N_("pixels") },
|
||||
/* pseudo unit */
|
||||
{ FALSE, 0.0, 0, "pixels", "px", "px", N_("pixel"), N_("pixels") },
|
||||
|
||||
/* 'standard' units */
|
||||
{ 1.0, 2, "''", "in", N_("inch"), N_("inches") },
|
||||
{ 2.54, 2, "cm", "cm", N_("centimeter"), N_("centimeters") },
|
||||
/* standard units */
|
||||
{ FALSE, 1.0, 2, "inches", "''", "in", N_("inch"), N_("inches") },
|
||||
{ FALSE, 2.54, 2, "centimeters", "cm", "cm", N_("centimeter"), N_("centimeters") },
|
||||
|
||||
/* 'professional' units */
|
||||
{ 72.0, 0, "pt", "pt", N_("point"), N_("points") },
|
||||
{ 6.0, 1, "pc", "pc", N_("pica"), N_("picas") },
|
||||
|
||||
/* convenience units */
|
||||
{ 25.4, 1, "mm", "mm", N_("millimeter"), N_("millimeters") },
|
||||
{ 0.0254, 4, "m", "m", N_("meter"), N_("meters") },
|
||||
{ 1.0/12.0, 4, "'", "ft", N_("foot"), N_("feet") },
|
||||
{ 1.0/36.0, 4, "yd", "yd", N_("yard"), N_("yards") }
|
||||
/* professional units */
|
||||
{ FALSE, 72.0, 0, "points", "pt", "pt", N_("point"), N_("points") },
|
||||
{ FALSE, 6.0, 1, "picas", "pc", "pc", N_("pica"), N_("picas") },
|
||||
};
|
||||
|
||||
static GSList* user_units = NULL;
|
||||
static gint number_of_user_units = 0;
|
||||
|
||||
|
||||
/* private functions */
|
||||
|
||||
GimpUnitDef *
|
||||
gimp_unit_get_user_unit (GUnit unit)
|
||||
{
|
||||
return g_slist_nth_data (user_units, unit - UNIT_END + 1);
|
||||
}
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
gint
|
||||
gimp_unit_get_number_of_units (void)
|
||||
{
|
||||
return UNIT_END + number_of_user_units;
|
||||
}
|
||||
|
||||
gint
|
||||
gimp_unit_get_number_of_built_in_units (void)
|
||||
{
|
||||
return UNIT_END;
|
||||
}
|
||||
|
||||
|
||||
GUnit
|
||||
gimp_unit_new (void)
|
||||
{
|
||||
GimpUnitDef *user_unit;
|
||||
|
||||
user_unit = g_malloc (sizeof (GimpUnitDef));
|
||||
user_unit->delete_on_exit = TRUE;
|
||||
user_unit->factor = 1.0;
|
||||
user_unit->digits = 2;
|
||||
user_unit->identifier = NULL;
|
||||
user_unit->symbol = NULL;
|
||||
user_unit->abbreviation = NULL;
|
||||
user_unit->singular = NULL;
|
||||
user_unit->plural = NULL;
|
||||
|
||||
if (user_units == NULL)
|
||||
user_units = g_slist_alloc ();
|
||||
|
||||
g_slist_append (user_units, user_unit);
|
||||
number_of_user_units++;
|
||||
|
||||
return UNIT_END + number_of_user_units - 1;
|
||||
}
|
||||
|
||||
|
||||
guint
|
||||
gimp_unit_get_deletion_flag (GUnit unit)
|
||||
{
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) &&
|
||||
(unit < (UNIT_END + number_of_user_units)), FALSE);
|
||||
|
||||
if (unit < UNIT_END)
|
||||
return FALSE;
|
||||
|
||||
return gimp_unit_get_user_unit (unit)->delete_on_exit;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_unit_set_deletion_flag (GUnit unit,
|
||||
guint deletion_flag)
|
||||
{
|
||||
g_return_if_fail ( (unit >= UNIT_END) &&
|
||||
(unit < (UNIT_END + number_of_user_units)));
|
||||
|
||||
gimp_unit_get_user_unit (unit)->delete_on_exit = deletion_flag;
|
||||
}
|
||||
|
||||
|
||||
gfloat
|
||||
gimp_unit_get_factor (GUnit unit)
|
||||
{
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) && (unit < UNIT_END),
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) &&
|
||||
(unit < (UNIT_END + number_of_user_units)),
|
||||
gimp_unit_defs[UNIT_INCH].factor );
|
||||
|
||||
return gimp_unit_defs[unit].factor;
|
||||
if (unit < UNIT_END)
|
||||
return gimp_unit_defs[unit].factor;
|
||||
|
||||
return gimp_unit_get_user_unit (unit)->factor;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_unit_set_factor (GUnit unit,
|
||||
gfloat factor)
|
||||
{
|
||||
g_return_if_fail ( (unit >= UNIT_END) &&
|
||||
(unit < (UNIT_END + number_of_user_units)));
|
||||
|
||||
gimp_unit_get_user_unit (unit)->factor = factor;
|
||||
}
|
||||
|
||||
|
||||
gint
|
||||
gimp_unit_get_digits (GUnit unit)
|
||||
{
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) && (unit < UNIT_END),
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) &&
|
||||
(unit < (UNIT_END + number_of_user_units)),
|
||||
gimp_unit_defs[UNIT_INCH].digits );
|
||||
|
||||
return gimp_unit_defs[unit].digits;
|
||||
if (unit < UNIT_END)
|
||||
return gimp_unit_defs[unit].digits;
|
||||
|
||||
return gimp_unit_get_user_unit (unit)->digits;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_unit_set_digits (GUnit unit,
|
||||
gint digits)
|
||||
{
|
||||
g_return_if_fail ( (unit >= UNIT_END) &&
|
||||
(unit < (UNIT_END + number_of_user_units)));
|
||||
|
||||
gimp_unit_get_user_unit (unit)->digits = digits;
|
||||
}
|
||||
|
||||
|
||||
const gchar *
|
||||
gimp_unit_get_identifier (GUnit unit)
|
||||
{
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) &&
|
||||
(unit < (UNIT_END + number_of_user_units)),
|
||||
gimp_unit_defs[UNIT_INCH].identifier );
|
||||
|
||||
if (unit < UNIT_END)
|
||||
return gimp_unit_defs[unit].identifier;
|
||||
|
||||
return gimp_unit_get_user_unit (unit)->identifier;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_unit_set_identifier (GUnit unit,
|
||||
gchar *identifier)
|
||||
{
|
||||
GimpUnitDef *user_unit;
|
||||
|
||||
g_return_if_fail ( (unit >= UNIT_END) &&
|
||||
(unit < (UNIT_END + number_of_user_units)));
|
||||
|
||||
user_unit = gimp_unit_get_user_unit (unit);
|
||||
if (user_unit->identifier)
|
||||
g_free (user_unit->identifier);
|
||||
user_unit->identifier = g_strdup (identifier);
|
||||
}
|
||||
|
||||
|
||||
const gchar *
|
||||
gimp_unit_get_symbol (GUnit unit)
|
||||
{
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) && (unit < UNIT_END),
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) &&
|
||||
(unit < (UNIT_END + number_of_user_units)),
|
||||
gimp_unit_defs[UNIT_INCH].symbol );
|
||||
|
||||
return gimp_unit_defs[unit].symbol;
|
||||
if (unit < UNIT_END)
|
||||
return gimp_unit_defs[unit].symbol;
|
||||
|
||||
return gimp_unit_get_user_unit (unit)->symbol;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_unit_set_symbol (GUnit unit,
|
||||
gchar *symbol)
|
||||
{
|
||||
GimpUnitDef *user_unit;
|
||||
|
||||
g_return_if_fail ( (unit >= UNIT_END) &&
|
||||
(unit < (UNIT_END + number_of_user_units)));
|
||||
|
||||
user_unit = gimp_unit_get_user_unit (unit);
|
||||
if (user_unit->symbol)
|
||||
g_free (user_unit->symbol);
|
||||
user_unit->symbol = g_strdup (symbol);
|
||||
}
|
||||
|
||||
|
||||
const gchar *
|
||||
gimp_unit_get_abbreviation (GUnit unit)
|
||||
{
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) && (unit < UNIT_END),
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) &&
|
||||
(unit < (UNIT_END + number_of_user_units)),
|
||||
gimp_unit_defs[UNIT_INCH].abbreviation );
|
||||
|
||||
return gimp_unit_defs[unit].abbreviation;
|
||||
if (unit < UNIT_END)
|
||||
return gimp_unit_defs[unit].abbreviation;
|
||||
|
||||
return gimp_unit_get_user_unit (unit)->abbreviation;
|
||||
}
|
||||
|
||||
|
||||
const gchar *
|
||||
gimp_unit_get_singular (GUnit unit)
|
||||
{
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) && (unit < UNIT_END),
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) &&
|
||||
(unit < (UNIT_END + number_of_user_units)),
|
||||
gettext(gimp_unit_defs[UNIT_INCH].singular) );
|
||||
|
||||
return gettext(gimp_unit_defs[unit].singular);
|
||||
if (unit < UNIT_END)
|
||||
return gettext(gimp_unit_defs[unit].singular);
|
||||
|
||||
return gimp_unit_get_user_unit (unit)->singular;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_unit_set_singular (GUnit unit,
|
||||
gchar *singular)
|
||||
{
|
||||
GimpUnitDef *user_unit;
|
||||
|
||||
g_return_if_fail ( (unit >= UNIT_END) &&
|
||||
(unit < (UNIT_END + number_of_user_units)));
|
||||
|
||||
user_unit = gimp_unit_get_user_unit (unit);
|
||||
if (user_unit->singular)
|
||||
g_free (user_unit->singular);
|
||||
user_unit->symbol = g_strdup (singular);
|
||||
}
|
||||
|
||||
|
||||
const gchar *
|
||||
gimp_unit_get_plural (GUnit unit)
|
||||
{
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) && (unit < UNIT_END),
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) &&
|
||||
(unit < (UNIT_END + number_of_user_units)),
|
||||
gettext(gimp_unit_defs[UNIT_INCH].plural) );
|
||||
|
||||
return gettext(gimp_unit_defs[unit].plural);
|
||||
if (unit < UNIT_END)
|
||||
return gettext(gimp_unit_defs[unit].plural);
|
||||
|
||||
return gimp_unit_get_user_unit (unit)->plural;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_unit_set_plural (GUnit unit,
|
||||
gchar *plural)
|
||||
{
|
||||
GimpUnitDef *user_unit;
|
||||
|
||||
g_return_if_fail ( (unit >= UNIT_END) &&
|
||||
(unit < (UNIT_END + number_of_user_units)));
|
||||
|
||||
user_unit = gimp_unit_get_user_unit (unit);
|
||||
if (user_unit->plural)
|
||||
g_free (user_unit->plural);
|
||||
user_unit->symbol = g_strdup (plural);
|
||||
}
|
||||
|
|
|
@ -23,8 +23,10 @@
|
|||
/* internal structures */
|
||||
|
||||
typedef struct {
|
||||
guint delete_on_exit;
|
||||
float factor;
|
||||
gint digits;
|
||||
gchar *identifier;
|
||||
gchar *symbol;
|
||||
gchar *abbreviation;
|
||||
gchar *singular;
|
||||
|
@ -33,82 +35,267 @@ typedef struct {
|
|||
|
||||
static GimpUnitDef gimp_unit_defs[UNIT_END] =
|
||||
{
|
||||
/* 'pseudo' unit */
|
||||
{ 0.0, 0, "px", "px", N_("pixel"), N_("pixels") },
|
||||
/* pseudo unit */
|
||||
{ FALSE, 0.0, 0, "pixels", "px", "px", N_("pixel"), N_("pixels") },
|
||||
|
||||
/* 'standard' units */
|
||||
{ 1.0, 2, "''", "in", N_("inch"), N_("inches") },
|
||||
{ 2.54, 2, "cm", "cm", N_("centimeter"), N_("centimeters") },
|
||||
/* standard units */
|
||||
{ FALSE, 1.0, 2, "inches", "''", "in", N_("inch"), N_("inches") },
|
||||
{ FALSE, 2.54, 2, "centimeters", "cm", "cm", N_("centimeter"), N_("centimeters") },
|
||||
|
||||
/* 'professional' units */
|
||||
{ 72.0, 0, "pt", "pt", N_("point"), N_("points") },
|
||||
{ 6.0, 1, "pc", "pc", N_("pica"), N_("picas") },
|
||||
|
||||
/* convenience units */
|
||||
{ 25.4, 1, "mm", "mm", N_("millimeter"), N_("millimeters") },
|
||||
{ 0.0254, 4, "m", "m", N_("meter"), N_("meters") },
|
||||
{ 1.0/12.0, 4, "'", "ft", N_("foot"), N_("feet") },
|
||||
{ 1.0/36.0, 4, "yd", "yd", N_("yard"), N_("yards") }
|
||||
/* professional units */
|
||||
{ FALSE, 72.0, 0, "points", "pt", "pt", N_("point"), N_("points") },
|
||||
{ FALSE, 6.0, 1, "picas", "pc", "pc", N_("pica"), N_("picas") },
|
||||
};
|
||||
|
||||
static GSList* user_units = NULL;
|
||||
static gint number_of_user_units = 0;
|
||||
|
||||
|
||||
/* private functions */
|
||||
|
||||
GimpUnitDef *
|
||||
gimp_unit_get_user_unit (GUnit unit)
|
||||
{
|
||||
return g_slist_nth_data (user_units, unit - UNIT_END + 1);
|
||||
}
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
gint
|
||||
gimp_unit_get_number_of_units (void)
|
||||
{
|
||||
return UNIT_END + number_of_user_units;
|
||||
}
|
||||
|
||||
gint
|
||||
gimp_unit_get_number_of_built_in_units (void)
|
||||
{
|
||||
return UNIT_END;
|
||||
}
|
||||
|
||||
|
||||
GUnit
|
||||
gimp_unit_new (void)
|
||||
{
|
||||
GimpUnitDef *user_unit;
|
||||
|
||||
user_unit = g_malloc (sizeof (GimpUnitDef));
|
||||
user_unit->delete_on_exit = TRUE;
|
||||
user_unit->factor = 1.0;
|
||||
user_unit->digits = 2;
|
||||
user_unit->identifier = NULL;
|
||||
user_unit->symbol = NULL;
|
||||
user_unit->abbreviation = NULL;
|
||||
user_unit->singular = NULL;
|
||||
user_unit->plural = NULL;
|
||||
|
||||
if (user_units == NULL)
|
||||
user_units = g_slist_alloc ();
|
||||
|
||||
g_slist_append (user_units, user_unit);
|
||||
number_of_user_units++;
|
||||
|
||||
return UNIT_END + number_of_user_units - 1;
|
||||
}
|
||||
|
||||
|
||||
guint
|
||||
gimp_unit_get_deletion_flag (GUnit unit)
|
||||
{
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) &&
|
||||
(unit < (UNIT_END + number_of_user_units)), FALSE);
|
||||
|
||||
if (unit < UNIT_END)
|
||||
return FALSE;
|
||||
|
||||
return gimp_unit_get_user_unit (unit)->delete_on_exit;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_unit_set_deletion_flag (GUnit unit,
|
||||
guint deletion_flag)
|
||||
{
|
||||
g_return_if_fail ( (unit >= UNIT_END) &&
|
||||
(unit < (UNIT_END + number_of_user_units)));
|
||||
|
||||
gimp_unit_get_user_unit (unit)->delete_on_exit = deletion_flag;
|
||||
}
|
||||
|
||||
|
||||
gfloat
|
||||
gimp_unit_get_factor (GUnit unit)
|
||||
{
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) && (unit < UNIT_END),
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) &&
|
||||
(unit < (UNIT_END + number_of_user_units)),
|
||||
gimp_unit_defs[UNIT_INCH].factor );
|
||||
|
||||
return gimp_unit_defs[unit].factor;
|
||||
if (unit < UNIT_END)
|
||||
return gimp_unit_defs[unit].factor;
|
||||
|
||||
return gimp_unit_get_user_unit (unit)->factor;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_unit_set_factor (GUnit unit,
|
||||
gfloat factor)
|
||||
{
|
||||
g_return_if_fail ( (unit >= UNIT_END) &&
|
||||
(unit < (UNIT_END + number_of_user_units)));
|
||||
|
||||
gimp_unit_get_user_unit (unit)->factor = factor;
|
||||
}
|
||||
|
||||
|
||||
gint
|
||||
gimp_unit_get_digits (GUnit unit)
|
||||
{
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) && (unit < UNIT_END),
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) &&
|
||||
(unit < (UNIT_END + number_of_user_units)),
|
||||
gimp_unit_defs[UNIT_INCH].digits );
|
||||
|
||||
return gimp_unit_defs[unit].digits;
|
||||
if (unit < UNIT_END)
|
||||
return gimp_unit_defs[unit].digits;
|
||||
|
||||
return gimp_unit_get_user_unit (unit)->digits;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_unit_set_digits (GUnit unit,
|
||||
gint digits)
|
||||
{
|
||||
g_return_if_fail ( (unit >= UNIT_END) &&
|
||||
(unit < (UNIT_END + number_of_user_units)));
|
||||
|
||||
gimp_unit_get_user_unit (unit)->digits = digits;
|
||||
}
|
||||
|
||||
|
||||
const gchar *
|
||||
gimp_unit_get_identifier (GUnit unit)
|
||||
{
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) &&
|
||||
(unit < (UNIT_END + number_of_user_units)),
|
||||
gimp_unit_defs[UNIT_INCH].identifier );
|
||||
|
||||
if (unit < UNIT_END)
|
||||
return gimp_unit_defs[unit].identifier;
|
||||
|
||||
return gimp_unit_get_user_unit (unit)->identifier;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_unit_set_identifier (GUnit unit,
|
||||
gchar *identifier)
|
||||
{
|
||||
GimpUnitDef *user_unit;
|
||||
|
||||
g_return_if_fail ( (unit >= UNIT_END) &&
|
||||
(unit < (UNIT_END + number_of_user_units)));
|
||||
|
||||
user_unit = gimp_unit_get_user_unit (unit);
|
||||
if (user_unit->identifier)
|
||||
g_free (user_unit->identifier);
|
||||
user_unit->identifier = g_strdup (identifier);
|
||||
}
|
||||
|
||||
|
||||
const gchar *
|
||||
gimp_unit_get_symbol (GUnit unit)
|
||||
{
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) && (unit < UNIT_END),
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) &&
|
||||
(unit < (UNIT_END + number_of_user_units)),
|
||||
gimp_unit_defs[UNIT_INCH].symbol );
|
||||
|
||||
return gimp_unit_defs[unit].symbol;
|
||||
if (unit < UNIT_END)
|
||||
return gimp_unit_defs[unit].symbol;
|
||||
|
||||
return gimp_unit_get_user_unit (unit)->symbol;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_unit_set_symbol (GUnit unit,
|
||||
gchar *symbol)
|
||||
{
|
||||
GimpUnitDef *user_unit;
|
||||
|
||||
g_return_if_fail ( (unit >= UNIT_END) &&
|
||||
(unit < (UNIT_END + number_of_user_units)));
|
||||
|
||||
user_unit = gimp_unit_get_user_unit (unit);
|
||||
if (user_unit->symbol)
|
||||
g_free (user_unit->symbol);
|
||||
user_unit->symbol = g_strdup (symbol);
|
||||
}
|
||||
|
||||
|
||||
const gchar *
|
||||
gimp_unit_get_abbreviation (GUnit unit)
|
||||
{
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) && (unit < UNIT_END),
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) &&
|
||||
(unit < (UNIT_END + number_of_user_units)),
|
||||
gimp_unit_defs[UNIT_INCH].abbreviation );
|
||||
|
||||
return gimp_unit_defs[unit].abbreviation;
|
||||
if (unit < UNIT_END)
|
||||
return gimp_unit_defs[unit].abbreviation;
|
||||
|
||||
return gimp_unit_get_user_unit (unit)->abbreviation;
|
||||
}
|
||||
|
||||
|
||||
const gchar *
|
||||
gimp_unit_get_singular (GUnit unit)
|
||||
{
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) && (unit < UNIT_END),
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) &&
|
||||
(unit < (UNIT_END + number_of_user_units)),
|
||||
gettext(gimp_unit_defs[UNIT_INCH].singular) );
|
||||
|
||||
return gettext(gimp_unit_defs[unit].singular);
|
||||
if (unit < UNIT_END)
|
||||
return gettext(gimp_unit_defs[unit].singular);
|
||||
|
||||
return gimp_unit_get_user_unit (unit)->singular;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_unit_set_singular (GUnit unit,
|
||||
gchar *singular)
|
||||
{
|
||||
GimpUnitDef *user_unit;
|
||||
|
||||
g_return_if_fail ( (unit >= UNIT_END) &&
|
||||
(unit < (UNIT_END + number_of_user_units)));
|
||||
|
||||
user_unit = gimp_unit_get_user_unit (unit);
|
||||
if (user_unit->singular)
|
||||
g_free (user_unit->singular);
|
||||
user_unit->symbol = g_strdup (singular);
|
||||
}
|
||||
|
||||
|
||||
const gchar *
|
||||
gimp_unit_get_plural (GUnit unit)
|
||||
{
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) && (unit < UNIT_END),
|
||||
g_return_val_if_fail ( (unit >= UNIT_PIXEL) &&
|
||||
(unit < (UNIT_END + number_of_user_units)),
|
||||
gettext(gimp_unit_defs[UNIT_INCH].plural) );
|
||||
|
||||
return gettext(gimp_unit_defs[unit].plural);
|
||||
if (unit < UNIT_END)
|
||||
return gettext(gimp_unit_defs[unit].plural);
|
||||
|
||||
return gimp_unit_get_user_unit (unit)->plural;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_unit_set_plural (GUnit unit,
|
||||
gchar *plural)
|
||||
{
|
||||
GimpUnitDef *user_unit;
|
||||
|
||||
g_return_if_fail ( (unit >= UNIT_END) &&
|
||||
(unit < (UNIT_END + number_of_user_units)));
|
||||
|
||||
user_unit = gimp_unit_get_user_unit (unit);
|
||||
if (user_unit->plural)
|
||||
g_free (user_unit->plural);
|
||||
user_unit->symbol = g_strdup (plural);
|
||||
}
|
||||
|
|
|
@ -42,26 +42,38 @@ typedef enum
|
|||
UNIT_CM = 2,
|
||||
UNIT_POINT = 3,
|
||||
UNIT_PICA = 4,
|
||||
UNIT_MM = 5,
|
||||
UNIT_METER = 6,
|
||||
UNIT_FOOT = 7,
|
||||
UNIT_YARD = 8,
|
||||
UNIT_END
|
||||
UNIT_END /* never use UNIT_END but gimp_unit_get_number_of_units() instead */
|
||||
} GUnit;
|
||||
|
||||
|
||||
#define gimp_unit_get_number_of_units() UNIT_END
|
||||
gint gimp_unit_get_number_of_units (void);
|
||||
gint gimp_unit_get_number_of_built_in_units (void);
|
||||
|
||||
/* create a new, empty user unit and returns it's ID
|
||||
*/
|
||||
GUnit gimp_unit_new (void);
|
||||
|
||||
/* the following functions fall back to inch (not pixel, as pixel is not
|
||||
* a 'real' unit) if the value passed is out of range
|
||||
*
|
||||
* trying to change built-in units will be ignored
|
||||
*/
|
||||
|
||||
/* if the deletion flag for a unit is TRUE on GIMP exit, this unit
|
||||
* will not be saved in the user units database
|
||||
*/
|
||||
guint gimp_unit_get_deletion_flag (GUnit unit);
|
||||
void gimp_unit_set_deletion_flag (GUnit unit,
|
||||
guint deletion_flag);
|
||||
|
||||
/* the meaning of 'factor' is:
|
||||
* distance_in_units == ( factor * distance_in_inches )
|
||||
*
|
||||
* returns 0 for unit == UNIT_PIXEL as we don't have resolution info here
|
||||
*/
|
||||
gfloat gimp_unit_get_factor (GUnit unit);
|
||||
gfloat gimp_unit_get_factor (GUnit unit);
|
||||
void gimp_unit_set_factor (GUnit unit,
|
||||
gfloat factor);
|
||||
|
||||
/* the following function gives a hint how many digits a spinbutton
|
||||
* should provide to get approximately the accuracy of an inch-spinbutton
|
||||
|
@ -69,12 +81,30 @@ gfloat gimp_unit_get_factor (GUnit unit);
|
|||
*
|
||||
* returns 0 for unit == UNIT_PIXEL as we don't have resolution info here
|
||||
*/
|
||||
gint gimp_unit_get_digits (GUnit unit);
|
||||
gint gimp_unit_get_digits (GUnit unit);
|
||||
void gimp_unit_set_digits (GUnit unit,
|
||||
gint digits);
|
||||
|
||||
const gchar * gimp_unit_get_symbol (GUnit unit);
|
||||
const gchar * gimp_unit_get_abbreviation (GUnit unit);
|
||||
const gchar * gimp_unit_get_singular (GUnit unit);
|
||||
const gchar * gimp_unit_get_plural (GUnit unit);
|
||||
/* this one is an untranslated string for gimprc */
|
||||
const gchar * gimp_unit_get_identifier (GUnit unit);
|
||||
void gimp_unit_set_identifier (GUnit unit,
|
||||
gchar *identifier);
|
||||
|
||||
const gchar * gimp_unit_get_symbol (GUnit unit);
|
||||
void gimp_unit_set_symbol (GUnit unit,
|
||||
gchar *symbol);
|
||||
|
||||
const gchar * gimp_unit_get_abbreviation (GUnit unit);
|
||||
void gimp_unit_set_abbreviation (GUnit unit,
|
||||
gchar *abbreviation);
|
||||
|
||||
const gchar * gimp_unit_get_singular (GUnit unit);
|
||||
void gimp_unit_set_singular (GUnit unit,
|
||||
gchar *singular);
|
||||
|
||||
const gchar * gimp_unit_get_plural (GUnit unit);
|
||||
void gimp_unit_set_plural (GUnit unit,
|
||||
gchar *plural);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue