Commit 151c624b authored by Sven Neumann's avatar Sven Neumann
Browse files

There were a few changes from Michael left, that I didn't knew of.


--Sven
parent ca41c260
Wed Mar 3 17:59:09 MET 1999 Sven Neumann <sven@gimp.org>
* gimprc.5.in
* gimprc.in
* libgimp/gimpunit.[ch]
* libgimp/gimpunitmenu.c : Seems that Michael had created some
more patches I didn't knew of.
This commit now should bring it all uptodate.
Wed Mar 3 15:39:01 MET 1999 Sven Neumann <sven@gimp.org>
* libgimp/gimpchainbutton.[ch]: that looks much better now
......
......@@ -155,16 +155,18 @@
# (dont-show-rulers)
# 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
# This is the default unit of a new image. It will appear in the
# File/New dialog and will be the unit for coordinate display when
# dot-for-dot is off.
# The default units can be one of:
# (inches millimeters 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
# (inches millimeters points picas) plus those in your user units database
# The default is inches
(default-resolution-units inches)
......
......@@ -115,9 +115,11 @@ One of
.BR none ", " small ", " medium ", or " large ", "
or an INT. small is 32x32, medium is 64x64, and large is 128x128.
.TP
.I RULERUNIT
.I UNIT
One of
.BR pixels ", " inches ", or " centimeters "."
.BR inches ", " millimeters ", " picas ", or " points
or the identifier of one of the units you have defined in your user
units database.
.PP
.SH PROPERTIES
Valid properties and their types:
......@@ -341,14 +343,26 @@ 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-units UNIT
Set the default units for new images and for the File/New dialog.
This units will be used for coordinate display when not in dot-for-dot
mode. The default units can be one of inches , millimeters, points or
picas or the identifier of one of the units defined in your user units
database. The default is inches.
.TP
.I default-xresolution FLOAT
Set the default image width resolution in the File/New dialog.
Set the default horizontal resolution for new images and for the
File/New dialog. This value is always in dpi (dots per inch).
.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 settings are in.
Set the default vertical resolution for new images and for the
File/New dialog. This value is always in dpi (dots per inch).
.TP
.I default-resolution-units UNIT
Set the units for the display of the default resolution in the
File/New dialog. The default resolution units can be one of inches,
millimeters, points or picas or the identifier of one of the units
defined in your user unit database. The default is inches.
.TP
.I monitor-xresolution FLOAT
Set the monitor's horizontal resolution, in dots per inch. If set to
......
......@@ -115,9 +115,11 @@ One of
.BR none ", " small ", " medium ", or " large ", "
or an INT. small is 32x32, medium is 64x64, and large is 128x128.
.TP
.I RULERUNIT
.I UNIT
One of
.BR pixels ", " inches ", or " centimeters "."
.BR inches ", " millimeters ", " picas ", or " points
or the identifier of one of the units you have defined in your user
units database.
.PP
.SH PROPERTIES
Valid properties and their types:
......@@ -341,14 +343,26 @@ 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-units UNIT
Set the default units for new images and for the File/New dialog.
This units will be used for coordinate display when not in dot-for-dot
mode. The default units can be one of inches , millimeters, points or
picas or the identifier of one of the units defined in your user units
database. The default is inches.
.TP
.I default-xresolution FLOAT
Set the default image width resolution in the File/New dialog.
Set the default horizontal resolution for new images and for the
File/New dialog. This value is always in dpi (dots per inch).
.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 settings are in.
Set the default vertical resolution for new images and for the
File/New dialog. This value is always in dpi (dots per inch).
.TP
.I default-resolution-units UNIT
Set the units for the display of the default resolution in the
File/New dialog. The default resolution units can be one of inches,
millimeters, points or picas or the identifier of one of the units
defined in your user unit database. The default is inches.
.TP
.I monitor-xresolution FLOAT
Set the monitor's horizontal resolution, in dots per inch. If set to
......
......@@ -155,16 +155,18 @@
# (dont-show-rulers)
# 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
# This is the default unit of a new image. It will appear in the
# File/New dialog and will be the unit for coordinate display when
# dot-for-dot is off.
# The default units can be one of:
# (inches millimeters 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
# (inches millimeters points picas) plus those in your user units database
# The default is inches
(default-resolution-units inches)
......
......@@ -36,15 +36,15 @@ typedef struct {
static GimpUnitDef gimp_unit_defs[UNIT_END] =
{
/* pseudo unit */
{ FALSE, 0.0, 0, "pixels", "px", "px", N_("pixel"), N_("pixels") },
{ FALSE, 0.0, 0, "pixels", "px", "px", N_("pixel"), N_("pixels") },
/* standard units */
{ FALSE, 1.0, 2, "inches", "''", "in", N_("inch"), N_("inches") },
{ FALSE, 2.54, 2, "centimeters", "cm", "cm", N_("centimeter"), N_("centimeters") },
{ FALSE, 1.0, 2, "inches", "''", "in", N_("inch"), N_("inches") },
{ FALSE, 25.4, 1, "millimeters", "mm", "mm", N_("millimeter"), N_("millimeters") },
/* professional units */
{ FALSE, 72.0, 0, "points", "pt", "pt", N_("point"), N_("points") },
{ FALSE, 6.0, 1, "picas", "pc", "pc", N_("pica"), N_("picas") },
{ 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;
......@@ -53,10 +53,10 @@ static gint number_of_user_units = 0;
/* private functions */
GimpUnitDef *
static GimpUnitDef *
gimp_unit_get_user_unit (GUnit unit)
{
return g_slist_nth_data (user_units, unit - UNIT_END + 1);
return g_slist_nth_data (user_units, unit - UNIT_END);
}
......@@ -76,24 +76,27 @@ gimp_unit_get_number_of_built_in_units (void)
GUnit
gimp_unit_new (void)
gimp_unit_new (gchar *identifier,
gfloat factor,
gint digits,
gchar *symbol,
gchar *abbreviation,
gchar *singular,
gchar *plural)
{
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);
user_unit->factor = factor;
user_unit->digits = digits;
user_unit->identifier = g_strdup (identifier);
user_unit->symbol = g_strdup (symbol);
user_unit->abbreviation = g_strdup (abbreviation);
user_unit->singular = g_strdup (singular);
user_unit->plural = g_strdup (plural);
user_units = g_slist_append (user_units, user_unit);
number_of_user_units++;
return UNIT_END + number_of_user_units - 1;
......@@ -136,16 +139,6 @@ gimp_unit_get_factor (GUnit unit)
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)
......@@ -160,16 +153,6 @@ gimp_unit_get_digits (GUnit unit)
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)
......@@ -184,21 +167,6 @@ gimp_unit_get_identifier (GUnit unit)
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)
......@@ -213,21 +181,6 @@ gimp_unit_get_symbol (GUnit unit)
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)
......@@ -256,21 +209,6 @@ gimp_unit_get_singular (GUnit unit)
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)
......@@ -284,18 +222,3 @@ gimp_unit_get_plural (GUnit unit)
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);
}
......@@ -39,72 +39,65 @@ typedef enum
{
UNIT_PIXEL = 0,
UNIT_INCH = 1,
UNIT_CM = 2,
UNIT_MM = 2,
UNIT_POINT = 3,
UNIT_PICA = 4,
UNIT_END /* never use UNIT_END but gimp_unit_get_number_of_units() instead */
} GUnit;
gint gimp_unit_get_number_of_units (void);
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
/* Create a new user unit and returns it's ID.
*
* Note that a new unit is always created with it's deletion flag
* set to TRUE. You will have to set it to FALSE after creation to make
* the unit definition persistant.
*/
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
GUnit gimp_unit_new (gchar *identifier,
gfloat factor,
gint digits,
gchar *symbol,
gchar *abbreviation,
gchar *singular,
gchar *plural);
/* 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
* Trying to change the deletion flag of 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
/* 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:
/* This one is an untranslated string for gimprc */
const gchar * gimp_unit_get_identifier (GUnit unit);
/* 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
* Returns 0 for unit == UNIT_PIXEL as we don't have resolution info here
*/
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
/* The following function gives a hint how many digits a spinbutton
* should provide to get approximately the accuracy of an inch-spinbutton
* with two digits.
*
* returns 0 for unit == UNIT_PIXEL as we don't have resolution info here
* Returns 0 for unit == UNIT_PIXEL as we don't have resolution info here.
*/
gint gimp_unit_get_digits (GUnit unit);
void gimp_unit_set_digits (GUnit unit,
gint digits);
/* 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
}
......
......@@ -36,15 +36,15 @@ typedef struct {
static GimpUnitDef gimp_unit_defs[UNIT_END] =
{
/* pseudo unit */
{ FALSE, 0.0, 0, "pixels", "px", "px", N_("pixel"), N_("pixels") },
{ FALSE, 0.0, 0, "pixels", "px", "px", N_("pixel"), N_("pixels") },
/* standard units */
{ FALSE, 1.0, 2, "inches", "''", "in", N_("inch"), N_("inches") },
{ FALSE, 2.54, 2, "centimeters", "cm", "cm", N_("centimeter"), N_("centimeters") },
{ FALSE, 1.0, 2, "inches", "''", "in", N_("inch"), N_("inches") },
{ FALSE, 25.4, 1, "millimeters", "mm", "mm", N_("millimeter"), N_("millimeters") },
/* professional units */
{ FALSE, 72.0, 0, "points", "pt", "pt", N_("point"), N_("points") },
{ FALSE, 6.0, 1, "picas", "pc", "pc", N_("pica"), N_("picas") },
{ 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;
......@@ -53,10 +53,10 @@ static gint number_of_user_units = 0;
/* private functions */
GimpUnitDef *
static GimpUnitDef *
gimp_unit_get_user_unit (GUnit unit)
{
return g_slist_nth_data (user_units, unit - UNIT_END + 1);
return g_slist_nth_data (user_units, unit - UNIT_END);
}
......@@ -76,24 +76,27 @@ gimp_unit_get_number_of_built_in_units (void)
GUnit
gimp_unit_new (void)
gimp_unit_new (gchar *identifier,
gfloat factor,
gint digits,
gchar *symbol,
gchar *abbreviation,
gchar *singular,
gchar *plural)
{
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);
user_unit->factor = factor;
user_unit->digits = digits;
user_unit->identifier = g_strdup (identifier);
user_unit->symbol = g_strdup (symbol);
user_unit->abbreviation = g_strdup (abbreviation);
user_unit->singular = g_strdup (singular);
user_unit->plural = g_strdup (plural);
user_units = g_slist_append (user_units, user_unit);
number_of_user_units++;
return UNIT_END + number_of_user_units - 1;
......@@ -136,16 +139,6 @@ gimp_unit_get_factor (GUnit unit)
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)
......@@ -160,16 +153,6 @@ gimp_unit_get_digits (GUnit unit)
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)
......@@ -184,21 +167,6 @@ gimp_unit_get_identifier (GUnit unit)
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)
......@@ -213,21 +181,6 @@ gimp_unit_get_symbol (GUnit unit)
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)
......@@ -256,21 +209,6 @@ gimp_unit_get_singular (GUnit unit)
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)
......@@ -284,18 +222,3 @@ gimp_unit_get_plural (GUnit unit)
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);
}