libgimpwidgets: fix gimpwidgets.def file.

Forgot to add/remove changed functions! Again!

Also I fixed a function which is supposed to be static in
GimpScaleEntry.
This commit is contained in:
Jehan 2020-11-05 19:23:35 +01:00
parent 6b846b4600
commit fb7a46c6a2
2 changed files with 92 additions and 86 deletions

View File

@ -62,7 +62,7 @@ static gboolean gimp_scale_entry_log_to_linear (GBinding *binding,
const GValue *from_value,
GValue *to_value,
gpointer user_data);
void gimp_scale_entry_configure (GimpScaleEntry *entry);
static void gimp_scale_entry_configure (GimpScaleEntry *entry);
G_DEFINE_TYPE_WITH_PRIVATE (GimpScaleEntry, gimp_scale_entry, GIMP_TYPE_LABEL_SPIN)
@ -183,6 +183,86 @@ gimp_scale_entry_log_to_linear (GBinding *binding,
return TRUE;
}
static void
gimp_scale_entry_configure (GimpScaleEntry *entry)
{
GimpScaleEntryPrivate *priv;
GBinding *binding;
GtkWidget *spinbutton;
GtkAdjustment *spin_adj;
GtkAdjustment *scale_adj;
gdouble scale_lower;
gdouble scale_upper;
g_return_if_fail (GIMP_IS_SCALE_ENTRY (entry));
priv = gimp_scale_entry_get_instance_private (entry);
scale_adj = gtk_range_get_adjustment (GTK_RANGE (priv->scale));
spinbutton = gimp_label_spin_get_spin_button (GIMP_LABEL_SPIN (entry));
spin_adj = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spinbutton));
g_clear_object (&priv->binding);
if (priv->limit_scale)
{
scale_lower = gtk_adjustment_get_lower (scale_adj);
scale_upper = gtk_adjustment_get_upper (scale_adj);
}
else
{
scale_lower = gtk_adjustment_get_lower (spin_adj);
scale_upper = gtk_adjustment_get_upper (spin_adj);
}
if (priv->logarithmic)
{
gdouble correction;
gdouble log_value, log_lower, log_upper;
gdouble log_step_increment, log_page_increment;
correction = (scale_lower > 0 ? 0 : 0.1 + - scale_lower);
log_value = log (gtk_adjustment_get_value (scale_adj) + correction);
log_lower = log (scale_lower + correction);
log_upper = log (scale_upper + correction);
log_step_increment =
(log_upper - log_lower) / ((scale_upper - scale_lower) /
gtk_adjustment_get_step_increment (spin_adj));
log_page_increment =
(log_upper - log_lower) / ((scale_upper - scale_lower) /
gtk_adjustment_get_page_increment (spin_adj));
gtk_adjustment_configure (scale_adj,
log_value, log_lower, log_upper,
log_step_increment, log_page_increment, 0.0);
binding = g_object_bind_property_full (G_OBJECT (spin_adj), "value",
G_OBJECT (scale_adj), "value",
G_BINDING_BIDIRECTIONAL |
G_BINDING_SYNC_CREATE,
gimp_scale_entry_linear_to_log,
gimp_scale_entry_log_to_linear,
NULL, NULL);
}
else
{
gtk_adjustment_configure (scale_adj,
gtk_adjustment_get_value (spin_adj),
scale_lower, scale_upper,
gtk_adjustment_get_step_increment (spin_adj),
gtk_adjustment_get_page_increment (spin_adj),
0.0);
binding = g_object_bind_property (G_OBJECT (spin_adj), "value",
G_OBJECT (scale_adj), "value",
G_BINDING_BIDIRECTIONAL |
G_BINDING_SYNC_CREATE);
}
priv->binding = binding;
}
/* Public functions */
/**
@ -344,86 +424,6 @@ gimp_scale_entry_set_logarithmic (GimpScaleEntry *entry,
}
}
void
gimp_scale_entry_configure (GimpScaleEntry *entry)
{
GimpScaleEntryPrivate *priv;
GBinding *binding;
GtkWidget *spinbutton;
GtkAdjustment *spin_adj;
GtkAdjustment *scale_adj;
gdouble scale_lower;
gdouble scale_upper;
g_return_if_fail (GIMP_IS_SCALE_ENTRY (entry));
priv = gimp_scale_entry_get_instance_private (entry);
scale_adj = gtk_range_get_adjustment (GTK_RANGE (priv->scale));
spinbutton = gimp_label_spin_get_spin_button (GIMP_LABEL_SPIN (entry));
spin_adj = gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (spinbutton));
g_clear_object (&priv->binding);
if (priv->limit_scale)
{
scale_lower = gtk_adjustment_get_lower (scale_adj);
scale_upper = gtk_adjustment_get_upper (scale_adj);
}
else
{
scale_lower = gtk_adjustment_get_lower (spin_adj);
scale_upper = gtk_adjustment_get_upper (spin_adj);
}
if (priv->logarithmic)
{
gdouble correction;
gdouble log_value, log_lower, log_upper;
gdouble log_step_increment, log_page_increment;
correction = (scale_lower > 0 ? 0 : 0.1 + - scale_lower);
log_value = log (gtk_adjustment_get_value (scale_adj) + correction);
log_lower = log (scale_lower + correction);
log_upper = log (scale_upper + correction);
log_step_increment =
(log_upper - log_lower) / ((scale_upper - scale_lower) /
gtk_adjustment_get_step_increment (spin_adj));
log_page_increment =
(log_upper - log_lower) / ((scale_upper - scale_lower) /
gtk_adjustment_get_page_increment (spin_adj));
gtk_adjustment_configure (scale_adj,
log_value, log_lower, log_upper,
log_step_increment, log_page_increment, 0.0);
binding = g_object_bind_property_full (G_OBJECT (spin_adj), "value",
G_OBJECT (scale_adj), "value",
G_BINDING_BIDIRECTIONAL |
G_BINDING_SYNC_CREATE,
gimp_scale_entry_linear_to_log,
gimp_scale_entry_log_to_linear,
NULL, NULL);
}
else
{
gtk_adjustment_configure (scale_adj,
gtk_adjustment_get_value (spin_adj),
scale_lower, scale_upper,
gtk_adjustment_get_step_increment (spin_adj),
gtk_adjustment_get_page_increment (spin_adj),
0.0);
binding = g_object_bind_property (G_OBJECT (spin_adj), "value",
G_OBJECT (scale_adj), "value",
G_BINDING_BIDIRECTIONAL |
G_BINDING_SYNC_CREATE);
}
priv->binding = binding;
}
/**
* gimp_scale_entry_get_logarithmic:
* @entry: a #GimpScaleEntry as returned by gimp_scale_entry_new()

View File

@ -227,6 +227,16 @@ EXPORTS
gimp_int_store_new
gimp_int_store_new_valist
gimp_label_set_attributes
gimp_label_spin_get_spin_button
gimp_label_spin_get_type
gimp_label_spin_get_value
gimp_label_spin_new
gimp_label_spin_set_increments
gimp_label_spin_set_value
gimp_labeled_get_label
gimp_labeled_get_text
gimp_labeled_get_type
gimp_labeled_set_text
gimp_memsize_entry_get_spinbutton
gimp_memsize_entry_get_type
gimp_memsize_entry_get_value
@ -336,6 +346,7 @@ EXPORTS
gimp_prop_int_radio_box_new
gimp_prop_int_radio_frame_new
gimp_prop_label_new
gimp_prop_label_spin_new
gimp_prop_memsize_entry_new
gimp_prop_opacity_entry_new
gimp_prop_path_editor_new
@ -364,17 +375,12 @@ EXPORTS
gimp_ruler_set_position
gimp_ruler_set_range
gimp_ruler_set_unit
gimp_scale_entry_get_label
gimp_scale_entry_get_logarithmic
gimp_scale_entry_get_range
gimp_scale_entry_get_spin_button
gimp_scale_entry_get_type
gimp_scale_entry_get_value
gimp_scale_entry_new
gimp_scale_entry_set_bounds
gimp_scale_entry_set_increments
gimp_scale_entry_set_logarithmic
gimp_scale_entry_set_value
gimp_scroll_adjustment_values
gimp_scrolled_preview_freeze
gimp_scrolled_preview_get_adjustments