gl_object_editor_changed_cb,
editor);
+ /* save a copy in internal units */
+ editor->priv->dx = dx;
+ editor->priv->dy = dy;
+
/* convert internal units to displayed units */
gl_debug (DEBUG_EDITOR, "internal dx,dy = %g, %g", dx, dy);
dx *= editor->priv->units_per_point;
gl_object_editor_changed_cb,
editor);
+ /* save a copy in internal units */
+ editor->priv->dx_max = dx_max;
+ editor->priv->dy_max = dy_max;
+
/* convert internal units to displayed units */
gl_debug (DEBUG_EDITOR, "internal dx_max,dy_max = %g, %g", dx_max, dy_max);
dx_max *= editor->priv->units_per_point;
*dx = COMP_X (r, theta);
*dy = COMP_Y (r, theta);
+ /* save a copy in internal units */
+ editor->priv->dx = *dx;
+ editor->priv->dy = *dy;
+
+ gl_debug (DEBUG_EDITOR, "END");
+}
+
+/*****************************************************************************/
+/* PRIVATE. Prefs changed callback. Update units related items. */
+/*****************************************************************************/
+void
+lsize_prefs_changed_cb (glObjectEditor *editor)
+{
+ const gchar *units_string;
+ gdouble climb_rate;
+ gint digits;
+
+ gl_debug (DEBUG_EDITOR, "START");
+
+ /* Get new configuration information */
+ units_string = gl_prefs_get_units_string ();
+ editor->priv->units_per_point = gl_prefs_get_units_per_point ();
+ climb_rate = gl_prefs_get_units_step_size ();
+ digits = gl_prefs_get_units_precision ();
+
+ /* Update characteristics of r_spin */
+ g_signal_handlers_block_by_func (G_OBJECT(editor->priv->lsize_r_spin),
+ gl_object_editor_changed_cb,
+ editor);
+ gtk_spin_button_set_digits (GTK_SPIN_BUTTON(editor->priv->lsize_r_spin),
+ digits);
+ gtk_spin_button_set_increments (GTK_SPIN_BUTTON(editor->priv->lsize_r_spin),
+ climb_rate, 10.0*climb_rate);
+ g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->lsize_r_spin),
+ gl_object_editor_changed_cb,
+ editor);
+
+ /* Update r_units_label */
+ gtk_label_set_text (GTK_LABEL(editor->priv->lsize_r_units_label),
+ units_string);
+
+ /* Update values of r_spin/theta_spin */
+ gl_object_editor_set_lsize (editor,
+ editor->priv->dx,
+ editor->priv->dy);
+ gl_object_editor_set_max_lsize (editor,
+ editor->priv->dx_max,
+ editor->priv->dy_max);
+
gl_debug (DEBUG_EDITOR, "END");
}
gl_object_editor_changed_cb,
editor);
+ /* save a copy in internal units */
+ editor->priv->x = x;
+ editor->priv->y = y;
+
/* convert internal units to displayed units */
gl_debug (DEBUG_EDITOR, "internal x,y = %g, %g", x, y);
x *= editor->priv->units_per_point;
gl_object_editor_changed_cb,
editor);
+ /* save a copy in internal units */
+ editor->priv->x_max = x_max;
+ editor->priv->y_max = y_max;
+
/* convert internal units to displayed units */
gl_debug (DEBUG_EDITOR, "internal x_max,y_max = %g, %g", x_max, y_max);
x_max *= editor->priv->units_per_point;
*x /= editor->priv->units_per_point;
*y /= editor->priv->units_per_point;
+ /* save a copy in internal units */
+ editor->priv->x = *x;
+ editor->priv->y = *y;
+
+ gl_debug (DEBUG_EDITOR, "END");
+}
+
+/*****************************************************************************/
+/* PRIVATE. Prefs changed callback. Update units related items. */
+/*****************************************************************************/
+void
+position_prefs_changed_cb (glObjectEditor *editor)
+{
+ const gchar *units_string;
+ gdouble climb_rate;
+ gint digits;
+
+ gl_debug (DEBUG_EDITOR, "START");
+
+ /* Get new configuration information */
+ units_string = gl_prefs_get_units_string ();
+ editor->priv->units_per_point = gl_prefs_get_units_per_point ();
+ climb_rate = gl_prefs_get_units_step_size ();
+ digits = gl_prefs_get_units_precision ();
+
+ /* Update characteristics of x_spin/y_spin */
+ g_signal_handlers_block_by_func (G_OBJECT(editor->priv->pos_x_spin),
+ gl_object_editor_changed_cb,
+ editor);
+ g_signal_handlers_block_by_func (G_OBJECT(editor->priv->pos_y_spin),
+ gl_object_editor_changed_cb,
+ editor);
+ gtk_spin_button_set_digits (GTK_SPIN_BUTTON(editor->priv->pos_x_spin),
+ digits);
+ gtk_spin_button_set_digits (GTK_SPIN_BUTTON(editor->priv->pos_y_spin),
+ digits);
+ gtk_spin_button_set_increments (GTK_SPIN_BUTTON(editor->priv->pos_x_spin),
+ climb_rate, 10.0*climb_rate);
+ gtk_spin_button_set_increments (GTK_SPIN_BUTTON(editor->priv->pos_y_spin),
+ climb_rate, 10.0*climb_rate);
+ g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->pos_x_spin),
+ gl_object_editor_changed_cb,
+ editor);
+ g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->pos_y_spin),
+ gl_object_editor_changed_cb,
+ editor);
+
+ /* Update units_labels */
+ gtk_label_set_text (GTK_LABEL(editor->priv->pos_x_units_label),
+ units_string);
+ gtk_label_set_text (GTK_LABEL(editor->priv->pos_y_units_label),
+ units_string);
+
+ /* Update values of x_spin/y_spin */
+ gl_object_editor_set_position (editor,
+ editor->priv->x,
+ editor->priv->y);
+ gl_object_editor_set_max_position (editor,
+ editor->priv->x_max,
+ editor->priv->y_max);
+
gl_debug (DEBUG_EDITOR, "END");
}
GtkWidget *pos_y_spin;
GtkWidget *pos_x_units_label;
GtkWidget *pos_y_units_label;
+ gdouble x;
+ gdouble y;
+ gdouble x_max;
+ gdouble y_max;
GtkWidget *size_page_vbox;
GtkWidget *size_w_spin;
GtkWidget *size_aspect_checkbutton;
GtkWidget *size_reset_image_button;
gdouble size_aspect_ratio;
+ gdouble w;
+ gdouble h;
+ gdouble w_max;
+ gdouble h_max;
gdouble w_base;
gdouble h_base;
GtkWidget *lsize_r_spin;
GtkWidget *lsize_theta_spin;
GtkWidget *lsize_r_units_label;
+ gdouble dx;
+ gdouble dy;
+ gdouble dx_max;
+ gdouble dy_max;
GtkWidget *fill_page_vbox;
GtkWidget *fill_color_combo;
void gl_object_editor_changed_cb (glObjectEditor *editor);
+void lsize_prefs_changed_cb (glObjectEditor *editor);
+void size_prefs_changed_cb (glObjectEditor *editor);
+void position_prefs_changed_cb (glObjectEditor *editor);
+
G_END_DECLS
#endif
static void
size_reset_cb (glObjectEditor *editor)
{
+ gdouble w_base, h_base;
+
g_signal_handlers_block_by_func (G_OBJECT (editor->priv->size_w_spin),
G_CALLBACK (h_spin_cb),
editor);
G_CALLBACK (h_spin_cb),
editor);
+ w_base *= editor->priv->units_per_point;
+ h_base *= editor->priv->units_per_point;
+
gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->size_w_spin),
- editor->priv->w_base);
+ w_base);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->size_h_spin),
- editor->priv->h_base);
+ h_base);
g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->size_w_spin),
G_CALLBACK (h_spin_cb),
h_spin_cb,
editor);
+ /* save a copy in internal units */
+ editor->priv->w = w;
+ editor->priv->h = h;
+
/* convert internal units to displayed units */
gl_debug (DEBUG_EDITOR, "internal w,h = %g, %g", w, h);
w *= editor->priv->units_per_point;
h_spin_cb,
editor);
+ /* save a copy in internal units */
+ editor->priv->w_max = w_max;
+ editor->priv->h_max = h_max;
+
/* convert internal units to displayed units */
gl_debug (DEBUG_EDITOR, "internal w_max,h_max = %g, %g", w_max, h_max);
w_max *= editor->priv->units_per_point;
gdouble w_base,
gdouble h_base)
{
- w_base *= editor->priv->units_per_point;
- h_base *= editor->priv->units_per_point;
-
gl_debug (DEBUG_EDITOR, "Setting w_base = %g", w_base);
gl_debug (DEBUG_EDITOR, "Setting h_base = %g", h_base);
*w /= editor->priv->units_per_point;
*h /= editor->priv->units_per_point;
+ /* save a copy in internal units */
+ editor->priv->w = *w;
+ editor->priv->h = *h;
+
+ gl_debug (DEBUG_EDITOR, "END");
+}
+
+/*****************************************************************************/
+/* PRIVATE. Prefs changed callback. Update units related items. */
+/*****************************************************************************/
+void
+size_prefs_changed_cb (glObjectEditor *editor)
+{
+ const gchar *units_string;
+ gdouble climb_rate;
+ gint digits;
+
+ gl_debug (DEBUG_EDITOR, "START");
+
+ /* Get new configuration information */
+ units_string = gl_prefs_get_units_string ();
+ editor->priv->units_per_point = gl_prefs_get_units_per_point ();
+ climb_rate = gl_prefs_get_units_step_size ();
+ digits = gl_prefs_get_units_precision ();
+
+ /* Update characteristics of w_spin/h_spin */
+ g_signal_handlers_block_by_func (G_OBJECT(editor->priv->size_w_spin),
+ w_spin_cb,
+ editor);
+ g_signal_handlers_block_by_func (G_OBJECT(editor->priv->size_h_spin),
+ h_spin_cb,
+ editor);
+ gtk_spin_button_set_digits (GTK_SPIN_BUTTON(editor->priv->size_w_spin),
+ digits);
+ gtk_spin_button_set_digits (GTK_SPIN_BUTTON(editor->priv->size_h_spin),
+ digits);
+ gtk_spin_button_set_increments (GTK_SPIN_BUTTON(editor->priv->size_w_spin),
+ climb_rate, 10.0*climb_rate);
+ gtk_spin_button_set_increments (GTK_SPIN_BUTTON(editor->priv->size_h_spin),
+ climb_rate, 10.0*climb_rate);
+ g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->size_w_spin),
+ w_spin_cb,
+ editor);
+ g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->size_h_spin),
+ h_spin_cb,
+ editor);
+
+ /* Update units_labels */
+ gtk_label_set_text (GTK_LABEL(editor->priv->size_w_units_label),
+ units_string);
+ gtk_label_set_text (GTK_LABEL(editor->priv->size_h_units_label),
+ units_string);
+
+ /* Update values of w_spin/h_spin */
+ gl_object_editor_set_size (editor,
+ editor->priv->w,
+ editor->priv->h);
+ gl_object_editor_set_max_size (editor,
+ editor->priv->w_max,
+ editor->priv->h_max);
+
gl_debug (DEBUG_EDITOR, "END");
}
glObjectEditorOption first_option,
va_list args);
+static void prefs_changed_cb (glObjectEditor *editor);
+
\f
/*****************************************************************************/
/* Boilerplate object stuff. */
g_free (editor->priv);
+ g_signal_handlers_disconnect_by_func (G_OBJECT(gl_prefs),
+ prefs_changed_cb, editor);
+
G_OBJECT_CLASS (parent_class)->finalize (object);
gl_debug (DEBUG_EDITOR, "END");
gtk_widget_show (editor->priv->notebook);
}
+ g_signal_connect_swapped (G_OBJECT (gl_prefs), "changed",
+ G_CALLBACK (prefs_changed_cb),
+ editor);
+
gl_debug (DEBUG_EDITOR, "END");
}
return color_combo;
}
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE. Prefs changed callback. Update units related items. */
+/*--------------------------------------------------------------------------*/
+static void
+prefs_changed_cb (glObjectEditor *editor)
+{
+
+ gl_debug (DEBUG_EDITOR, "START");
+
+ if (editor->priv->lsize_r_spin) {
+ lsize_prefs_changed_cb (editor);
+ }
+
+ if (editor->priv->size_w_spin) {
+ size_prefs_changed_cb (editor);
+ }
+
+ if (editor->priv->pos_x_spin) {
+ position_prefs_changed_cb (editor);
+ }
+
+ gl_debug (DEBUG_EDITOR, "END");
+}
+
gpointer user_data);
static void template_entry_changed_cb (GtkEntry *entry,
gpointer user_data);
+static void prefs_changed_cb (glPrefsModel *gl_prefs,
+ gpointer user_data);
static void details_update (glWdgtMediaSelect *media_select,
gchar *name);
media_select = GL_WDGT_MEDIA_SELECT (object);
+ g_signal_handlers_disconnect_by_func (G_OBJECT(gl_prefs),
+ prefs_changed_cb, media_select);
+
G_OBJECT_CLASS (parent_class)->finalize (object);
gl_debug (DEBUG_MEDIA_SELECT, "END");
g_signal_connect (G_OBJECT (media_select->template_entry), "changed",
G_CALLBACK (template_entry_changed_cb),
media_select);
+ g_signal_connect (G_OBJECT (gl_prefs), "changed",
+ G_CALLBACK (prefs_changed_cb),
+ media_select);
g_free (page_size_name);
gl_debug (DEBUG_MEDIA_SELECT, "END");
}
+/*--------------------------------------------------------------------------*/
+/* PRIVATE. modify widget due to change in prefs */
+/*--------------------------------------------------------------------------*/
+static void
+prefs_changed_cb (glPrefsModel *gl_prefs,
+ gpointer user_data)
+{
+ glWdgtMediaSelect *media_select = GL_WDGT_MEDIA_SELECT (user_data);
+ gchar *name;
+
+ gl_debug (DEBUG_MEDIA_SELECT, "START");
+
+ /* Update mini_preview canvas & details with template */
+ name = gtk_editable_get_chars (GTK_EDITABLE (media_select->template_entry), 0, -1);
+ if ( strlen(name) ) {
+ gl_debug (DEBUG_MEDIA_SELECT, "name = \"%s\"", name);
+ details_update (media_select, name);
+ }
+ g_free (name);
+
+ gl_debug (DEBUG_MEDIA_SELECT, "END");
+}
+
/*--------------------------------------------------------------------------*/
/* PRIVATE. update "details" widgets from new template. */
/*--------------------------------------------------------------------------*/