ui.c \
ui-property-bar.h \
ui-property-bar.c \
+ ui-sidebar.h \
+ ui-sidebar.c \
ui-util.h \
ui-util.c \
commands.h \
view-highlight.h \
merge-properties-dialog.c \
merge-properties-dialog.h \
+ object-editor.c \
+ object-editor.h \
+ object-editor-private.h \
+ object-editor-position-page.c \
+ object-editor-position-page.h \
+ object-editor-size-page.c \
+ object-editor-size-page.h \
+ object-editor-lsize-page.c \
+ object-editor-lsize-page.h \
+ object-editor-line-page.c \
+ object-editor-line-page.h \
+ object-editor-fill-page.c \
+ object-editor-fill-page.h \
+ object-editor-image-page.c \
+ object-editor-image-page.h \
+ object-editor-text-page.c \
+ object-editor-text-page.h \
+ object-editor-edit-page.c \
+ object-editor-edit-page.h \
+ object-editor-bc-page.c \
+ object-editor-bc-page.h \
+ object-editor-data-page.c \
+ object-editor-data-page.h \
print.c \
print.h \
print-dialog.c \
merge-text.h \
text-node.c \
text-node.h \
- wdgt-text-props.c \
- wdgt-text-props.h \
- wdgt-text-entry.c \
- wdgt-text-entry.h \
- wdgt-position.c \
- wdgt-position.h \
- wdgt-size.c \
- wdgt-size.h \
- wdgt-line.c \
- wdgt-line.h \
- wdgt-fill.c \
- wdgt-fill.h \
- wdgt-vector.c \
- wdgt-vector.h \
wdgt-image-select.c \
wdgt-image-select.h \
- wdgt-bc-props.c \
- wdgt-bc-props.h \
- wdgt-bc-style.c \
- wdgt-bc-style.h \
- wdgt-bc-data.c \
- wdgt-bc-data.h \
wdgt-print-copies.c \
wdgt-print-copies.h \
wdgt-print-merge.c \
gint gl_debug_media_select = 0;
gint gl_debug_mini_preview = 0;
gint gl_debug_pixbuf_cache = 0;
+gint gl_debug_editor = 0;
gint gl_debug_wdgt = 0;
/****************************************************************************/
(gl_debug_media_select && section == GL_DEBUG_MEDIA_SELECT) ||
(gl_debug_mini_preview && section == GL_DEBUG_MINI_PREVIEW) ||
(gl_debug_pixbuf_cache && section == GL_DEBUG_PIXBUF_CACHE) ||
+ (gl_debug_editor && section == GL_DEBUG_EDITOR) ||
(gl_debug_wdgt && section == GL_DEBUG_WDGT) )
g_print ("%s:%d (%s) %s\n", file, line, function, msg);
GL_DEBUG_MEDIA_SELECT,
GL_DEBUG_MINI_PREVIEW,
GL_DEBUG_PIXBUF_CACHE,
+ GL_DEBUG_EDITOR,
GL_DEBUG_WDGT,
} glDebugSection;
extern gint gl_debug_media_select;
extern gint gl_debug_mini_preview;
extern gint gl_debug_pixbuf_cache;
+extern gint gl_debug_editor;
extern gint gl_debug_wdgt;
#ifndef __GNUC__
#define DEBUG_MEDIA_SELECT GL_DEBUG_MEDIA_SELECT, __FILE__, __LINE__, __FUNCTION__
#define DEBUG_MINI_PREVIEW GL_DEBUG_MINI_PREVIEW, __FILE__, __LINE__, __FUNCTION__
#define DEBUG_PIXBUF_CACHE GL_DEBUG_PIXBUF_CACHE, __FILE__, __LINE__, __FUNCTION__
+#define DEBUG_EDITOR GL_DEBUG_EDITOR, __FILE__, __LINE__, __FUNCTION__
#define DEBUG_WDGT GL_DEBUG_WDGT, __FILE__, __LINE__, __FUNCTION__
void gl_debug (gint section, gchar *file,
pixtype="stock" pixname="gtk-zoom-100"
/>
+ <cmd name="ToolsZoomToFit"
+ _tip="Zoom to fit window"
+ pixtype="stock" pixname="gtk-zoom-fit"
+ />
+
<cmd name="ToolsMergeProperties"
_tip="Edit merge properties"
pixtype="stock" pixname="gl_stock_merge"
/>
- <cmd name="ToolsObjectProperties"
- _tip="Edit object properties"
- pixtype="stock" pixname="gl_stock_properties"
- />
-
<cmd name="ToolsRaiseObjects"
_tip="Raise object to top"
pixtype="stock" pixname="gl_stock_order_top"
_tip="Line width"
/>
+ <cmd name="PropertyEditor"
+ />
+
<cmd name="HelpContents"
_label="Contents"
_tip="Open the glabels manual"
_label="Zoom _1:1"
/>
+ <menuitem name="ToolsZoomToFit"
+ verb=""
+ _label="Zoom to _fit"
+ />
+
</submenu>
<separator />
- <menuitem name="ToolsObjectProperties"
- verb=""
- _label="Object _Properties..."
- />
-
- <separator />
-
<menuitem name="ToolsMergeProperties"
verb=""
_label="_Merge Properties..."
verb=""
/>
+ <toolitem name="ToolsZoomToFit"
+ verb=""
+ />
+
<separator />
<toolitem name="ToolsMergeProperties"
</dockitem>
+ <dockitem name="PropertySidebar"
+ _tip="Object property editor"
+ config="0"
+ behavior="exclusive,never horizontal"
+ in_new_band="1"
+ placement="right"
+ >
+
+ <control name="PropertyEditor"
+ verb=""
+ />
+
+ </dockitem>
+
+
+
<status resize_grip="1">
{ "debug-pixbuf-cache", '\0', POPT_ARG_NONE, &gl_debug_pixbuf_cache, 0,
N_("Show pixbuf cache debugging messages."), NULL },
- { "debug-wdgt", '\0', POPT_ARG_NONE, &gl_debug_wdgt, 0,
+ { "debug-editor", '\0', POPT_ARG_NONE, &gl_debug_editor, 0,
N_("Show widget debugging messages."), NULL },
+ { "debug-wdgt", '\0', POPT_ARG_NONE, &gl_debug_wdgt, 0,
+ N_("Show object editor debugging messages."), NULL },
+
{ "debug", '\0', POPT_ARG_NONE, &gl_debug_all, 0,
N_("Turn on all debugging messages."), NULL },
--- /dev/null
+/*
+ * (GLABELS) Label and Business Card Creation program for GNOME
+ *
+ * object-editor.c: object properties editor module
+ *
+ * Copyright (C) 2003 Jim Evins <evins@snaught.com>.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#include <config.h>
+
+#include <gnome.h>
+#include <math.h>
+
+#include "object-editor.h"
+#include "prefs.h"
+#include "mygal/widget-color-combo.h"
+#include "color.h"
+
+#include "object-editor-private.h"
+
+#include "debug.h"
+
+/*===========================================*/
+/* Private macros */
+/*===========================================*/
+
+/*===========================================*/
+/* Private data types */
+/*===========================================*/
+
+/*===========================================*/
+/* Private globals */
+/*===========================================*/
+
+/*===========================================*/
+/* Local function prototypes */
+/*===========================================*/
+
+static void style_changed_cb (glObjectEditor *editor);
+
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE. Prepare size page. */
+/*--------------------------------------------------------------------------*/
+void
+gl_object_editor_prepare_bc_page (glObjectEditor *editor)
+{
+ GList *styles = NULL;
+ GtkSizeGroup *label_size_group;
+ GtkWidget *label;
+
+ gl_debug (DEBUG_EDITOR, "START");
+
+ /* Extract widgets from XML tree. */
+ editor->priv->bc_page_vbox =
+ glade_xml_get_widget (editor->priv->gui, "bc_page_vbox");
+ editor->priv->bc_style_entry =
+ glade_xml_get_widget (editor->priv->gui, "bc_style_entry");
+ editor->priv->bc_style_combo =
+ glade_xml_get_widget (editor->priv->gui, "bc_style_combo");
+ editor->priv->bc_text_check =
+ glade_xml_get_widget (editor->priv->gui, "bc_text_check");
+ editor->priv->bc_cs_check =
+ glade_xml_get_widget (editor->priv->gui, "bc_cs_check");
+ editor->priv->bc_color_combo =
+ glade_xml_get_widget (editor->priv->gui, "bc_color_combo");
+
+ /* Load barcode styles */
+ styles = gl_barcode_get_styles_list ();
+ gtk_combo_set_popdown_strings (GTK_COMBO(editor->priv->bc_style_combo), styles);
+ gl_barcode_free_styles_list (styles);
+
+ /* Align label widths */
+ label_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+ label = glade_xml_get_widget (editor->priv->gui, "bc_style_label");
+ gtk_size_group_add_widget (label_size_group, label);
+ label = glade_xml_get_widget (editor->priv->gui, "bc_color_label");
+ gtk_size_group_add_widget (label_size_group, label);
+
+ /* Un-hide */
+ gtk_widget_show_all (editor->priv->bc_page_vbox);
+
+ /* Connect signals */
+ g_signal_connect_swapped (G_OBJECT (editor->priv->bc_style_entry),
+ "changed",
+ G_CALLBACK (style_changed_cb),
+ G_OBJECT (editor));
+ g_signal_connect_swapped (G_OBJECT (editor->priv->bc_text_check),
+ "toggled",
+ G_CALLBACK (gl_object_editor_changed_cb),
+ G_OBJECT (editor));
+ g_signal_connect_swapped (G_OBJECT (editor->priv->bc_cs_check),
+ "toggled",
+ G_CALLBACK (gl_object_editor_changed_cb),
+ G_OBJECT (editor));
+ g_signal_connect_swapped (G_OBJECT (editor->priv->bc_color_combo),
+ "color_changed",
+ G_CALLBACK (gl_object_editor_changed_cb),
+ G_OBJECT (editor));
+
+ gl_debug (DEBUG_EDITOR, "END");
+}
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE. Callback for when style has changed. */
+/*--------------------------------------------------------------------------*/
+static void
+style_changed_cb (glObjectEditor *editor)
+{
+ gchar *style_string;
+ glBarcodeStyle style;
+
+ style_string =
+ gtk_editable_get_chars (GTK_EDITABLE(editor->priv->bc_style_entry), 0, -1);
+
+ /* Don't emit if entry is empty. */
+ if ( *style_string != 0 ) {
+ style = gl_barcode_text_to_style (style_string);
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(editor->priv->bc_text_check),
+ gl_barcode_can_text (style));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(editor->priv->bc_cs_check),
+ gl_barcode_can_csum (style));
+
+ gtk_widget_set_sensitive (editor->priv->bc_text_check,
+ gl_barcode_text_optional (style));
+ gtk_widget_set_sensitive (editor->priv->bc_cs_check,
+ gl_barcode_csum_optional (style));
+
+
+ /* Emit our "changed" signal */
+ g_signal_emit (G_OBJECT (editor), gl_object_editor_signals[CHANGED], 0);
+ }
+
+ g_free (style_string);
+}
+
+/*****************************************************************************/
+/* Set barcode style. */
+/*****************************************************************************/
+void
+gl_object_editor_set_bc_style (glObjectEditor *editor,
+ glBarcodeStyle style,
+ gboolean text_flag,
+ gboolean checksum_flag)
+{
+ const gchar *style_string;
+ gint pos;
+
+ gl_debug (DEBUG_EDITOR, "START");
+
+ g_signal_handlers_block_by_func (G_OBJECT(editor->priv->bc_style_entry),
+ G_CALLBACK (style_changed_cb),
+ editor);
+ g_signal_handlers_block_by_func (G_OBJECT(editor->priv->bc_text_check),
+ G_CALLBACK (gl_object_editor_changed_cb),
+ editor);
+ g_signal_handlers_block_by_func (G_OBJECT(editor->priv->bc_cs_check),
+ G_CALLBACK (gl_object_editor_changed_cb),
+ editor);
+
+ style_string = gl_barcode_style_to_text (style);
+
+ gtk_editable_delete_text (GTK_EDITABLE (editor->priv->bc_style_entry),
+ 0, -1);
+
+ pos = 0;
+ gtk_editable_insert_text (GTK_EDITABLE (editor->priv->bc_style_entry),
+ style_string,
+ strlen (style_string),
+ &pos);
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->bc_text_check),
+ text_flag);
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->bc_cs_check),
+ checksum_flag);
+
+ gtk_widget_set_sensitive (editor->priv->bc_text_check,
+ gl_barcode_text_optional (style));
+ gtk_widget_set_sensitive (editor->priv->bc_cs_check,
+ gl_barcode_csum_optional (style));
+
+ g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->bc_style_entry),
+ G_CALLBACK (style_changed_cb),
+ editor);
+ g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->bc_text_check),
+ G_CALLBACK (gl_object_editor_changed_cb),
+ editor);
+ g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->bc_cs_check),
+ G_CALLBACK (gl_object_editor_changed_cb),
+ editor);
+
+ gl_debug (DEBUG_EDITOR, "END");
+}
+
+/*****************************************************************************/
+/* Query barcode style. */
+/*****************************************************************************/
+void
+gl_object_editor_get_bc_style (glObjectEditor *editor,
+ glBarcodeStyle *style,
+ gboolean *text_flag,
+ gboolean *checksum_flag)
+{
+ gchar *style_string;
+
+ gl_debug (DEBUG_EDITOR, "START");
+
+ style_string =
+ gtk_editable_get_chars (GTK_EDITABLE(editor->priv->bc_style_entry),
+ 0, -1);
+ *style = gl_barcode_text_to_style (style_string);
+
+ *text_flag =
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (editor->priv->bc_text_check));
+
+ *checksum_flag =
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (editor->priv->bc_cs_check));
+
+ g_free (style_string);
+
+ gl_debug (DEBUG_EDITOR, "END");
+}
+
+/*****************************************************************************/
+/* Set bc color. */
+/*****************************************************************************/
+void
+gl_object_editor_set_bc_color (glObjectEditor *editor,
+ guint bc_color)
+{
+ GdkColor *gdk_color;
+
+ gl_debug (DEBUG_EDITOR, "START");
+
+ g_signal_handlers_block_by_func (G_OBJECT(editor->priv->bc_color_combo),
+ gl_object_editor_changed_cb,
+ editor);
+
+ gdk_color = gl_color_to_gdk_color (bc_color);
+ color_combo_set_color (COLOR_COMBO(editor->priv->bc_color_combo), gdk_color);
+ g_free (gdk_color);
+
+ g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->bc_color_combo),
+ gl_object_editor_changed_cb,
+ editor);
+
+ gl_debug (DEBUG_EDITOR, "END");
+}
+
+/*****************************************************************************/
+/* Query bc color. */
+/*****************************************************************************/
+guint
+gl_object_editor_get_bc_color (glObjectEditor *editor)
+{
+ GdkColor *gdk_color;
+ guint color;
+ gboolean is_default;
+
+ gl_debug (DEBUG_EDITOR, "START");
+
+ gdk_color = color_combo_get_color (COLOR_COMBO(editor->priv->bc_color_combo),
+ &is_default);
+
+ if (is_default) {
+ color = gl_prefs->default_line_color;
+ } else {
+ color = gl_color_from_gdk_color (gdk_color);
+ }
+
+
+ gl_debug (DEBUG_EDITOR, "END");
+
+ return color;
+}
+
+
--- /dev/null
+/*
+ * (GLABELS) Label and Business Card Creation program for GNOME
+ *
+ * object-editor.c: object properties editor module
+ *
+ * Copyright (C) 2003 Jim Evins <evins@snaught.com>.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#include <config.h>
+
+#include <gnome.h>
+#include <math.h>
+
+#include "object-editor.h"
+#include "prefs.h"
+
+#include "object-editor-private.h"
+
+#include "debug.h"
+
+/*===========================================*/
+/* Private macros */
+/*===========================================*/
+
+/*===========================================*/
+/* Private data types */
+/*===========================================*/
+
+/*===========================================*/
+/* Private globals */
+/*===========================================*/
+
+/*===========================================*/
+/* Local function prototypes */
+/*===========================================*/
+
+static void data_radio_toggled_cb (glObjectEditor *editor);
+
+
+\f
+/*--------------------------------------------------------------------------*/
+/* PRIVATE. Prepare data page. */
+/*--------------------------------------------------------------------------*/
+void
+gl_object_editor_prepare_data_page (glObjectEditor *editor)
+{
+ GdkColor *gdk_color;
+ GtkSizeGroup *label_size_group;
+
+ gl_debug (DEBUG_EDITOR, "START");
+
+ /* Extract widgets from XML tree. */
+ editor->priv->data_page_vbox = glade_xml_get_widget (editor->priv->gui,
+ "data_page_vbox");
+ editor->priv->data_literal_radio = glade_xml_get_widget (editor->priv->gui,
+ "data_literal_radio");
+ editor->priv->data_key_radio = glade_xml_get_widget (editor->priv->gui,
+ "data_key_radio");
+ editor->priv->data_text_entry = glade_xml_get_widget (editor->priv->gui,
+ "data_text_entry");
+ editor->priv->data_key_combo = glade_xml_get_widget (editor->priv->gui,
+ "data_key_combo");
+ editor->priv->data_key_entry = glade_xml_get_widget (editor->priv->gui,
+ "data_key_entry");
+
+ /* Align label widths */
+ label_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+ gtk_size_group_add_widget (label_size_group, editor->priv->data_literal_radio);
+ gtk_size_group_add_widget (label_size_group, editor->priv->data_key_radio);
+
+ /* Un-hide */
+ gtk_widget_show_all (editor->priv->data_page_vbox);
+
+ /* Connect signals */
+ g_signal_connect_swapped (G_OBJECT (editor->priv->data_text_entry),
+ "changed",
+ G_CALLBACK (gl_object_editor_changed_cb),
+ G_OBJECT (editor));
+ g_signal_connect_swapped (G_OBJECT (editor->priv->data_key_entry),
+ "changed",
+ G_CALLBACK (gl_object_editor_changed_cb),
+ G_OBJECT (editor));
+ g_signal_connect_swapped (G_OBJECT (editor->priv->data_literal_radio),
+ "toggled",
+ G_CALLBACK (data_radio_toggled_cb),
+ G_OBJECT (editor));
+ g_signal_connect_swapped (G_OBJECT (editor->priv->data_key_radio),
+ "toggled",
+ G_CALLBACK (data_radio_toggled_cb),
+ G_OBJECT (editor));
+
+ gl_debug (DEBUG_EDITOR, "END");
+}
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE. data radio callback. */
+/*--------------------------------------------------------------------------*/
+static void
+data_radio_toggled_cb (glObjectEditor *editor)
+{
+ gl_debug (DEBUG_WDGT, "START");
+
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (editor->priv->data_literal_radio))) {
+ gtk_widget_set_sensitive (editor->priv->data_text_entry, TRUE);
+ gtk_widget_set_sensitive (editor->priv->data_key_combo, FALSE);
+ } else {
+ gtk_widget_set_sensitive (editor->priv->data_text_entry, FALSE);
+ gtk_widget_set_sensitive (editor->priv->data_key_combo, TRUE);
+ }
+
+ /* Emit our "changed" signal */
+ g_signal_emit (G_OBJECT (editor), gl_object_editor_signals[CHANGED], 0);
+
+ gl_debug (DEBUG_WDGT, "END");
+}
+
+/*****************************************************************************/
+/* Set data. */
+/*****************************************************************************/
+void
+gl_object_editor_set_data (glObjectEditor *editor,
+ gboolean merge_flag,
+ glTextNode *text_node)
+{
+ gint pos;
+
+ gl_debug (DEBUG_EDITOR, "START");
+
+ g_signal_handlers_block_by_func (G_OBJECT (editor->priv->data_text_entry),
+ G_CALLBACK (gl_object_editor_changed_cb),
+ editor);
+ g_signal_handlers_block_by_func (G_OBJECT (editor->priv->data_key_entry),
+ G_CALLBACK (gl_object_editor_changed_cb),
+ editor);
+
+ gtk_widget_set_sensitive (editor->priv->data_key_radio, merge_flag);
+
+ if (!text_node->field_flag) {
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
+ (editor->priv->data_literal_radio), TRUE);
+ gtk_widget_set_sensitive (editor->priv->data_text_entry, TRUE);
+ gtk_widget_set_sensitive (editor->priv->data_key_combo, FALSE);
+
+ gtk_editable_delete_text (GTK_EDITABLE (editor->priv->data_text_entry), 0, -1);
+ pos = 0;
+ if (text_node->data != NULL ) {
+ gtk_editable_insert_text (GTK_EDITABLE (editor->priv->data_text_entry),
+ text_node->data,
+ strlen (text_node->data),
+ &pos);
+ }
+
+ } else {
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
+ (editor->priv->data_key_radio), TRUE);
+
+ gtk_widget_set_sensitive (editor->priv->data_text_entry, FALSE);
+ gtk_widget_set_sensitive (editor->priv->data_key_combo, TRUE);
+
+ gtk_editable_delete_text (GTK_EDITABLE (editor->priv->data_key_entry), 0, -1);
+ pos = 0;
+ gtk_editable_insert_text (GTK_EDITABLE (editor->priv->data_key_entry),
+ text_node->data,
+ strlen (text_node->data),
+ &pos);
+ }
+
+
+ g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->data_text_entry),
+ G_CALLBACK (gl_object_editor_changed_cb),
+ editor);
+ g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->data_key_entry),
+ G_CALLBACK (gl_object_editor_changed_cb),
+ editor);
+
+ gl_debug (DEBUG_EDITOR, "END");
+}
+
+/*****************************************************************************/
+/* Query data. */
+/*****************************************************************************/
+glTextNode *
+gl_object_editor_get_data (glObjectEditor *editor)
+{
+ glTextNode *text_node;
+
+ gl_debug (DEBUG_EDITOR, "START");
+
+ text_node = g_new0(glTextNode,1);
+
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (editor->priv->data_literal_radio))) {
+ text_node->field_flag = FALSE;
+ text_node->data =
+ gtk_editable_get_chars (GTK_EDITABLE (editor->priv->data_text_entry),
+ 0, -1);
+ } else {
+ text_node->field_flag = TRUE;
+ text_node->data =
+ gtk_editable_get_chars (GTK_EDITABLE (editor->priv->data_key_entry),
+ 0, -1);
+ }
+
+ gl_debug (DEBUG_EDITOR, "text_node: field_flag=%d, data=%s",
+ text_node->field_flag, text_node->data);
+
+ gl_debug (DEBUG_EDITOR, "END");
+
+ return text_node;
+}
+
--- /dev/null
+/*
+ * (GLABELS) Label and Business Card Creation program for GNOME
+ *
+ * object-editor.c: object properties editor module
+ *
+ * Copyright (C) 2003 Jim Evins <evins@snaught.com>.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#include <config.h>
+
+#include <gnome.h>
+#include <math.h>
+
+#include "object-editor.h"
+#include "prefs.h"
+#include "mygal/widget-color-combo.h"
+#include "color.h"
+
+#include "object-editor-private.h"
+
+#include "debug.h"
+
+/*===========================================*/
+/* Private macros */
+/*===========================================*/
+
+/*===========================================*/
+/* Private data types */
+/*===========================================*/
+
+/*===========================================*/
+/* Private globals */
+/*===========================================*/
+
+/*===========================================*/
+/* Local function prototypes */
+/*===========================================*/
+
+static void insert_button_cb (glObjectEditor *editor);
+
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE. Prepare size page. */
+/*--------------------------------------------------------------------------*/
+void
+gl_object_editor_prepare_edit_page (glObjectEditor *editor)
+{
+ GList *family_names = NULL;
+ GtkSizeGroup *label_size_group;
+ GtkWidget *label;
+
+ gl_debug (DEBUG_EDITOR, "START");
+
+ /* Extract widgets from XML tree. */
+ editor->priv->edit_page_vbox =
+ glade_xml_get_widget (editor->priv->gui, "edit_page_vbox");
+ editor->priv->edit_text_view =
+ glade_xml_get_widget (editor->priv->gui, "edit_text_view");
+ editor->priv->edit_key_label =
+ glade_xml_get_widget (editor->priv->gui, "edit_key_label");
+ editor->priv->edit_key_entry =
+ glade_xml_get_widget (editor->priv->gui, "edit_key_entry");
+ editor->priv->edit_key_combo =
+ glade_xml_get_widget (editor->priv->gui, "edit_key_combo");
+ editor->priv->edit_insert_field_button =
+ glade_xml_get_widget (editor->priv->gui, "edit_insert_field_button");
+
+ /* Un-hide */
+ gtk_widget_show_all (editor->priv->edit_page_vbox);
+
+ /* Connect signals */
+ g_signal_connect_swapped (G_OBJECT (editor->priv->edit_insert_field_button),
+ "clicked",
+ G_CALLBACK (insert_button_cb),
+ G_OBJECT (editor));
+
+ gl_debug (DEBUG_EDITOR, "END");
+}
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE. Alignment togglebutton callback. */
+/*--------------------------------------------------------------------------*/
+static void
+insert_button_cb (glObjectEditor *editor)
+{
+ GtkTextBuffer *buffer;
+ gchar *key, *field;
+
+ gl_debug (DEBUG_EDITOR, "START");
+
+ key =
+ gtk_editable_get_chars (GTK_EDITABLE (editor->priv->edit_key_entry), 0, -1);
+ field = g_strdup_printf ("${%s}", key);
+ gl_debug (DEBUG_WDGT, "Inserting %s", field);
+
+ buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (editor->priv->edit_text_view));
+ gtk_text_buffer_insert_at_cursor (buffer, field, -1);
+
+ g_free (field);
+ g_free (key);
+
+
+ gl_debug (DEBUG_EDITOR, "END");
+}
+
+/*****************************************************************************/
+/* Set text buffer as model for text view/editor. */
+/*****************************************************************************/
+void
+gl_object_editor_set_text_buffer (glObjectEditor *editor,
+ GtkTextBuffer *buffer)
+{
+ gl_debug (DEBUG_EDITOR, "START");
+
+ gtk_text_view_set_buffer (GTK_TEXT_VIEW(editor->priv->edit_text_view), buffer);
+
+ gl_debug (DEBUG_EDITOR, "END");
+}
+
--- /dev/null
+/*
+ * (GLABELS) Label and Business Card Creation program for GNOME
+ *
+ * object-editor.c: object properties editor module
+ *
+ * Copyright (C) 2003 Jim Evins <evins@snaught.com>.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#include <config.h>
+
+#include <gnome.h>
+#include <math.h>
+
+#include "object-editor.h"
+#include "prefs.h"
+#include "mygal/widget-color-combo.h"
+#include "color.h"
+
+#include "object-editor-private.h"
+
+#include "debug.h"
+
+/*===========================================*/
+/* Private macros */
+/*===========================================*/
+
+/*===========================================*/
+/* Private data types */
+/*===========================================*/
+
+/*===========================================*/
+/* Private globals */
+/*===========================================*/
+
+/*===========================================*/
+/* Local function prototypes */
+/*===========================================*/
+
+\f
+/*--------------------------------------------------------------------------*/
+/* PRIVATE. Prepare fill page. */
+/*--------------------------------------------------------------------------*/
+void
+gl_object_editor_prepare_fill_page (glObjectEditor *editor)
+{
+ GdkColor *gdk_color;
+
+ gl_debug (DEBUG_EDITOR, "START");
+
+ /* Extract widgets from XML tree. */
+ editor->priv->fill_page_vbox = glade_xml_get_widget (editor->priv->gui,
+ "fill_page_vbox");
+ editor->priv->fill_color_combo = glade_xml_get_widget (editor->priv->gui,
+ "fill_color_combo");
+
+ /* Modify widgets based on configuration */
+ gdk_color = gl_color_to_gdk_color (gl_prefs->default_fill_color);
+ color_combo_set_color (COLOR_COMBO(editor->priv->fill_color_combo), gdk_color);
+ g_free (gdk_color);
+
+ /* Un-hide */
+ gtk_widget_show_all (editor->priv->fill_page_vbox);
+
+ /* Connect signals */
+ g_signal_connect_swapped (G_OBJECT (editor->priv->fill_color_combo),
+ "color_changed",
+ G_CALLBACK (gl_object_editor_changed_cb),
+ G_OBJECT (editor));
+
+ gl_debug (DEBUG_EDITOR, "END");
+}
+
+/*****************************************************************************/
+/* Set fill color. */
+/*****************************************************************************/
+void
+gl_object_editor_set_fill_color (glObjectEditor *editor,
+ guint color)
+{
+ GdkColor *gdk_color;
+
+ gl_debug (DEBUG_EDITOR, "START");
+
+ g_signal_handlers_block_by_func (G_OBJECT(editor->priv->fill_color_combo),
+ gl_object_editor_changed_cb,
+ editor);
+
+ gdk_color = gl_color_to_gdk_color (color);
+ color_combo_set_color (COLOR_COMBO(editor->priv->fill_color_combo), gdk_color);
+ g_free (gdk_color);
+
+ g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->fill_color_combo),
+ gl_object_editor_changed_cb,
+ editor);
+
+ gl_debug (DEBUG_EDITOR, "END");
+}
+
+/*****************************************************************************/
+/* Query fill color. */
+/*****************************************************************************/
+guint
+gl_object_editor_get_fill_color (glObjectEditor *editor)
+{
+ GdkColor *gdk_color;
+ gboolean is_default;
+ guint color;
+
+ gl_debug (DEBUG_EDITOR, "START");
+
+ gdk_color = color_combo_get_color (COLOR_COMBO(editor->priv->fill_color_combo),
+ &is_default);
+
+ if (is_default) {
+ color = GL_COLOR_NONE;
+ } else {
+ color = gl_color_from_gdk_color (gdk_color);
+ }
+
+ gl_debug (DEBUG_EDITOR, "END");
+
+ return color;
+}
+
--- /dev/null
+/*
+ * (GLABELS) Label and Business Card Creation program for GNOME
+ *
+ * object-editor.c: object properties editor module
+ *
+ * Copyright (C) 2003 Jim Evins <evins@snaught.com>.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#include <config.h>
+
+#include <gnome.h>
+#include <math.h>
+
+#include "object-editor.h"
+#include "prefs.h"
+
+#include "object-editor-private.h"
+
+#include "debug.h"
+
+/*===========================================*/
+/* Private macros */
+/*===========================================*/
+
+/*===========================================*/
+/* Private data types */
+/*===========================================*/
+
+/*===========================================*/
+/* Private globals */
+/*===========================================*/
+
+/*===========================================*/
+/* Local function prototypes */
+/*===========================================*/
+
+static void img_radio_toggled_cb (glObjectEditor *editor);
+
+
+\f
+/*--------------------------------------------------------------------------*/
+/* PRIVATE. Prepare image page. */
+/*--------------------------------------------------------------------------*/
+void
+gl_object_editor_prepare_image_page (glObjectEditor *editor)
+{
+ GdkColor *gdk_color;
+ GtkSizeGroup *label_size_group;
+
+ gl_debug (DEBUG_EDITOR, "START");
+
+ /* Extract widgets from XML tree. */
+ editor->priv->img_page_vbox = glade_xml_get_widget (editor->priv->gui,
+ "img_page_vbox");
+ editor->priv->img_file_radio = glade_xml_get_widget (editor->priv->gui,
+ "img_file_radio");
+ editor->priv->img_key_radio = glade_xml_get_widget (editor->priv->gui,
+ "img_key_radio");
+ editor->priv->img_pixmap_entry = glade_xml_get_widget (editor->priv->gui,
+ "img_pixmap_entry");
+ editor->priv->img_key_combo = glade_xml_get_widget (editor->priv->gui,
+ "img_key_combo");
+ editor->priv->img_key_entry = glade_xml_get_widget (editor->priv->gui,
+ "img_key_entry");
+
+ /* Align label widths */
+ label_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+ gtk_size_group_add_widget (label_size_group, editor->priv->img_file_radio);
+ gtk_size_group_add_widget (label_size_group, editor->priv->img_key_radio);
+
+ /* Un-hide */
+ gtk_widget_show_all (editor->priv->img_page_vbox);
+
+ /* Connect signals */
+ g_signal_connect_swapped (G_OBJECT (editor->priv->img_pixmap_entry),
+ "activate",
+ G_CALLBACK (gl_object_editor_changed_cb),
+ G_OBJECT (editor));
+ g_signal_connect_swapped (G_OBJECT (editor->priv->img_key_entry),
+ "changed",
+ G_CALLBACK (gl_object_editor_changed_cb),
+ G_OBJECT (editor));
+ g_signal_connect_swapped (G_OBJECT (editor->priv->img_file_radio),
+ "toggled",
+ G_CALLBACK (img_radio_toggled_cb),
+ G_OBJECT (editor));
+ g_signal_connect_swapped (G_OBJECT (editor->priv->img_key_radio),
+ "toggled",
+ G_CALLBACK (img_radio_toggled_cb),
+ G_OBJECT (editor));
+
+ gl_debug (DEBUG_EDITOR, "END");
+}
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE. image radio callback. */
+/*--------------------------------------------------------------------------*/
+static void
+img_radio_toggled_cb (glObjectEditor *editor)
+{
+ gl_debug (DEBUG_WDGT, "START");
+
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (editor->priv->img_file_radio))) {
+ gtk_widget_set_sensitive (editor->priv->img_pixmap_entry, TRUE);
+ gtk_widget_set_sensitive (editor->priv->img_key_combo, FALSE);
+ } else {
+ gtk_widget_set_sensitive (editor->priv->img_pixmap_entry, FALSE);
+ gtk_widget_set_sensitive (editor->priv->img_key_combo, TRUE);
+ }
+
+ /* Emit our "changed" signal */
+ g_signal_emit (G_OBJECT (editor), gl_object_editor_signals[CHANGED], 0);
+
+ gl_debug (DEBUG_WDGT, "END");
+}
+
+/*****************************************************************************/
+/* Set image. */
+/*****************************************************************************/
+void
+gl_object_editor_set_image (glObjectEditor *editor,
+ gboolean merge_flag,
+ glTextNode *text_node)
+{
+ gint pos;
+
+ gl_debug (DEBUG_EDITOR, "START");
+
+ g_signal_handlers_block_by_func (G_OBJECT (editor->priv->img_pixmap_entry),
+ G_CALLBACK (gl_object_editor_changed_cb),
+ editor);
+ g_signal_handlers_block_by_func (G_OBJECT (editor->priv->img_key_entry),
+ G_CALLBACK (gl_object_editor_changed_cb),
+ editor);
+
+ gtk_widget_set_sensitive (editor->priv->img_key_radio, merge_flag);
+
+ if (!text_node->field_flag) {
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
+ (editor->priv->img_file_radio), TRUE);
+ gtk_widget_set_sensitive (editor->priv->img_pixmap_entry, TRUE);
+ gtk_widget_set_sensitive (editor->priv->img_key_combo, FALSE);
+
+ if (text_node->data != NULL ) {
+ gnome_file_entry_set_filename (GNOME_FILE_ENTRY(editor->priv->img_pixmap_entry),
+ text_node->data);
+ } else {
+ gnome_file_entry_set_filename (GNOME_FILE_ENTRY(editor->priv->img_pixmap_entry),
+ "");
+ }
+ } else {
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
+ (editor->priv->img_key_radio), TRUE);
+
+ gtk_widget_set_sensitive (editor->priv->img_pixmap_entry, FALSE);
+ gtk_widget_set_sensitive (editor->priv->img_key_combo, TRUE);
+
+ gtk_editable_delete_text (GTK_EDITABLE (editor->priv->img_key_entry), 0, -1);
+ pos = 0;
+ gtk_editable_insert_text (GTK_EDITABLE (editor->priv->img_key_entry),
+ text_node->data,
+ strlen (text_node->data),
+ &pos);
+ }
+
+ g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->img_pixmap_entry),
+ G_CALLBACK (gl_object_editor_changed_cb),
+ editor);
+ g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->img_key_entry),
+ G_CALLBACK (gl_object_editor_changed_cb),
+ editor);
+
+ gl_debug (DEBUG_EDITOR, "END");
+}
+
+/*****************************************************************************/
+/* Query image. */
+/*****************************************************************************/
+glTextNode *
+gl_object_editor_get_image (glObjectEditor *editor)
+{
+ glTextNode *text_node;
+
+ gl_debug (DEBUG_EDITOR, "START");
+
+ text_node = g_new0(glTextNode,1);
+
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (editor->priv->img_file_radio))) {
+ text_node->field_flag = FALSE;
+ text_node->data =
+ gnome_pixmap_entry_get_filename (GNOME_PIXMAP_ENTRY(editor->priv->img_pixmap_entry));
+ } else {
+ text_node->field_flag = TRUE;
+ text_node->data =
+ gtk_editable_get_chars (GTK_EDITABLE (editor->priv->img_key_entry),
+ 0, -1);
+ }
+
+ gl_debug (DEBUG_EDITOR, "text_node: field_flag=%d, data=%s",
+ text_node->field_flag, text_node->data);
+
+ gl_debug (DEBUG_EDITOR, "END");
+
+ return text_node;
+}
+
--- /dev/null
+/*
+ * (GLABELS) Label and Business Card Creation program for GNOME
+ *
+ * object-editor.c: object properties editor module
+ *
+ * Copyright (C) 2003 Jim Evins <evins@snaught.com>.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#include <config.h>
+
+#include <gnome.h>
+#include <math.h>
+
+#include "object-editor.h"
+#include "prefs.h"
+#include "mygal/widget-color-combo.h"
+#include "color.h"
+
+#include "object-editor-private.h"
+
+#include "debug.h"
+
+/*===========================================*/
+/* Private macros */
+/*===========================================*/
+
+/*===========================================*/
+/* Private data types */
+/*===========================================*/
+
+/*===========================================*/
+/* Private globals */
+/*===========================================*/
+
+/*===========================================*/
+/* Local function prototypes */
+/*===========================================*/
+
+\f
+/*--------------------------------------------------------------------------*/
+/* PRIVATE. Prepare line page. */
+/*--------------------------------------------------------------------------*/
+void
+gl_object_editor_prepare_line_page (glObjectEditor *editor)
+{
+ GdkColor *gdk_color;
+ GtkSizeGroup *label_size_group;
+ GtkWidget *label;
+
+ gl_debug (DEBUG_EDITOR, "START");
+
+ /* Extract widgets from XML tree. */
+ editor->priv->line_page_vbox = glade_xml_get_widget (editor->priv->gui,
+ "line_page_vbox");
+ editor->priv->line_width_spin = glade_xml_get_widget (editor->priv->gui,
+ "line_width_spin");
+ editor->priv->line_color_combo = glade_xml_get_widget (editor->priv->gui,
+ "line_color_combo");
+
+ /* Modify widgets based on configuration */
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->line_width_spin),
+ gl_prefs->default_line_width);
+ gdk_color = gl_color_to_gdk_color (gl_prefs->default_line_color);
+ color_combo_set_color (COLOR_COMBO(editor->priv->line_color_combo), gdk_color);
+ g_free (gdk_color);
+
+ /* Align label widths */
+ label_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+ label = glade_xml_get_widget (editor->priv->gui, "line_w_label");
+ gtk_size_group_add_widget (label_size_group, label);
+ label = glade_xml_get_widget (editor->priv->gui, "line_color_label");
+ gtk_size_group_add_widget (label_size_group, label);
+
+ /* Un-hide */
+ gtk_widget_show_all (editor->priv->line_page_vbox);
+
+ /* Connect signals */
+ g_signal_connect_swapped (G_OBJECT (editor->priv->line_width_spin),
+ "changed",
+ G_CALLBACK (gl_object_editor_changed_cb),
+ G_OBJECT (editor));
+ g_signal_connect_swapped (G_OBJECT (editor->priv->line_color_combo),
+ "color_changed",
+ G_CALLBACK (gl_object_editor_changed_cb),
+ G_OBJECT (editor));
+
+ gl_debug (DEBUG_EDITOR, "END");
+}
+
+/*****************************************************************************/
+/* Set line width. */
+/*****************************************************************************/
+void
+gl_object_editor_set_line_width (glObjectEditor *editor,
+ gdouble width)
+{
+ gl_debug (DEBUG_EDITOR, "START");
+
+ g_signal_handlers_block_by_func (G_OBJECT(editor->priv->line_width_spin),
+ gl_object_editor_changed_cb,
+ editor);
+
+ /* Set widget values */
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->line_width_spin),
+ width);
+
+ g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->line_width_spin),
+ gl_object_editor_changed_cb,
+ editor);
+
+ gl_debug (DEBUG_EDITOR, "END");
+}
+
+/*****************************************************************************/
+/* Query line width. */
+/*****************************************************************************/
+gdouble
+gl_object_editor_get_line_width (glObjectEditor *editor)
+{
+ gdouble w;
+
+ gl_debug (DEBUG_EDITOR, "START");
+
+ w = gtk_spin_button_get_value (GTK_SPIN_BUTTON(editor->priv->line_width_spin));
+
+ gl_debug (DEBUG_EDITOR, "END");
+
+ return w;
+}
+
+/*****************************************************************************/
+/* Set line color. */
+/*****************************************************************************/
+void
+gl_object_editor_set_line_color (glObjectEditor *editor,
+ guint color)
+{
+ GdkColor *gdk_color;
+
+ gl_debug (DEBUG_EDITOR, "START");
+
+ g_signal_handlers_block_by_func (G_OBJECT(editor->priv->line_color_combo),
+ gl_object_editor_changed_cb,
+ editor);
+
+ gdk_color = gl_color_to_gdk_color (color);
+ color_combo_set_color (COLOR_COMBO(editor->priv->line_color_combo), gdk_color);
+ g_free (gdk_color);
+
+ g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->line_color_combo),
+ gl_object_editor_changed_cb,
+ editor);
+
+ gl_debug (DEBUG_EDITOR, "END");
+}
+
+/*****************************************************************************/
+/* Query line color. */
+/*****************************************************************************/
+guint
+gl_object_editor_get_line_color (glObjectEditor *editor)
+{
+ GdkColor *gdk_color;
+ gboolean is_default;
+ guint color;
+
+ gl_debug (DEBUG_EDITOR, "START");
+
+ gdk_color = color_combo_get_color (COLOR_COMBO(editor->priv->line_color_combo),
+ &is_default);
+
+ if (is_default) {
+ color = GL_COLOR_NONE;
+ } else {
+ color = gl_color_from_gdk_color (gdk_color);
+ }
+
+ gl_debug (DEBUG_EDITOR, "END");
+
+ return color;
+}
+
--- /dev/null
+/*
+ * (GLABELS) Label and Business Card Creation program for GNOME
+ *
+ * object-editor.c: object properties editor module
+ *
+ * Copyright (C) 2003 Jim Evins <evins@snaught.com>.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#include <config.h>
+
+#include <gnome.h>
+#include <math.h>
+
+#include "object-editor.h"
+#include "prefs.h"
+
+#include "object-editor-private.h"
+
+#include "debug.h"
+
+/*===========================================*/
+/* Private macros */
+/*===========================================*/
+
+#define LENGTH(x,y) sqrt( (x)*(x) + (y)*(y) )
+#define ANGLE(x,y) ( (180.0/G_PI)*atan2( -(y), (x) ) )
+#define COMP_X(l,a) ( (l) * cos( (G_PI/180.0)*(a) ) )
+#define COMP_Y(l,a) ( -(l) * sin( (G_PI/180.0)*(a) ) )
+
+
+/*===========================================*/
+/* Private data types */
+/*===========================================*/
+
+/*===========================================*/
+/* Private globals */
+/*===========================================*/
+
+/*===========================================*/
+/* Local function prototypes */
+/*===========================================*/
+
+
+\f
+/*--------------------------------------------------------------------------*/
+/* PRIVATE. Prepare line size page. */
+/*--------------------------------------------------------------------------*/
+void
+gl_object_editor_prepare_lsize_page (glObjectEditor *editor)
+{
+ const gchar *units_string;
+ gdouble climb_rate;
+ gint digits;
+ GtkSizeGroup *label_size_group;
+ GtkWidget *label;
+
+ gl_debug (DEBUG_EDITOR, "START");
+
+ /* Extract widgets from XML tree. */
+ editor->priv->lsize_page_vbox =
+ glade_xml_get_widget (editor->priv->gui, "lsize_page_vbox");
+ editor->priv->lsize_r_spin =
+ glade_xml_get_widget (editor->priv->gui, "lsize_r_spin");
+ editor->priv->lsize_theta_spin =
+ glade_xml_get_widget (editor->priv->gui, "lsize_theta_spin");
+ editor->priv->lsize_r_units_label =
+ glade_xml_get_widget (editor->priv->gui, "lsize_r_units_label");
+
+ /* Get 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 ();
+
+ /* Modify widgets based on configuration */
+ 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);
+ gtk_label_set_text (GTK_LABEL(editor->priv->lsize_r_units_label), units_string);
+
+ /* Align label widths */
+ label_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+ label = glade_xml_get_widget (editor->priv->gui, "lsize_r_label");
+ gtk_size_group_add_widget (label_size_group, label);
+ label = glade_xml_get_widget (editor->priv->gui, "lsize_theta_label");
+ gtk_size_group_add_widget (label_size_group, label);
+
+ /* Un-hide */
+ gtk_widget_show_all (editor->priv->lsize_page_vbox);
+
+ /* Connect signals */
+ g_signal_connect_swapped (G_OBJECT (editor->priv->lsize_r_spin),
+ "changed",
+ G_CALLBACK (gl_object_editor_changed_cb),
+ G_OBJECT (editor));
+ g_signal_connect_swapped (G_OBJECT (editor->priv->lsize_theta_spin),
+ "changed",
+ G_CALLBACK (gl_object_editor_changed_cb),
+ G_OBJECT (editor));
+
+ gl_debug (DEBUG_EDITOR, "END");
+}
+
+/*****************************************************************************/
+/* Set line size. */
+/*****************************************************************************/
+void
+gl_object_editor_set_lsize (glObjectEditor *editor,
+ gdouble dx,
+ gdouble dy)
+{
+ gdouble r, theta;
+
+ gl_debug (DEBUG_EDITOR, "START");
+
+ g_signal_handlers_block_by_func (G_OBJECT(editor->priv->lsize_r_spin),
+ gl_object_editor_changed_cb,
+ editor);
+ g_signal_handlers_block_by_func (G_OBJECT(editor->priv->lsize_theta_spin),
+ gl_object_editor_changed_cb,
+ editor);
+
+ /* convert internal units to displayed units */
+ gl_debug (DEBUG_EDITOR, "internal dx,dy = %g, %g", dx, dy);
+ dx *= editor->priv->units_per_point;
+ dy *= editor->priv->units_per_point;
+ gl_debug (DEBUG_EDITOR, "display dx,dy = %g, %g", dx, dy);
+
+ r = LENGTH (dx, dy);
+ theta = ANGLE (dx, dy);
+
+ /* Set widget values */
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->lsize_r_spin), r);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->lsize_theta_spin),
+ theta);
+
+ g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->lsize_r_spin),
+ gl_object_editor_changed_cb,
+ editor);
+ g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->lsize_theta_spin),
+ gl_object_editor_changed_cb,
+ editor);
+
+ gl_debug (DEBUG_EDITOR, "END");
+}
+
+/*****************************************************************************/
+/* Set maximum line size. */
+/*****************************************************************************/
+void
+gl_object_editor_set_max_lsize (glObjectEditor *editor,
+ gdouble dx_max,
+ gdouble dy_max)
+{
+ gl_debug (DEBUG_EDITOR, "START");
+
+ g_signal_handlers_block_by_func (G_OBJECT(editor->priv->lsize_r_spin),
+ gl_object_editor_changed_cb,
+ editor);
+
+ /* 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;
+ dy_max *= editor->priv->units_per_point;
+ gl_debug (DEBUG_EDITOR, "display dx_max,dy_max = %g, %g", dx_max, dy_max);
+
+ /* Set widget values */
+ gtk_spin_button_set_range (GTK_SPIN_BUTTON (editor->priv->lsize_r_spin),
+ 0.0, LENGTH (dx_max, dy_max));
+
+ g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->lsize_r_spin),
+ gl_object_editor_changed_cb,
+ editor);
+
+ gl_debug (DEBUG_EDITOR, "END");
+}
+
+/*****************************************************************************/
+/* Query line size. */
+/*****************************************************************************/
+void
+gl_object_editor_get_lsize (glObjectEditor *editor,
+ gdouble *dx,
+ gdouble *dy)
+{
+ gdouble r, theta;
+
+ gl_debug (DEBUG_EDITOR, "START");
+
+ /* Get values from widgets */
+ r = gtk_spin_button_get_value (GTK_SPIN_BUTTON (editor->priv->lsize_r_spin));
+ theta = gtk_spin_button_get_value (GTK_SPIN_BUTTON (editor->priv->lsize_theta_spin));
+
+ /* convert everything back to our internal units (points) */
+ r /= editor->priv->units_per_point;
+
+ *dx = COMP_X (r, theta);
+ *dy = COMP_Y (r, theta);
+
+ gl_debug (DEBUG_EDITOR, "END");
+}
+
--- /dev/null
+/*
+ * (GLABELS) Label and Business Card Creation program for GNOME
+ *
+ * object-editor.c: object properties editor module
+ *
+ * Copyright (C) 2003 Jim Evins <evins@snaught.com>.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#include <config.h>
+
+#include <gnome.h>
+#include <math.h>
+
+#include "object-editor.h"
+#include "prefs.h"
+
+#include "object-editor-private.h"
+
+#include "debug.h"
+
+/*===========================================*/
+/* Private macros */
+/*===========================================*/
+
+/*===========================================*/
+/* Private data types */
+/*===========================================*/
+
+/*===========================================*/
+/* Private globals */
+/*===========================================*/
+
+/*===========================================*/
+/* Local function prototypes */
+/*===========================================*/
+
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE. Prepare position page. */
+/*--------------------------------------------------------------------------*/
+void
+gl_object_editor_prepare_position_page (glObjectEditor *editor)
+{
+ const gchar *units_string;
+ gdouble climb_rate;
+ gint digits;
+ GtkSizeGroup *label_size_group;
+ GtkWidget *label;
+
+ gl_debug (DEBUG_EDITOR, "START");
+
+ /* Extract widgets from XML tree. */
+ editor->priv->pos_page_vbox = glade_xml_get_widget (editor->priv->gui,
+ "pos_page_vbox");
+ editor->priv->pos_x_spin = glade_xml_get_widget (editor->priv->gui,
+ "pos_x_spin");
+ editor->priv->pos_y_spin = glade_xml_get_widget (editor->priv->gui,
+ "pos_y_spin");
+ editor->priv->pos_x_units_label = glade_xml_get_widget (editor->priv->gui,
+ "pos_x_units_label");
+ editor->priv->pos_y_units_label = glade_xml_get_widget (editor->priv->gui,
+ "pos_y_units_label");
+
+ /* Get 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 ();
+
+ /* Modify widgets based on configuration */
+ gtk_spin_button_set_digits (GTK_SPIN_BUTTON(editor->priv->pos_x_spin), digits);
+ gtk_spin_button_set_increments (GTK_SPIN_BUTTON(editor->priv->pos_x_spin),
+ climb_rate, 10.0*climb_rate);
+ gtk_label_set_text (GTK_LABEL(editor->priv->pos_x_units_label), units_string);
+ 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_y_spin),
+ climb_rate, 10.0*climb_rate);
+ gtk_label_set_text (GTK_LABEL(editor->priv->pos_y_units_label), units_string);
+
+ /* Align label widths */
+ label_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+ label = glade_xml_get_widget (editor->priv->gui, "pos_x_label");
+ gtk_size_group_add_widget (label_size_group, label);
+ label = glade_xml_get_widget (editor->priv->gui, "pos_y_label");
+ gtk_size_group_add_widget (label_size_group, label);
+
+ /* Un-hide */
+ gtk_widget_show_all (editor->priv->pos_page_vbox);
+
+ /* Connect signals */
+ g_signal_connect_swapped (G_OBJECT (editor->priv->pos_x_spin),
+ "changed",
+ G_CALLBACK (gl_object_editor_changed_cb),
+ G_OBJECT (editor));
+ g_signal_connect_swapped (G_OBJECT (editor->priv->pos_y_spin),
+ "changed",
+ G_CALLBACK (gl_object_editor_changed_cb),
+ G_OBJECT (editor));
+
+ gl_debug (DEBUG_EDITOR, "END");
+}
+
+/*****************************************************************************/
+/* Set position. */
+/*****************************************************************************/
+void
+gl_object_editor_set_position (glObjectEditor *editor,
+ gdouble x,
+ gdouble y)
+{
+ gl_debug (DEBUG_EDITOR, "START");
+
+ 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);
+
+ /* convert internal units to displayed units */
+ gl_debug (DEBUG_EDITOR, "internal x,y = %g, %g", x, y);
+ x *= editor->priv->units_per_point;
+ y *= editor->priv->units_per_point;
+ gl_debug (DEBUG_EDITOR, "display x,y = %g, %g", x, y);
+
+ /* Set widget values */
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->pos_x_spin), x);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->pos_y_spin), y);
+
+ 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);
+
+ gl_debug (DEBUG_EDITOR, "END");
+}
+
+/*****************************************************************************/
+/* Set maximum position. */
+/*****************************************************************************/
+void
+gl_object_editor_set_max_position (glObjectEditor *editor,
+ gdouble x_max,
+ gdouble y_max)
+{
+ gdouble tmp;
+
+ gl_debug (DEBUG_EDITOR, "START");
+
+ 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);
+
+ /* 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;
+ y_max *= editor->priv->units_per_point;
+ gl_debug (DEBUG_EDITOR, "display x_max,y_max = %g, %g", x_max, y_max);
+
+ /* Set widget values */
+ tmp = gtk_spin_button_get_value (GTK_SPIN_BUTTON (editor->priv->pos_x_spin));
+ gtk_spin_button_set_range (GTK_SPIN_BUTTON (editor->priv->pos_x_spin),
+ 0.0, x_max);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->pos_x_spin), tmp);
+ tmp = gtk_spin_button_get_value (GTK_SPIN_BUTTON (editor->priv->pos_y_spin));
+ gtk_spin_button_set_range (GTK_SPIN_BUTTON (editor->priv->pos_y_spin),
+ 0.0, y_max);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->pos_y_spin), tmp);
+
+ 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);
+
+ gl_debug (DEBUG_EDITOR, "END");
+}
+
+/*****************************************************************************/
+/* Query position. */
+/*****************************************************************************/
+void
+gl_object_editor_get_position (glObjectEditor *editor,
+ gdouble *x,
+ gdouble *y)
+{
+ gl_debug (DEBUG_EDITOR, "START");
+
+ /* Get values from widgets */
+ *x = gtk_spin_button_get_value (GTK_SPIN_BUTTON (editor->priv->pos_x_spin));
+ *y = gtk_spin_button_get_value (GTK_SPIN_BUTTON (editor->priv->pos_y_spin));
+
+ /* convert everything back to our internal units (points) */
+ *x /= editor->priv->units_per_point;
+ *y /= editor->priv->units_per_point;
+
+ gl_debug (DEBUG_EDITOR, "END");
+}
+
--- /dev/null
+/*
+ * (GLABELS) Label and Business Card Creation program for GNOME
+ *
+ * object-editor-private.h: object properties editor module private header file
+ *
+ * Copyright (C) 2003 Jim Evins <evins@snaught.com>.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#ifndef __OBJECT_EDITOR_PRIVATE_H__
+#define __OBJECT_EDITOR_PRIVATE_H__
+
+#include <gtk/gtk.h>
+#include <glade/glade-xml.h>
+
+G_BEGIN_DECLS
+
+struct _glObjectEditorPrivate {
+
+ GladeXML *gui;
+ GtkWidget *editor_vbox;
+
+ gdouble units_per_point;
+
+ GtkWidget *title_image;
+ GtkWidget *title_label;
+ GtkWidget *notebook;
+
+ GtkWidget *pos_page_vbox;
+ GtkWidget *pos_x_spin;
+ GtkWidget *pos_y_spin;
+ GtkWidget *pos_x_units_label;
+ GtkWidget *pos_y_units_label;
+
+ GtkWidget *size_page_vbox;
+ GtkWidget *size_w_spin;
+ GtkWidget *size_h_spin;
+ GtkWidget *size_w_units_label;
+ GtkWidget *size_h_units_label;
+ GtkWidget *size_aspect_checkbutton;
+ GtkWidget *size_reset_image_button;
+ gdouble size_aspect_ratio;
+ gdouble w_base;
+ gdouble h_base;
+
+ GtkWidget *lsize_page_vbox;
+ GtkWidget *lsize_r_spin;
+ GtkWidget *lsize_theta_spin;
+ GtkWidget *lsize_r_units_label;
+
+ GtkWidget *fill_page_vbox;
+ GtkWidget *fill_color_combo;
+
+ GtkWidget *line_page_vbox;
+ GtkWidget *line_width_spin;
+ GtkWidget *line_color_combo;
+
+ GtkWidget *img_page_vbox;
+ GtkWidget *img_file_radio;
+ GtkWidget *img_key_radio;
+ GtkWidget *img_pixmap_entry;
+ GtkWidget *img_key_combo;
+ GtkWidget *img_key_entry;
+
+ GtkWidget *text_page_vbox;
+ GtkWidget *text_family_entry;
+ GtkWidget *text_family_combo;
+ GtkWidget *text_size_spin;
+ GtkWidget *text_bold_toggle;
+ GtkWidget *text_italic_toggle;
+ GtkWidget *text_color_combo;
+ GtkWidget *text_left_toggle;
+ GtkWidget *text_center_toggle;
+ GtkWidget *text_right_toggle;
+
+ GtkWidget *edit_page_vbox;
+ GtkWidget *edit_text_view;
+ GtkWidget *edit_key_label;
+ GtkWidget *edit_key_entry;
+ GtkWidget *edit_key_combo;
+ GtkWidget *edit_insert_field_button;
+
+ GtkWidget *bc_page_vbox;
+ GtkWidget *bc_style_entry;
+ GtkWidget *bc_style_combo;
+ GtkWidget *bc_text_check;
+ GtkWidget *bc_cs_check;
+ GtkWidget *bc_color_combo;
+
+ GtkWidget *data_page_vbox;
+ GtkWidget *data_literal_radio;
+ GtkWidget *data_key_radio;
+ GtkWidget *data_text_entry;
+ GtkWidget *data_key_entry;
+ GtkWidget *data_key_combo;
+
+};
+
+enum {
+ CHANGED,
+ LAST_SIGNAL
+};
+
+extern gint gl_object_editor_signals[LAST_SIGNAL];
+
+
+
+void gl_object_editor_prepare_position_page (glObjectEditor *editor);
+
+void gl_object_editor_prepare_size_page (glObjectEditor *editor,
+ glObjectEditorOption option);
+
+void gl_object_editor_prepare_lsize_page (glObjectEditor *editor);
+
+void gl_object_editor_prepare_fill_page (glObjectEditor *editor);
+
+void gl_object_editor_prepare_line_page (glObjectEditor *editor);
+
+void gl_object_editor_prepare_image_page (glObjectEditor *editor);
+
+void gl_object_editor_prepare_text_page (glObjectEditor *editor);
+
+void gl_object_editor_prepare_edit_page (glObjectEditor *editor);
+
+void gl_object_editor_prepare_bc_page (glObjectEditor *editor);
+
+void gl_object_editor_prepare_data_page (glObjectEditor *editor);
+
+
+void gl_object_editor_changed_cb (glObjectEditor *editor);
+
+G_END_DECLS
+
+#endif
--- /dev/null
+/*
+ * (GLABELS) Label and Business Card Creation program for GNOME
+ *
+ * object-editor.c: object properties editor module
+ *
+ * Copyright (C) 2003 Jim Evins <evins@snaught.com>.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#include <config.h>
+
+#include <gnome.h>
+#include <math.h>
+
+#include "object-editor.h"
+#include "prefs.h"
+
+#include "object-editor-private.h"
+
+#include "debug.h"
+
+/*===========================================*/
+/* Private macros */
+/*===========================================*/
+
+/*===========================================*/
+/* Private data types */
+/*===========================================*/
+
+/*===========================================*/
+/* Private globals */
+/*===========================================*/
+
+/*===========================================*/
+/* Local function prototypes */
+/*===========================================*/
+
+static void aspect_toggle_cb (glObjectEditor *editor);
+static void size_reset_cb (glObjectEditor *editor);
+static void w_spin_cb (glObjectEditor *editor);
+static void h_spin_cb (glObjectEditor *editor);
+
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE. Prepare size page. */
+/*--------------------------------------------------------------------------*/
+void
+gl_object_editor_prepare_size_page (glObjectEditor *editor,
+ glObjectEditorOption option)
+{
+ const gchar *units_string;
+ gdouble climb_rate;
+ gint digits;
+ GtkSizeGroup *label_size_group;
+ GtkWidget *label;
+
+ gl_debug (DEBUG_EDITOR, "START");
+
+ /* Extract widgets from XML tree. */
+ editor->priv->size_page_vbox =
+ glade_xml_get_widget (editor->priv->gui, "size_page_vbox");
+ editor->priv->size_w_spin =
+ glade_xml_get_widget (editor->priv->gui, "size_w_spin");
+ editor->priv->size_h_spin =
+ glade_xml_get_widget (editor->priv->gui, "size_h_spin");
+ editor->priv->size_w_units_label =
+ glade_xml_get_widget (editor->priv->gui, "size_w_units_label");
+ editor->priv->size_h_units_label =
+ glade_xml_get_widget (editor->priv->gui, "size_h_units_label");
+ editor->priv->size_aspect_checkbutton =
+ glade_xml_get_widget (editor->priv->gui, "size_aspect_checkbutton");
+ editor->priv->size_reset_image_button =
+ glade_xml_get_widget (editor->priv->gui, "size_reset_image_button");
+
+ /* Get 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 ();
+
+ /* Modify widgets based on configuration */
+ gtk_spin_button_set_digits (GTK_SPIN_BUTTON(editor->priv->size_w_spin), digits);
+ gtk_spin_button_set_increments (GTK_SPIN_BUTTON(editor->priv->size_w_spin),
+ climb_rate, 10.0*climb_rate);
+ gtk_label_set_text (GTK_LABEL(editor->priv->size_w_units_label), units_string);
+ 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_h_spin),
+ climb_rate, 10.0*climb_rate);
+ gtk_label_set_text (GTK_LABEL(editor->priv->size_h_units_label), units_string);
+
+ /* Align label widths */
+ label_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+ label = glade_xml_get_widget (editor->priv->gui, "size_w_label");
+ gtk_size_group_add_widget (label_size_group, label);
+ label = glade_xml_get_widget (editor->priv->gui, "size_h_label");
+ gtk_size_group_add_widget (label_size_group, label);
+
+ /* Un-hide */
+ gtk_widget_show_all (editor->priv->size_page_vbox);
+ if (option != GL_OBJECT_EDITOR_SIZE_IMAGE_PAGE) {
+ gtk_widget_hide (editor->priv->size_reset_image_button);
+ }
+
+ /* Connect signals */
+ g_signal_connect_swapped (G_OBJECT (editor->priv->size_aspect_checkbutton),
+ "toggled",
+ G_CALLBACK (aspect_toggle_cb),
+ G_OBJECT (editor));
+ g_signal_connect_swapped (G_OBJECT (editor->priv->size_w_spin),
+ "changed",
+ G_CALLBACK (w_spin_cb),
+ G_OBJECT (editor));
+ g_signal_connect_swapped (G_OBJECT (editor->priv->size_h_spin),
+ "changed",
+ G_CALLBACK (h_spin_cb),
+ G_OBJECT (editor));
+
+ if (option == GL_OBJECT_EDITOR_SIZE_IMAGE_PAGE) {
+ g_signal_connect_swapped (G_OBJECT (editor->priv->size_reset_image_button),
+ "clicked",
+ G_CALLBACK (size_reset_cb),
+ G_OBJECT (editor));
+ }
+
+ gl_debug (DEBUG_EDITOR, "END");
+}
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE. Maintain aspect ratio checkbox callback. */
+/*--------------------------------------------------------------------------*/
+static void
+aspect_toggle_cb (glObjectEditor *editor)
+{
+ GtkToggleButton *toggle;
+ gdouble w, h;
+
+ toggle = GTK_TOGGLE_BUTTON (editor->priv->size_aspect_checkbutton);
+
+ if (gtk_toggle_button_get_active (toggle)) {
+
+ w = gtk_spin_button_get_value (GTK_SPIN_BUTTON(editor->priv->size_w_spin));
+ h = gtk_spin_button_get_value (GTK_SPIN_BUTTON(editor->priv->size_h_spin));
+
+ editor->priv->size_aspect_ratio = h / w;
+
+ }
+}
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE. W spin button changed callback. */
+/*--------------------------------------------------------------------------*/
+static void
+w_spin_cb (glObjectEditor *editor)
+{
+ gdouble w, h;
+ GtkToggleButton *toggle;
+
+ toggle = GTK_TOGGLE_BUTTON (editor->priv->size_aspect_checkbutton);
+
+ if (gtk_toggle_button_get_active (toggle)) {
+
+ w = gtk_spin_button_get_value (GTK_SPIN_BUTTON (editor->priv->size_w_spin));
+
+ h = w * editor->priv->size_aspect_ratio;
+
+ /* Update our sibling control, blocking recursion. */
+ g_signal_handlers_block_by_func (G_OBJECT (editor->priv->size_h_spin),
+ G_CALLBACK (h_spin_cb),
+ editor);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->size_h_spin), h);
+ g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->size_h_spin),
+ G_CALLBACK (h_spin_cb),
+ editor);
+ }
+
+ /* Emit our "changed" signal */
+ g_signal_emit (G_OBJECT (editor), gl_object_editor_signals[CHANGED], 0);
+
+}
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE. H spin button changed callback. */
+/*--------------------------------------------------------------------------*/
+static void
+h_spin_cb (glObjectEditor *editor)
+{
+ gdouble w, h;
+
+ GtkToggleButton *toggle = GTK_TOGGLE_BUTTON (editor->priv->size_aspect_checkbutton);
+
+ if (gtk_toggle_button_get_active (toggle)) {
+
+ h = gtk_spin_button_get_value (GTK_SPIN_BUTTON (editor->priv->size_w_spin));
+
+ w = h / editor->priv->size_aspect_ratio;
+
+ /* Update our sibling control, blocking recursion. */
+ g_signal_handlers_block_by_func (G_OBJECT (editor->priv->size_w_spin),
+ G_CALLBACK (w_spin_cb),
+ editor);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->size_w_spin), w);
+ g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->size_w_spin),
+ G_CALLBACK (w_spin_cb),
+ editor);
+ }
+
+ /* Emit our "changed" signal */
+ g_signal_emit (G_OBJECT (editor), gl_object_editor_signals[CHANGED], 0);
+
+}
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE. Reset image size callback. */
+/*--------------------------------------------------------------------------*/
+static void
+size_reset_cb (glObjectEditor *editor)
+{
+ g_signal_handlers_block_by_func (G_OBJECT (editor->priv->size_w_spin),
+ G_CALLBACK (h_spin_cb),
+ editor);
+ g_signal_handlers_block_by_func (G_OBJECT (editor->priv->size_h_spin),
+ G_CALLBACK (h_spin_cb),
+ editor);
+
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->size_w_spin),
+ editor->priv->w_base);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->size_h_spin),
+ editor->priv->h_base);
+
+ g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->size_w_spin),
+ G_CALLBACK (h_spin_cb),
+ editor);
+ g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->size_h_spin),
+ G_CALLBACK (h_spin_cb),
+ editor);
+ /* Emit our "changed" signal */
+ g_signal_emit (G_OBJECT (editor), gl_object_editor_signals[CHANGED], 0);
+}
+
+/*****************************************************************************/
+/* Set size. */
+/*****************************************************************************/
+void
+gl_object_editor_set_size (glObjectEditor *editor,
+ gdouble w,
+ gdouble h)
+{
+ gl_debug (DEBUG_EDITOR, "START");
+
+ 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);
+
+ /* convert internal units to displayed units */
+ gl_debug (DEBUG_EDITOR, "internal w,h = %g, %g", w, h);
+ w *= editor->priv->units_per_point;
+ h *= editor->priv->units_per_point;
+ gl_debug (DEBUG_EDITOR, "display w,h = %g, %g", w, h);
+
+ /* Set widget values */
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->size_w_spin), w);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->size_h_spin), h);
+
+ 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 aspect ratio */
+ editor->priv->size_aspect_ratio = h / w;
+
+ gl_debug (DEBUG_EDITOR, "END");
+}
+
+/*****************************************************************************/
+/* Set maximum size. */
+/*****************************************************************************/
+void
+gl_object_editor_set_max_size (glObjectEditor *editor,
+ gdouble w_max,
+ gdouble h_max)
+{
+ gdouble tmp;
+
+ gl_debug (DEBUG_EDITOR, "START");
+
+ 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);
+
+ /* 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;
+ h_max *= editor->priv->units_per_point;
+ gl_debug (DEBUG_EDITOR, "display w_max,h_max = %g, %g", w_max, h_max);
+
+ /* Set widget values */
+ tmp = gtk_spin_button_get_value (GTK_SPIN_BUTTON (editor->priv->size_w_spin));
+ gtk_spin_button_set_range (GTK_SPIN_BUTTON (editor->priv->size_w_spin),
+ 0.0, w_max);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->size_w_spin), tmp);
+ tmp = gtk_spin_button_get_value (GTK_SPIN_BUTTON (editor->priv->size_h_spin));
+ gtk_spin_button_set_range (GTK_SPIN_BUTTON (editor->priv->size_h_spin),
+ 0.0, h_max);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->size_h_spin), tmp);
+
+ 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);
+
+ gl_debug (DEBUG_EDITOR, "END");
+}
+
+/*****************************************************************************/
+/* Set base or natural size of image. */
+/*****************************************************************************/
+void
+gl_object_editor_set_base_size (glObjectEditor *editor,
+ 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);
+
+ editor->priv->w_base = w_base;
+ editor->priv->h_base = h_base;
+}
+
+/*****************************************************************************/
+/* Query size. */
+/*****************************************************************************/
+void
+gl_object_editor_get_size (glObjectEditor *editor,
+ gdouble *w,
+ gdouble *h)
+{
+ gl_debug (DEBUG_EDITOR, "START");
+
+
+ /* Get values from widgets */
+ *w = gtk_spin_button_get_value (GTK_SPIN_BUTTON (editor->priv->size_w_spin));
+ *h = gtk_spin_button_get_value (GTK_SPIN_BUTTON (editor->priv->size_h_spin));
+
+ /* convert everything back to our internal units (points) */
+ *w /= editor->priv->units_per_point;
+ *h /= editor->priv->units_per_point;
+
+ gl_debug (DEBUG_EDITOR, "END");
+}
+
--- /dev/null
+/*
+ * (GLABELS) Label and Business Card Creation program for GNOME
+ *
+ * object-editor.c: object properties editor module
+ *
+ * Copyright (C) 2003 Jim Evins <evins@snaught.com>.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#include <config.h>
+
+#include <gnome.h>
+#include <math.h>
+
+#include "object-editor.h"
+#include "prefs.h"
+#include "mygal/widget-color-combo.h"
+#include "color.h"
+
+#include "object-editor-private.h"
+
+#include "debug.h"
+
+/*===========================================*/
+/* Private macros */
+/*===========================================*/
+
+/*===========================================*/
+/* Private data types */
+/*===========================================*/
+
+/*===========================================*/
+/* Private globals */
+/*===========================================*/
+
+/*===========================================*/
+/* Local function prototypes */
+/*===========================================*/
+
+static void align_toggle_cb (GtkToggleButton *toggle,
+ glObjectEditor *editor);
+
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE. Prepare size page. */
+/*--------------------------------------------------------------------------*/
+void
+gl_object_editor_prepare_text_page (glObjectEditor *editor)
+{
+ GList *family_names = NULL;
+ GtkSizeGroup *label_size_group;
+ GtkWidget *label;
+
+ gl_debug (DEBUG_EDITOR, "START");
+
+ /* Extract widgets from XML tree. */
+ editor->priv->text_page_vbox =
+ glade_xml_get_widget (editor->priv->gui, "text_page_vbox");
+ editor->priv->text_family_entry =
+ glade_xml_get_widget (editor->priv->gui, "text_family_entry");
+ editor->priv->text_family_combo =
+ glade_xml_get_widget (editor->priv->gui, "text_family_combo");
+ editor->priv->text_size_spin =
+ glade_xml_get_widget (editor->priv->gui, "text_size_spin");
+ editor->priv->text_bold_toggle =
+ glade_xml_get_widget (editor->priv->gui, "text_bold_toggle");
+ editor->priv->text_italic_toggle =
+ glade_xml_get_widget (editor->priv->gui, "text_italic_toggle");
+ editor->priv->text_color_combo =
+ glade_xml_get_widget (editor->priv->gui, "text_color_combo");
+ editor->priv->text_left_toggle =
+ glade_xml_get_widget (editor->priv->gui, "text_left_toggle");
+ editor->priv->text_center_toggle =
+ glade_xml_get_widget (editor->priv->gui, "text_center_toggle");
+ editor->priv->text_right_toggle =
+ glade_xml_get_widget (editor->priv->gui, "text_right_toggle");
+
+ /* Load family names */
+ family_names = gnome_font_family_list ();
+ gtk_combo_set_popdown_strings (GTK_COMBO(editor->priv->text_family_combo),
+ family_names);
+ gnome_font_family_list_free (family_names);
+
+ /* Align label widths */
+ label_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
+ label = glade_xml_get_widget (editor->priv->gui, "text_family_label");
+ gtk_size_group_add_widget (label_size_group, label);
+ label = glade_xml_get_widget (editor->priv->gui, "text_size_label");
+ gtk_size_group_add_widget (label_size_group, label);
+ label = glade_xml_get_widget (editor->priv->gui, "text_style_label");
+ gtk_size_group_add_widget (label_size_group, label);
+ label = glade_xml_get_widget (editor->priv->gui, "text_color_label");
+ gtk_size_group_add_widget (label_size_group, label);
+ label = glade_xml_get_widget (editor->priv->gui, "text_align_label");
+ gtk_size_group_add_widget (label_size_group, label);
+
+ /* Un-hide */
+ gtk_widget_show_all (editor->priv->text_page_vbox);
+
+ /* Connect signals */
+ g_signal_connect_swapped (G_OBJECT (editor->priv->text_family_entry),
+ "changed",
+ G_CALLBACK (gl_object_editor_changed_cb),
+ G_OBJECT (editor));
+ g_signal_connect_swapped (G_OBJECT (editor->priv->text_size_spin),
+ "changed",
+ G_CALLBACK (gl_object_editor_changed_cb),
+ G_OBJECT (editor));
+ g_signal_connect_swapped (G_OBJECT (editor->priv->text_bold_toggle),
+ "toggled",
+ G_CALLBACK (gl_object_editor_changed_cb),
+ G_OBJECT (editor));
+ g_signal_connect_swapped (G_OBJECT (editor->priv->text_italic_toggle),
+ "toggled",
+ G_CALLBACK (gl_object_editor_changed_cb),
+ G_OBJECT (editor));
+ g_signal_connect_swapped (G_OBJECT (editor->priv->text_color_combo),
+ "color_changed",
+ G_CALLBACK (gl_object_editor_changed_cb),
+ G_OBJECT (editor));
+
+ g_signal_connect (G_OBJECT (editor->priv->text_left_toggle),
+ "toggled",
+ G_CALLBACK (align_toggle_cb),
+ G_OBJECT (editor));
+ g_signal_connect (G_OBJECT (editor->priv->text_center_toggle),
+ "toggled",
+ G_CALLBACK (align_toggle_cb),
+ G_OBJECT (editor));
+ g_signal_connect (G_OBJECT (editor->priv->text_right_toggle),
+ "toggled",
+ G_CALLBACK (align_toggle_cb),
+ G_OBJECT (editor));
+
+ gl_debug (DEBUG_EDITOR, "END");
+}
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE. Alignment togglebutton callback. */
+/*--------------------------------------------------------------------------*/
+static void
+align_toggle_cb (GtkToggleButton *toggle,
+ glObjectEditor *editor)
+{
+ if (gtk_toggle_button_get_active (toggle)) {
+
+ if (GTK_WIDGET (toggle) == GTK_WIDGET (editor->priv->text_left_toggle)) {
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
+ (editor->priv->text_center_toggle),
+ FALSE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
+ (editor->priv->text_right_toggle),
+ FALSE);
+ } else if (GTK_WIDGET (toggle) ==
+ GTK_WIDGET (editor->priv->text_center_toggle)) {
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
+ (editor->priv->text_left_toggle),
+ FALSE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
+ (editor->priv->text_right_toggle),
+ FALSE);
+ } else if (GTK_WIDGET (toggle) ==
+ GTK_WIDGET (editor->priv->text_right_toggle)) {
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
+ (editor->priv->text_left_toggle),
+ FALSE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
+ (editor->priv->text_center_toggle),
+ FALSE);
+ }
+
+ /* Emit our "changed" signal */
+ g_signal_emit (G_OBJECT (editor), gl_object_editor_signals[CHANGED], 0);
+ }
+
+}
+
+/*****************************************************************************/
+/* Set font family. */
+/*****************************************************************************/
+void
+gl_object_editor_set_font_family (glObjectEditor *editor,
+ const gchar *font_family)
+{
+ GList *family_names;
+ gchar *good_font_family;
+
+ gl_debug (DEBUG_EDITOR, "START");
+
+ g_signal_handlers_block_by_func (G_OBJECT(editor->priv->text_family_entry),
+ gl_object_editor_changed_cb,
+ editor);
+
+ /* Make sure we have a valid font family. if not provide a good default. */
+ family_names = gnome_font_family_list ();
+ if (g_list_find_custom (family_names, font_family, (GCompareFunc)g_utf8_collate)) {
+ good_font_family = g_strdup (font_family);
+ } else {
+ if (family_names != NULL) {
+ good_font_family = g_strdup (family_names->data); /* 1st entry */
+ } else {
+ good_font_family = NULL;
+ }
+ }
+ gnome_font_family_list_free (family_names);
+ gtk_entry_set_text (GTK_ENTRY (editor->priv->text_family_entry), good_font_family);
+ g_free (good_font_family);
+
+ g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->text_family_entry),
+ gl_object_editor_changed_cb,
+ editor);
+
+ gl_debug (DEBUG_EDITOR, "END");
+}
+
+/*****************************************************************************/
+/* Query font family. */
+/*****************************************************************************/
+gchar *
+gl_object_editor_get_font_family (glObjectEditor *editor)
+{
+ gchar *font_family;
+
+ gl_debug (DEBUG_EDITOR, "START");
+
+ font_family =
+ gtk_editable_get_chars (GTK_EDITABLE (editor->priv->text_family_entry),
+ 0, -1);
+
+ gl_debug (DEBUG_EDITOR, "END");
+
+ return font_family;
+}
+
+/*****************************************************************************/
+/* Set font size. */
+/*****************************************************************************/
+void
+gl_object_editor_set_font_size (glObjectEditor *editor,
+ gdouble font_size)
+{
+ gl_debug (DEBUG_EDITOR, "START");
+
+ g_signal_handlers_block_by_func (G_OBJECT(editor->priv->text_size_spin),
+ gl_object_editor_changed_cb,
+ editor);
+
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->text_size_spin),
+ font_size);
+
+ g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->text_size_spin),
+ gl_object_editor_changed_cb,
+ editor);
+
+ gl_debug (DEBUG_EDITOR, "END");
+}
+
+/*****************************************************************************/
+/* Query font size. */
+/*****************************************************************************/
+gdouble
+gl_object_editor_get_font_size (glObjectEditor *editor)
+{
+ gdouble font_size;
+
+ gl_debug (DEBUG_EDITOR, "START");
+
+ font_size =
+ gtk_spin_button_get_value (GTK_SPIN_BUTTON(editor->priv->text_size_spin));
+
+ gl_debug (DEBUG_EDITOR, "END");
+
+ return font_size;
+}
+
+/*****************************************************************************/
+/* Set font weight. */
+/*****************************************************************************/
+void
+gl_object_editor_set_font_weight (glObjectEditor *editor,
+ GnomeFontWeight font_weight)
+{
+ gl_debug (DEBUG_EDITOR, "START");
+
+ g_signal_handlers_block_by_func (G_OBJECT(editor->priv->text_bold_toggle),
+ gl_object_editor_changed_cb,
+ editor);
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->text_bold_toggle),
+ (font_weight == GNOME_FONT_BOLD));
+
+ g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->text_bold_toggle),
+ gl_object_editor_changed_cb,
+ editor);
+
+ gl_debug (DEBUG_EDITOR, "END");
+}
+
+/*****************************************************************************/
+/* Query font weight. */
+/*****************************************************************************/
+GnomeFontWeight
+gl_object_editor_get_font_weight (glObjectEditor *editor)
+{
+ GnomeFontWeight font_weight;
+
+ gl_debug (DEBUG_EDITOR, "START");
+
+ if (gtk_toggle_button_get_active
+ (GTK_TOGGLE_BUTTON (editor->priv->text_bold_toggle))) {
+ font_weight = GNOME_FONT_BOLD;
+ } else {
+ font_weight = GNOME_FONT_BOOK;
+ }
+
+ gl_debug (DEBUG_EDITOR, "END");
+
+ return font_weight;
+}
+
+/*****************************************************************************/
+/* Set font italic flag. */
+/*****************************************************************************/
+void
+gl_object_editor_set_font_italic_flag (glObjectEditor *editor,
+ gboolean font_italic_flag)
+{
+ gl_debug (DEBUG_EDITOR, "START");
+
+ g_signal_handlers_block_by_func (G_OBJECT(editor->priv->text_italic_toggle),
+ gl_object_editor_changed_cb,
+ editor);
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->text_italic_toggle),
+ font_italic_flag);
+
+
+ g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->text_italic_toggle),
+ gl_object_editor_changed_cb,
+ editor);
+
+ gl_debug (DEBUG_EDITOR, "END");
+}
+
+/*****************************************************************************/
+/* Query font italic flag. */
+/*****************************************************************************/
+gboolean
+gl_object_editor_get_font_italic_flag (glObjectEditor *editor)
+{
+ gboolean italic_flag;
+
+ gl_debug (DEBUG_EDITOR, "START");
+
+ italic_flag =
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
+ (editor->priv->text_italic_toggle));
+
+ gl_debug (DEBUG_EDITOR, "END");
+
+ return italic_flag;
+}
+
+/*****************************************************************************/
+/* Set text alignment. */
+/*****************************************************************************/
+void
+gl_object_editor_set_text_alignment (glObjectEditor *editor,
+ GtkJustification just)
+{
+ gl_debug (DEBUG_EDITOR, "START");
+
+ g_signal_handlers_block_by_func (G_OBJECT(editor->priv->text_left_toggle),
+ align_toggle_cb,
+ editor);
+ g_signal_handlers_block_by_func (G_OBJECT(editor->priv->text_center_toggle),
+ align_toggle_cb,
+ editor);
+ g_signal_handlers_block_by_func (G_OBJECT(editor->priv->text_right_toggle),
+ align_toggle_cb,
+ editor);
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->text_left_toggle),
+ (just == GTK_JUSTIFY_LEFT));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->text_center_toggle),
+ (just == GTK_JUSTIFY_CENTER));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->text_right_toggle),
+ (just == GTK_JUSTIFY_RIGHT));
+
+ g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->text_left_toggle),
+ align_toggle_cb,
+ editor);
+ g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->text_center_toggle),
+ align_toggle_cb,
+ editor);
+ g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->text_right_toggle),
+ align_toggle_cb,
+ editor);
+
+ gl_debug (DEBUG_EDITOR, "END");
+}
+
+/*****************************************************************************/
+/* Query text alignment. */
+/*****************************************************************************/
+GtkJustification
+gl_object_editor_get_text_alignment (glObjectEditor *editor)
+{
+ GtkJustification just;
+
+ gl_debug (DEBUG_EDITOR, "START");
+
+ if (gtk_toggle_button_get_active
+ (GTK_TOGGLE_BUTTON (editor->priv->text_left_toggle))) {
+ just = GTK_JUSTIFY_LEFT;
+ } else
+ if (gtk_toggle_button_get_active
+ (GTK_TOGGLE_BUTTON (editor->priv->text_right_toggle))) {
+ just = GTK_JUSTIFY_RIGHT;
+ } else
+ if (gtk_toggle_button_get_active
+ (GTK_TOGGLE_BUTTON (editor->priv->text_center_toggle))) {
+ just = GTK_JUSTIFY_CENTER;
+ } else {
+ just = GTK_JUSTIFY_LEFT; /* Should not happen. */
+ }
+
+ gl_debug (DEBUG_EDITOR, "END");
+
+ return just;
+}
+
+/*****************************************************************************/
+/* Set text color. */
+/*****************************************************************************/
+void
+gl_object_editor_set_text_color (glObjectEditor *editor,
+ guint text_color)
+{
+ GdkColor *gdk_color;
+
+ gl_debug (DEBUG_EDITOR, "START");
+
+ g_signal_handlers_block_by_func (G_OBJECT(editor->priv->text_color_combo),
+ gl_object_editor_changed_cb,
+ editor);
+
+ gdk_color = gl_color_to_gdk_color (text_color);
+ color_combo_set_color (COLOR_COMBO(editor->priv->text_color_combo), gdk_color);
+ g_free (gdk_color);
+
+ g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->text_color_combo),
+ gl_object_editor_changed_cb,
+ editor);
+
+ gl_debug (DEBUG_EDITOR, "END");
+}
+
+/*****************************************************************************/
+/* Query text color. */
+/*****************************************************************************/
+guint
+gl_object_editor_get_text_color (glObjectEditor *editor)
+{
+ GdkColor *gdk_color;
+ guint color;
+ gboolean is_default;
+
+ gl_debug (DEBUG_EDITOR, "START");
+
+ gdk_color = color_combo_get_color (COLOR_COMBO(editor->priv->text_color_combo),
+ &is_default);
+
+ if (is_default) {
+ color = gl_prefs->default_text_color;
+ } else {
+ color = gl_color_from_gdk_color (gdk_color);
+ }
+
+
+ gl_debug (DEBUG_EDITOR, "END");
+
+ return color;
+}
+
+
+
--- /dev/null
+/*
+ * (GLABELS) Label and Business Card Creation program for GNOME
+ *
+ * object-editor.c: object properties editor module
+ *
+ * Copyright (C) 2003 Jim Evins <evins@snaught.com>.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#include <config.h>
+
+#include <gnome.h>
+#include <glade/glade-xml.h>
+#include <math.h>
+
+#include "object-editor.h"
+#include "prefs.h"
+#include "mygal/widget-color-combo.h"
+#include "color.h"
+#include "marshal.h"
+
+#include "object-editor-private.h"
+
+#include "debug.h"
+
+/*===========================================*/
+/* Private macros */
+/*===========================================*/
+
+/*===========================================*/
+/* Private data types */
+/*===========================================*/
+
+typedef void (*ChangedSignal) (GObject * object, gpointer data);
+
+/*===========================================*/
+/* Private globals */
+/*===========================================*/
+
+gint gl_object_editor_signals[LAST_SIGNAL] = { 0 };
+
+static GtkVBoxClass *parent_class = NULL;
+
+/*===========================================*/
+/* Local function prototypes */
+/*===========================================*/
+
+static void gl_object_editor_class_init (glObjectEditorClass *klass);
+static void gl_object_editor_init (glObjectEditor *editor);
+static void gl_object_editor_finalize (GObject *object);
+
+static void gl_object_notebook_construct_valist (glObjectEditor *editor,
+ glObjectEditorOption first_option,
+ va_list args);
+
+\f
+/*****************************************************************************/
+/* Boilerplate object stuff. */
+/*****************************************************************************/
+GType
+gl_object_editor_get_type (void)
+{
+ static GType editor_type = 0;
+
+ if (!editor_type)
+ {
+ static const GTypeInfo editor_info =
+ {
+ sizeof (glObjectEditorClass),
+ NULL, /* base_init */
+ NULL, /* base_finalize */
+ (GClassInitFunc) gl_object_editor_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (glObjectEditor),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) gl_object_editor_init
+ };
+
+ editor_type = g_type_register_static (GTK_TYPE_VBOX,
+ "glObjectEditor",
+ &editor_info,
+ 0);
+ }
+
+ return editor_type;
+}
+
+static void
+gl_object_editor_class_init (glObjectEditorClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ gl_debug (DEBUG_EDITOR, "START");
+
+ parent_class = g_type_class_peek_parent (klass);
+
+ object_class->finalize = gl_object_editor_finalize;
+
+ gl_object_editor_signals[CHANGED] =
+ g_signal_new ("changed",
+ G_OBJECT_CLASS_TYPE(object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (glObjectEditorClass, changed),
+ NULL, NULL,
+ gl_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ gl_debug (DEBUG_EDITOR, "END");
+}
+
+static void
+gl_object_editor_init (glObjectEditor *editor)
+{
+ gl_debug (DEBUG_EDITOR, "START");
+
+ editor->priv = g_new0 (glObjectEditorPrivate, 1);
+
+ editor->priv->gui = glade_xml_new ("object-editor.glade",
+ "editor_vbox",
+ NULL);
+
+ if (!editor->priv->gui) {
+ g_warning ("Could not open object-editor.glade, reinstall glabels!");
+ return;
+ }
+
+ editor->priv->editor_vbox = glade_xml_get_widget (editor->priv->gui,
+ "editor_vbox");
+ gtk_box_pack_start (GTK_BOX(editor),
+ editor->priv->editor_vbox,
+ FALSE, FALSE, 0);
+
+ editor->priv->title_image = glade_xml_get_widget (editor->priv->gui,
+ "title_image");
+ editor->priv->title_label = glade_xml_get_widget (editor->priv->gui,
+ "title_label");
+ editor->priv->notebook = glade_xml_get_widget (editor->priv->gui,
+ "notebook");
+
+ gtk_widget_show_all (GTK_WIDGET(editor));
+
+ /* Hide all notebook pages to start with. */
+ gtk_widget_hide_all (editor->priv->notebook);
+ gtk_widget_show (editor->priv->notebook);
+
+ gl_debug (DEBUG_EDITOR, "END");
+}
+
+static void
+gl_object_editor_finalize (GObject *object)
+{
+ glObjectEditor* editor;
+
+ gl_debug (DEBUG_EDITOR, "START");
+
+ g_return_if_fail (object != NULL);
+
+ editor = GL_OBJECT_EDITOR (object);
+
+ g_return_if_fail (GL_IS_OBJECT_EDITOR (editor));
+ g_return_if_fail (editor->priv != NULL);
+
+ g_free (editor->priv);
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+
+ gl_debug (DEBUG_EDITOR, "END");
+}
+
+/*****************************************************************************/
+/* NEW object editor. */
+/*****************************************************************************/
+GtkWidget*
+gl_object_editor_new (gchar *image,
+ gchar *label,
+ glObjectEditorOption first_option, ...)
+{
+ glObjectEditor *editor;
+ va_list args;
+
+ gl_debug (DEBUG_EDITOR, "START");
+
+ editor = GL_OBJECT_EDITOR (g_object_new (GL_TYPE_OBJECT_EDITOR, NULL));
+
+ if (image) {
+ gtk_image_set_from_stock (GTK_IMAGE(editor->priv->title_image),
+ image,
+ GTK_ICON_SIZE_LARGE_TOOLBAR);
+ }
+
+ if (label) {
+ gchar *s;
+
+ s = g_strdup_printf ("<span weight=\"bold\">%s</span>",
+ label);
+ gtk_label_set_text (GTK_LABEL(editor->priv->title_label), s);
+ g_free (s);
+
+ gtk_label_set_use_markup (GTK_LABEL(editor->priv->title_label), TRUE);
+
+ }
+
+ gtk_notebook_set_homogeneous_tabs (GTK_NOTEBOOK(editor->priv->notebook), TRUE);
+
+ va_start (args, first_option);
+ gl_object_notebook_construct_valist (editor, first_option, args);
+ va_end (args);
+
+ gl_debug (DEBUG_EDITOR, "END");
+
+ return GTK_WIDGET(editor);
+}
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE. Construct notebook. */
+/*--------------------------------------------------------------------------*/
+static void
+gl_object_notebook_construct_valist (glObjectEditor *editor,
+ glObjectEditorOption first_option,
+ va_list args)
+{
+ glObjectEditorOption option;
+
+ gl_debug (DEBUG_EDITOR, "START");
+
+ option = first_option;
+
+ for ( option=first_option; option; option=va_arg (args, glObjectEditorOption) ) {
+
+ switch (option) {
+
+ case GL_OBJECT_EDITOR_EMPTY:
+ gtk_widget_set_sensitive (editor->priv->title_image, FALSE);
+ gtk_widget_set_sensitive (editor->priv->title_label, FALSE);
+ break;
+
+ case GL_OBJECT_EDITOR_POSITION_PAGE:
+ gl_object_editor_prepare_position_page (editor);
+ break;
+
+ case GL_OBJECT_EDITOR_SIZE_PAGE:
+ case GL_OBJECT_EDITOR_SIZE_IMAGE_PAGE:
+ gl_object_editor_prepare_size_page (editor, option);
+ break;
+
+ case GL_OBJECT_EDITOR_SIZE_LINE_PAGE:
+ gl_object_editor_prepare_lsize_page (editor);
+ break;
+
+ case GL_OBJECT_EDITOR_FILL_PAGE:
+ gl_object_editor_prepare_fill_page (editor);
+ break;
+
+ case GL_OBJECT_EDITOR_LINE_PAGE:
+ gl_object_editor_prepare_line_page (editor);
+ break;
+
+ case GL_OBJECT_EDITOR_IMAGE_PAGE:
+ gl_object_editor_prepare_image_page (editor);
+ break;
+
+ case GL_OBJECT_EDITOR_TEXT_PAGE:
+ gl_object_editor_prepare_text_page (editor);
+ break;
+
+ case GL_OBJECT_EDITOR_EDIT_PAGE:
+ gl_object_editor_prepare_edit_page (editor);
+ break;
+
+ case GL_OBJECT_EDITOR_BC_PAGE:
+ gl_object_editor_prepare_bc_page (editor);
+ break;
+
+ case GL_OBJECT_EDITOR_DATA_PAGE:
+ gl_object_editor_prepare_data_page (editor);
+ break;
+
+ default:
+ g_warning ("option = %d", option);
+ g_assert_not_reached ();
+ }
+
+ }
+
+ gl_debug (DEBUG_EDITOR, "END");
+}
+
+/*--------------------------------------------------------------------------*/
+/* PRIVATE. Widget changed callback. Emit our "changed" signal. */
+/*--------------------------------------------------------------------------*/
+void
+gl_object_editor_changed_cb (glObjectEditor *editor)
+{
+ gl_debug (DEBUG_EDITOR, "START");
+
+ /* Emit our "changed" signal */
+ g_signal_emit (G_OBJECT (editor), gl_object_editor_signals[CHANGED], 0);
+
+ gl_debug (DEBUG_EDITOR, "END");
+}
+
+/*****************************************************************************/
+/* Set possible key names from merge object. */
+/*****************************************************************************/
+void
+gl_object_editor_set_key_names (glObjectEditor *editor,
+ glMerge *merge)
+{
+ GList *keys;
+ GtkWidget *combo;
+
+ gl_debug (DEBUG_EDITOR, "START");
+
+ if (editor->priv->edit_key_label) {
+ gtk_widget_set_sensitive (editor->priv->edit_key_label, merge != NULL);
+ }
+
+ if (editor->priv->edit_key_combo) {
+ gtk_widget_set_sensitive (editor->priv->edit_key_combo, merge != NULL);
+ }
+
+ if (editor->priv->edit_insert_field_button) {
+ gtk_widget_set_sensitive (editor->priv->edit_insert_field_button,
+ merge != NULL);
+ }
+
+ if (editor->priv->img_key_combo) {
+ gtk_widget_set_sensitive (editor->priv->img_key_combo, merge != NULL);
+ }
+
+ if (editor->priv->img_key_radio) {
+ gtk_widget_set_sensitive (editor->priv->img_key_radio, merge != NULL);
+ if (merge == NULL) {
+ gtk_toggle_button_set_active (
+ GTK_TOGGLE_BUTTON(editor->priv->img_file_radio), TRUE);
+ }
+ }
+
+ if (editor->priv->data_key_combo) {
+ gtk_widget_set_sensitive (editor->priv->data_key_combo, merge != NULL);
+ }
+
+ if (editor->priv->data_key_radio) {
+ gtk_widget_set_sensitive (editor->priv->data_key_radio, merge != NULL);
+ if (merge == NULL) {
+ gtk_toggle_button_set_active (
+ GTK_TOGGLE_BUTTON(editor->priv->data_literal_radio), TRUE);
+ }
+ }
+
+
+
+ keys = gl_merge_get_key_list (merge);
+ if ( keys != NULL ) {
+
+ combo = editor->priv->img_key_combo;
+ if (combo) {
+ gtk_combo_set_popdown_strings (GTK_COMBO (combo), keys);
+ }
+
+ combo = editor->priv->edit_key_combo;
+ if (combo) {
+ gtk_combo_set_popdown_strings (GTK_COMBO (combo), keys);
+ }
+
+ combo = editor->priv->data_key_combo;
+ if (combo) {
+ gtk_combo_set_popdown_strings (GTK_COMBO (combo), keys);
+ }
+
+ gl_merge_free_key_list (&keys);
+ } else {
+
+ keys = g_list_append (keys, "");
+
+ combo = editor->priv->img_key_combo;
+ if (combo) {
+ gtk_combo_set_popdown_strings (GTK_COMBO (combo), keys);
+ }
+
+ combo = editor->priv->edit_key_combo;
+ if (combo) {
+ gtk_combo_set_popdown_strings (GTK_COMBO (combo), keys);
+ }
+
+ combo = editor->priv->data_key_combo;
+ if (combo) {
+ gtk_combo_set_popdown_strings (GTK_COMBO (combo), keys);
+ }
+
+ g_list_free (keys);
+ }
+
+ gl_debug (DEBUG_EDITOR, "END");
+}
+
+/*****************************************************************************/
+/* Construct color combo "Custom widget". */
+/*****************************************************************************/
+GtkWidget *
+gl_object_editor_construct_color_combo (gchar *name,
+ gchar *string1,
+ gchar *string2,
+ gint int1,
+ gint int2)
+{
+ GtkWidget *color_combo;
+ ColorGroup *cg;
+ gchar *cg_name;
+ guint color;
+ GdkColor *gdk_color;
+ gchar *no_color;
+
+ switch (int1) {
+
+ case 2:
+ cg_name = "text_color_group";
+ color = gl_prefs->default_text_color;
+ no_color = _("Default");
+ break;
+
+ case 1:
+ cg_name = "line_color_group";
+ color = gl_prefs->default_line_color;
+ no_color = _("No line");
+ break;
+
+ case 0:
+ default:
+ cg_name = "fill_color_group";
+ color = gl_prefs->default_fill_color;
+ no_color = _("No fill");
+ break;
+
+ }
+
+ cg = color_group_fetch (cg_name, NULL);
+ gdk_color = gl_color_to_gdk_color (color);
+ color_combo = color_combo_new (NULL, no_color, gdk_color, cg);
+ g_free (gdk_color);
+
+ color_combo_box_set_preview_relief (COLOR_COMBO(color_combo), GTK_RELIEF_NORMAL);
+
+ return color_combo;
+}
--- /dev/null
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
+
+<glade-interface>
+<requires lib="gnome"/>
+
+<widget class="GtkDialog" id="dialog">
+ <property name="border_width">6</property>
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">dialog1</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">False</property>
+ <property name="resizable">True</property>
+ <property name="destroy_with_parent">False</property>
+ <property name="has_separator">True</property>
+
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="dialog-vbox1">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child internal-child="action_area">
+ <widget class="GtkHButtonBox" id="dialog-action_area1">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+
+ <child>
+ <widget class="GtkButton" id="closebutton1">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-close</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="response_id">-7</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="editor_vbox">
+ <property name="border_width">6</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkHBox" id="title_hbox">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkImage" id="title_image">
+ <property name="visible">True</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="title_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"><span weight="bold" size="larger">Xxx object properties</span></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkNotebook" id="notebook">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="show_tabs">True</property>
+ <property name="show_border">True</property>
+ <property name="tab_pos">GTK_POS_TOP</property>
+ <property name="scrollable">True</property>
+ <property name="enable_popup">False</property>
+
+ <child>
+ <widget class="GtkVBox" id="edit_page_vbox">
+ <property name="border_width">12</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox30">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkScrolledWindow" id="scrolledwindow1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property>
+ <property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
+ <property name="shadow_type">GTK_SHADOW_NONE</property>
+ <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+
+ <child>
+ <widget class="GtkTextView" id="edit_text_view">
+ <property name="width_request">232</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="justification">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap_mode">GTK_WRAP_NONE</property>
+ <property name="cursor_visible">True</property>
+ <property name="pixels_above_lines">0</property>
+ <property name="pixels_below_lines">0</property>
+ <property name="pixels_inside_wrap">0</property>
+ <property name="left_margin">0</property>
+ <property name="right_margin">0</property>
+ <property name="indent">0</property>
+ <property name="text" translatable="yes"></property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkLabel" id="edit_key_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Key:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCombo" id="edit_key_combo">
+ <property name="visible">True</property>
+ <property name="value_in_list">True</property>
+ <property name="allow_empty">False</property>
+ <property name="case_sensitive">False</property>
+ <property name="enable_arrow_keys">True</property>
+ <property name="enable_arrows_always">False</property>
+
+ <child internal-child="entry">
+ <widget class="GtkEntry" id="edit_key_entry">
+ <property name="width_request">66</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">False</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char" translatable="yes">*</property>
+ <property name="activates_default">False</property>
+ </widget>
+ </child>
+
+ <child internal-child="list">
+ <widget class="GtkList" id="combo-list1">
+ <property name="visible">True</property>
+ <property name="selection_mode">GTK_SELECTION_BROWSE</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkButton" id="edit_insert_field_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Insert merge field</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="tab_expand">False</property>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="edit_tab_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Edit</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="type">tab</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="text_page_vbox">
+ <property name="border_width">12</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox2">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkLabel" id="text_family_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Family:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCombo" id="text_family_combo">
+ <property name="visible">True</property>
+ <property name="value_in_list">True</property>
+ <property name="allow_empty">False</property>
+ <property name="case_sensitive">False</property>
+ <property name="enable_arrow_keys">True</property>
+ <property name="enable_arrows_always">False</property>
+
+ <child internal-child="entry">
+ <widget class="GtkEntry" id="text_family_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char" translatable="yes">*</property>
+ <property name="activates_default">False</property>
+ </widget>
+ </child>
+
+ <child internal-child="list">
+ <widget class="GtkList" id="combo-list2">
+ <property name="visible">True</property>
+ <property name="selection_mode">GTK_SELECTION_BROWSE</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox28">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkLabel" id="text_size_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Size:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkSpinButton" id="text_size_spin">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="climb_rate">1</property>
+ <property name="digits">0</property>
+ <property name="numeric">False</property>
+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="snap_to_ticks">False</property>
+ <property name="wrap">False</property>
+ <property name="adjustment">1 0 100 1 10 10</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox29">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkLabel" id="text_style_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Style:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkToggleButton" id="text_bold_toggle">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+
+ <child>
+ <widget class="GtkImage" id="image1">
+ <property name="visible">True</property>
+ <property name="stock">gtk-bold</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkToggleButton" id="text_italic_toggle">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+
+ <child>
+ <widget class="GtkImage" id="image2">
+ <property name="visible">True</property>
+ <property name="stock">gtk-italic</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox3">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkLabel" id="text_color_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Color:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="Custom" id="text_color_combo">
+ <property name="visible">True</property>
+ <property name="creation_function">gl_object_editor_construct_color_combo</property>
+ <property name="int1">2</property>
+ <property name="int2">0</property>
+ <property name="last_modification_time">Sun, 16 Nov 2003 06:52:23 GMT</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox4">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkLabel" id="text_align_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Alignment:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkToggleButton" id="text_left_toggle">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+
+ <child>
+ <widget class="GtkImage" id="image3">
+ <property name="visible">True</property>
+ <property name="stock">gtk-justify-left</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkToggleButton" id="text_center_toggle">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+
+ <child>
+ <widget class="GtkImage" id="image4">
+ <property name="visible">True</property>
+ <property name="stock">gtk-justify-center</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkToggleButton" id="text_right_toggle">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+
+ <child>
+ <widget class="GtkImage" id="image5">
+ <property name="visible">True</property>
+ <property name="stock">gtk-justify-right</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="tab_expand">False</property>
+ <property name="tab_fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="text_tab_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Text</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="type">tab</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="line_page_vbox">
+ <property name="border_width">12</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox7">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkLabel" id="line_w_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Width:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkSpinButton" id="line_width_spin">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="climb_rate">0.25</property>
+ <property name="digits">2</property>
+ <property name="numeric">False</property>
+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="snap_to_ticks">False</property>
+ <property name="wrap">False</property>
+ <property name="adjustment">1 0.25 4 0.25 1 1</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label21">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">points</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox8">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkLabel" id="line_color_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Color:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="Custom" id="line_color_combo">
+ <property name="visible">True</property>
+ <property name="creation_function">gl_object_editor_construct_color_combo</property>
+ <property name="int1">1</property>
+ <property name="int2">0</property>
+ <property name="last_modification_time">Sat, 15 Nov 2003 22:10:18 GMT</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="tab_expand">False</property>
+ <property name="tab_fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="line_tab_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Line</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="type">tab</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="fill_page_vbox">
+ <property name="border_width">12</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox9">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkLabel" id="label23">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Color:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="Custom" id="fill_color_combo">
+ <property name="visible">True</property>
+ <property name="creation_function">gl_object_editor_construct_color_combo</property>
+ <property name="string1"></property>
+ <property name="int1">0</property>
+ <property name="int2">0</property>
+ <property name="last_modification_time">Sat, 15 Nov 2003 20:47:48 GMT</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="tab_expand">False</property>
+ <property name="tab_fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="fill_tab_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Fill</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="type">tab</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="img_page_vbox">
+ <property name="border_width">12</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox16">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkRadioButton" id="img_file_radio">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">File:</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GnomePixmapEntry" id="img_pixmap_entry">
+ <property name="visible">True</property>
+ <property name="history_id">image</property>
+ <property name="max_saved">10</property>
+ <property name="browse_dialog_title" translatable="yes">Load image</property>
+ <property name="modal">False</property>
+ <property name="do_preview">True</property>
+
+ <child internal-child="entry">
+ <widget class="GtkEntry" id="combo-entry3">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char" translatable="yes">*</property>
+ <property name="activates_default">False</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHSeparator" id="hseparator1">
+ <property name="visible">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox17">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkRadioButton" id="img_key_radio">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Key:</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">img_file_radio</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCombo" id="img_key_combo">
+ <property name="visible">True</property>
+ <property name="value_in_list">False</property>
+ <property name="allow_empty">True</property>
+ <property name="case_sensitive">False</property>
+ <property name="enable_arrow_keys">True</property>
+ <property name="enable_arrows_always">False</property>
+
+ <child internal-child="entry">
+ <widget class="GtkEntry" id="img_key_entry">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">True</property>
+ <property name="editable">False</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char" translatable="yes">*</property>
+ <property name="activates_default">False</property>
+ </widget>
+ </child>
+
+ <child internal-child="list">
+ <widget class="GtkList" id="combo-list3">
+ <property name="visible">True</property>
+ <property name="selection_mode">GTK_SELECTION_BROWSE</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="tab_expand">False</property>
+ <property name="tab_fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="img_tab_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Image</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="type">tab</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="data_page_vbox">
+ <property name="border_width">12</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox18">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkRadioButton" id="data_literal_radio">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Literal:</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkEntry" id="data_text_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char" translatable="yes">*</property>
+ <property name="activates_default">False</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox19">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkRadioButton" id="data_key_radio">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Key:</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">data_literal_radio</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCombo" id="data_key_combo">
+ <property name="visible">True</property>
+ <property name="value_in_list">False</property>
+ <property name="allow_empty">True</property>
+ <property name="case_sensitive">False</property>
+ <property name="enable_arrow_keys">True</property>
+ <property name="enable_arrows_always">False</property>
+
+ <child internal-child="entry">
+ <widget class="GtkEntry" id="data_key_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char" translatable="yes">*</property>
+ <property name="activates_default">False</property>
+ </widget>
+ </child>
+
+ <child internal-child="list">
+ <widget class="GtkList" id="combo-list5">
+ <property name="visible">True</property>
+ <property name="selection_mode">GTK_SELECTION_BROWSE</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="tab_expand">False</property>
+ <property name="tab_fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="data_tab_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Data</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="type">tab</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="bc_page_vbox">
+ <property name="border_width">12</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox20">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkLabel" id="bc_style_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Style:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCombo" id="bc_style_combo">
+ <property name="visible">True</property>
+ <property name="value_in_list">False</property>
+ <property name="allow_empty">True</property>
+ <property name="case_sensitive">False</property>
+ <property name="enable_arrow_keys">True</property>
+ <property name="enable_arrows_always">False</property>
+
+ <child internal-child="entry">
+ <widget class="GtkEntry" id="bc_style_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char" translatable="yes">*</property>
+ <property name="activates_default">False</property>
+ </widget>
+ </child>
+
+ <child internal-child="list">
+ <widget class="GtkList" id="combo-list4">
+ <property name="visible">True</property>
+ <property name="selection_mode">GTK_SELECTION_BROWSE</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox21">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkCheckButton" id="bc_text_check">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Text</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox22">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkCheckButton" id="bc_cs_check">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Checksum</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox23">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkLabel" id="bc_color_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Color:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="Custom" id="bc_color_combo">
+ <property name="visible">True</property>
+ <property name="creation_function">gl_object_editor_construct_color_combo</property>
+ <property name="int1">1</property>
+ <property name="int2">0</property>
+ <property name="last_modification_time">Sun, 16 Nov 2003 07:00:32 GMT</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="tab_expand">True</property>
+ <property name="tab_fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="bc_tab_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Barcode</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="type">tab</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="size_page_vbox">
+ <property name="border_width">12</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox10">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkLabel" id="size_w_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Width:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkSpinButton" id="size_w_spin">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="climb_rate">0.01</property>
+ <property name="digits">2</property>
+ <property name="numeric">True</property>
+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="snap_to_ticks">True</property>
+ <property name="wrap">False</property>
+ <property name="adjustment">1 0 100 0.01 10 10</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="size_w_units_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">inches</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox11">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkLabel" id="size_h_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Height:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkSpinButton" id="size_h_spin">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="climb_rate">0.01</property>
+ <property name="digits">2</property>
+ <property name="numeric">True</property>
+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="snap_to_ticks">True</property>
+ <property name="wrap">False</property>
+ <property name="adjustment">1 0 100 0.01 10 10</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="size_h_units_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">inches</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox12">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkCheckButton" id="size_aspect_checkbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Maintain current aspect ratio</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">True</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox13">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkButton" id="size_reset_image_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Reset image size</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="tab_expand">False</property>
+ <property name="tab_fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="size_tab_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Size</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="type">tab</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="lsize_page_vbox">
+ <property name="border_width">12</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox25">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkLabel" id="lsize_r_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Length:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkSpinButton" id="lsize_r_spin">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="climb_rate">0.01</property>
+ <property name="digits">2</property>
+ <property name="numeric">True</property>
+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="snap_to_ticks">True</property>
+ <property name="wrap">False</property>
+ <property name="adjustment">1 0 100 0.01 10 10</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="lsize_r_units_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">inches</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox26">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkLabel" id="lsize_theta_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Angle:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkSpinButton" id="lsize_theta_spin">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="climb_rate">0.1</property>
+ <property name="digits">1</property>
+ <property name="numeric">True</property>
+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="snap_to_ticks">True</property>
+ <property name="wrap">False</property>
+ <property name="adjustment">0 -180 180 0.1 5 5</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label38">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">degrees</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="tab_expand">False</property>
+ <property name="tab_fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="lsize_tab_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Size</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="type">tab</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="pos_page_vbox">
+ <property name="border_width">12</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox5">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkLabel" id="pos_x_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">X:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkSpinButton" id="pos_x_spin">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="climb_rate">0.01</property>
+ <property name="digits">2</property>
+ <property name="numeric">True</property>
+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="snap_to_ticks">True</property>
+ <property name="wrap">False</property>
+ <property name="adjustment">0 0 100 0.01 10 10</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="pos_x_units_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">inches</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox6">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkLabel" id="pos_y_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Y:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkSpinButton" id="pos_y_spin">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="climb_rate">0.01</property>
+ <property name="digits">2</property>
+ <property name="numeric">True</property>
+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="snap_to_ticks">True</property>
+ <property name="wrap">False</property>
+ <property name="adjustment">0 0 100 0.01 10 10</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="pos_y_units_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">inches</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="tab_expand">False</property>
+ <property name="tab_fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="pos_tab_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Position</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="type">tab</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+</widget>
+
+</glade-interface>
--- /dev/null
+/*
+ * (GLABELS) Label and Business Card Creation program for GNOME
+ *
+ * object-editor.h: object properties editor module header file
+ *
+ * Copyright (C) 2003 Jim Evins <evins@snaught.com>.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#ifndef __OBJECT_EDITOR_H__
+#define __OBJECT_EDITOR_H__
+
+#include <gtk/gtk.h>
+#include "text-node.h"
+#include "merge.h"
+#include "bc.h"
+#include <gtk/gtkenums.h>
+#include <libgnomeprint/gnome-font.h>
+
+G_BEGIN_DECLS
+
+typedef enum {
+ GL_OBJECT_EDITOR_EMPTY = 1,
+ GL_OBJECT_EDITOR_POSITION_PAGE,
+ GL_OBJECT_EDITOR_SIZE_PAGE,
+ GL_OBJECT_EDITOR_SIZE_IMAGE_PAGE,
+ GL_OBJECT_EDITOR_SIZE_LINE_PAGE,
+ GL_OBJECT_EDITOR_FILL_PAGE,
+ GL_OBJECT_EDITOR_LINE_PAGE,
+ GL_OBJECT_EDITOR_IMAGE_PAGE,
+ GL_OBJECT_EDITOR_TEXT_PAGE,
+ GL_OBJECT_EDITOR_EDIT_PAGE,
+ GL_OBJECT_EDITOR_BC_PAGE,
+ GL_OBJECT_EDITOR_DATA_PAGE,
+} glObjectEditorOption;
+
+#define GL_TYPE_OBJECT_EDITOR (gl_object_editor_get_type ())
+#define GL_OBJECT_EDITOR(obj) (GTK_CHECK_CAST ((obj), GL_TYPE_OBJECT_EDITOR, glObjectEditor))
+#define GL_OBJECT_EDITOR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_OBJECT_EDITOR, glObjectEditorClass))
+#define GL_IS_OBJECT_EDITOR(obj) (GTK_CHECK_TYPE ((obj), GL_TYPE_OBJECT_EDITOR))
+#define GL_IS_OBJECT_EDITOR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_OBJECT_EDITOR))
+#define GL_OBJECT_EDITOR_GET_CLASS(obj) (GTK_CHECK_GET_CLASS ((obj), GL_TYPE_OBJECT_EDITOR, glObjectEditorClass))
+
+
+typedef struct _glObjectEditor glObjectEditor;
+typedef struct _glObjectEditorClass glObjectEditorClass;
+
+typedef struct _glObjectEditorPrivate glObjectEditorPrivate;
+
+struct _glObjectEditor
+{
+ GtkVBox parent_instance;
+
+ glObjectEditorPrivate *priv;
+
+};
+
+struct _glObjectEditorClass
+{
+ GtkVBoxClass parent_class;
+
+ void (*changed) (glObjectEditor *editor, gpointer user_data);
+};
+
+
+
+
+GtkType gl_object_editor_get_type (void) G_GNUC_CONST;
+
+GtkWidget *gl_object_editor_new (gchar *image,
+ gchar *label,
+ glObjectEditorOption first_option, ...);
+
+void gl_object_editor_set_key_names (glObjectEditor *editor,
+ glMerge *merge);
+
+
+/*
+ * Position Page
+ */
+void gl_object_editor_set_position (glObjectEditor *editor,
+ gdouble x,
+ gdouble y);
+
+void gl_object_editor_set_max_position (glObjectEditor *editor,
+ gdouble x_max,
+ gdouble y_max);
+
+void gl_object_editor_get_position (glObjectEditor *editor,
+ gdouble *x,
+ gdouble *y);
+
+/*
+ * Size Page
+ */
+void gl_object_editor_set_size (glObjectEditor *editor,
+ gdouble w,
+ gdouble h);
+
+void gl_object_editor_set_max_size (glObjectEditor *editor,
+ gdouble w_max,
+ gdouble h_max);
+
+void gl_object_editor_set_base_size (glObjectEditor *editor,
+ gdouble w_max,
+ gdouble h_max);
+
+void gl_object_editor_get_size (glObjectEditor *editor,
+ gdouble *w,
+ gdouble *h);
+
+
+/*
+ * Line Size Page
+ */
+void gl_object_editor_set_lsize (glObjectEditor *editor,
+ gdouble dx,
+ gdouble dy);
+
+void gl_object_editor_set_max_lsize (glObjectEditor *editor,
+ gdouble dx_max,
+ gdouble dy_max);
+
+void gl_object_editor_get_lsize (glObjectEditor *editor,
+ gdouble *dx,
+ gdouble *dy);
+
+
+/*
+ * Fill Page
+ */
+void gl_object_editor_set_fill_color (glObjectEditor *editor,
+ guint color);
+
+guint gl_object_editor_get_fill_color (glObjectEditor *editor);
+
+
+/*
+ * Line/Outline Page
+ */
+void gl_object_editor_set_line_color (glObjectEditor *editor,
+ guint color);
+
+guint gl_object_editor_get_line_color (glObjectEditor *editor);
+
+void gl_object_editor_set_line_width (glObjectEditor *editor,
+ gdouble width);
+
+gdouble gl_object_editor_get_line_width (glObjectEditor *editor);
+
+
+/*
+ * Image Page
+ */
+void gl_object_editor_set_image (glObjectEditor *editor,
+ gboolean merge_flag,
+ glTextNode *text_node);
+
+glTextNode *gl_object_editor_get_image (glObjectEditor *editor);
+
+
+/*
+ * Text Page
+ */
+void gl_object_editor_set_font_family (glObjectEditor *editor,
+ const gchar *font_family);
+
+gchar *gl_object_editor_get_font_family (glObjectEditor *editor);
+
+void gl_object_editor_set_font_size (glObjectEditor *editor,
+ gdouble font_size);
+
+gdouble gl_object_editor_get_font_size (glObjectEditor *editor);
+
+void gl_object_editor_set_font_weight (glObjectEditor *editor,
+ GnomeFontWeight font_weight);
+
+GnomeFontWeight gl_object_editor_get_font_weight (glObjectEditor *editor);
+
+void gl_object_editor_set_font_italic_flag (glObjectEditor *editor,
+ gboolean font_italic_flag);
+
+gboolean gl_object_editor_get_font_italic_flag (glObjectEditor *editor);
+
+void gl_object_editor_set_text_alignment (glObjectEditor *editor,
+ GtkJustification text_alignment);
+
+GtkJustification gl_object_editor_get_text_alignment (glObjectEditor *editor);
+
+void gl_object_editor_set_text_color (glObjectEditor *editor,
+ guint text_color);
+
+guint gl_object_editor_get_text_color (glObjectEditor *editor);
+
+
+/*
+ * Edit Text Page
+ */
+void gl_object_editor_set_text_buffer (glObjectEditor *editor,
+ GtkTextBuffer *buffer);
+
+/*
+ * Barcode Page
+ */
+void gl_object_editor_set_bc_style (glObjectEditor *editor,
+ glBarcodeStyle style,
+ gboolean text_flag,
+ gboolean checksum_flag);
+
+void gl_object_editor_get_bc_style (glObjectEditor *editor,
+ glBarcodeStyle *style,
+ gboolean *text_flag,
+ gboolean *checksum_flag);
+
+void gl_object_editor_set_bc_color (glObjectEditor *editor,
+ guint text_color);
+
+guint gl_object_editor_get_bc_color (glObjectEditor *editor);
+
+
+/*
+ * Barcode Data Page
+ */
+void gl_object_editor_set_data (glObjectEditor *editor,
+ gboolean merge_flag,
+ glTextNode *text_node);
+
+glTextNode *gl_object_editor_get_data (glObjectEditor *editor);
+
+
+
+
+G_END_DECLS
+
+#endif
#include <libgnome/libgnome.h>
#include <libgnomeui/libgnomeui.h>
+#include <glade/glade-xml.h>
#include "prefs-dialog.h"
#include "prefs.h"
-#include "wdgt-line.h"
-#include "wdgt-fill.h"
-#include "wdgt-text-props.h"
+#include "mygal/widget-color-combo.h"
+#include "color.h"
#include "debug.h"
/*========================================================*/
struct _glPrefsDialogPrivate
{
- GtkWidget* categories_tree;
+ GladeXML *gui;
- GtkWidget* notebook;
-
- GtkTreeModel *categories_tree_model;
-
- /* Units page */
+ /* Units properties */
GtkWidget *units_points_radio;
GtkWidget *units_inches_radio;
GtkWidget *units_mm_radio;
- /* Page size page */
+ /* Page size properties */
GtkWidget *page_size_us_letter_radio;
GtkWidget *page_size_a4_radio;
/* Default text properties */
- GtkWidget *text;
+ GtkWidget *text_family_entry;
+ GtkWidget *text_family_combo;
+ GtkWidget *text_size_spin;
+ GtkWidget *text_bold_toggle;
+ GtkWidget *text_italic_toggle;
+ GtkWidget *text_color_combo;
+ GtkWidget *text_left_toggle;
+ GtkWidget *text_center_toggle;
+ GtkWidget *text_right_toggle;
/* Default line properties */
- GtkWidget *line;
+ GtkWidget *line_width_spin;
+ GtkWidget *line_color_combo;
/* Default fill properties */
- GtkWidget *fill;
+ GtkWidget *fill_color_combo;
};
/*========================================================*/
/* Private function prototypes. */
/*========================================================*/
-static void gl_prefs_dialog_class_init (glPrefsDialogClass *klass);
-static void gl_prefs_dialog_init (glPrefsDialog *dlg);
-static void gl_prefs_dialog_finalize (GObject *object);
-static void gl_prefs_dialog_construct (glPrefsDialog *dlg);
+static void gl_prefs_dialog_class_init (glPrefsDialogClass *klass);
+static void gl_prefs_dialog_init (glPrefsDialog *dlg);
+static void gl_prefs_dialog_finalize (GObject *object);
+static void gl_prefs_dialog_construct (glPrefsDialog *dlg);
-static void response_cb (glPrefsDialog *dialog,
- gint response,
- gpointer user_data);
+static void response_cb (glPrefsDialog *dialog,
+ gint response,
+ gpointer user_data);
-static GtkWidget *locale_page (glPrefsDialog *dlg);
-static GtkWidget *object_page (glPrefsDialog *dlg);
+static void construct_locale_page (glPrefsDialog *dlg);
+static void construct_object_page (glPrefsDialog *dlg);
-static update_locale_page_from_prefs (glPrefsDialog *dlg);
-static update_object_page_from_prefs (glPrefsDialog *dlg);
+static void align_toggle_cb (GtkToggleButton *toggle,
+ glPrefsDialog *dlg);
+
+static void update_locale_page_from_prefs (glPrefsDialog *dlg);
+static void update_object_page_from_prefs (glPrefsDialog *dlg);
-static update_prefs_from_locale_page (glPrefsDialog *dlg);
-static update_prefs_from_object_page (glPrefsDialog *dlg);
+static void update_prefs_from_locale_page (glPrefsDialog *dlg);
+static void update_prefs_from_object_page (glPrefsDialog *dlg);
\f
/*****************************************************************************/
static void
gl_prefs_dialog_init (glPrefsDialog *dlg)
{
- gl_debug (DEBUG_PREFS, "");
+ gl_debug (DEBUG_PREFS, "START");
+
+ dlg->priv = g_new0 (glPrefsDialogPrivate, 1);
+
+ dlg->priv->gui = glade_xml_new ("prefs-dialog.glade",
+ "prefs_notebook",
+ NULL);
+
+ if (!dlg->priv->gui) {
+ g_warning ("Could not open prefs-dialog.glade, reinstall glabels!");
+ return;
+ }
- dlg->private = g_new0 (glPrefsDialogPrivate, 1);
+ gl_debug (DEBUG_PREFS, "END");
}
static void
{
glPrefsDialog* dlg;
- gl_debug (DEBUG_PREFS, "");
+ gl_debug (DEBUG_PREFS, "START");
g_return_if_fail (object != NULL);
dlg = GL_PREFS_DIALOG (object);
g_return_if_fail (GL_IS_PREFS_DIALOG (dlg));
- g_return_if_fail (dlg->private != NULL);
+ g_return_if_fail (dlg->priv != NULL);
G_OBJECT_CLASS (parent_class)->finalize (object);
- g_free (dlg->private);
+ g_free (dlg->priv);
+
+ gl_debug (DEBUG_PREFS, "END");
}
/*****************************************************************************/
{
GtkWidget *dlg;
- gl_debug (DEBUG_PREFS, "");
+ gl_debug (DEBUG_PREFS, "START");
dlg = GTK_WIDGET (g_object_new (GL_TYPE_PREFS_DIALOG, NULL));
gl_prefs_dialog_construct (GL_PREFS_DIALOG(dlg));
+
+ gl_debug (DEBUG_PREFS, "END");
+
return dlg;
}
static void
gl_prefs_dialog_construct (glPrefsDialog *dlg)
{
- GtkWidget *notebook, *wlabel, *wvbox, *wvbox1, *whbox, *wframe;
- GSList *radio_group = NULL;
+ GtkWidget *notebook;
g_return_if_fail (GL_IS_PREFS_DIALOG (dlg));
- g_return_if_fail (dlg->private != NULL);
+ g_return_if_fail (dlg->priv != NULL);
gtk_dialog_add_button (GTK_DIALOG(dlg),
GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE);
g_signal_connect(G_OBJECT (dlg), "response",
G_CALLBACK (response_cb), NULL);
- notebook = gtk_notebook_new ();
+ notebook = glade_xml_get_widget (dlg->priv->gui, "prefs_notebook");
gl_hig_dialog_add_widget (GL_HIG_DIALOG(dlg), notebook);
- gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
- locale_page (dlg),
- gtk_label_new (_("Locale")));
-
- gtk_notebook_append_page (GTK_NOTEBOOK (notebook),
- object_page (dlg),
- gtk_label_new (_("Object defaults")));
+ construct_locale_page (dlg);
+ construct_object_page (dlg);
update_locale_page_from_prefs (dlg);
update_object_page_from_prefs (dlg);
/*--------------------------------------------------------------------------*/
/* PRIVATE. Build Locale Properties Notebook Tab */
/*--------------------------------------------------------------------------*/
-static GtkWidget *
-locale_page (glPrefsDialog *dlg)
+static void
+construct_locale_page (glPrefsDialog *dlg)
{
- GtkWidget *wlabel, *wvbox, *wframe;
- GSList *radio_group = NULL;
-
- wvbox = gl_hig_vbox_new (GL_HIG_VBOX_OUTER);
-
- wlabel = gtk_label_new (_("Select locale specific behavior."));
- gtk_misc_set_alignment (GTK_MISC(wlabel), 0.0, 0.0);
- gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), wlabel);
-
- /* ----- Display Units Frame ------------------------------------ */
- wframe = gl_hig_category_new (_("Display units"));
- gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), wframe);
-
- radio_group = NULL;
-
- dlg->private->units_points_radio =
- gtk_radio_button_new_with_label (radio_group, _("Points"));
- radio_group =
- gtk_radio_button_get_group (GTK_RADIO_BUTTON (dlg->private->units_points_radio));
- gl_hig_category_add_widget (GL_HIG_CATEGORY(wframe),
- dlg->private->units_points_radio);
-
- dlg->private->units_inches_radio =
- gtk_radio_button_new_with_label (radio_group, _("Inches"));
- radio_group =
- gtk_radio_button_get_group (GTK_RADIO_BUTTON (dlg->private->units_inches_radio));
- gl_hig_category_add_widget (GL_HIG_CATEGORY(wframe),
- dlg->private->units_inches_radio);
-
- dlg->private->units_mm_radio =
- gtk_radio_button_new_with_label (radio_group, _("Millimeters"));
- radio_group =
- gtk_radio_button_get_group (GTK_RADIO_BUTTON (dlg->private->units_mm_radio));
- gl_hig_category_add_widget (GL_HIG_CATEGORY(wframe),
- dlg->private->units_mm_radio);
-
- /* ----- Page Size Frame ------------------------------------ */
- wframe = gl_hig_category_new (_("Default page size"));
- gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), wframe);
-
- radio_group = NULL;
-
- dlg->private->page_size_us_letter_radio =
- gtk_radio_button_new_with_label (radio_group, _("US Letter"));
- radio_group =
- gtk_radio_button_get_group (GTK_RADIO_BUTTON
- (dlg->private->page_size_us_letter_radio));
- gl_hig_category_add_widget (GL_HIG_CATEGORY(wframe),
- dlg->private->page_size_us_letter_radio);
-
- dlg->private->page_size_a4_radio =
- gtk_radio_button_new_with_label (radio_group, _("A4"));
- radio_group =
- gtk_radio_button_get_group (GTK_RADIO_BUTTON (dlg->private->page_size_a4_radio));
- gl_hig_category_add_widget (GL_HIG_CATEGORY(wframe),
- dlg->private->page_size_a4_radio);
+
+ dlg->priv->units_points_radio =
+ glade_xml_get_widget (dlg->priv->gui, "units_points_radio");
+
+ dlg->priv->units_inches_radio =
+ glade_xml_get_widget (dlg->priv->gui, "units_inches_radio");
+
+ dlg->priv->units_mm_radio =
+ glade_xml_get_widget (dlg->priv->gui, "units_mm_radio");
+
+ dlg->priv->page_size_us_letter_radio =
+ glade_xml_get_widget (dlg->priv->gui, "page_size_us_letter_radio");
+
+ dlg->priv->page_size_a4_radio =
+ glade_xml_get_widget (dlg->priv->gui, "page_size_a4_radio");
g_signal_connect_swapped (
- G_OBJECT(dlg->private->units_points_radio),
- "toggled", G_CALLBACK(update_prefs_from_locale_page), dlg);
+ G_OBJECT(dlg->priv->units_points_radio),
+ "toggled", G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dlg));
g_signal_connect_swapped (
- G_OBJECT(dlg->private->units_inches_radio),
- "toggled", G_CALLBACK(update_prefs_from_locale_page), dlg);
+ G_OBJECT(dlg->priv->units_inches_radio),
+ "toggled", G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dlg));
g_signal_connect_swapped (
- G_OBJECT(dlg->private->units_mm_radio),
- "toggled", G_CALLBACK(update_prefs_from_locale_page), dlg);
+ G_OBJECT(dlg->priv->units_mm_radio),
+ "toggled", G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dlg));
g_signal_connect_swapped (
- G_OBJECT(dlg->private->page_size_us_letter_radio),
- "toggled", G_CALLBACK(update_prefs_from_locale_page), dlg);
+ G_OBJECT(dlg->priv->page_size_us_letter_radio),
+ "toggled", G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dlg));
g_signal_connect_swapped (
- G_OBJECT(dlg->private->page_size_a4_radio),
- "toggled", G_CALLBACK(update_prefs_from_locale_page), dlg);
-
- return wvbox;
+ G_OBJECT(dlg->priv->page_size_a4_radio),
+ "toggled", G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dlg));
}
/*--------------------------------------------------------------------------*/
/* PRIVATE. Build Default Object Properties Notebook Tab */
/*--------------------------------------------------------------------------*/
-static GtkWidget *
-object_page (glPrefsDialog *dlg)
+static void
+construct_object_page (glPrefsDialog *dlg)
{
- GtkWidget *wlabel, *wvbox, *wframe;
- GtkSizeGroup *label_size_group;
-
- wvbox = gl_hig_vbox_new (GL_HIG_VBOX_OUTER);
- label_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
-
- wlabel = gtk_label_new (_("Select default properties for new objects."));
- gtk_misc_set_alignment (GTK_MISC(wlabel), 0.0, 0.0);
- gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), wlabel);
-
- /* ------ text props entry ------ */
- wframe = gl_hig_category_new (_("Text"));
- gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), wframe);
- dlg->private->text = gl_wdgt_text_props_new ();
- gl_wdgt_text_props_set_label_size_group (GL_WDGT_TEXT_PROPS(dlg->private->text),
- label_size_group);
- gl_hig_category_add_widget (GL_HIG_CATEGORY(wframe),
- dlg->private->text);
-
- /* ------ Line box ------ */
- wframe = gl_hig_category_new (_("Line"));
- gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), wframe);
- dlg->private->line = gl_wdgt_line_new ();
- gl_wdgt_line_set_label_size_group (GL_WDGT_LINE(dlg->private->line),
- label_size_group);
- gl_hig_category_add_widget (GL_HIG_CATEGORY(wframe),
- dlg->private->line);
-
- /* ------ Fill box ------ */
- wframe = gl_hig_category_new (_("Fill"));
- gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), wframe);
- dlg->private->fill = gl_wdgt_fill_new ();
- gl_wdgt_fill_set_label_size_group (GL_WDGT_FILL(dlg->private->fill),
- label_size_group);
- gl_hig_category_add_widget (GL_HIG_CATEGORY(wframe),
- dlg->private->fill);
-
- g_signal_connect_swapped (G_OBJECT(dlg->private->text),
+ GList *family_names;
+
+ dlg->priv->text_family_entry =
+ glade_xml_get_widget (dlg->priv->gui, "text_family_entry");
+ dlg->priv->text_family_combo =
+ glade_xml_get_widget (dlg->priv->gui, "text_family_combo");
+ dlg->priv->text_size_spin =
+ glade_xml_get_widget (dlg->priv->gui, "text_size_spin");
+ dlg->priv->text_bold_toggle =
+ glade_xml_get_widget (dlg->priv->gui, "text_bold_toggle");
+ dlg->priv->text_italic_toggle =
+ glade_xml_get_widget (dlg->priv->gui, "text_italic_toggle");
+ dlg->priv->text_color_combo =
+ glade_xml_get_widget (dlg->priv->gui, "text_color_combo");
+ dlg->priv->text_left_toggle =
+ glade_xml_get_widget (dlg->priv->gui, "text_left_toggle");
+ dlg->priv->text_center_toggle =
+ glade_xml_get_widget (dlg->priv->gui, "text_center_toggle");
+ dlg->priv->text_right_toggle =
+ glade_xml_get_widget (dlg->priv->gui, "text_right_toggle");
+
+ dlg->priv->line_width_spin =
+ glade_xml_get_widget (dlg->priv->gui, "line_width_spin");
+ dlg->priv->line_color_combo =
+ glade_xml_get_widget (dlg->priv->gui, "line_color_combo");
+
+ dlg->priv->fill_color_combo =
+ glade_xml_get_widget (dlg->priv->gui, "fill_color_combo");
+
+ /* Load family names */
+ family_names = gnome_font_family_list ();
+ gtk_combo_set_popdown_strings (GTK_COMBO(dlg->priv->text_family_combo),
+ family_names);
+ gnome_font_family_list_free (family_names);
+
+
+ g_signal_connect_swapped (G_OBJECT(dlg->priv->text_family_entry),
"changed",
G_CALLBACK(update_prefs_from_object_page),
- dlg);
- g_signal_connect_swapped (G_OBJECT(dlg->private->line),
+ G_OBJECT(dlg));
+ g_signal_connect_swapped (G_OBJECT(dlg->priv->text_size_spin),
"changed",
G_CALLBACK(update_prefs_from_object_page),
- dlg);
- g_signal_connect_swapped (G_OBJECT(dlg->private->fill),
+ G_OBJECT(dlg));
+ g_signal_connect_swapped (G_OBJECT(dlg->priv->text_bold_toggle),
+ "toggled",
+ G_CALLBACK(update_prefs_from_object_page),
+ G_OBJECT(dlg));
+ g_signal_connect_swapped (G_OBJECT(dlg->priv->text_italic_toggle),
+ "toggled",
+ G_CALLBACK(update_prefs_from_object_page),
+ G_OBJECT(dlg));
+ g_signal_connect_swapped (G_OBJECT(dlg->priv->text_color_combo),
+ "color_changed",
+ G_CALLBACK(update_prefs_from_object_page),
+ G_OBJECT(dlg));
+
+ g_signal_connect (G_OBJECT(dlg->priv->text_left_toggle),
+ "toggled",
+ G_CALLBACK(align_toggle_cb),
+ G_OBJECT(dlg));
+ g_signal_connect (G_OBJECT(dlg->priv->text_center_toggle),
+ "toggled",
+ G_CALLBACK(align_toggle_cb),
+ G_OBJECT(dlg));
+ g_signal_connect (G_OBJECT(dlg->priv->text_right_toggle),
+ "toggled",
+ G_CALLBACK(align_toggle_cb),
+ G_OBJECT(dlg));
+
+ g_signal_connect_swapped (G_OBJECT(dlg->priv->line_width_spin),
"changed",
G_CALLBACK(update_prefs_from_object_page),
- dlg);
- return wvbox;
+ G_OBJECT(dlg));
+ g_signal_connect_swapped (G_OBJECT(dlg->priv->line_color_combo),
+ "color_changed",
+ G_CALLBACK(update_prefs_from_object_page),
+ G_OBJECT(dlg));
+
+ g_signal_connect_swapped (G_OBJECT(dlg->priv->fill_color_combo),
+ "color_changed",
+ G_CALLBACK(update_prefs_from_object_page),
+ G_OBJECT(dlg));
}
+/*--------------------------------------------------------------------------*/
+/* PRIVATE. Alignment togglebutton callback. */
+/*--------------------------------------------------------------------------*/
+static void
+align_toggle_cb (GtkToggleButton *toggle,
+ glPrefsDialog *dlg)
+{
+ if (gtk_toggle_button_get_active (toggle)) {
+
+ if (GTK_WIDGET (toggle) == GTK_WIDGET (dlg->priv->text_left_toggle)) {
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
+ (dlg->priv->text_center_toggle),
+ FALSE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
+ (dlg->priv->text_right_toggle),
+ FALSE);
+ } else if (GTK_WIDGET (toggle) ==
+ GTK_WIDGET (dlg->priv->text_center_toggle)) {
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
+ (dlg->priv->text_left_toggle),
+ FALSE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
+ (dlg->priv->text_right_toggle),
+ FALSE);
+ } else if (GTK_WIDGET (toggle) ==
+ GTK_WIDGET (dlg->priv->text_right_toggle)) {
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
+ (dlg->priv->text_left_toggle),
+ FALSE);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
+ (dlg->priv->text_center_toggle),
+ FALSE);
+ }
+
+ update_prefs_from_object_page (dlg);
+ }
+
+}
+
+
/*--------------------------------------------------------------------------*/
/* PRIVATE. Update locale page widgets from current prefs. */
/*--------------------------------------------------------------------------*/
-static update_locale_page_from_prefs (glPrefsDialog *dlg)
+static void
+update_locale_page_from_prefs (glPrefsDialog *dlg)
{
g_signal_handlers_block_by_func (
- G_OBJECT(dlg->private->units_points_radio),
- G_CALLBACK(update_prefs_from_locale_page), dlg);
+ G_OBJECT(dlg->priv->units_points_radio),
+ G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dlg));
g_signal_handlers_block_by_func (
- G_OBJECT(dlg->private->units_inches_radio),
- G_CALLBACK(update_prefs_from_locale_page), dlg);
+ G_OBJECT(dlg->priv->units_inches_radio),
+ G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dlg));
g_signal_handlers_block_by_func (
- G_OBJECT(dlg->private->units_mm_radio),
- G_CALLBACK(update_prefs_from_locale_page), dlg);
+ G_OBJECT(dlg->priv->units_mm_radio),
+ G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dlg));
g_signal_handlers_block_by_func (
- G_OBJECT(dlg->private->page_size_us_letter_radio),
- G_CALLBACK(update_prefs_from_locale_page), dlg);
+ G_OBJECT(dlg->priv->page_size_us_letter_radio),
+ G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dlg));
g_signal_handlers_block_by_func (
- G_OBJECT(dlg->private->page_size_a4_radio),
- G_CALLBACK(update_prefs_from_locale_page), dlg);
+ G_OBJECT(dlg->priv->page_size_a4_radio),
+ G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dlg));
switch (gl_prefs->units) {
case GL_PREFS_UNITS_PTS:
gtk_toggle_button_set_active (
- GTK_TOGGLE_BUTTON(dlg->private->units_points_radio),
+ GTK_TOGGLE_BUTTON(dlg->priv->units_points_radio),
TRUE);
break;
case GL_PREFS_UNITS_INCHES:
gtk_toggle_button_set_active (
- GTK_TOGGLE_BUTTON(dlg->private->units_inches_radio),
+ GTK_TOGGLE_BUTTON(dlg->priv->units_inches_radio),
TRUE);
break;
case GL_PREFS_UNITS_MM:
gtk_toggle_button_set_active (
- GTK_TOGGLE_BUTTON(dlg->private->units_mm_radio),
+ GTK_TOGGLE_BUTTON(dlg->priv->units_mm_radio),
TRUE);
break;
default:
if ( g_strcasecmp(gl_prefs->default_page_size, US_LETTER_ID) == 0) {
gtk_toggle_button_set_active (
- GTK_TOGGLE_BUTTON(dlg->private->page_size_us_letter_radio),
+ GTK_TOGGLE_BUTTON(dlg->priv->page_size_us_letter_radio),
TRUE);
} else if ( g_strcasecmp(gl_prefs->default_page_size, A4_ID) == 0) {
gtk_toggle_button_set_active (
- GTK_TOGGLE_BUTTON(dlg->private->page_size_a4_radio),
+ GTK_TOGGLE_BUTTON(dlg->priv->page_size_a4_radio),
TRUE);
} else {
g_warning ("Unknown default page size"); /* Shouldn't happen */
}
g_signal_handlers_unblock_by_func (
- G_OBJECT(dlg->private->units_points_radio),
- G_CALLBACK(update_prefs_from_locale_page), dlg);
+ G_OBJECT(dlg->priv->units_points_radio),
+ G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dlg));
g_signal_handlers_unblock_by_func (
- G_OBJECT(dlg->private->units_inches_radio),
- G_CALLBACK(update_prefs_from_locale_page), dlg);
+ G_OBJECT(dlg->priv->units_inches_radio),
+ G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dlg));
g_signal_handlers_unblock_by_func (
- G_OBJECT(dlg->private->units_mm_radio),
- G_CALLBACK(update_prefs_from_locale_page), dlg);
+ G_OBJECT(dlg->priv->units_mm_radio),
+ G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dlg));
g_signal_handlers_unblock_by_func (
- G_OBJECT(dlg->private->page_size_us_letter_radio),
- G_CALLBACK(update_prefs_from_locale_page), dlg);
+ G_OBJECT(dlg->priv->page_size_us_letter_radio),
+ G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dlg));
g_signal_handlers_unblock_by_func (
- G_OBJECT(dlg->private->page_size_a4_radio),
- G_CALLBACK(update_prefs_from_locale_page), dlg);
+ G_OBJECT(dlg->priv->page_size_a4_radio),
+ G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dlg));
}
/*--------------------------------------------------------------------------*/
/* PRIVATE. Update object page widgets from current prefs. */
/*--------------------------------------------------------------------------*/
-static update_object_page_from_prefs (glPrefsDialog *dlg)
+static void
+ update_object_page_from_prefs (glPrefsDialog *dlg)
{
+ GList *family_names;
+ gchar *good_font_family;
+ GdkColor *gdk_color;
+
g_signal_handlers_block_by_func (
- G_OBJECT(dlg->private->text),
- G_CALLBACK(update_prefs_from_object_page), dlg);
+ G_OBJECT(dlg->priv->text_family_entry),
+ G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dlg));
g_signal_handlers_block_by_func (
- G_OBJECT(dlg->private->line),
- G_CALLBACK(update_prefs_from_object_page), dlg);
+ G_OBJECT(dlg->priv->text_size_spin),
+ G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dlg));
g_signal_handlers_block_by_func (
- G_OBJECT(dlg->private->fill),
- G_CALLBACK(update_prefs_from_object_page), dlg);
-
- gl_wdgt_text_props_set_params (GL_WDGT_TEXT_PROPS(dlg->private->text),
- gl_prefs->default_font_family,
- gl_prefs->default_font_size,
- gl_prefs->default_font_weight,
- gl_prefs->default_font_italic_flag,
- gl_prefs->default_text_color,
- gl_prefs->default_text_alignment);
-
- gl_wdgt_line_set_params (GL_WDGT_LINE(dlg->private->line),
- gl_prefs->default_line_width,
- gl_prefs->default_line_color);
+ G_OBJECT(dlg->priv->text_bold_toggle),
+ G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dlg));
+ g_signal_handlers_block_by_func (
+ G_OBJECT(dlg->priv->text_italic_toggle),
+ G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dlg));
+ g_signal_handlers_block_by_func (
+ G_OBJECT(dlg->priv->text_color_combo),
+ G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dlg));
+ g_signal_handlers_block_by_func (
+ G_OBJECT(dlg->priv->text_left_toggle),
+ G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dlg));
+ g_signal_handlers_block_by_func (
+ G_OBJECT(dlg->priv->text_center_toggle),
+ G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dlg));
+ g_signal_handlers_block_by_func (
+ G_OBJECT(dlg->priv->text_right_toggle),
+ G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dlg));
+ g_signal_handlers_block_by_func (
+ G_OBJECT(dlg->priv->line_width_spin),
+ G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dlg));
+ g_signal_handlers_block_by_func (
+ G_OBJECT(dlg->priv->line_color_combo),
+ G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dlg));
+ g_signal_handlers_block_by_func (
+ G_OBJECT(dlg->priv->fill_color_combo),
+ G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dlg));
+
+
+ /* Make sure we have a valid font family. if not provide a good default. */
+ family_names = gnome_font_family_list ();
+ if (g_list_find_custom (family_names,
+ gl_prefs->default_font_family,
+ (GCompareFunc)g_utf8_collate)) {
+ good_font_family = g_strdup (gl_prefs->default_font_family);
+ } else {
+ if (family_names != NULL) {
+ good_font_family = g_strdup (family_names->data); /* 1st entry */
+ } else {
+ good_font_family = NULL;
+ }
+ }
+ gnome_font_family_list_free (family_names);
+ gtk_entry_set_text (GTK_ENTRY (dlg->priv->text_family_entry), good_font_family);
+ g_free (good_font_family);
+
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (dlg->priv->text_size_spin),
+ gl_prefs->default_font_size);
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dlg->priv->text_bold_toggle),
+ (gl_prefs->default_font_weight == GNOME_FONT_BOLD));
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dlg->priv->text_italic_toggle),
+ gl_prefs->default_font_italic_flag);
+
+ gdk_color = gl_color_to_gdk_color (gl_prefs->default_text_color);
+ color_combo_set_color (COLOR_COMBO(dlg->priv->text_color_combo), gdk_color);
+ g_free (gdk_color);
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dlg->priv->text_left_toggle),
+ (gl_prefs->default_text_alignment == GTK_JUSTIFY_LEFT));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dlg->priv->text_center_toggle),
+ (gl_prefs->default_text_alignment == GTK_JUSTIFY_CENTER));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dlg->priv->text_right_toggle),
+ (gl_prefs->default_text_alignment == GTK_JUSTIFY_RIGHT));
+
+
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (dlg->priv->line_width_spin),
+ gl_prefs->default_line_width);
+
+ gdk_color = gl_color_to_gdk_color (gl_prefs->default_line_color);
+ color_combo_set_color (COLOR_COMBO(dlg->priv->line_color_combo), gdk_color);
+ g_free (gdk_color);
+
+
+ gdk_color = gl_color_to_gdk_color (gl_prefs->default_fill_color);
+ color_combo_set_color (COLOR_COMBO(dlg->priv->fill_color_combo), gdk_color);
+ g_free (gdk_color);
- gl_wdgt_fill_set_params (GL_WDGT_FILL(dlg->private->fill),
- gl_prefs->default_fill_color);
g_signal_handlers_unblock_by_func (
- G_OBJECT(dlg->private->text),
- G_CALLBACK(update_prefs_from_object_page), dlg);
+ G_OBJECT(dlg->priv->text_family_entry),
+ G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dlg));
+ g_signal_handlers_unblock_by_func (
+ G_OBJECT(dlg->priv->text_size_spin),
+ G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dlg));
+ g_signal_handlers_unblock_by_func (
+ G_OBJECT(dlg->priv->text_bold_toggle),
+ G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dlg));
+ g_signal_handlers_unblock_by_func (
+ G_OBJECT(dlg->priv->text_italic_toggle),
+ G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dlg));
+ g_signal_handlers_unblock_by_func (
+ G_OBJECT(dlg->priv->text_color_combo),
+ G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dlg));
g_signal_handlers_unblock_by_func (
- G_OBJECT(dlg->private->line),
- G_CALLBACK(update_prefs_from_object_page), dlg);
+ G_OBJECT(dlg->priv->text_left_toggle),
+ G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dlg));
g_signal_handlers_unblock_by_func (
- G_OBJECT(dlg->private->fill),
- G_CALLBACK(update_prefs_from_object_page), dlg);
+ G_OBJECT(dlg->priv->text_center_toggle),
+ G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dlg));
+ g_signal_handlers_unblock_by_func (
+ G_OBJECT(dlg->priv->text_right_toggle),
+ G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dlg));
+ g_signal_handlers_unblock_by_func (
+ G_OBJECT(dlg->priv->line_width_spin),
+ G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dlg));
+ g_signal_handlers_unblock_by_func (
+ G_OBJECT(dlg->priv->line_color_combo),
+ G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dlg));
+ g_signal_handlers_unblock_by_func (
+ G_OBJECT(dlg->priv->fill_color_combo),
+ G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dlg));
}
/*--------------------------------------------------------------------------*/
/* PRIVATE. Update prefs from current state of locale page widgets. */
/*--------------------------------------------------------------------------*/
-static update_prefs_from_locale_page (glPrefsDialog *dlg)
+static void
+update_prefs_from_locale_page (glPrefsDialog *dlg)
{
if (gtk_toggle_button_get_active (
- GTK_TOGGLE_BUTTON(dlg->private->units_points_radio))) {
+ GTK_TOGGLE_BUTTON(dlg->priv->units_points_radio))) {
gl_prefs->units = GL_PREFS_UNITS_PTS;
}
if (gtk_toggle_button_get_active (
- GTK_TOGGLE_BUTTON(dlg->private->units_inches_radio))) {
+ GTK_TOGGLE_BUTTON(dlg->priv->units_inches_radio))) {
gl_prefs->units = GL_PREFS_UNITS_INCHES;
}
if (gtk_toggle_button_get_active (
- GTK_TOGGLE_BUTTON(dlg->private->units_mm_radio))) {
+ GTK_TOGGLE_BUTTON(dlg->priv->units_mm_radio))) {
gl_prefs->units = GL_PREFS_UNITS_MM;
}
if (gtk_toggle_button_get_active (
- GTK_TOGGLE_BUTTON(dlg->private->page_size_us_letter_radio))) {
+ GTK_TOGGLE_BUTTON(dlg->priv->page_size_us_letter_radio))) {
gl_prefs->default_page_size = US_LETTER_ID;
}
if (gtk_toggle_button_get_active (
- GTK_TOGGLE_BUTTON(dlg->private->page_size_a4_radio))) {
+ GTK_TOGGLE_BUTTON(dlg->priv->page_size_a4_radio))) {
gl_prefs->default_page_size = A4_ID;
}
/*--------------------------------------------------------------------------*/
/* PRIVATE. Update prefs from current state of object page widgets. */
/*--------------------------------------------------------------------------*/
-static update_prefs_from_object_page (glPrefsDialog *dlg)
+static void
+update_prefs_from_object_page (glPrefsDialog *dlg)
{
- gl_wdgt_text_props_get_params (GL_WDGT_TEXT_PROPS(dlg->private->text),
- &gl_prefs->default_font_family,
- &gl_prefs->default_font_size,
- &gl_prefs->default_font_weight,
- &gl_prefs->default_font_italic_flag,
- &gl_prefs->default_text_color,
- &gl_prefs->default_text_alignment);
-
- gl_wdgt_line_get_params (GL_WDGT_LINE(dlg->private->line),
- &gl_prefs->default_line_width,
- &gl_prefs->default_line_color);
-
- gl_wdgt_fill_get_params (GL_WDGT_FILL(dlg->private->fill),
- &gl_prefs->default_fill_color);
+ GdkColor *gdk_color;
+ gboolean is_default;
+
+
+ g_free (gl_prefs->default_font_family);
+ gl_prefs->default_font_family =
+ gtk_editable_get_chars (GTK_EDITABLE (dlg->priv->text_family_entry),
+ 0, -1);
+ gl_prefs->default_font_size =
+ gtk_spin_button_get_value (GTK_SPIN_BUTTON(dlg->priv->text_size_spin));
+
+ if (gtk_toggle_button_get_active
+ (GTK_TOGGLE_BUTTON (dlg->priv->text_bold_toggle))) {
+ gl_prefs->default_font_weight = GNOME_FONT_BOLD;
+ } else {
+ gl_prefs->default_font_weight = GNOME_FONT_BOOK;
+ }
+
+ gl_prefs->default_font_italic_flag =
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
+ (dlg->priv->text_italic_toggle));
+
+ gdk_color = color_combo_get_color (COLOR_COMBO(dlg->priv->text_color_combo),
+ &is_default);
+ if (!is_default) {
+ gl_prefs->default_text_color = gl_color_from_gdk_color (gdk_color);
+ }
+
+ if (gtk_toggle_button_get_active
+ (GTK_TOGGLE_BUTTON (dlg->priv->text_left_toggle))) {
+ gl_prefs->default_text_alignment = GTK_JUSTIFY_LEFT;
+ } else
+ if (gtk_toggle_button_get_active
+ (GTK_TOGGLE_BUTTON (dlg->priv->text_right_toggle))) {
+ gl_prefs->default_text_alignment = GTK_JUSTIFY_RIGHT;
+ } else
+ if (gtk_toggle_button_get_active
+ (GTK_TOGGLE_BUTTON (dlg->priv->text_center_toggle))) {
+ gl_prefs->default_text_alignment = GTK_JUSTIFY_CENTER;
+ } else {
+ /* Should not happen. */
+ gl_prefs->default_text_alignment = GTK_JUSTIFY_LEFT;
+ }
+
+
+ gl_prefs->default_line_width =
+ gtk_spin_button_get_value (GTK_SPIN_BUTTON(dlg->priv->line_width_spin));
+
+ gdk_color = color_combo_get_color (COLOR_COMBO(dlg->priv->line_color_combo),
+ &is_default);
+ if (!is_default) {
+ gl_prefs->default_line_color = gl_color_from_gdk_color (gdk_color);
+ }
+
+
+ gdk_color = color_combo_get_color (COLOR_COMBO(dlg->priv->fill_color_combo),
+ &is_default);
+ if (!is_default) {
+ gl_prefs->default_fill_color = gl_color_from_gdk_color (gdk_color);
+ }
gl_prefs_save_settings ();
}
--- /dev/null
+<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
+<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
+
+<glade-interface>
+
+<widget class="GtkDialog" id="dialog1">
+ <property name="visible">True</property>
+ <property name="title" translatable="yes">gLabels Preferences</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">False</property>
+ <property name="resizable">True</property>
+ <property name="destroy_with_parent">False</property>
+ <property name="has_separator">True</property>
+
+ <child internal-child="vbox">
+ <widget class="GtkVBox" id="dialog-vbox1">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child internal-child="action_area">
+ <widget class="GtkHButtonBox" id="dialog-action_area1">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+
+ <child>
+ <widget class="GtkButton" id="closebutton1">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-close</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="response_id">-7</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkNotebook" id="prefs_notebook">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="show_tabs">True</property>
+ <property name="show_border">True</property>
+ <property name="tab_pos">GTK_POS_TOP</property>
+ <property name="scrollable">False</property>
+ <property name="enable_popup">False</property>
+
+ <child>
+ <widget class="GtkVBox" id="vbox1">
+ <property name="border_width">12</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkLabel" id="label3">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Select locale specific behavior.</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkFrame" id="frame1">
+ <property name="visible">True</property>
+ <property name="label_xalign">0</property>
+ <property name="label_yalign">0.5</property>
+ <property name="shadow_type">GTK_SHADOW_NONE</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkLabel" id="label6">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"> </property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox2">
+ <property name="border_width">6</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkRadioButton" id="units_points_radio">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Points</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkRadioButton" id="units_inches_radio">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Inches</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">units_points_radio</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkRadioButton" id="units_mm_radio">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Millimeters</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">units_points_radio</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label4">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"><span weight="bold">Units</span></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="type">label_item</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkFrame" id="frame2">
+ <property name="visible">True</property>
+ <property name="label_xalign">0</property>
+ <property name="label_yalign">0.5</property>
+ <property name="shadow_type">GTK_SHADOW_NONE</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox2">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkLabel" id="label7">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"> </property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox3">
+ <property name="border_width">6</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+
+ <child>
+ <widget class="GtkRadioButton" id="page_size_us_letter_radio">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">US Letter</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkRadioButton" id="page_size_a4_radio">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">ISO A4</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ <property name="group">page_size_us_letter_radio</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label5">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"><span weight="bold">Default page size</span></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="type">label_item</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="tab_expand">False</property>
+ <property name="tab_fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label1">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Locale</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="type">tab</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox4">
+ <property name="border_width">12</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkLabel" id="label8">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Select default properties for new objects.</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkFrame" id="frame3">
+ <property name="visible">True</property>
+ <property name="label_xalign">0</property>
+ <property name="label_yalign">0.5</property>
+ <property name="shadow_type">GTK_SHADOW_NONE</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox3">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkLabel" id="label12">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"> </property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox5">
+ <property name="border_width">6</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox6">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkLabel" id="label15">
+ <property name="width_request">64</property>
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Font:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkCombo" id="text_family_combo">
+ <property name="visible">True</property>
+ <property name="value_in_list">True</property>
+ <property name="allow_empty">False</property>
+ <property name="case_sensitive">False</property>
+ <property name="enable_arrow_keys">True</property>
+ <property name="enable_arrows_always">False</property>
+
+ <child internal-child="entry">
+ <widget class="GtkEntry" id="text_family_entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="editable">True</property>
+ <property name="visibility">True</property>
+ <property name="max_length">0</property>
+ <property name="text" translatable="yes"></property>
+ <property name="has_frame">True</property>
+ <property name="invisible_char" translatable="yes">*</property>
+ <property name="activates_default">False</property>
+ </widget>
+ </child>
+
+ <child internal-child="list">
+ <widget class="GtkList" id="combo-list1">
+ <property name="visible">True</property>
+ <property name="selection_mode">GTK_SELECTION_BROWSE</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkSpinButton" id="text_size_spin">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="climb_rate">1</property>
+ <property name="digits">0</property>
+ <property name="numeric">False</property>
+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="snap_to_ticks">False</property>
+ <property name="wrap">False</property>
+ <property name="adjustment">1 0 100 1 10 10</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkToggleButton" id="text_bold_toggle">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+
+ <child>
+ <widget class="GtkImage" id="image6">
+ <property name="visible">True</property>
+ <property name="stock">gtk-bold</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkToggleButton" id="text_italic_toggle">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+
+ <child>
+ <widget class="GtkImage" id="image7">
+ <property name="visible">True</property>
+ <property name="stock">gtk-italic</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox7">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkLabel" id="label16">
+ <property name="width_request">64</property>
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Color:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="Custom" id="text_color_combo">
+ <property name="visible">True</property>
+ <property name="creation_function">gl_object_editor_construct_color_combo</property>
+ <property name="int1">2</property>
+ <property name="int2">0</property>
+ <property name="last_modification_time">Sun, 23 Nov 2003 15:42:02 GMT</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox8">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkLabel" id="label17">
+ <property name="width_request">64</property>
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Alignment:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkToggleButton" id="text_left_toggle">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+
+ <child>
+ <widget class="GtkImage" id="image3">
+ <property name="visible">True</property>
+ <property name="stock">gtk-justify-left</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkToggleButton" id="text_center_toggle">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+
+ <child>
+ <widget class="GtkImage" id="image4">
+ <property name="visible">True</property>
+ <property name="stock">gtk-justify-center</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkToggleButton" id="text_right_toggle">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+
+ <child>
+ <widget class="GtkImage" id="image5">
+ <property name="visible">True</property>
+ <property name="stock">gtk-justify-right</property>
+ <property name="icon_size">4</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label9">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"><span weight="bold">Text</span></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="type">label_item</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkFrame" id="frame4">
+ <property name="visible">True</property>
+ <property name="label_xalign">0</property>
+ <property name="label_yalign">0.5</property>
+ <property name="shadow_type">GTK_SHADOW_NONE</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox4">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkLabel" id="label13">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"> </property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox6">
+ <property name="border_width">6</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox9">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkLabel" id="label18">
+ <property name="width_request">64</property>
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Width:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkSpinButton" id="line_width_spin">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="climb_rate">1</property>
+ <property name="digits">0</property>
+ <property name="numeric">False</property>
+ <property name="update_policy">GTK_UPDATE_ALWAYS</property>
+ <property name="snap_to_ticks">False</property>
+ <property name="wrap">False</property>
+ <property name="adjustment">1 0 100 1 10 10</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label21">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">points</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkHBox" id="hbox10">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkLabel" id="label19">
+ <property name="width_request">64</property>
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Color:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="Custom" id="line_color_combo">
+ <property name="visible">True</property>
+ <property name="creation_function">gl_object_editor_construct_color_combo</property>
+ <property name="int1">1</property>
+ <property name="int2">0</property>
+ <property name="last_modification_time">Sun, 23 Nov 2003 15:42:41 GMT</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label10">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"><span weight="bold">Line</span></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="type">label_item</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkFrame" id="frame5">
+ <property name="visible">True</property>
+ <property name="label_xalign">0</property>
+ <property name="label_yalign">0.5</property>
+ <property name="shadow_type">GTK_SHADOW_NONE</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox5">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+
+ <child>
+ <widget class="GtkLabel" id="label14">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"> </property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkVBox" id="vbox7">
+ <property name="border_width">6</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkHBox" id="hbox11">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+
+ <child>
+ <widget class="GtkLabel" id="label20">
+ <property name="width_request">64</property>
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Color:</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="Custom" id="fill_color_combo">
+ <property name="visible">True</property>
+ <property name="creation_function">gl_object_editor_construct_color_combo</property>
+ <property name="int1">0</property>
+ <property name="int2">0</property>
+ <property name="last_modification_time">Sun, 23 Nov 2003 15:43:12 GMT</property>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label11">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"><span weight="bold">Fill</span></property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">True</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="type">label_item</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="tab_expand">False</property>
+ <property name="tab_fill">True</property>
+ </packing>
+ </child>
+
+ <child>
+ <widget class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Object defaults</property>
+ <property name="use_underline">False</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </widget>
+ <packing>
+ <property name="type">tab</property>
+ </packing>
+ </child>
+ </widget>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </widget>
+ </child>
+</widget>
+
+</glade-interface>
{
glHigDialog parent_instance;
- glPrefsDialogPrivate *private;
+ glPrefsDialogPrivate *priv;
};
stock_line_16.png \
stock_merge_24.png \
stock_merge_16.png \
+ stock_properties_24.png \
stock_properties_16.png \
stock_text_24.png \
stock_text_16.png \
stock_line_16 $(srcdir)/stock_line_16.png \
stock_merge_24 $(srcdir)/stock_merge_24.png \
stock_merge_16 $(srcdir)/stock_merge_16.png \
+ stock_properties_24 $(srcdir)/stock_properties_24.png \
stock_properties_16 $(srcdir)/stock_properties_16.png \
stock_text_24 $(srcdir)/stock_text_24.png \
stock_text_16 $(srcdir)/stock_text_16.png \
add_icons (factory, GL_STOCK_BARCODE, stock_barcode_24, stock_barcode_16);
add_icons (factory, GL_STOCK_MERGE, stock_merge_24, stock_merge_16);
- add_icons (factory, GL_STOCK_PROPERTIES, NULL, stock_properties_16);
+ add_icons (factory, GL_STOCK_PROPERTIES,
+ stock_properties_24,
+ stock_properties_16);
add_icons (factory, GL_STOCK_ORDER_TOP, NULL, stock_order_top_16);
add_icons (factory, GL_STOCK_ORDER_BOTTOM, NULL, stock_order_bottom_16);
}
/*****************************************************************************/
-/* edit merge properties callback. */
+/* zoom to fit callback. */
/*****************************************************************************/
void
-gl_tools_merge_properties (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname)
+gl_tools_zoom_to_fit (BonoboUIComponent *uic,
+ gpointer user_data,
+ const gchar *verbname)
{
glWindow *window;
window = GL_WINDOW (user_data);
if (window->view != NULL) {
- gl_view_edit_merge_props (GL_VIEW(window->view));
+ gl_view_zoom_best_fit (GL_VIEW(window->view));
}
}
/*****************************************************************************/
-/* edit object properties callback. */
+/* edit merge properties callback. */
/*****************************************************************************/
void
-gl_tools_object_properties (BonoboUIComponent *uic,
- gpointer user_data,
- const gchar *verbname)
+gl_tools_merge_properties (BonoboUIComponent *uic,
+ gpointer user_data,
+ const gchar *verbname)
{
glWindow *window;
window = GL_WINDOW (user_data);
if (window->view != NULL) {
- gl_view_edit_object_props (GL_VIEW(window->view));
+ gl_view_edit_merge_props (GL_VIEW(window->view));
}
}
gpointer user_data,
const gchar *verbname);
-void gl_tools_merge_properties (BonoboUIComponent *uic,
+void gl_tools_zoom_to_fit (BonoboUIComponent *uic,
gpointer user_data,
const gchar *verbname);
-void gl_tools_object_properties (BonoboUIComponent *uic,
+void gl_tools_merge_properties (BonoboUIComponent *uic,
gpointer user_data,
const gchar *verbname);
--- /dev/null
+/*
+ * (GLABELS) Label and Business Card Creation program for GNOME
+ *
+ * ui-sidebar.c: Object property sidebar
+ *
+ * Copyright (C) 2003 Jim Evins <evins@snaught.com>.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <config.h>
+
+#include <libgnomeprint/gnome-font.h>
+
+#include "ui-sidebar.h"
+#include "ui-util.h"
+#include "object-editor.h"
+#include "stock.h"
+
+#include "debug.h"
+
+/*============================================================================*/
+/* Private macros and constants. */
+/*============================================================================*/
+
+#define DEFAULT_SIDEBAR_WIDTH 300
+
+/*============================================================================*/
+/* Private globals */
+/*============================================================================*/
+
+static GObjectClass *parent_class;
+
+static gchar* doc_verbs [] = {
+ "/commands/PropertyEditor",
+
+ NULL
+};
+
+/*============================================================================*/
+/* Local function prototypes */
+/*============================================================================*/
+
+static void gl_ui_sidebar_class_init (glUISidebarClass *class);
+static void gl_ui_sidebar_instance_init (glUISidebar *sidebar);
+static void gl_ui_sidebar_finalize (GObject *object);
+
+static void gl_ui_sidebar_construct (glUISidebar *sidebar,
+ BonoboUIComponent *ui_component);
+
+static void selection_changed_cb (glView *view,
+ glUISidebar *sidebar);
+
+
+\f
+/****************************************************************************/
+/* Boilerplate Object stuff. */
+/****************************************************************************/
+guint
+gl_ui_sidebar_get_type (void)
+{
+ static guint sidebar_type = 0;
+
+ if (!sidebar_type) {
+ GTypeInfo sidebar_info = {
+ sizeof (glUISidebarClass),
+ NULL,
+ NULL,
+ (GClassInitFunc) gl_ui_sidebar_class_init,
+ NULL,
+ NULL,
+ sizeof (glUISidebar),
+ 0,
+ (GInstanceInitFunc) gl_ui_sidebar_instance_init,
+ };
+
+ sidebar_type =
+ g_type_register_static (GTK_TYPE_VBOX,
+ "glUISidebar",
+ &sidebar_info, 0);
+ }
+
+ return sidebar_type;
+}
+
+static void
+gl_ui_sidebar_class_init (glUISidebarClass *class)
+{
+ GObjectClass *object_class = (GObjectClass *) class;
+
+ gl_debug (DEBUG_UI, "START");
+
+ parent_class = g_type_class_peek_parent (class);
+
+ object_class->finalize = gl_ui_sidebar_finalize;
+
+ gl_debug (DEBUG_UI, "END");
+}
+
+static void
+gl_ui_sidebar_instance_init (glUISidebar *sidebar)
+{
+ gl_debug (DEBUG_UI, "START");
+
+ sidebar->view = NULL;
+
+ gl_debug (DEBUG_UI, "END");
+}
+
+static void
+gl_ui_sidebar_finalize (GObject *object)
+{
+ glUISidebar *sidebar;
+
+ gl_debug (DEBUG_UI, "START");
+
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (GL_IS_UI_SIDEBAR (object));
+
+ sidebar = GL_UI_SIDEBAR (object);
+
+ if (sidebar->view) {
+ g_object_unref (G_OBJECT(sidebar->view));
+ sidebar = NULL;
+ }
+
+ G_OBJECT_CLASS (parent_class)->finalize (object);
+
+ gl_debug (DEBUG_UI, "END");
+}
+
+/****************************************************************************/
+/* Create a NEW sidebar. */
+/****************************************************************************/
+GObject *
+gl_ui_sidebar_new (BonoboUIComponent *ui_component)
+{
+ glUISidebar *sidebar;
+
+ gl_debug (DEBUG_UI, "START");
+
+ sidebar = g_object_new (gl_ui_sidebar_get_type (), NULL);
+
+ gtk_widget_set_size_request (GTK_WIDGET (sidebar), DEFAULT_SIDEBAR_WIDTH, -1);
+
+ gl_ui_sidebar_construct (sidebar, ui_component);
+
+ gl_debug (DEBUG_UI, "END");
+
+ return G_OBJECT(sidebar);
+}
+
+/******************************************************************************/
+/* Initialize property toolbar. */
+/******************************************************************************/
+static void
+gl_ui_sidebar_construct (glUISidebar *sidebar,
+ BonoboUIComponent *ui_component)
+{
+ gl_debug (DEBUG_UI, "START");
+
+ sidebar->ui_component = ui_component;
+
+ gl_ui_util_insert_widget (ui_component,
+ GTK_WIDGET (sidebar),
+ "/PropertySidebar/PropertyEditor");
+
+ sidebar->empty_child = gl_object_editor_new (GL_STOCK_PROPERTIES,
+ _("Object properties"),
+ GL_OBJECT_EDITOR_EMPTY,
+ NULL);
+
+ sidebar->child = gtk_widget_ref (sidebar->empty_child);
+ gtk_widget_show (sidebar->child);
+ gtk_container_add (GTK_CONTAINER(sidebar), sidebar->child);
+
+ gl_ui_util_set_verb_list_sensitive (ui_component, doc_verbs, FALSE);
+
+ gl_debug (DEBUG_UI, "END");
+}
+
+/****************************************************************************/
+/* Set view associated with sidebar. */
+/****************************************************************************/
+void
+gl_ui_sidebar_set_view (glUISidebar *sidebar,
+ glView *view)
+{
+ gl_debug (DEBUG_UI, "START");
+
+ g_return_if_fail (view && GL_IS_VIEW (view));
+
+ gl_ui_util_set_verb_list_sensitive (sidebar->ui_component, doc_verbs, TRUE);
+
+ sidebar->view = GL_VIEW (g_object_ref (G_OBJECT (view)));
+
+ g_signal_connect (G_OBJECT(view), "selection_changed",
+ G_CALLBACK(selection_changed_cb), sidebar);
+
+ gl_debug (DEBUG_UI, "END");
+}
+
+/*---------------------------------------------------------------------------*/
+/* PRIVATE. View "selection state changed" callback. */
+/*---------------------------------------------------------------------------*/
+static void
+selection_changed_cb (glView *view,
+ glUISidebar *sidebar)
+{
+ gl_debug (DEBUG_UI, "START");
+
+ g_return_if_fail (view && GL_IS_VIEW (view));
+ g_return_if_fail (sidebar && GL_IS_UI_SIDEBAR (sidebar));
+
+ gtk_container_remove (GTK_CONTAINER(sidebar), sidebar->child);
+
+ if (gl_view_is_selection_empty (view)) {
+
+ sidebar->child = gtk_widget_ref (sidebar->empty_child);
+
+ } else {
+
+ sidebar->child = gtk_widget_ref (gl_view_get_editor (view));
+
+ }
+
+ gtk_widget_show (sidebar->child);
+#if 0
+ gtk_container_add (GTK_CONTAINER(sidebar), sidebar->child);
+#else
+ gtk_box_pack_start (GTK_BOX(sidebar), sidebar->child, TRUE, TRUE, 0);
+#endif
+
+ gl_debug (DEBUG_UI, "END");
+}
+
--- /dev/null
+/*
+ * (GLABELS) Label and Business Card Creation program for GNOME
+ *
+ * ui-sidebar.h: Object property sidebar header file
+ *
+ * Copyright (C) 2003 Jim Evins <evins@snaught.com>.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef __UI_SIDEBAR_H__
+#define __UI_SIDEBAR_H__
+
+#include <glib-object.h>
+#include <bonobo/bonobo-ui-component.h>
+#include <bonobo/bonobo-window.h>
+
+#include "view.h"
+
+G_BEGIN_DECLS
+
+#define GL_TYPE_UI_SIDEBAR (gl_ui_sidebar_get_type ())
+#define GL_UI_SIDEBAR(obj) \
+ (GTK_CHECK_CAST((obj), GL_TYPE_UI_SIDEBAR, glUISidebar ))
+#define GL_UI_SIDEBAR_CLASS(klass) \
+ (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_UI_SIDEBAR, glUISidebarClass))
+#define GL_IS_UI_SIDEBAR(obj) \
+ (GTK_CHECK_TYPE ((obj), GL_TYPE_UI_SIDEBAR))
+#define GL_IS_UI_SIDEBAR_CLASS(klass) \
+ (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_UI_SIDEBAR))
+
+typedef struct _glUISidebar glUISidebar;
+typedef struct _glUISidebarClass glUISidebarClass;
+
+struct _glUISidebar {
+ GtkVBox parent_widget;
+
+ BonoboUIComponent *ui_component;
+
+ glView *view;
+ GtkWidget *child;
+ GtkWidget *empty_child;
+};
+
+struct _glUISidebarClass {
+ GtkVBoxClass parent_class;
+};
+
+guint gl_ui_sidebar_get_type (void);
+
+GObject *gl_ui_sidebar_new (BonoboUIComponent *ui_component);
+
+void gl_ui_sidebar_set_view (glUISidebar *sidebar,
+ glView *view);
+
+
+G_END_DECLS
+
+#endif /* __UI_SIDEBAR_H__ */
BONOBO_UI_VERB ("ToolsZoomIn", gl_tools_zoomin),
BONOBO_UI_VERB ("ToolsZoomOut", gl_tools_zoomout),
BONOBO_UI_VERB ("ToolsZoom1to1", gl_tools_zoom1to1),
+ BONOBO_UI_VERB ("ToolsZoomToFit", gl_tools_zoom_to_fit),
BONOBO_UI_VERB ("ToolsMergeProperties", gl_tools_merge_properties),
- BONOBO_UI_VERB ("ToolsObjectProperties", gl_tools_object_properties),
BONOBO_UI_VERB ("ToolsRaiseObjects", gl_tools_raise_objects),
BONOBO_UI_VERB ("ToolsLowerObjects", gl_tools_lower_objects),
BONOBO_UI_VERB ("ToolsRotateLeft", gl_tools_rotate_objects_left),
"/commands/ToolsZoomIn",
"/commands/ToolsZoomOut",
"/commands/ToolsZoom1to1",
+ "/commands/ToolsZoomToFit",
"/commands/ToolsMergeProperties",
- "/commands/ToolsObjectProperties",
"/commands/ToolsRaiseObjects",
"/commands/ToolsLowerObjects",
"/commands/ToolsRotateLeft",
};
static gchar* atomic_selection_verbs [] = {
- "/commands/ToolsObjectProperties",
NULL
};
/*
* (GLABELS) Label and Business Card Creation program for GNOME
*
- * view_barcode.c: GLabels label barcode object widget
+ * view_text.c: GLabels label text object widget
*
- * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>.
+ * Copyright (C) 2001-2003 Jim Evins <evins@snaught.com>.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "view-barcode.h"
#include "canvas-hacktext.h"
-
#include "view-highlight.h"
-#include "wdgt-bc-data.h"
-#include "wdgt-bc-props.h"
-#include "wdgt-bc-style.h"
-#include "wdgt-position.h"
#include "color.h"
+#include "object-editor.h"
+#include "stock.h"
#include "pixmaps/cursor_barcode.xbm"
#include "pixmaps/cursor_barcode_mask.xbm"
struct _glViewBarcodePrivate {
- GList *item_list;
-
- /* Page 0 widgets */
- GtkWidget *bc_data;
+ GList *item_list;
- /* Page 1 widgets */
- GtkWidget *bc_props;
- GtkWidget *bc_style;
-
- /* Page 2 widgets */
- GtkWidget *position;
};
/*========================================================*/
/* Private function prototypes. */
/*========================================================*/
-static void gl_view_barcode_class_init (glViewBarcodeClass *klass);
-static void gl_view_barcode_instance_init (glViewBarcode *view_barcode);
-static void gl_view_barcode_finalize (GObject *object);
-
-static void update_view_barcode_cb (glLabelObject *object,
- glViewBarcode *view_barcode);
+static void gl_view_barcode_class_init (glViewBarcodeClass *klass);
+static void gl_view_barcode_instance_init (glViewBarcode *view_bc);
+static void gl_view_barcode_finalize (GObject *object);
-static GtkWidget *construct_properties_dialog (glViewObject *view_object);
+static GtkWidget *construct_properties_editor (glViewObject *view_object);
-static void response_cb (GtkDialog *dialog,
- gint response,
- glViewBarcode *view_barcode);
+static void update_canvas_item_from_object_cb (glLabelObject *object,
+ glViewBarcode *view_bc);
-static void bc_data_changed_cb (glWdgtBCData *bc_data,
- glViewBarcode *view_barcode);
+static void update_object_from_editor_cb (glObjectEditor *editor,
+ glLabelObject *object);
-static void bc_props_changed_cb (glWdgtBCProps *bc_props,
- glViewBarcode *view_barcode);
+static void update_editor_from_object_cb (glLabelObject *object,
+ glObjectEditor *editor);
-static void bc_style_changed_cb (glWdgtBCStyle *bc_style,
- glViewBarcode *view_barcode);
+static void update_editor_from_move_cb (glLabelObject *object,
+ gdouble dx,
+ gdouble dy,
+ glObjectEditor *editor);
-static void position_changed_cb (glWdgtPosition *position,
- glViewBarcode *view_barcode);
+static void update_editor_from_label_cb (glLabel *label,
+ glObjectEditor *editor);
-static void update_dialog_cb (glLabelObject *object,
- glViewBarcode *view_barcode);
+static void draw_barcode (glViewBarcode *view_bc);
-static void update_dialog_from_move_cb (glLabelObject *object,
- gdouble dx,
- gdouble dy,
- glViewBarcode *view_barcode);
-
-static void draw_barcode (glViewBarcode *view_barcode);
\f
/*****************************************************************************/
object_class->finalize = gl_view_barcode_finalize;
- view_object_class->construct_dialog = construct_properties_dialog;
+ view_object_class->construct_editor = construct_properties_editor;
gl_debug (DEBUG_VIEW, "END");
}
static void
-gl_view_barcode_instance_init (glViewBarcode *view_barcode)
+gl_view_barcode_instance_init (glViewBarcode *view_bc)
{
gl_debug (DEBUG_VIEW, "START");
- view_barcode->private = g_new0 (glViewBarcodePrivate, 1);
+ view_bc->private = g_new0 (glViewBarcodePrivate, 1);
gl_debug (DEBUG_VIEW, "END");
}
gl_view_barcode_new (glLabelBarcode *object,
glView *view)
{
- glViewBarcode *view_barcode;
+ glViewBarcode *view_bc;
GtkMenu *menu;
gl_debug (DEBUG_VIEW, "START");
g_return_if_fail (object && GL_IS_LABEL_BARCODE (object));
g_return_if_fail (view && GL_IS_VIEW (view));
- view_barcode = g_object_new (gl_view_barcode_get_type(), NULL);
+ view_bc = g_object_new (gl_view_barcode_get_type(), NULL);
- gl_view_object_set_view (GL_VIEW_OBJECT(view_barcode), view);
- gl_view_object_set_object (GL_VIEW_OBJECT(view_barcode),
+ gl_view_object_set_view (GL_VIEW_OBJECT(view_bc), view);
+ gl_view_object_set_object (GL_VIEW_OBJECT(view_bc),
GL_LABEL_OBJECT(object),
GL_VIEW_HIGHLIGHT_BOX_RESIZABLE);
/* Create analogous canvas items. */
- draw_barcode (view_barcode);
+ draw_barcode (view_bc);
g_signal_connect (G_OBJECT (object), "changed",
- G_CALLBACK (update_view_barcode_cb), view_barcode);
+ G_CALLBACK (update_canvas_item_from_object_cb), view_bc);
gl_debug (DEBUG_VIEW, "END");
- return GL_VIEW_OBJECT (view_barcode);
-}
-
-/*---------------------------------------------------------------------------*/
-/* PRIVATE. label object "changed" callback. */
-/*---------------------------------------------------------------------------*/
-static void
-update_view_barcode_cb (glLabelObject *object,
- glViewBarcode *view_barcode)
-{
- glView *view;
- GnomeCanvasItem *group;
-
- gl_debug (DEBUG_VIEW, "START");
-
- view = gl_view_object_get_view (GL_VIEW_OBJECT(view_barcode));
-
- /* Adjust appearance of analogous canvas items. */
- draw_barcode (view_barcode);
-
- gl_debug (DEBUG_VIEW, "END");
+ return GL_VIEW_OBJECT (view_bc);
}
/*****************************************************************************/
-/* Create a properties dialog for a barcode object. */
+/* Create a properties editor for a barcode object. */
/*****************************************************************************/
static GtkWidget *
-construct_properties_dialog (glViewObject *view_object)
+construct_properties_editor (glViewObject *view_object)
{
- glViewBarcode *view_barcode = (glViewBarcode *)view_object;
- GtkWidget *dialog, *wsection;
+ GtkWidget *editor;
+ glViewBarcode *view_bc = (glViewBarcode *)view_object;
glLabelObject *object;
- gdouble x, y, w, h, label_width, label_height;
- glTextNode *text_node;
- glBarcodeStyle style;
- gboolean text_flag;
- gboolean checksum_flag;
- guint color;
- glMerge *merge;
- GtkSizeGroup *label_size_group;
- GtkWidget *window;
gl_debug (DEBUG_VIEW, "START");
- /* retrieve object and query parameters */
- object = gl_view_object_get_object (view_object);
- gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y);
- text_node = gl_label_barcode_get_data(GL_LABEL_BARCODE(object));
- gl_label_barcode_get_props (GL_LABEL_BARCODE(object),
- &style, &text_flag, &checksum_flag, &color);
- gl_label_get_size (GL_LABEL(object->parent),
- &label_width, &label_height);
- merge = gl_label_get_merge (GL_LABEL(object->parent));
+ object = gl_view_object_get_object (GL_VIEW_OBJECT(view_bc));
+
+ /* Build editor. */
+ editor = gl_object_editor_new (GL_STOCK_BARCODE, _("Barcode object properties"),
+ GL_OBJECT_EDITOR_POSITION_PAGE,
+ GL_OBJECT_EDITOR_SIZE_PAGE,
+ GL_OBJECT_EDITOR_BC_PAGE,
+ GL_OBJECT_EDITOR_DATA_PAGE,
+ 0);
+
+ /* Update */
+ update_editor_from_object_cb (object, GL_OBJECT_EDITOR(editor));
+ update_editor_from_move_cb (object, 0, 0, GL_OBJECT_EDITOR(editor));
+ update_editor_from_label_cb (object->parent, GL_OBJECT_EDITOR(editor));
- /*-----------------------------------------------------------------*/
- /* Build dialog. */
- /*-----------------------------------------------------------------*/
- window = gtk_widget_get_toplevel (
- GTK_WIDGET(gl_view_object_get_view(view_object)));
- dialog = gl_hig_dialog_new_with_buttons ( _("Edit barcode object properties"),
- GTK_WINDOW (window),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_STOCK_CLOSE,
- GTK_RESPONSE_CLOSE,
- NULL );
- gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
- g_signal_connect (G_OBJECT (dialog), "response",
- G_CALLBACK (response_cb), view_object);
-
- label_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
-
- /*---------------------------*/
- /* Data section */
- /*---------------------------*/
- wsection = gl_hig_category_new (_("Data"));
- gl_hig_dialog_add_widget (GL_HIG_DIALOG(dialog), wsection);
-
- /* barcode data */
- view_barcode->private->bc_data = gl_wdgt_bc_data_new (merge);
- gl_wdgt_bc_data_set_label_size_group (GL_WDGT_BC_DATA(view_barcode->private->bc_data),
- label_size_group);
- gl_wdgt_bc_data_set_data (GL_WDGT_BC_DATA(view_barcode->private->bc_data),
- (merge != NULL),
- text_node);
- gl_hig_category_add_widget (GL_HIG_CATEGORY(wsection),
- view_barcode->private->bc_data);
- g_signal_connect ( G_OBJECT(view_barcode->private->bc_data),
- "changed", G_CALLBACK (bc_data_changed_cb),
- view_barcode);
-
-
- /*---------------------------*/
- /* Appearance section */
- /*---------------------------*/
- wsection = gl_hig_category_new (_("Properties"));
- gl_hig_dialog_add_widget (GL_HIG_DIALOG(dialog), wsection);
-
- /* Barcode style widget */
- view_barcode->private->bc_style = gl_wdgt_bc_style_new ();
- gl_wdgt_bc_style_set_label_size_group (GL_WDGT_BC_STYLE(view_barcode->private->bc_style),
- label_size_group);
- gl_wdgt_bc_style_set_params (GL_WDGT_BC_STYLE (view_barcode->private->bc_style),
- style, text_flag, checksum_flag);
- gl_hig_category_add_widget (GL_HIG_CATEGORY(wsection),
- view_barcode->private->bc_style);
- g_signal_connect (G_OBJECT (view_barcode->private->bc_style),
- "changed", G_CALLBACK (bc_style_changed_cb),
- view_barcode);
-
- /* barcode props entry */
- gl_debug (DEBUG_VIEW, "Creating props entry...");
- view_barcode->private->bc_props = gl_wdgt_bc_props_new ();
- gl_wdgt_bc_props_set_label_size_group (GL_WDGT_BC_PROPS(view_barcode->private->bc_props),
- label_size_group);
- gl_wdgt_bc_props_set_params (GL_WDGT_BC_PROPS(view_barcode->private->bc_props),
- color);
- gl_hig_category_add_widget (GL_HIG_CATEGORY(wsection),
- view_barcode->private->bc_props);
- g_signal_connect ( G_OBJECT(view_barcode->private->bc_props),
- "changed", G_CALLBACK (bc_props_changed_cb),
- view_barcode);
-
-
- /*----------------------------*/
- /* Position section */
- /*----------------------------*/
- wsection = gl_hig_category_new (_("Position"));
- gl_hig_dialog_add_widget (GL_HIG_DIALOG(dialog), wsection);
-
- /* ------ Position Frame ------ */
- view_barcode->private->position = gl_wdgt_position_new ();
- gl_wdgt_position_set_label_size_group (GL_WDGT_POSITION(view_barcode->private->position),
- label_size_group);
- gl_wdgt_position_set_params (GL_WDGT_POSITION (view_barcode->private->position),
- x, y,
- label_width, label_height);
- gl_hig_category_add_widget (GL_HIG_CATEGORY(wsection),
- view_barcode->private->position);
- g_signal_connect (G_OBJECT (view_barcode->private->position),
- "changed",
- G_CALLBACK(position_changed_cb), view_barcode);
-
-
- /*----------------------------*/
- /* Track object changes. */
- /*----------------------------*/
+ /* Connect signals. */
+ g_signal_connect (G_OBJECT (editor), "changed",
+ G_CALLBACK(update_object_from_editor_cb), object);
g_signal_connect (G_OBJECT (object), "changed",
- G_CALLBACK (update_dialog_cb), view_barcode);
+ G_CALLBACK (update_editor_from_object_cb), editor);
g_signal_connect (G_OBJECT (object), "moved",
- G_CALLBACK (update_dialog_from_move_cb),
- view_barcode);
+ G_CALLBACK (update_editor_from_move_cb), editor);
+ g_signal_connect (G_OBJECT (object->parent), "size_changed",
+ G_CALLBACK (update_editor_from_label_cb), editor);
+ g_signal_connect (G_OBJECT (object->parent), "merge_changed",
+ G_CALLBACK (update_editor_from_label_cb), editor);
gl_debug (DEBUG_VIEW, "END");
- return dialog;
+ return editor;
}
/*---------------------------------------------------------------------------*/
-/* PRIVATE. "Response" callback. */
+/* PRIVATE. label object "changed" callback. */
/*---------------------------------------------------------------------------*/
static void
-response_cb (GtkDialog *dialog,
- gint response,
- glViewBarcode *view_barcode)
+update_canvas_item_from_object_cb (glLabelObject *object,
+ glViewBarcode *view_bc)
{
- glLabelObject *object;
-
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail(dialog != NULL);
- g_return_if_fail(GTK_IS_DIALOG(dialog));
-
- switch(response) {
- case GTK_RESPONSE_CLOSE:
- gtk_widget_hide (GTK_WIDGET(dialog));
- break;
- case GTK_RESPONSE_DELETE_EVENT:
- /* Dialog destroyed, remove callbacks that reference it. */
- object = gl_view_object_get_object (GL_VIEW_OBJECT(view_barcode));
-
- g_signal_handlers_disconnect_by_func (object, update_dialog_cb,
- view_barcode);
- g_signal_handlers_disconnect_by_func (object, update_dialog_from_move_cb,
- view_barcode);
- break;
- default:
- g_print ("response = %d", response);
- g_assert_not_reached();
- }
+ /* Adjust appearance of analogous canvas item. */
+ draw_barcode (view_bc);
gl_debug (DEBUG_VIEW, "END");
}
/*---------------------------------------------------------------------------*/
-/* PRIVATE. barcode data "changed" callback. */
+/* PRIVATE. editor "changed" callback. */
/*---------------------------------------------------------------------------*/
static void
-bc_data_changed_cb (glWdgtBCData *bc_data,
- glViewBarcode *view_barcode)
+update_object_from_editor_cb (glObjectEditor *editor,
+ glLabelObject *object)
{
- glLabelObject *object;
- glTextNode *text_node;
+ gdouble x, y, w, h;
+ glTextNode *text_node;
+ glBarcodeStyle style;
+ gboolean text_flag, cs_flag;
+ guint color;
gl_debug (DEBUG_VIEW, "START");
- object = gl_view_object_get_object (GL_VIEW_OBJECT(view_barcode));
-
- text_node = gl_wdgt_bc_data_get_data (bc_data);
-
g_signal_handlers_block_by_func (G_OBJECT(object),
- update_dialog_cb, view_barcode);
- gl_label_barcode_set_data (GL_LABEL_BARCODE(object), text_node);
- g_signal_handlers_unblock_by_func (G_OBJECT(object),
- update_dialog_cb, view_barcode);
-
- gl_text_node_free (&text_node);
+ update_editor_from_object_cb,
+ editor);
+ g_signal_handlers_block_by_func (G_OBJECT(object),
+ update_editor_from_move_cb,
+ editor);
- gl_debug (DEBUG_VIEW, "END");
-}
-/*---------------------------------------------------------------------------*/
-/* PRIVATE. barcode props "changed" callback. */
-/*---------------------------------------------------------------------------*/
-static void
-bc_props_changed_cb (glWdgtBCProps *text_props,
- glViewBarcode *view_barcode)
-{
- glLabelObject *object;
- glBarcodeStyle style;
- gboolean text_flag;
- gboolean checksum_flag;
- guint color;
+ gl_object_editor_get_position (editor, &x, &y);
+ gl_label_object_set_position (object, x, y);
- gl_debug (DEBUG_VIEW, "START");
+ gl_object_editor_get_size (editor, &w, &h);
+ gl_label_object_set_size (object, w, h);
- object = gl_view_object_get_object (GL_VIEW_OBJECT(view_barcode));
-
- gl_label_barcode_get_props (GL_LABEL_BARCODE(object),
- &style, &text_flag, &checksum_flag, &color);
- gl_wdgt_bc_props_get_params (text_props, &color);
+ text_node = gl_object_editor_get_data (editor);
+ gl_label_barcode_set_data (GL_LABEL_BARCODE(object), text_node);
+ gl_text_node_free (&text_node);
- g_signal_handlers_block_by_func (G_OBJECT(object),
- update_dialog_cb, view_barcode);
+ gl_object_editor_get_bc_style (editor, &style, &text_flag, &cs_flag);
+ color = gl_object_editor_get_bc_color (editor);
gl_label_barcode_set_props (GL_LABEL_BARCODE(object),
- style, text_flag, checksum_flag, color);
+ style, text_flag, cs_flag, color);
+
g_signal_handlers_unblock_by_func (G_OBJECT(object),
- update_dialog_cb, view_barcode);
+ update_editor_from_object_cb,
+ editor);
+ g_signal_handlers_unblock_by_func (G_OBJECT(object),
+ update_editor_from_move_cb,
+ editor);
gl_debug (DEBUG_VIEW, "END");
}
/*---------------------------------------------------------------------------*/
-/* PRIVATE. barcode style "changed" callback. */
+/* PRIVATE. label object "changed" callback. */
/*---------------------------------------------------------------------------*/
static void
-bc_style_changed_cb (glWdgtBCStyle *bc_style,
- glViewBarcode *view_barcode)
+update_editor_from_object_cb (glLabelObject *object,
+ glObjectEditor *editor)
{
- glLabelObject *object;
+ gdouble w, h;
+ glTextNode *text_node;
glBarcodeStyle style;
- gboolean text_flag;
- gboolean checksum_flag;
+ gboolean text_flag, cs_flag;
guint color;
-
+ glMerge *merge;
gl_debug (DEBUG_VIEW, "START");
- object = gl_view_object_get_object (GL_VIEW_OBJECT(view_barcode));
+ gl_label_object_get_size (object, &w, &h);
+ gl_object_editor_set_size (editor, w, h);
gl_label_barcode_get_props (GL_LABEL_BARCODE(object),
- &style, &text_flag, &checksum_flag, &color);
- gl_wdgt_bc_style_get_params (bc_style, &style, &text_flag, &checksum_flag);
+ &style, &text_flag, &cs_flag, &color);
+ gl_object_editor_set_bc_style (editor, style, text_flag, cs_flag);
+ gl_object_editor_set_bc_color (editor, color);
- g_signal_handlers_block_by_func (G_OBJECT(object),
- update_dialog_cb, view_barcode);
- gl_label_barcode_set_props (GL_LABEL_BARCODE(object),
- style, text_flag, checksum_flag, color);
- g_signal_handlers_unblock_by_func (G_OBJECT(object),
- update_dialog_cb, view_barcode);
-
- gl_debug (DEBUG_VIEW, "END");
-}
-
-/*---------------------------------------------------------------------------*/
-/* PRIVATE. position "changed" callback. */
-/*---------------------------------------------------------------------------*/
-static void
-position_changed_cb (glWdgtPosition *position,
- glViewBarcode *view_barcode)
-{
- glLabelObject *object;
- gdouble x, y;
-
- gl_debug (DEBUG_VIEW, "START");
-
- gl_wdgt_position_get_position (GL_WDGT_POSITION (position), &x, &y);
-
- object = gl_view_object_get_object (GL_VIEW_OBJECT(view_barcode));
+ text_node = gl_label_barcode_get_data (GL_LABEL_BARCODE(object));
+ merge = gl_label_get_merge (GL_LABEL(object->parent));
+ gl_object_editor_set_data (editor, (merge != NULL), text_node);
+ gl_text_node_free (&text_node);
- g_signal_handlers_block_by_func (G_OBJECT(object),
- update_dialog_cb, view_barcode);
- gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y);
- g_signal_handlers_unblock_by_func (G_OBJECT(object),
- update_dialog_cb, view_barcode);
gl_debug (DEBUG_VIEW, "END");
}
/*---------------------------------------------------------------------------*/
-/* PRIVATE. label object "changed" callback. */
+/* PRIVATE. label object "moved" callback. */
/*---------------------------------------------------------------------------*/
static void
-update_dialog_cb (glLabelObject *object,
- glViewBarcode *view_barcode)
+update_editor_from_move_cb (glLabelObject *object,
+ gdouble dx,
+ gdouble dy,
+ glObjectEditor *editor)
{
gdouble x, y;
- glTextNode *text_node;
- glBarcodeStyle style;
- gboolean text_flag;
- gboolean checksum_flag;
- guint color;
- glMerge *merge;
gl_debug (DEBUG_VIEW, "START");
- /* Query properties of object. */
- text_node = gl_label_barcode_get_data(GL_LABEL_BARCODE(object));
- gl_label_barcode_get_props (GL_LABEL_BARCODE(object),
- &style, &text_flag, &checksum_flag, &color);
- gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y);
- merge = gl_label_get_merge (GL_LABEL(object->parent));
-
- /* Block widget handlers to prevent recursion */
- g_signal_handlers_block_by_func (G_OBJECT(view_barcode->private->bc_data),
- bc_data_changed_cb, view_barcode);
- g_signal_handlers_block_by_func (G_OBJECT(view_barcode->private->bc_props),
- bc_props_changed_cb, view_barcode);
- g_signal_handlers_block_by_func (G_OBJECT(view_barcode->private->bc_style),
- bc_style_changed_cb, view_barcode);
- g_signal_handlers_block_by_func (G_OBJECT(view_barcode->private->position),
- position_changed_cb, view_barcode);
-
- /* Update widgets in property dialog */
-
- gl_wdgt_bc_data_set_data (GL_WDGT_BC_DATA(view_barcode->private->bc_data),
- (merge != NULL),
- text_node);
- gl_wdgt_bc_data_set_field_defs (GL_WDGT_BC_DATA(view_barcode->private->bc_data),
- merge);
- gl_wdgt_bc_props_set_params (GL_WDGT_BC_PROPS(view_barcode->private->bc_props),
- color);
- gl_wdgt_bc_style_set_params (GL_WDGT_BC_STYLE(view_barcode->private->bc_style),
- style, text_flag, checksum_flag);
- gl_wdgt_position_set_position (GL_WDGT_POSITION(view_barcode->private->position),
- x, y);
-
- /* Unblock widget handlers */
- g_signal_handlers_unblock_by_func (G_OBJECT(view_barcode->private->bc_data),
- bc_data_changed_cb, view_barcode);
- g_signal_handlers_unblock_by_func (G_OBJECT(view_barcode->private->bc_props),
- bc_props_changed_cb, view_barcode);
- g_signal_handlers_unblock_by_func (G_OBJECT(view_barcode->private->bc_style),
- bc_style_changed_cb, view_barcode);
- g_signal_handlers_unblock_by_func (G_OBJECT(view_barcode->private->position),
- position_changed_cb, view_barcode);
-
- gl_text_node_free (&text_node);
+ gl_label_object_get_position (object, &x, &y);
+ gl_object_editor_set_position (editor, x, y);
gl_debug (DEBUG_VIEW, "END");
}
/*---------------------------------------------------------------------------*/
-/* PRIVATE. label object "moved" callback. */
+/* PRIVATE. label "changed" callback. */
/*---------------------------------------------------------------------------*/
static void
-update_dialog_from_move_cb (glLabelObject *object,
- gdouble dx,
- gdouble dy,
- glViewBarcode *view_barcode)
+update_editor_from_label_cb (glLabel *label,
+ glObjectEditor *editor)
{
- gdouble x, y;
+ gdouble label_width, label_height;
+ glMerge *merge;
gl_debug (DEBUG_VIEW, "START");
- /* Query properties of object. */
- gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y);
-
- /* Block widget handlers to prevent recursion */
- g_signal_handlers_block_by_func (G_OBJECT(view_barcode->private->position),
- position_changed_cb, view_barcode);
-
- /* Update widgets in property dialog */
- gl_wdgt_position_set_position (GL_WDGT_POSITION(view_barcode->private->position),
- x, y);
+ gl_label_get_size (label, &label_width, &label_height);
+ gl_object_editor_set_max_position (GL_OBJECT_EDITOR (editor),
+ label_width, label_height);
+ gl_object_editor_set_max_size (GL_OBJECT_EDITOR (editor),
+ label_width, label_height);
- /* Unblock widget handlers */
- g_signal_handlers_unblock_by_func (G_OBJECT(view_barcode->private->position),
- position_changed_cb, view_barcode);
+ merge = gl_label_get_merge (label);
+ gl_object_editor_set_key_names (editor, merge);
gl_debug (DEBUG_VIEW, "END");
}
*
* view_box.c: GLabels label box object widget
*
- * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>.
+ * Copyright (C) 2001-2003 Jim Evins <evins@snaught.com>.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "view-highlight.h"
-#include "wdgt-line.h"
-#include "wdgt-fill.h"
-#include "wdgt-size.h"
-#include "wdgt-position.h"
#include "color.h"
+#include "object-editor.h"
+#include "stock.h"
#include "pixmaps/cursor_box.xbm"
#include "pixmaps/cursor_box_mask.xbm"
struct _glViewBoxPrivate {
GnomeCanvasItem *item;
-
- /* Property dialog Page 0 widgets */
- GtkWidget *line;
- GtkWidget *fill;
-
- /* Property dialog Page 1 widgets */
- GtkWidget *position;
- GtkWidget *size;
};
/*========================================================*/
/* Private function prototypes. */
/*========================================================*/
-static void gl_view_box_class_init (glViewBoxClass *klass);
-static void gl_view_box_instance_init (glViewBox *view_box);
-static void gl_view_box_finalize (GObject *object);
-
-static void update_view_box_cb (glLabelObject *object,
- glViewBox *view_box);
-
-static GtkWidget *construct_properties_dialog (glViewObject *view_object);
+static void gl_view_box_class_init (glViewBoxClass *klass);
+static void gl_view_box_instance_init (glViewBox *view_box);
+static void gl_view_box_finalize (GObject *object);
-static void response_cb (GtkDialog *dialog,
- gint response,
- glViewBox *view_box);
+static GtkWidget *construct_properties_editor (glViewObject *view_object);
-static void line_changed_cb (glWdgtLine *line,
- glViewBox *view_box);
+static void update_canvas_item_from_object_cb (glLabelObject *object,
+ glViewBox *view_box);
-static void fill_changed_cb (glWdgtFill *fill,
- glViewBox *view_box);
+static void update_object_from_editor_cb (glObjectEditor *editor,
+ glLabelObject *object);
-static void position_changed_cb (glWdgtPosition *position,
- glViewBox *view_box);
+static void update_editor_from_object_cb (glLabelObject *object,
+ glObjectEditor *editor);
-static void size_changed_cb (glWdgtSize *size,
- glViewBox *view_box);
+static void update_editor_from_move_cb (glLabelObject *object,
+ gdouble dx,
+ gdouble dy,
+ glObjectEditor *editor);
-static void update_dialog_cb (glLabelObject *object,
- glViewBox *view_box);
+static void update_editor_from_label_cb (glLabel *label,
+ glObjectEditor *editor);
-static void update_dialog_from_move_cb (glLabelObject *object,
- gdouble dx,
- gdouble dy,
- glViewBox *view_box);
\f
/*****************************************************************************/
object_class->finalize = gl_view_box_finalize;
- view_object_class->construct_dialog = construct_properties_dialog;
+ view_object_class->construct_editor = construct_properties_editor;
gl_debug (DEBUG_VIEW, "END");
}
gdouble line_width;
guint line_color, fill_color;
gdouble w, h;
- GtkMenu *menu;
gl_debug (DEBUG_VIEW, "START");
g_return_if_fail (object && GL_IS_LABEL_BOX (object));
NULL);
g_signal_connect (G_OBJECT (object), "changed",
- G_CALLBACK (update_view_box_cb), view_box);
+ G_CALLBACK (update_canvas_item_from_object_cb), view_box);
gl_debug (DEBUG_VIEW, "END");
return GL_VIEW_OBJECT (view_box);
}
-/*---------------------------------------------------------------------------*/
-/* PRIVATE. label object "changed" callback. */
-/*---------------------------------------------------------------------------*/
-static void
-update_view_box_cb (glLabelObject *object,
- glViewBox *view_box)
-{
- gdouble line_width;
- guint line_color, fill_color;
- gdouble w, h;
-
- gl_debug (DEBUG_VIEW, "START");
-
- /* Query properties of object. */
- gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h);
- line_width = gl_label_box_get_line_width(GL_LABEL_BOX(object));
- line_color = gl_label_box_get_line_color(GL_LABEL_BOX(object));
- fill_color = gl_label_box_get_fill_color(GL_LABEL_BOX(object));
-
- /* Adjust appearance of analogous canvas item. */
- gnome_canvas_item_set (view_box->private->item,
- "x2", w + DELTA,
- "y2", h + DELTA,
- "width_units", line_width,
- "outline_color_rgba", line_color,
- "fill_color_rgba", fill_color,
- NULL);
-
- gl_debug (DEBUG_VIEW, "END");
-}
-
/*****************************************************************************/
/* Create a properties dialog for a box object. */
/*****************************************************************************/
static GtkWidget *
-construct_properties_dialog (glViewObject *view_object)
+construct_properties_editor (glViewObject *view_object)
{
+ GtkWidget *editor;
glViewBox *view_box = (glViewBox *)view_object;
- GtkWidget *dialog, *wsection;
glLabelObject *object;
- gdouble line_width;
- guint line_color, fill_color;
- gdouble x, y, w, h, label_width, label_height;
- GtkSizeGroup *label_size_group;
- GtkWidget *window;
gl_debug (DEBUG_VIEW, "START");
- /* retrieve object and query parameters */
object = gl_view_object_get_object (GL_VIEW_OBJECT(view_box));
- gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y);
- gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h);
- line_width = gl_label_box_get_line_width(GL_LABEL_BOX(object));
- line_color = gl_label_box_get_line_color(GL_LABEL_BOX(object));
- fill_color = gl_label_box_get_fill_color(GL_LABEL_BOX(object));
- gl_label_get_size (GL_LABEL(object->parent),
- &label_width, &label_height);
-
- /*-----------------------------------------------------------------*/
- /* Build dialog with notebook. */
- /*-----------------------------------------------------------------*/
- window = gtk_widget_get_toplevel (
- GTK_WIDGET(gl_view_object_get_view(GL_VIEW_OBJECT(view_box))));
- dialog = gl_hig_dialog_new_with_buttons ( _("Edit box object properties"),
- GTK_WINDOW (window),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_STOCK_CLOSE,
- GTK_RESPONSE_CLOSE,
- NULL );
- gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
- g_signal_connect (G_OBJECT (dialog), "response",
- G_CALLBACK (response_cb), view_box);
-
- label_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
-
-
- /*---------------------------*/
- /* Outline section */
- /*---------------------------*/
- wsection = gl_hig_category_new (_("Outline"));
- gl_hig_dialog_add_widget (GL_HIG_DIALOG(dialog), wsection);
- view_box->private->line = gl_wdgt_line_new ();
- gl_wdgt_line_set_label_size_group (GL_WDGT_LINE(view_box->private->line),
- label_size_group);
- gl_wdgt_line_set_params (GL_WDGT_LINE (view_box->private->line),
- line_width,
- line_color);
- gl_hig_category_add_widget (GL_HIG_CATEGORY(wsection),
- view_box->private->line);
- g_signal_connect (G_OBJECT (view_box->private->line), "changed",
- G_CALLBACK(line_changed_cb), view_box);
-
- /*---------------------------*/
- /* Fill section */
- /*---------------------------*/
- wsection = gl_hig_category_new (_("Fill"));
- gl_hig_dialog_add_widget (GL_HIG_DIALOG(dialog), wsection);
- view_box->private->fill = gl_wdgt_fill_new ();
- gl_wdgt_fill_set_label_size_group (GL_WDGT_FILL(view_box->private->fill),
- label_size_group);
- gl_wdgt_fill_set_params (GL_WDGT_FILL (view_box->private->fill),
- fill_color);
- gl_hig_category_add_widget (GL_HIG_CATEGORY(wsection),
- view_box->private->fill);
- g_signal_connect (G_OBJECT (view_box->private->fill), "changed",
- G_CALLBACK(fill_changed_cb), view_box);
-
-
- /*---------------------------*/
- /* Position section */
- /*---------------------------*/
- wsection = gl_hig_category_new (_("Position"));
- gl_hig_dialog_add_widget (GL_HIG_DIALOG(dialog), wsection);
- view_box->private->position = gl_wdgt_position_new ();
- gl_wdgt_position_set_label_size_group (GL_WDGT_POSITION(view_box->private->position),
- label_size_group);
- gl_wdgt_position_set_params (GL_WDGT_POSITION (view_box->private->position),
- x, y, label_width, label_height);
- gl_hig_category_add_widget (GL_HIG_CATEGORY(wsection),
- view_box->private->position);
- g_signal_connect (G_OBJECT (view_box->private->position), "changed",
- G_CALLBACK(position_changed_cb), view_box);
-
- /*---------------------------*/
- /* Size section */
- /*---------------------------*/
- wsection = gl_hig_category_new (_("Size"));
- gl_hig_dialog_add_widget (GL_HIG_DIALOG(dialog), wsection);
- view_box->private->size = gl_wdgt_size_new ();
- gl_wdgt_size_set_label_size_group (GL_WDGT_SIZE(view_box->private->size),
- label_size_group);
- gl_wdgt_size_set_params (GL_WDGT_SIZE (view_box->private->size),
- w, h, TRUE, label_width, label_height);
- gl_hig_category_add_widget (GL_HIG_CATEGORY(wsection),
- view_box->private->size);
- g_signal_connect (G_OBJECT (view_box->private->size), "changed",
- G_CALLBACK(size_changed_cb), view_box);
-
-
- /*----------------------------*/
- /* Track object changes. */
- /*----------------------------*/
+
+ /* Build editor. */
+ editor = gl_object_editor_new (GL_STOCK_BOX, _("Box object properties"),
+ GL_OBJECT_EDITOR_POSITION_PAGE,
+ GL_OBJECT_EDITOR_SIZE_PAGE,
+ GL_OBJECT_EDITOR_FILL_PAGE,
+ GL_OBJECT_EDITOR_LINE_PAGE,
+ 0);
+
+ /* Update */
+ update_editor_from_object_cb (object, GL_OBJECT_EDITOR(editor));
+ update_editor_from_move_cb (object, 0, 0, GL_OBJECT_EDITOR(editor));
+ update_editor_from_label_cb (object->parent, GL_OBJECT_EDITOR(editor));
+
+ /* Connect signals. */
+ g_signal_connect (G_OBJECT (editor), "changed",
+ G_CALLBACK(update_object_from_editor_cb), object);
g_signal_connect (G_OBJECT (object), "changed",
- G_CALLBACK (update_dialog_cb), view_box);
+ G_CALLBACK (update_editor_from_object_cb), editor);
g_signal_connect (G_OBJECT (object), "moved",
- G_CALLBACK (update_dialog_from_move_cb), view_box);
+ G_CALLBACK (update_editor_from_move_cb), editor);
+ g_signal_connect (G_OBJECT (object->parent), "size_changed",
+ G_CALLBACK (update_editor_from_label_cb), editor);
gl_debug (DEBUG_VIEW, "END");
- return dialog;
+ return editor;
}
/*---------------------------------------------------------------------------*/
-/* PRIVATE. "Response" callback. */
+/* PRIVATE. label object "changed" callback. */
/*---------------------------------------------------------------------------*/
static void
-response_cb (GtkDialog *dialog,
- gint response,
- glViewBox *view_box)
+update_canvas_item_from_object_cb (glLabelObject *object,
+ glViewBox *view_box)
{
- glLabelObject *object;
+ gdouble line_width;
+ guint line_color, fill_color;
+ gdouble w, h;
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail(dialog != NULL);
- g_return_if_fail(GTK_IS_DIALOG(dialog));
-
- switch(response) {
-
- case GTK_RESPONSE_CLOSE:
- gtk_widget_hide (GTK_WIDGET(dialog));
- break;
-
- case GTK_RESPONSE_DELETE_EVENT:
- /* Dialog destroyed, remove callbacks that reference it. */
- object = gl_view_object_get_object (GL_VIEW_OBJECT(view_box));
-
- g_signal_handlers_disconnect_by_func (object, update_dialog_cb, view_box);
- g_signal_handlers_disconnect_by_func (object, update_dialog_from_move_cb,
- view_box);
- break;
+ /* Query properties of object. */
+ gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h);
+ line_width = gl_label_box_get_line_width(GL_LABEL_BOX(object));
+ line_color = gl_label_box_get_line_color(GL_LABEL_BOX(object));
+ fill_color = gl_label_box_get_fill_color(GL_LABEL_BOX(object));
- default:
- g_print ("response = %d", response);
- g_assert_not_reached ();
- }
+ /* Adjust appearance of analogous canvas item. */
+ gnome_canvas_item_set (view_box->private->item,
+ "x2", w + DELTA,
+ "y2", h + DELTA,
+ "width_units", line_width,
+ "outline_color_rgba", line_color,
+ "fill_color_rgba", fill_color,
+ NULL);
gl_debug (DEBUG_VIEW, "END");
}
/*---------------------------------------------------------------------------*/
-/* PRIVATE. line properties "changed" callback. */
+/* PRIVATE. editor "changed" callback. */
/*---------------------------------------------------------------------------*/
static void
-line_changed_cb (glWdgtLine *line,
- glViewBox *view_box)
+update_object_from_editor_cb (glObjectEditor *editor,
+ glLabelObject *object)
{
- glLabelObject *object;
+ gdouble w, h;
+ guint line_color, fill_color;
gdouble line_width;
- guint line_color;
gl_debug (DEBUG_VIEW, "START");
- object = gl_view_object_get_object (GL_VIEW_OBJECT(view_box));
-
- gl_wdgt_line_get_params (GL_WDGT_LINE (line),
- &line_width,
- &line_color);
-
g_signal_handlers_block_by_func (G_OBJECT(object),
- update_dialog_cb, view_box);
- gl_label_box_set_line_width(GL_LABEL_BOX(object), line_width);
- gl_label_box_set_line_color(GL_LABEL_BOX(object), line_color);
- g_signal_handlers_unblock_by_func (G_OBJECT(object),
- update_dialog_cb, view_box);
-
- gl_debug (DEBUG_VIEW, "END");
-}
-
-/*---------------------------------------------------------------------------*/
-/* PRIVATE. fill properties "changed" callback. */
-/*---------------------------------------------------------------------------*/
-static void
-fill_changed_cb (glWdgtFill *fill,
- glViewBox *view_box)
-{
- glLabelObject *object;
- guint fill_color;
-
- gl_debug (DEBUG_VIEW, "START");
-
- object = gl_view_object_get_object (GL_VIEW_OBJECT(view_box));
-
- gl_wdgt_fill_get_params (GL_WDGT_FILL (fill),
- &fill_color);
-
+ update_editor_from_object_cb,
+ editor);
g_signal_handlers_block_by_func (G_OBJECT(object),
- update_dialog_cb, view_box);
- gl_label_box_set_fill_color(GL_LABEL_BOX(object), fill_color);
- g_signal_handlers_unblock_by_func (G_OBJECT(object),
- update_dialog_cb, view_box);
+ update_editor_from_move_cb,
+ editor);
- gl_debug (DEBUG_VIEW, "END");
-}
+ gl_object_editor_get_size (editor, &w, &h);
+ gl_label_object_set_size (object, w, h);
-/*---------------------------------------------------------------------------*/
-/* PRIVATE. position "changed" callback. */
-/*---------------------------------------------------------------------------*/
-static void
-position_changed_cb (glWdgtPosition *position,
- glViewBox *view_box)
-{
- glLabelObject *object;
- gdouble x, y;
+ fill_color = gl_object_editor_get_fill_color (editor);
+ gl_label_object_set_fill_color (object, fill_color);
- gl_debug (DEBUG_VIEW, "START");
+ line_color = gl_object_editor_get_line_color (editor);
+ gl_label_object_set_line_color (object, line_color);
- gl_wdgt_position_get_position (GL_WDGT_POSITION (position), &x, &y);
+ line_width = gl_object_editor_get_line_width (editor);
+ gl_label_object_set_line_width (object, line_width);
- object = gl_view_object_get_object (GL_VIEW_OBJECT(view_box));
- g_signal_handlers_block_by_func (G_OBJECT(object),
- update_dialog_cb, view_box);
- gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y);
g_signal_handlers_unblock_by_func (G_OBJECT(object),
- update_dialog_cb, view_box);
+ update_editor_from_object_cb,
+ editor);
+ g_signal_handlers_unblock_by_func (G_OBJECT(object),
+ update_editor_from_move_cb,
+ editor);
gl_debug (DEBUG_VIEW, "END");
}
/*---------------------------------------------------------------------------*/
-/* PRIVATE. size "changed" callback. */
+/* PRIVATE. label object "changed" callback. */
/*---------------------------------------------------------------------------*/
static void
-size_changed_cb (glWdgtSize *size,
- glViewBox *view_box)
+update_editor_from_object_cb (glLabelObject *object,
+ glObjectEditor *editor)
{
- glLabelObject *object;
- gdouble w, h;
- gboolean keep_aspect_ratio_flag;
+ gdouble w, h;
+ guint line_color, fill_color;
+ gdouble line_width;
gl_debug (DEBUG_VIEW, "START");
- gl_wdgt_size_get_size (GL_WDGT_SIZE (size),
- &w, &h, &keep_aspect_ratio_flag);
+ gl_label_object_get_size (object, &w, &h);
+ gl_object_editor_set_size (editor, w, h);
- object = gl_view_object_get_object (GL_VIEW_OBJECT(view_box));
+ fill_color = gl_label_box_get_fill_color (GL_LABEL_BOX(object));
+ gl_object_editor_set_fill_color (editor, fill_color);
- g_signal_handlers_block_by_func (G_OBJECT(object),
- update_dialog_cb, view_box);
- gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h);
- g_signal_handlers_unblock_by_func (G_OBJECT(object),
- update_dialog_cb, view_box);
+ line_color = gl_label_box_get_line_color (GL_LABEL_BOX(object));
+ gl_object_editor_set_line_color (editor, line_color);
+
+ line_width = gl_label_box_get_line_width (GL_LABEL_BOX(object));
+ gl_object_editor_set_line_width (editor, line_width);
gl_debug (DEBUG_VIEW, "END");
}
/*---------------------------------------------------------------------------*/
-/* PRIVATE. label object "changed" callback. */
+/* PRIVATE. label object "moved" callback. */
/*---------------------------------------------------------------------------*/
static void
-update_dialog_cb (glLabelObject *object,
- glViewBox *view_box)
+update_editor_from_move_cb (glLabelObject *object,
+ gdouble dx,
+ gdouble dy,
+ glObjectEditor *editor)
{
- gdouble line_width;
- guint line_color, fill_color;
- gdouble x, y, w, h;
+ gdouble x, y;
gl_debug (DEBUG_VIEW, "START");
- /* Query properties of object. */
- gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y);
- gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h);
- line_width = gl_label_box_get_line_width(GL_LABEL_BOX(object));
- line_color = gl_label_box_get_line_color(GL_LABEL_BOX(object));
- fill_color = gl_label_box_get_fill_color(GL_LABEL_BOX(object));
-
- /* Block widget handlers to prevent recursion */
- g_signal_handlers_block_by_func (G_OBJECT(view_box->private->line),
- line_changed_cb, view_box);
- g_signal_handlers_block_by_func (G_OBJECT(view_box->private->fill),
- fill_changed_cb, view_box);
- g_signal_handlers_block_by_func (G_OBJECT(view_box->private->position),
- position_changed_cb, view_box);
- g_signal_handlers_block_by_func (G_OBJECT(view_box->private->size),
- size_changed_cb, view_box);
-
- /* Update widgets in property dialog */
- gl_wdgt_line_set_params (GL_WDGT_LINE (view_box->private->line),
- line_width,
- line_color);
- gl_wdgt_fill_set_params (GL_WDGT_FILL (view_box->private->fill),
- fill_color);
- gl_wdgt_position_set_position (GL_WDGT_POSITION(view_box->private->position),
- x, y);
- gl_wdgt_size_set_size (GL_WDGT_SIZE(view_box->private->size), w, h);
-
- /* Unblock widget handlers */
- g_signal_handlers_unblock_by_func (G_OBJECT(view_box->private->line),
- line_changed_cb, view_box);
- g_signal_handlers_unblock_by_func (G_OBJECT(view_box->private->fill),
- fill_changed_cb, view_box);
- g_signal_handlers_unblock_by_func (G_OBJECT(view_box->private->position),
- position_changed_cb, view_box);
- g_signal_handlers_unblock_by_func (G_OBJECT(view_box->private->size),
- size_changed_cb, view_box);
-
+ gl_label_object_get_position (object, &x, &y);
+ gl_object_editor_set_position (editor, x, y);
gl_debug (DEBUG_VIEW, "END");
}
/*---------------------------------------------------------------------------*/
-/* PRIVATE. label object "moved" callback. */
+/* PRIVATE. label "changed" callback. */
/*---------------------------------------------------------------------------*/
static void
-update_dialog_from_move_cb (glLabelObject *object,
- gdouble dx,
- gdouble dy,
- glViewBox *view_box)
+update_editor_from_label_cb (glLabel *label,
+ glObjectEditor *editor)
{
- gdouble x, y;
+ gdouble label_width, label_height;
gl_debug (DEBUG_VIEW, "START");
- /* Query properties of object. */
- gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y);
-
- /* Block widget handlers to prevent recursion */
- g_signal_handlers_block_by_func (G_OBJECT(view_box->private->position),
- position_changed_cb, view_box);
-
- /* Update widgets in property dialog */
- gl_wdgt_position_set_position (GL_WDGT_POSITION(view_box->private->position),
- x, y);
-
- /* Unblock widget handlers */
- g_signal_handlers_unblock_by_func (G_OBJECT(view_box->private->position),
- position_changed_cb, view_box);
+ gl_label_get_size (label, &label_width, &label_height);
+ gl_object_editor_set_max_position (GL_OBJECT_EDITOR (editor),
+ label_width, label_height);
+ gl_object_editor_set_max_size (GL_OBJECT_EDITOR (editor),
+ label_width, label_height);
gl_debug (DEBUG_VIEW, "END");
}
GdkEvent *event,
glView *view)
{
- static gdouble x0, y0;
- static gboolean dragging = FALSE;
+ static gdouble x0, y0;
+ static gboolean dragging = FALSE;
static glViewObject *view_box;
static GObject *object;
- guint line_color, fill_color;
- gdouble x, y, w, h;
+ guint line_color, fill_color;
+ gdouble x, y, w, h;
gl_debug (DEBUG_VIEW, "");
*
* view_ellipse.c: GLabels label ellipse object widget
*
- * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>.
+ * Copyright (C) 2001-2003 Jim Evins <evins@snaught.com>.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "view-highlight.h"
-#include "wdgt-line.h"
-#include "wdgt-fill.h"
-#include "wdgt-size.h"
-#include "wdgt-position.h"
#include "color.h"
+#include "object-editor.h"
+#include "stock.h"
#include "pixmaps/cursor_ellipse.xbm"
#include "pixmaps/cursor_ellipse_mask.xbm"
/*========================================================*/
struct _glViewEllipsePrivate {
- GnomeCanvasItem *item;
-
- /* Property dialog Page 0 widgets */
- GtkWidget *line;
- GtkWidget *fill;
-
- /* Property dialog Page 1 widgets */
- GtkWidget *position;
- GtkWidget *size;
+ GnomeCanvasItem *item;
};
/*========================================================*/
/* Private function prototypes. */
/*========================================================*/
-static void gl_view_ellipse_class_init (glViewEllipseClass *klass);
-static void gl_view_ellipse_instance_init (glViewEllipse *view_ellipse);
-static void gl_view_ellipse_finalize (GObject *object);
-
-static void update_view_ellipse_cb (glLabelObject *object,
- glViewEllipse *view_ellipse);
-
-static GtkWidget *construct_properties_dialog (glViewObject *view_object);
+static void gl_view_ellipse_class_init (glViewEllipseClass *klass);
+static void gl_view_ellipse_instance_init (glViewEllipse *view_ellipse);
+static void gl_view_ellipse_finalize (GObject *object);
-static void response_cb (GtkDialog *dialog,
- gint response,
- glViewEllipse *view_ellipse);
+static GtkWidget *construct_properties_editor (glViewObject *view_object);
-static void line_changed_cb (glWdgtLine *line,
- glViewEllipse *view_ellipse);
+static void update_canvas_item_from_object_cb (glLabelObject *object,
+ glViewEllipse *view_ellipse);
-static void fill_changed_cb (glWdgtFill *fill,
- glViewEllipse *view_ellipse);
+static void update_object_from_editor_cb (glObjectEditor *editor,
+ glLabelObject *object);
-static void position_changed_cb (glWdgtPosition *position,
- glViewEllipse *view_ellipse);
+static void update_editor_from_object_cb (glLabelObject *object,
+ glObjectEditor *editor);
-static void size_changed_cb (glWdgtSize *size,
- glViewEllipse *view_ellipse);
+static void update_editor_from_move_cb (glLabelObject *object,
+ gdouble dx,
+ gdouble dy,
+ glObjectEditor *editor);
-static void update_dialog_cb (glLabelObject *object,
- glViewEllipse *view_ellipse);
+static void update_editor_from_label_cb (glLabel *label,
+ glObjectEditor *editor);
-static void update_dialog_from_move_cb (glLabelObject *object,
- gdouble dx,
- gdouble dy,
- glViewEllipse *view_ellipse);
\f
/*****************************************************************************/
object_class->finalize = gl_view_ellipse_finalize;
- view_object_class->construct_dialog = construct_properties_dialog;
+ view_object_class->construct_editor = construct_properties_editor;
gl_debug (DEBUG_VIEW, "END");
}
/*****************************************************************************/
glViewObject *
gl_view_ellipse_new (glLabelEllipse *object,
- glView *view)
+ glView *view)
{
- glViewEllipse *view_ellipse;
+ glViewEllipse *view_ellipse;
gdouble line_width;
guint line_color, fill_color;
gdouble w, h;
- GtkMenu *menu;
gl_debug (DEBUG_VIEW, "START");
g_return_if_fail (object && GL_IS_LABEL_ELLIPSE (object));
NULL);
g_signal_connect (G_OBJECT (object), "changed",
- G_CALLBACK (update_view_ellipse_cb), view_ellipse);
+ G_CALLBACK (update_canvas_item_from_object_cb), view_ellipse);
gl_debug (DEBUG_VIEW, "END");
return GL_VIEW_OBJECT (view_ellipse);
}
+/*****************************************************************************/
+/* Create a properties editor for an ellipse object. */
+/*****************************************************************************/
+static GtkWidget *
+construct_properties_editor (glViewObject *view_object)
+{
+ GtkWidget *editor;
+ glViewEllipse *view_ellipse = (glViewEllipse *)view_object;
+ glLabelObject *object;
+
+ gl_debug (DEBUG_VIEW, "START");
+
+ object = gl_view_object_get_object (GL_VIEW_OBJECT(view_ellipse));
+
+ /* Build editor. */
+ editor = gl_object_editor_new (GL_STOCK_ELLIPSE, _("Ellipse object properties"),
+ GL_OBJECT_EDITOR_POSITION_PAGE,
+ GL_OBJECT_EDITOR_SIZE_PAGE,
+ GL_OBJECT_EDITOR_FILL_PAGE,
+ GL_OBJECT_EDITOR_LINE_PAGE,
+ 0);
+
+ /* Update */
+ update_editor_from_object_cb (object, GL_OBJECT_EDITOR(editor));
+ update_editor_from_move_cb (object, 0, 0, GL_OBJECT_EDITOR(editor));
+ update_editor_from_label_cb (object->parent, GL_OBJECT_EDITOR(editor));
+
+ /* Connect signals. */
+ g_signal_connect (G_OBJECT (editor), "changed",
+ G_CALLBACK(update_object_from_editor_cb), object);
+ g_signal_connect (G_OBJECT (object), "changed",
+ G_CALLBACK (update_editor_from_object_cb), editor);
+ g_signal_connect (G_OBJECT (object), "moved",
+ G_CALLBACK (update_editor_from_move_cb), editor);
+ g_signal_connect (G_OBJECT (object->parent), "size_changed",
+ G_CALLBACK (update_editor_from_label_cb), editor);
+
+ gl_debug (DEBUG_VIEW, "END");
+
+ return editor;
+}
+
/*---------------------------------------------------------------------------*/
/* PRIVATE. label object "changed" callback. */
/*---------------------------------------------------------------------------*/
static void
-update_view_ellipse_cb (glLabelObject *object,
- glViewEllipse *view_ellipse)
+update_canvas_item_from_object_cb (glLabelObject *object,
+ glViewEllipse *view_ellipse)
{
gdouble line_width;
guint line_color, fill_color;
gl_debug (DEBUG_VIEW, "END");
}
-/*****************************************************************************/
-/* Create a properties dialog for a ellipse object. */
-/*****************************************************************************/
-static GtkWidget *
-construct_properties_dialog (glViewObject *view_object)
-{
- glViewEllipse *view_ellipse = (glViewEllipse *)view_object;
- GtkWidget *dialog, *wsection;
- glLabelObject *object;
- gdouble line_width;
- guint line_color, fill_color;
- gdouble x, y, w, h, label_width, label_height;
- GtkSizeGroup *label_size_group;
- GtkWidget *window;
-
- gl_debug (DEBUG_VIEW, "START");
-
- /* retrieve object and query parameters */
- object = gl_view_object_get_object (GL_VIEW_OBJECT(view_ellipse));
- gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y);
- gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h);
- line_width = gl_label_ellipse_get_line_width(GL_LABEL_ELLIPSE(object));
- line_color = gl_label_ellipse_get_line_color(GL_LABEL_ELLIPSE(object));
- fill_color = gl_label_ellipse_get_fill_color(GL_LABEL_ELLIPSE(object));
- gl_label_get_size (GL_LABEL(object->parent),
- &label_width, &label_height);
-
- /*-----------------------------------------------------------------*/
- /* Build dialog with notebook. */
- /*-----------------------------------------------------------------*/
- window = gtk_widget_get_toplevel (
- GTK_WIDGET(gl_view_object_get_view(GL_VIEW_OBJECT(view_ellipse))));
- dialog = gl_hig_dialog_new_with_buttons ( _("Edit ellipse object properties"),
- GTK_WINDOW (window),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_STOCK_CLOSE,
- GTK_RESPONSE_CLOSE,
- NULL );
- gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
- g_signal_connect (G_OBJECT (dialog), "response",
- G_CALLBACK (response_cb), view_ellipse);
-
- label_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
-
-
- /*---------------------------*/
- /* Outline section */
- /*---------------------------*/
- wsection = gl_hig_category_new (_("Outline"));
- gl_hig_dialog_add_widget (GL_HIG_DIALOG(dialog), wsection);
- view_ellipse->private->line = gl_wdgt_line_new ();
- gl_wdgt_line_set_label_size_group (GL_WDGT_LINE(view_ellipse->private->line),
- label_size_group);
- gl_wdgt_line_set_params (GL_WDGT_LINE (view_ellipse->private->line),
- line_width,
- line_color);
- gl_hig_category_add_widget (GL_HIG_CATEGORY(wsection),
- view_ellipse->private->line);
- g_signal_connect (G_OBJECT (view_ellipse->private->line), "changed",
- G_CALLBACK(line_changed_cb), view_ellipse);
-
- /*---------------------------*/
- /* Fill section */
- /*---------------------------*/
- wsection = gl_hig_category_new (_("Fill"));
- gl_hig_dialog_add_widget (GL_HIG_DIALOG(dialog), wsection);
- view_ellipse->private->fill = gl_wdgt_fill_new ();
- gl_wdgt_fill_set_label_size_group (GL_WDGT_FILL(view_ellipse->private->fill),
- label_size_group);
- gl_wdgt_fill_set_params (GL_WDGT_FILL (view_ellipse->private->fill),
- fill_color);
- gl_hig_category_add_widget (GL_HIG_CATEGORY(wsection),
- view_ellipse->private->fill);
- g_signal_connect (G_OBJECT (view_ellipse->private->fill), "changed",
- G_CALLBACK(fill_changed_cb), view_ellipse);
-
-
- /*---------------------------*/
- /* Position section */
- /*---------------------------*/
- wsection = gl_hig_category_new (_("Position"));
- gl_hig_dialog_add_widget (GL_HIG_DIALOG(dialog), wsection);
- view_ellipse->private->position = gl_wdgt_position_new ();
- gl_wdgt_position_set_label_size_group (GL_WDGT_POSITION(view_ellipse->private->position),
- label_size_group);
- gl_wdgt_position_set_params (GL_WDGT_POSITION (view_ellipse->private->position),
- x, y, label_width, label_height);
- gl_hig_category_add_widget (GL_HIG_CATEGORY(wsection),
- view_ellipse->private->position);
- g_signal_connect (G_OBJECT (view_ellipse->private->position), "changed",
- G_CALLBACK(position_changed_cb), view_ellipse);
-
- /*---------------------------*/
- /* Size section */
- /*---------------------------*/
- wsection = gl_hig_category_new (_("Size"));
- gl_hig_dialog_add_widget (GL_HIG_DIALOG(dialog), wsection);
- view_ellipse->private->size = gl_wdgt_size_new ();
- gl_wdgt_size_set_label_size_group (GL_WDGT_SIZE(view_ellipse->private->size),
- label_size_group);
- gl_wdgt_size_set_params (GL_WDGT_SIZE (view_ellipse->private->size),
- w, h, TRUE, label_width, label_height);
- gl_hig_category_add_widget (GL_HIG_CATEGORY(wsection),
- view_ellipse->private->size);
- g_signal_connect (G_OBJECT (view_ellipse->private->size), "changed",
- G_CALLBACK(size_changed_cb), view_ellipse);
-
-
- /*----------------------------*/
- /* Track object changes. */
- /*----------------------------*/
- g_signal_connect (G_OBJECT (object), "changed",
- G_CALLBACK (update_dialog_cb), view_ellipse);
- g_signal_connect (G_OBJECT (object), "moved",
- G_CALLBACK (update_dialog_from_move_cb),
- view_ellipse);
-
- gl_debug (DEBUG_VIEW, "END");
-
- return dialog;
-}
-
/*---------------------------------------------------------------------------*/
-/* PRIVATE. "Response" callback. */
+/* PRIVATE. editor "changed" callback. */
/*---------------------------------------------------------------------------*/
static void
-response_cb (GtkDialog *dialog,
- gint response,
- glViewEllipse *view_ellipse)
+update_object_from_editor_cb (glObjectEditor *editor,
+ glLabelObject *object)
{
- glLabelObject *object;
-
- gl_debug (DEBUG_VIEW, "START");
-
- g_return_if_fail(dialog != NULL);
- g_return_if_fail(GTK_IS_DIALOG(dialog));
-
- switch(response) {
- case GTK_RESPONSE_CLOSE:
- gtk_widget_hide (GTK_WIDGET(dialog));
- break;
- case GTK_RESPONSE_DELETE_EVENT:
- /* Dialog destroyed, remove callbacks that reference it. */
- object = gl_view_object_get_object (GL_VIEW_OBJECT(view_ellipse));
-
- g_signal_handlers_disconnect_by_func (object, update_dialog_cb,
- view_ellipse);
- g_signal_handlers_disconnect_by_func (object, update_dialog_from_move_cb,
- view_ellipse);
- break;
- default:
- g_print ("response = %d", response);
- g_assert_not_reached();
- }
-
- gl_debug (DEBUG_VIEW, "END");
-}
-
-/*---------------------------------------------------------------------------*/
-/* PRIVATE. line properties "changed" callback. */
-/*---------------------------------------------------------------------------*/
-static void
-line_changed_cb (glWdgtLine *line,
- glViewEllipse *view_ellipse)
-{
- glLabelObject *object;
+ gdouble x, y, w, h;
+ guint line_color, fill_color;
gdouble line_width;
- guint line_color;
gl_debug (DEBUG_VIEW, "START");
- object = gl_view_object_get_object (GL_VIEW_OBJECT(view_ellipse));
-
- gl_wdgt_line_get_params (GL_WDGT_LINE (line),
- &line_width,
- &line_color);
-
g_signal_handlers_block_by_func (G_OBJECT(object),
- update_dialog_cb, view_ellipse);
- gl_label_ellipse_set_line_width(GL_LABEL_ELLIPSE(object), line_width);
- gl_label_ellipse_set_line_color(GL_LABEL_ELLIPSE(object), line_color);
- g_signal_handlers_unblock_by_func (G_OBJECT(object),
- update_dialog_cb, view_ellipse);
-
- gl_debug (DEBUG_VIEW, "END");
-}
-
-/*---------------------------------------------------------------------------*/
-/* PRIVATE. fill properties "changed" callback. */
-/*---------------------------------------------------------------------------*/
-static void
-fill_changed_cb (glWdgtFill *fill,
- glViewEllipse *view_ellipse)
-{
- glLabelObject *object;
- guint fill_color;
-
- gl_debug (DEBUG_VIEW, "START");
+ update_editor_from_object_cb,
+ editor);
+ g_signal_handlers_block_by_func (G_OBJECT(object),
+ update_editor_from_move_cb,
+ editor);
- object = gl_view_object_get_object (GL_VIEW_OBJECT(view_ellipse));
- gl_wdgt_fill_get_params (GL_WDGT_FILL (fill),
- &fill_color);
+ gl_object_editor_get_position (editor, &x, &y);
+ gl_label_object_set_position (object, x, y);
- g_signal_handlers_block_by_func (G_OBJECT(object),
- update_dialog_cb, view_ellipse);
- gl_label_ellipse_set_fill_color(GL_LABEL_ELLIPSE(object), fill_color);
- g_signal_handlers_unblock_by_func (G_OBJECT(object),
- update_dialog_cb, view_ellipse);
+ gl_object_editor_get_size (editor, &w, &h);
+ gl_label_object_set_size (object, w, h);
- gl_debug (DEBUG_VIEW, "END");
-}
+ fill_color = gl_object_editor_get_fill_color (editor);
+ gl_label_object_set_fill_color (object, fill_color);
-/*---------------------------------------------------------------------------*/
-/* PRIVATE. position "changed" callback. */
-/*---------------------------------------------------------------------------*/
-static void
-position_changed_cb (glWdgtPosition *position,
- glViewEllipse *view_ellipse)
-{
- glLabelObject *object;
- gdouble x, y;
+ line_color = gl_object_editor_get_line_color (editor);
+ gl_label_object_set_line_color (object, line_color);
- gl_debug (DEBUG_VIEW, "START");
+ line_width = gl_object_editor_get_line_width (editor);
+ gl_label_object_set_line_width (object, line_width);
- gl_wdgt_position_get_position (GL_WDGT_POSITION (position), &x, &y);
- object = gl_view_object_get_object (GL_VIEW_OBJECT(view_ellipse));
-
- g_signal_handlers_block_by_func (G_OBJECT(object),
- update_dialog_cb, view_ellipse);
- gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y);
g_signal_handlers_unblock_by_func (G_OBJECT(object),
- update_dialog_cb, view_ellipse);
+ update_editor_from_object_cb,
+ editor);
+ g_signal_handlers_unblock_by_func (G_OBJECT(object),
+ update_editor_from_move_cb,
+ editor);
gl_debug (DEBUG_VIEW, "END");
}
/*---------------------------------------------------------------------------*/
-/* PRIVATE. size "changed" callback. */
+/* PRIVATE. label object "changed" callback. */
/*---------------------------------------------------------------------------*/
static void
-size_changed_cb (glWdgtSize *size,
- glViewEllipse *view_ellipse)
+update_editor_from_object_cb (glLabelObject *object,
+ glObjectEditor *editor)
{
- glLabelObject *object;
- gdouble w, h;
- gboolean keep_aspect_ratio_flag;
+ gdouble w, h;
+ guint line_color, fill_color;
+ gdouble line_width;
gl_debug (DEBUG_VIEW, "START");
- gl_wdgt_size_get_size (GL_WDGT_SIZE (size),
- &w, &h, &keep_aspect_ratio_flag);
+ gl_label_object_get_size (object, &w, &h);
+ gl_object_editor_set_size (editor, w, h);
- object = gl_view_object_get_object (GL_VIEW_OBJECT(view_ellipse));
+ fill_color = gl_label_ellipse_get_fill_color (GL_LABEL_ELLIPSE(object));
+ gl_object_editor_set_fill_color (editor, fill_color);
- g_signal_handlers_block_by_func (G_OBJECT(object),
- update_dialog_cb, view_ellipse);
- gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h);
- g_signal_handlers_unblock_by_func (G_OBJECT(object),
- update_dialog_cb, view_ellipse);
+ line_color = gl_label_ellipse_get_line_color (GL_LABEL_ELLIPSE(object));
+ gl_object_editor_set_line_color (editor, line_color);
+
+ line_width = gl_label_ellipse_get_line_width (GL_LABEL_ELLIPSE(object));
+ gl_object_editor_set_line_width (editor, line_width);
gl_debug (DEBUG_VIEW, "END");
}
/*---------------------------------------------------------------------------*/
-/* PRIVATE. label object "changed" callback. */
+/* PRIVATE. label object "moved" callback. */
/*---------------------------------------------------------------------------*/
static void
-update_dialog_cb (glLabelObject *object,
- glViewEllipse *view_ellipse)
+update_editor_from_move_cb (glLabelObject *object,
+ gdouble dx,
+ gdouble dy,
+ glObjectEditor *editor)
{
- gdouble line_width;
- guint line_color, fill_color;
- gdouble x, y, w, h;
+ gdouble x, y;
gl_debug (DEBUG_VIEW, "START");
- /* Query properties of object. */
- gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y);
- gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h);
- line_width = gl_label_ellipse_get_line_width(GL_LABEL_ELLIPSE(object));
- line_color = gl_label_ellipse_get_line_color(GL_LABEL_ELLIPSE(object));
- fill_color = gl_label_ellipse_get_fill_color(GL_LABEL_ELLIPSE(object));
-
- /* Block widget handlers to prevent recursion */
- g_signal_handlers_block_by_func (G_OBJECT(view_ellipse->private->line),
- line_changed_cb, view_ellipse);
- g_signal_handlers_block_by_func (G_OBJECT(view_ellipse->private->fill),
- fill_changed_cb, view_ellipse);
- g_signal_handlers_block_by_func (G_OBJECT(view_ellipse->private->position),
- position_changed_cb, view_ellipse);
- g_signal_handlers_block_by_func (G_OBJECT(view_ellipse->private->size),
- size_changed_cb, view_ellipse);
-
- /* Update widgets in property dialog */
- gl_wdgt_line_set_params (GL_WDGT_LINE (view_ellipse->private->line),
- line_width,
- line_color);
- gl_wdgt_fill_set_params (GL_WDGT_FILL (view_ellipse->private->fill),
- fill_color);
- gl_wdgt_position_set_position (GL_WDGT_POSITION(view_ellipse->private->position),
- x, y);
- gl_wdgt_size_set_size (GL_WDGT_SIZE(view_ellipse->private->size), w, h);
-
- /* Unblock widget handlers */
- g_signal_handlers_unblock_by_func (G_OBJECT(view_ellipse->private->line),
- line_changed_cb, view_ellipse);
- g_signal_handlers_unblock_by_func (G_OBJECT(view_ellipse->private->fill),
- fill_changed_cb, view_ellipse);
- g_signal_handlers_unblock_by_func (G_OBJECT(view_ellipse->private->position),
- position_changed_cb, view_ellipse);
- g_signal_handlers_unblock_by_func (G_OBJECT(view_ellipse->private->size),
- size_changed_cb, view_ellipse);
+ gl_label_object_get_position (object, &x, &y);
+ gl_object_editor_set_position (editor, x, y);
gl_debug (DEBUG_VIEW, "END");
}
/*---------------------------------------------------------------------------*/
-/* PRIVATE. label object "moved" callback. */
+/* PRIVATE. label "changed" callback. */
/*---------------------------------------------------------------------------*/
static void
-update_dialog_from_move_cb (glLabelObject *object,
- gdouble dx,
- gdouble dy,
- glViewEllipse *view_ellipse)
+update_editor_from_label_cb (glLabel *label,
+ glObjectEditor *editor)
{
- gdouble x, y;
+ gdouble label_width, label_height;
gl_debug (DEBUG_VIEW, "START");
- /* Query properties of object. */
- gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y);
-
- /* Block widget handlers to prevent recursion */
- g_signal_handlers_block_by_func (G_OBJECT(view_ellipse->private->position),
- position_changed_cb, view_ellipse);
-
- /* Update widgets in property dialog */
- gl_wdgt_position_set_position (GL_WDGT_POSITION(view_ellipse->private->position),
- x, y);
-
- /* Unblock widget handlers */
- g_signal_handlers_unblock_by_func (G_OBJECT(view_ellipse->private->position),
- position_changed_cb, view_ellipse);
+ gl_label_get_size (label, &label_width, &label_height);
+ gl_object_editor_set_max_position (GL_OBJECT_EDITOR (editor),
+ label_width, label_height);
+ gl_object_editor_set_max_size (GL_OBJECT_EDITOR (editor),
+ label_width, label_height);
gl_debug (DEBUG_VIEW, "END");
}
GdkEvent *event,
glView *view)
{
- static gdouble x0, y0;
- static gboolean dragging = FALSE;
+ static gdouble x0, y0;
+ static gboolean dragging = FALSE;
static glViewObject *view_ellipse;
static GObject *object;
- guint line_color, fill_color;
- gdouble x, y, w, h;
+ guint line_color, fill_color;
+ gdouble x, y, w, h;
gl_debug (DEBUG_VIEW, "");
switch (event->button.button) {
case 1:
dragging = TRUE;
- gnome_canvas_item_grab (canvas->root,
- GDK_POINTER_MOTION_MASK |
- GDK_BUTTON_RELEASE_MASK |
- GDK_BUTTON_PRESS_MASK,
- NULL, event->button.time);
+ gnome_canvas_item_grab ( canvas->root,
+ GDK_POINTER_MOTION_MASK |
+ GDK_BUTTON_RELEASE_MASK |
+ GDK_BUTTON_PRESS_MASK,
+ NULL, event->button.time);
gnome_canvas_window_to_world (canvas,
event->button.x,
event->button.y, &x, &y);
line_color = gl_color_set_opacity (gl_view_get_default_line_color(view), 0.5);
fill_color = gl_color_set_opacity (gl_view_get_default_fill_color(view), 0.5);
gl_label_ellipse_set_line_width (GL_LABEL_ELLIPSE(object),
- gl_view_get_default_line_width (view));
+ gl_view_get_default_line_width(view));
gl_label_ellipse_set_line_color (GL_LABEL_ELLIPSE(object),
- line_color);
+ line_color);
gl_label_ellipse_set_fill_color (GL_LABEL_ELLIPSE(object),
- fill_color);
+ fill_color);
view_ellipse = gl_view_ellipse_new (GL_LABEL_ELLIPSE(object),
- view);
+ view);
x0 = x;
y0 = y;
return TRUE;
gl_label_object_set_size (GL_LABEL_OBJECT(object),
w, h);
gl_label_ellipse_set_line_color (GL_LABEL_ELLIPSE(object),
- gl_view_get_default_line_color (view));
+ gl_view_get_default_line_color(view));
gl_label_ellipse_set_fill_color (GL_LABEL_ELLIPSE(object),
- gl_view_get_default_fill_color (view));
+ gl_view_get_default_fill_color(view));
gl_view_unselect_all (view);
gl_view_object_select (GL_VIEW_OBJECT(view_ellipse));
gl_view_arrow_mode (view);
*
* view_image.c: GLabels label image object widget
*
- * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>.
+ * Copyright (C) 2001-2003 Jim Evins <evins@snaught.com>.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "view-highlight.h"
-#include "wdgt-image-select.h"
-#include "wdgt-line.h"
-#include "wdgt-fill.h"
-#include "wdgt-size.h"
-#include "wdgt-position.h"
+#include "color.h"
+#include "object-editor.h"
+#include "stock.h"
#include "pixmaps/cursor_image.xbm"
#include "pixmaps/cursor_image_mask.xbm"
/*========================================================*/
struct _glViewImagePrivate {
- GnomeCanvasItem *item;
-
- /* Page 0 widgets */
- GtkWidget *pixmap_entry;
-
- /* Page 1 widgets */
- GtkWidget *position;
- GtkWidget *size;
+ GnomeCanvasItem *item;
};
/*========================================================*/
/* Save state of image file entry */
static gchar *image_path = NULL;
-
/*========================================================*/
/* Private function prototypes. */
/*========================================================*/
-static void gl_view_image_class_init (glViewImageClass *klass);
-static void gl_view_image_instance_init (glViewImage *view_image);
-static void gl_view_image_finalize (GObject *object);
-
-static void update_view_image_cb (glLabelObject *object,
- glViewImage *view_image);
+static void gl_view_image_class_init (glViewImageClass *klass);
+static void gl_view_image_instance_init (glViewImage *view_image);
+static void gl_view_image_finalize (GObject *object);
-static GtkWidget *construct_properties_dialog (glViewObject *view_object);
+static GtkWidget *construct_properties_editor (glViewObject *view_object);
-static void response_cb (GtkDialog *dialog,
- gint response,
- glViewImage *view_image);
+static void update_canvas_item_from_object_cb (glLabelObject *object,
+ glViewImage *view_image);
-static void file_changed_cb (GtkEntry *pixmap_entry,
- glViewImage *view_image);
+static void update_object_from_editor_cb (glObjectEditor *editor,
+ glLabelObject *object);
-static void position_changed_cb (glWdgtPosition *position,
- glViewImage *view_image);
+static void update_editor_from_object_cb (glLabelObject *object,
+ glObjectEditor *editor);
-static void size_changed_cb (glWdgtSize *size,
- glViewImage *view_image);
+static void update_editor_from_move_cb (glLabelObject *object,
+ gdouble dx,
+ gdouble dy,
+ glObjectEditor *editor);
-static void size_reset_cb (GtkButton *button,
- glViewImage *view_image);
+static void update_editor_from_label_cb (glLabel *label,
+ glObjectEditor *editor);
-static void update_dialog_cb (glLabelObject *object,
- glViewImage *view_image);
-
-static void update_dialog_from_move_cb (glLabelObject *object,
- gdouble dx,
- gdouble dy,
- glViewImage *view_image);
\f
/*****************************************************************************/
object_class->finalize = gl_view_image_finalize;
- view_object_class->construct_dialog = construct_properties_dialog;
+ view_object_class->construct_editor = construct_properties_editor;
gl_debug (DEBUG_VIEW, "END");
}
}
/*****************************************************************************/
-/* NEW image object view. */
+/* NEW image object view. */
/*****************************************************************************/
glViewObject *
gl_view_image_new (glLabelImage *object,
glViewImage *view_image;
const GdkPixbuf *pixbuf;
gdouble w, h;
- GtkMenu *menu;
gl_debug (DEBUG_VIEW, "START");
g_return_if_fail (object && GL_IS_LABEL_IMAGE (object));
NULL);
g_signal_connect (G_OBJECT (object), "changed",
- G_CALLBACK (update_view_image_cb), view_image);
+ G_CALLBACK (update_canvas_item_from_object_cb), view_image);
gl_debug (DEBUG_VIEW, "END");
return GL_VIEW_OBJECT (view_image);
}
-/*---------------------------------------------------------------------------*/
-/* PRIVATE. label object "changed" callback. */
-/*---------------------------------------------------------------------------*/
-static void
-update_view_image_cb (glLabelObject *object,
- glViewImage *view_image)
-{
- const GdkPixbuf *pixbuf;
- gdouble w, h;
-
- gl_debug (DEBUG_VIEW, "START");
-
- /* Query properties of object. */
- gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h);
- pixbuf = gl_label_image_get_pixbuf (GL_LABEL_IMAGE(object), NULL);
-
- /* Adjust appearance of analogous canvas item. */
- gnome_canvas_item_set (view_image->private->item,
- "width_set", TRUE,
- "height_set", TRUE,
- "width", w,
- "height", h,
- "pixbuf", pixbuf,
- NULL);
-
- gl_debug (DEBUG_VIEW, "END");
-}
-
/*****************************************************************************/
-/* Create a properties dialog for a image object. */
+/* Create a properties editor for an image object. */
/*****************************************************************************/
static GtkWidget *
-construct_properties_dialog (glViewObject *view_object)
+construct_properties_editor (glViewObject *view_object)
{
+ GtkWidget *editor;
glViewImage *view_image = (glViewImage *)view_object;
- GtkWidget *dialog, *wsection, *wbutton;
glLabelObject *object;
- gdouble x, y, w, h, label_width, label_height;
- glTextNode *filename;
- glMerge *merge;
- GtkSizeGroup *label_size_group;
- GtkWidget *window;
gl_debug (DEBUG_VIEW, "START");
- /* retrieve object and query parameters */
object = gl_view_object_get_object (GL_VIEW_OBJECT(view_image));
- gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y);
- gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h);
- filename = gl_label_image_get_filename (GL_LABEL_IMAGE(object));
- gl_label_get_size (GL_LABEL(object->parent),
- &label_width, &label_height);
- merge = gl_label_get_merge (GL_LABEL(object->parent));
- /*-----------------------------------------------------------------*/
- /* Build dialog. */
- /*-----------------------------------------------------------------*/
- window = gtk_widget_get_toplevel (
- GTK_WIDGET(gl_view_object_get_view(GL_VIEW_OBJECT(view_image))));
- dialog = gl_hig_dialog_new_with_buttons ( _("Edit image object properties"),
- GTK_WINDOW (window),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_STOCK_CLOSE,
- GTK_RESPONSE_CLOSE,
- NULL );
- gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
- g_signal_connect (G_OBJECT (dialog), "response",
- G_CALLBACK (response_cb), view_image);
-
- label_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
-
- /*---------------------------*/
- /* Image section */
- /*---------------------------*/
- wsection = gl_hig_category_new (_("Image"));
- gl_hig_dialog_add_widget (GL_HIG_DIALOG(dialog), wsection);
-
- view_image->private->pixmap_entry =
- gl_wdgt_image_select_new (merge, filename);
- gl_hig_category_add_widget (GL_HIG_CATEGORY(wsection),
- view_image->private->pixmap_entry);
- g_signal_connect ( G_OBJECT(view_image->private->pixmap_entry), "changed",
- G_CALLBACK (file_changed_cb), view_image);
-
-
- /*----------------------------*/
- /* Position section */
- /*----------------------------*/
- wsection = gl_hig_category_new (_("Position"));
- gl_hig_dialog_add_widget (GL_HIG_DIALOG(dialog), wsection);
- view_image->private->position = gl_wdgt_position_new ();
- gl_wdgt_position_set_label_size_group (GL_WDGT_POSITION(view_image->private->position),
- label_size_group);
- gl_wdgt_position_set_params (GL_WDGT_POSITION (view_image->private->position),
- x, y, label_width, label_height);
- gl_hig_category_add_widget (GL_HIG_CATEGORY(wsection),
- view_image->private->position);
- g_signal_connect (G_OBJECT (view_image->private->position),
- "changed",
- G_CALLBACK(position_changed_cb), view_image);
-
-
- /*----------------------------*/
- /* Size section */
- /*----------------------------*/
- wsection = gl_hig_category_new (_("Size"));
- gl_hig_dialog_add_widget (GL_HIG_DIALOG(dialog), wsection);
- view_image->private->size = gl_wdgt_size_new ();
- gl_wdgt_size_set_label_size_group (GL_WDGT_SIZE(view_image->private->size),
- label_size_group);
- gl_wdgt_size_set_params (GL_WDGT_SIZE (view_image->private->size),
- w, h, TRUE, label_width, label_height);
- gl_hig_category_add_widget (GL_HIG_CATEGORY(wsection),
- view_image->private->size);
- g_signal_connect (G_OBJECT (view_image->private->size), "changed",
- G_CALLBACK(size_changed_cb), view_image);
-
- /* ------ Size Reset Button ------ */
- wbutton = gtk_button_new_with_label (_("Reset image size"));
- gl_hig_category_add_widget (GL_HIG_CATEGORY(wsection), wbutton);
- g_signal_connect (G_OBJECT (wbutton), "clicked",
- G_CALLBACK (size_reset_cb), view_image);
-
-
- /*----------------------------*/
- /* Track object changes. */
- /*----------------------------*/
+ /* Build editor. */
+ editor = gl_object_editor_new (GL_STOCK_IMAGE, _("Image object properties"),
+ GL_OBJECT_EDITOR_POSITION_PAGE,
+ GL_OBJECT_EDITOR_SIZE_IMAGE_PAGE,
+ GL_OBJECT_EDITOR_IMAGE_PAGE,
+ 0);
+
+ /* Update */
+ update_editor_from_object_cb (object, GL_OBJECT_EDITOR(editor));
+ update_editor_from_move_cb (object, 0, 0, GL_OBJECT_EDITOR(editor));
+ update_editor_from_label_cb (object->parent, GL_OBJECT_EDITOR(editor));
+
+ /* Connect signals. */
+ g_signal_connect (G_OBJECT (editor), "changed",
+ G_CALLBACK(update_object_from_editor_cb), object);
g_signal_connect (G_OBJECT (object), "changed",
- G_CALLBACK (update_dialog_cb), view_image);
+ G_CALLBACK (update_editor_from_object_cb), editor);
g_signal_connect (G_OBJECT (object), "moved",
- G_CALLBACK (update_dialog_from_move_cb), view_image);
+ G_CALLBACK (update_editor_from_move_cb), editor);
+ g_signal_connect (G_OBJECT (object->parent), "size_changed",
+ G_CALLBACK (update_editor_from_label_cb), editor);
+ g_signal_connect (G_OBJECT (object->parent), "merge_changed",
+ G_CALLBACK (update_editor_from_label_cb), editor);
gl_debug (DEBUG_VIEW, "END");
- return dialog;
+ return editor;
}
/*---------------------------------------------------------------------------*/
-/* PRIVATE. "Response" callback. */
-/*---------------------------------------------------------------------------*/
-static void
-response_cb (GtkDialog *dialog,
- gint response,
- glViewImage *view_image)
-{
- glLabelObject *object;
-
- gl_debug (DEBUG_VIEW, "START");
-
- g_return_if_fail(dialog != NULL);
- g_return_if_fail(GTK_IS_DIALOG(dialog));
-
- switch(response) {
- case GTK_RESPONSE_CLOSE:
- gtk_widget_hide (GTK_WIDGET(dialog));
- break;
- case GTK_RESPONSE_DELETE_EVENT:
- /* Dialog destroyed, remove callbacks that reference it. */
- object = gl_view_object_get_object (GL_VIEW_OBJECT(view_image));
-
- g_signal_handlers_disconnect_by_func (object, update_dialog_cb,
- view_image);
- g_signal_handlers_disconnect_by_func (object, update_dialog_from_move_cb,
- view_image);
- break;
- default:
- g_print ("response = %d", response);
- g_assert_not_reached();
- }
-
- gl_debug (DEBUG_VIEW, "END");
-}
-
-/*---------------------------------------------------------------------------*/
-/* PRIVATE. file "changed" callback. */
+/* PRIVATE. label object "changed" callback. */
/*---------------------------------------------------------------------------*/
static void
-file_changed_cb (GtkEntry *pixmap_entry,
- glViewImage *view_image)
+update_canvas_item_from_object_cb (glLabelObject *object,
+ glViewImage *view_image)
{
- glLabelObject *object;
- glTextNode *filename;
+ const GdkPixbuf *pixbuf;
+ gdouble w, h;
gl_debug (DEBUG_VIEW, "START");
- object = gl_view_object_get_object (GL_VIEW_OBJECT(view_image));
-
- filename = gl_wdgt_image_select_get_data (GL_WDGT_IMAGE_SELECT(view_image->private->pixmap_entry));
- gl_debug (DEBUG_VIEW, "filename = %s", filename->data);
-
- g_signal_handlers_block_by_func (G_OBJECT(object),
- update_dialog_cb, view_image);
- gl_label_image_set_filename(GL_LABEL_IMAGE(object), filename);
- g_signal_handlers_unblock_by_func (G_OBJECT(object),
- update_dialog_cb, view_image);
+ /* Query properties of object. */
+ gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h);
+ pixbuf = gl_label_image_get_pixbuf (GL_LABEL_IMAGE(object), NULL);
- gl_text_node_free (&filename);
+ /* Adjust appearance of analogous canvas item. */
+ gnome_canvas_item_set (view_image->private->item,
+ "width_set", TRUE,
+ "height_set", TRUE,
+ "width", w,
+ "height", h,
+ "pixbuf", pixbuf,
+ NULL);
gl_debug (DEBUG_VIEW, "END");
}
/*---------------------------------------------------------------------------*/
-/* PRIVATE. position "changed" callback. */
+/* PRIVATE. editor "changed" callback. */
/*---------------------------------------------------------------------------*/
static void
-position_changed_cb (glWdgtPosition *position,
- glViewImage *view_image)
+update_object_from_editor_cb (glObjectEditor *editor,
+ glLabelObject *object)
{
- glLabelObject *object;
- gdouble x, y;
+ gdouble x, y, w, h;
+ glTextNode *filename;
gl_debug (DEBUG_VIEW, "START");
- gl_wdgt_position_get_position (GL_WDGT_POSITION (position), &x, &y);
-
- object = gl_view_object_get_object (GL_VIEW_OBJECT(view_image));
-
g_signal_handlers_block_by_func (G_OBJECT(object),
- update_dialog_cb, view_image);
- gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y);
- g_signal_handlers_unblock_by_func (G_OBJECT(object),
- update_dialog_cb, view_image);
-
- gl_debug (DEBUG_VIEW, "END");
-}
+ update_editor_from_object_cb,
+ editor);
+ g_signal_handlers_block_by_func (G_OBJECT(object),
+ update_editor_from_move_cb,
+ editor);
-/*---------------------------------------------------------------------------*/
-/* PRIVATE. size "changed" callback. */
-/*---------------------------------------------------------------------------*/
-static void
-size_changed_cb (glWdgtSize *size,
- glViewImage *view_image)
-{
- glLabelObject *object;
- gdouble w, h;
- gboolean keep_aspect_ratio_flag;
- gl_debug (DEBUG_VIEW, "START");
+ gl_object_editor_get_position (editor, &x, &y);
+ gl_label_object_set_position (object, x, y);
- gl_wdgt_size_get_size (GL_WDGT_SIZE (size),
- &w, &h, &keep_aspect_ratio_flag);
+ gl_object_editor_get_size (editor, &w, &h);
+ gl_label_object_set_size (object, w, h);
- object = gl_view_object_get_object (GL_VIEW_OBJECT(view_image));
+ filename = gl_object_editor_get_image (editor);
+ gl_label_image_set_filename (GL_LABEL_IMAGE(object), filename);
- g_signal_handlers_block_by_func (G_OBJECT(object),
- update_dialog_cb, view_image);
- gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h);
g_signal_handlers_unblock_by_func (G_OBJECT(object),
- update_dialog_cb, view_image);
+ update_editor_from_object_cb,
+ editor);
+ g_signal_handlers_unblock_by_func (G_OBJECT(object),
+ update_editor_from_move_cb,
+ editor);
gl_debug (DEBUG_VIEW, "END");
}
/*---------------------------------------------------------------------------*/
-/* PRIVATE. size "changed" callback. */
+/* PRIVATE. label object "changed" callback. */
/*---------------------------------------------------------------------------*/
static void
-size_reset_cb (GtkButton *button,
- glViewImage *view_image)
+update_editor_from_object_cb (glLabelObject *object,
+ glObjectEditor *editor)
{
- glLabelObject *object;
- gdouble image_w, image_h;
- const GdkPixbuf *pixbuf;
+ gdouble w, h;
+ const GdkPixbuf *pixbuf;
+ gdouble image_w, image_h;
+ glTextNode *filename;
+ glMerge *merge;
gl_debug (DEBUG_VIEW, "START");
- object = gl_view_object_get_object (GL_VIEW_OBJECT(view_image));
- pixbuf = gl_label_image_get_pixbuf (GL_LABEL_IMAGE(object), NULL);
+ gl_label_object_get_size (object, &w, &h);
+ gl_object_editor_set_size (editor, w, h);
- image_w = gdk_pixbuf_get_width (pixbuf);
- image_h = gdk_pixbuf_get_height (pixbuf);
+ pixbuf = gl_label_image_get_pixbuf (GL_LABEL_IMAGE(object), NULL);
+ image_w = gdk_pixbuf_get_width (pixbuf);
+ image_h = gdk_pixbuf_get_height (pixbuf);
+ gl_object_editor_set_base_size (editor, image_w, image_h);
- gl_label_object_set_size (GL_LABEL_OBJECT(object), image_w, image_h);
+ filename = gl_label_image_get_filename (GL_LABEL_IMAGE(object));
+ merge = gl_label_get_merge (GL_LABEL(object->parent));
+ if ( filename != NULL ) {
+ gl_object_editor_set_image (editor, (merge != NULL), filename);
+ }
gl_debug (DEBUG_VIEW, "END");
}
/*---------------------------------------------------------------------------*/
-/* PRIVATE. label object "changed" callback. */
+/* PRIVATE. label object "moved" callback. */
/*---------------------------------------------------------------------------*/
static void
-update_dialog_cb (glLabelObject *object,
- glViewImage *view_image)
+update_editor_from_move_cb (glLabelObject *object,
+ gdouble dx,
+ gdouble dy,
+ glObjectEditor *editor)
{
- glTextNode *filename;
- gdouble x, y, w, h;
- glMerge *merge;
+ gdouble x, y;
gl_debug (DEBUG_VIEW, "START");
- /* Query properties of object. */
- gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y);
- gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h);
- filename = gl_label_image_get_filename (GL_LABEL_IMAGE(object));
- merge = gl_label_get_merge (GL_LABEL(object->parent));
-
- /* Block widget handlers to prevent recursion */
- g_signal_handlers_block_by_func (G_OBJECT(view_image->private->pixmap_entry),
- file_changed_cb, view_image);
- g_signal_handlers_block_by_func (G_OBJECT(view_image->private->position),
- position_changed_cb, view_image);
- g_signal_handlers_block_by_func (G_OBJECT(view_image->private->size),
- size_changed_cb, view_image);
-
- /* Update widgets in property dialog */
-
- if ( filename != NULL ) {
- gl_wdgt_image_select_set_data (GL_WDGT_IMAGE_SELECT(view_image->private->pixmap_entry),
- (merge != NULL),
- filename);
- }
- gl_wdgt_image_select_set_field_defs (GL_WDGT_IMAGE_SELECT(view_image->private->pixmap_entry),
- merge);
- gl_wdgt_position_set_position (GL_WDGT_POSITION(view_image->private->position),
- x, y);
- gl_wdgt_size_set_size (GL_WDGT_SIZE(view_image->private->size), w, h);
-
- /* Unblock widget handlers */
- g_signal_handlers_unblock_by_func (G_OBJECT(view_image->private->pixmap_entry),
- file_changed_cb, view_image);
- g_signal_handlers_unblock_by_func (G_OBJECT(view_image->private->position),
- position_changed_cb, view_image);
- g_signal_handlers_unblock_by_func (G_OBJECT(view_image->private->size),
- size_changed_cb, view_image);
-
- g_free (filename);
+ gl_label_object_get_position (object, &x, &y);
+ gl_object_editor_set_position (editor, x, y);
gl_debug (DEBUG_VIEW, "END");
}
/*---------------------------------------------------------------------------*/
-/* PRIVATE. label object "moved" callback. */
+/* PRIVATE. label "changed" callback. */
/*---------------------------------------------------------------------------*/
static void
-update_dialog_from_move_cb (glLabelObject *object,
- gdouble dx,
- gdouble dy,
- glViewImage *view_image)
+update_editor_from_label_cb (glLabel *label,
+ glObjectEditor *editor)
{
- gdouble x, y;
+ gdouble label_width, label_height;
+ glMerge *merge;
gl_debug (DEBUG_VIEW, "START");
- /* Query properties of object. */
- gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y);
-
- /* Block widget handlers to prevent recursion */
- g_signal_handlers_block_by_func (G_OBJECT(view_image->private->position),
- position_changed_cb, view_image);
-
- /* Update widgets in property dialog */
- gl_wdgt_position_set_position (GL_WDGT_POSITION(view_image->private->position),
- x, y);
+ gl_label_get_size (label, &label_width, &label_height);
+ gl_object_editor_set_max_position (GL_OBJECT_EDITOR (editor),
+ label_width, label_height);
+ gl_object_editor_set_max_size (GL_OBJECT_EDITOR (editor),
+ label_width, label_height);
- /* Unblock widget handlers */
- g_signal_handlers_unblock_by_func (G_OBJECT(view_image->private->position),
- position_changed_cb, view_image);
+ merge = gl_label_get_merge (label);
+ gl_object_editor_set_key_names (editor, merge);
gl_debug (DEBUG_VIEW, "END");
}
*
* view_line.c: GLabels label line object widget
*
- * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>.
+ * Copyright (C) 2001-2003 Jim Evins <evins@snaught.com>.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "view-highlight.h"
-#include "wdgt-line.h"
-#include "wdgt-vector.h"
-#include "wdgt-position.h"
#include "color.h"
+#include "object-editor.h"
+#include "stock.h"
#include "pixmaps/cursor_line.xbm"
#include "pixmaps/cursor_line_mask.xbm"
struct _glViewLinePrivate {
GnomeCanvasItem *item;
-
- /* Property dialog Page 0 widgets */
- GtkWidget *line;
-
- /* Property dialog Page 1 widgets */
- GtkWidget *position;
- GtkWidget *vector;
};
/*========================================================*/
/* Private function prototypes. */
/*========================================================*/
-static void gl_view_line_class_init (glViewLineClass *klass);
-static void gl_view_line_instance_init (glViewLine *view_line);
-static void gl_view_line_finalize (GObject *object);
+static void gl_view_line_class_init (glViewLineClass *klass);
+static void gl_view_line_instance_init (glViewLine *view_line);
+static void gl_view_line_finalize (GObject *object);
-static void update_view_line_cb (glLabelObject *object,
- glViewLine *view_line);
+static GtkWidget *construct_properties_editor (glViewObject *view_object);
-static GtkWidget *construct_properties_dialog (glViewObject *view_object);
+static void update_canvas_item_from_object_cb (glLabelObject *object,
+ glViewLine *view_line);
-static void response_cb (GtkDialog *dialog,
- gint response,
- glViewLine *view_line);
+static void update_object_from_editor_cb (glObjectEditor *editor,
+ glLabelObject *object);
-static void line_changed_cb (glWdgtLine *line,
- glViewLine *view_line);
+static void update_editor_from_object_cb (glLabelObject *object,
+ glObjectEditor *editor);
-static void position_changed_cb (glWdgtPosition *position,
- glViewLine *view_line);
+static void update_editor_from_move_cb (glLabelObject *object,
+ gdouble dx,
+ gdouble dy,
+ glObjectEditor *editor);
-static void vector_changed_cb (glWdgtVector *vector,
- glViewLine *view_line);
+static void update_editor_from_label_cb (glLabel *label,
+ glObjectEditor *editor);
-static void update_dialog_cb (glLabelObject *object,
- glViewLine *view_line);
-
-static void update_dialog_from_move_cb (glLabelObject *object,
- gdouble dx,
- gdouble dy,
- glViewLine *view_line);
\f
/*****************************************************************************/
object_class->finalize = gl_view_line_finalize;
- view_object_class->construct_dialog = construct_properties_dialog;
+ view_object_class->construct_editor = construct_properties_editor;
gl_debug (DEBUG_VIEW, "END");
}
}
/*****************************************************************************/
-/* NEW line object view. */
+/* NEW line object view. */
/*****************************************************************************/
glViewObject *
gl_view_line_new (glLabelLine *object,
- glView *view)
+ glView *view)
{
- glViewLine *view_line;
+ glViewLine *view_line;
gdouble line_width;
guint line_color;
gdouble w, h;
- GtkMenu *menu;
- GnomeCanvasPoints *points;
+ GnomeCanvasPoints *points;
gl_debug (DEBUG_VIEW, "START");
g_return_if_fail (object && GL_IS_LABEL_LINE (object));
gnome_canvas_points_free (points);
g_signal_connect (G_OBJECT (object), "changed",
- G_CALLBACK (update_view_line_cb), view_line);
+ G_CALLBACK (update_canvas_item_from_object_cb), view_line);
gl_debug (DEBUG_VIEW, "END");
return GL_VIEW_OBJECT (view_line);
}
+/*****************************************************************************/
+/* Create a properties editor for a line object. */
+/*****************************************************************************/
+static GtkWidget *
+construct_properties_editor (glViewObject *view_object)
+{
+ GtkWidget *editor;
+ glViewLine *view_line = (glViewLine *)view_object;
+ glLabelObject *object;
+
+ gl_debug (DEBUG_VIEW, "START");
+
+ object = gl_view_object_get_object (GL_VIEW_OBJECT(view_line));
+
+ /* Build editor. */
+ editor = gl_object_editor_new (GL_STOCK_LINE, _("Line object properties"),
+ GL_OBJECT_EDITOR_POSITION_PAGE,
+ GL_OBJECT_EDITOR_SIZE_LINE_PAGE,
+ GL_OBJECT_EDITOR_LINE_PAGE,
+ 0);
+
+ /* Update */
+ update_editor_from_object_cb (object, GL_OBJECT_EDITOR(editor));
+ update_editor_from_move_cb (object, 0, 0, GL_OBJECT_EDITOR(editor));
+ update_editor_from_label_cb (object->parent, GL_OBJECT_EDITOR(editor));
+
+ /* Connect signals. */
+ g_signal_connect (G_OBJECT (editor), "changed",
+ G_CALLBACK(update_object_from_editor_cb), object);
+ g_signal_connect (G_OBJECT (object), "changed",
+ G_CALLBACK (update_editor_from_object_cb), editor);
+ g_signal_connect (G_OBJECT (object), "moved",
+ G_CALLBACK (update_editor_from_move_cb), editor);
+ g_signal_connect (G_OBJECT (object->parent), "size_changed",
+ G_CALLBACK (update_editor_from_label_cb), editor);
+
+ gl_debug (DEBUG_VIEW, "END");
+
+ return editor;
+}
+
/*---------------------------------------------------------------------------*/
/* PRIVATE. label object "changed" callback. */
/*---------------------------------------------------------------------------*/
static void
-update_view_line_cb (glLabelObject *object,
- glViewLine *view_line)
+update_canvas_item_from_object_cb (glLabelObject *object,
+ glViewLine *view_line)
{
gdouble line_width;
guint line_color;
gl_debug (DEBUG_VIEW, "END");
}
-/*****************************************************************************/
-/* Create a properties dialog for a line object. */
-/*****************************************************************************/
-static GtkWidget *
-construct_properties_dialog (glViewObject *view_object)
-{
- glViewLine *view_line = (glViewLine *)view_object;
- GtkWidget *dialog, *wsection;
- glLabelObject *object;
- gdouble line_width;
- guint line_color;
- gdouble x, y, w, h, label_width, label_height;
- GtkSizeGroup *label_size_group;
- GtkWidget *window;
-
- gl_debug (DEBUG_VIEW, "START");
-
- /* retrieve object and query parameters */
- object = gl_view_object_get_object (GL_VIEW_OBJECT(view_line));
- gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y);
- gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h);
- line_width = gl_label_line_get_line_width(GL_LABEL_LINE(object));
- line_color = gl_label_line_get_line_color(GL_LABEL_LINE(object));
- gl_label_get_size (GL_LABEL(object->parent),
- &label_width, &label_height);
-
- /*-----------------------------------------------------------------*/
- /* Build dialog with notebook. */
- /*-----------------------------------------------------------------*/
- window = gtk_widget_get_toplevel (
- GTK_WIDGET(gl_view_object_get_view(GL_VIEW_OBJECT(view_line))));
- dialog = gl_hig_dialog_new_with_buttons ( _("Edit line object properties"),
- GTK_WINDOW (window),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_STOCK_CLOSE,
- GTK_RESPONSE_CLOSE,
- NULL );
- gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
- g_signal_connect (G_OBJECT (dialog), "response",
- G_CALLBACK (response_cb), view_line);
-
- label_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
-
- /*---------------------------*/
- /* Line section */
- /*---------------------------*/
- wsection = gl_hig_category_new (_("Line"));
- gl_hig_dialog_add_widget (GL_HIG_DIALOG(dialog), wsection);
- view_line->private->line = gl_wdgt_line_new ();
- gl_wdgt_line_set_label_size_group (GL_WDGT_LINE(view_line->private->line),
- label_size_group);
- gl_wdgt_line_set_params (GL_WDGT_LINE (view_line->private->line),
- line_width,
- line_color);
- gl_hig_category_add_widget (GL_HIG_CATEGORY(wsection),
- view_line->private->line);
- g_signal_connect (G_OBJECT (view_line->private->line), "changed",
- G_CALLBACK(line_changed_cb), view_line);
-
- /*---------------------------*/
- /* Position section */
- /*---------------------------*/
- wsection = gl_hig_category_new (_("Position"));
- gl_hig_dialog_add_widget (GL_HIG_DIALOG(dialog), wsection);
- view_line->private->position = gl_wdgt_position_new ();
- gl_wdgt_position_set_label_size_group (GL_WDGT_POSITION(view_line->private->position),
- label_size_group);
- gl_wdgt_position_set_params (GL_WDGT_POSITION (view_line->private->position),
- x, y,
- label_width, label_height);
- gl_hig_category_add_widget (GL_HIG_CATEGORY(wsection),
- view_line->private->position);
- g_signal_connect (G_OBJECT (view_line->private->position),
- "changed",
- G_CALLBACK(position_changed_cb), view_line);
-
-
- /*---------------------------*/
- /* Size section */
- /*---------------------------*/
- wsection = gl_hig_category_new (_("Size"));
- gl_hig_dialog_add_widget (GL_HIG_DIALOG(dialog), wsection);
- view_line->private->vector = gl_wdgt_vector_new ();
- gl_wdgt_vector_set_label_size_group (GL_WDGT_VECTOR(view_line->private->vector),
- label_size_group);
- gl_wdgt_vector_set_params (GL_WDGT_VECTOR (view_line->private->vector),
- w, h,
- label_width, label_height);
- gl_hig_category_add_widget (GL_HIG_CATEGORY(wsection),
- view_line->private->vector);
- g_signal_connect (G_OBJECT (view_line->private->vector), "changed",
- G_CALLBACK(vector_changed_cb), view_line);
-
-
- /*----------------------------*/
- /* Track object changes. */
- /*----------------------------*/
- g_signal_connect (G_OBJECT (object), "changed",
- G_CALLBACK (update_dialog_cb), view_line);
- g_signal_connect (G_OBJECT (object), "moved",
- G_CALLBACK (update_dialog_from_move_cb), view_line);
-
- gl_debug (DEBUG_VIEW, "END");
-
- return dialog;
-}
-
/*---------------------------------------------------------------------------*/
-/* PRIVATE. "Response" callback. */
+/* PRIVATE. editor "changed" callback. */
/*---------------------------------------------------------------------------*/
static void
-response_cb (GtkDialog *dialog,
- gint response,
- glViewLine *view_line)
+update_object_from_editor_cb (glObjectEditor *editor,
+ glLabelObject *object)
{
- glLabelObject *object;
-
- gl_debug (DEBUG_VIEW, "START");
-
- g_return_if_fail(dialog != NULL);
- g_return_if_fail(GTK_IS_DIALOG(dialog));
-
- switch(response) {
- case GTK_RESPONSE_CLOSE:
- gtk_widget_hide (GTK_WIDGET(dialog));
- break;
- case GTK_RESPONSE_DELETE_EVENT:
- /* Dialog destroyed, remove callbacks that reference it. */
- object = gl_view_object_get_object (GL_VIEW_OBJECT(view_line));
-
- g_signal_handlers_disconnect_by_func (object, update_dialog_cb,
- view_line);
- g_signal_handlers_disconnect_by_func (object, update_dialog_from_move_cb,
- view_line);
- break;
- default:
- g_print ("response = %d", response);
- g_assert_not_reached();
- }
-
- gl_debug (DEBUG_VIEW, "END");
-}
-
-/*---------------------------------------------------------------------------*/
-/* PRIVATE. line properties "changed" callback. */
-/*---------------------------------------------------------------------------*/
-static void
-line_changed_cb (glWdgtLine *line,
- glViewLine *view_line)
-{
- glLabelObject *object;
- gdouble line_width;
+ gdouble x, y, w, h;
guint line_color;
+ gdouble line_width;
gl_debug (DEBUG_VIEW, "START");
- object = gl_view_object_get_object (GL_VIEW_OBJECT(view_line));
-
- gl_wdgt_line_get_params (GL_WDGT_LINE (line),
- &line_width,
- &line_color);
-
g_signal_handlers_block_by_func (G_OBJECT(object),
- update_dialog_cb, view_line);
- gl_label_line_set_line_width(GL_LABEL_LINE(object), line_width);
- gl_label_line_set_line_color(GL_LABEL_LINE(object), line_color);
- g_signal_handlers_unblock_by_func (G_OBJECT(object),
- update_dialog_cb, view_line);
+ update_editor_from_object_cb,
+ editor);
+ g_signal_handlers_block_by_func (G_OBJECT(object),
+ update_editor_from_move_cb,
+ editor);
- gl_debug (DEBUG_VIEW, "END");
-}
-/*---------------------------------------------------------------------------*/
-/* PRIVATE. position "changed" callback. */
-/*---------------------------------------------------------------------------*/
-static void
-position_changed_cb (glWdgtPosition *position,
- glViewLine *view_line)
-{
- glLabelObject *object;
- gdouble x, y;
+ gl_object_editor_get_position (editor, &x, &y);
+ gl_label_object_set_position (object, x, y);
- gl_debug (DEBUG_VIEW, "START");
+ gl_object_editor_get_lsize (editor, &w, &h);
+ gl_label_object_set_size (object, w, h);
- gl_wdgt_position_get_position (GL_WDGT_POSITION (position), &x, &y);
+ line_color = gl_object_editor_get_line_color (editor);
+ gl_label_object_set_line_color (object, line_color);
+
+ line_width = gl_object_editor_get_line_width (editor);
+ gl_label_object_set_line_width (object, line_width);
- object = gl_view_object_get_object (GL_VIEW_OBJECT(view_line));
- g_signal_handlers_block_by_func (G_OBJECT(object),
- update_dialog_cb, view_line);
- gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y);
g_signal_handlers_unblock_by_func (G_OBJECT(object),
- update_dialog_cb, view_line);
+ update_editor_from_object_cb,
+ editor);
+ g_signal_handlers_unblock_by_func (G_OBJECT(object),
+ update_editor_from_move_cb,
+ editor);
gl_debug (DEBUG_VIEW, "END");
}
/*---------------------------------------------------------------------------*/
-/* PRIVATE. vector "changed" callback. */
+/* PRIVATE. label object "changed" callback. */
/*---------------------------------------------------------------------------*/
static void
-vector_changed_cb (glWdgtVector *vector,
- glViewLine *view_line)
+update_editor_from_object_cb (glLabelObject *object,
+ glObjectEditor *editor)
{
- glLabelObject *object;
- gdouble w, h;
- gboolean keep_aspect_ratio_flag;
+ gdouble w, h;
+ guint line_color;
+ gdouble line_width;
gl_debug (DEBUG_VIEW, "START");
- gl_wdgt_vector_get_params (GL_WDGT_VECTOR (vector), &w, &h);
+ gl_label_object_get_size (object, &w, &h);
+ gl_object_editor_set_lsize (editor, w, h);
- object = gl_view_object_get_object (GL_VIEW_OBJECT(view_line));
+ line_color = gl_label_line_get_line_color (GL_LABEL_LINE(object));
+ gl_object_editor_set_line_color (editor, line_color);
- g_signal_handlers_block_by_func (G_OBJECT(object),
- update_dialog_cb, view_line);
- gl_label_object_set_size (GL_LABEL_OBJECT(object), w, h);
- g_signal_handlers_unblock_by_func (G_OBJECT(object),
- update_dialog_cb, view_line);
+ line_width = gl_label_line_get_line_width (GL_LABEL_LINE(object));
+ gl_object_editor_set_line_width (editor, line_width);
gl_debug (DEBUG_VIEW, "END");
}
/*---------------------------------------------------------------------------*/
-/* PRIVATE. label object "changed" callback. */
+/* PRIVATE. label object "moved" callback. */
/*---------------------------------------------------------------------------*/
static void
-update_dialog_cb (glLabelObject *object,
- glViewLine *view_line)
+update_editor_from_move_cb (glLabelObject *object,
+ gdouble dx,
+ gdouble dy,
+ glObjectEditor *editor)
{
- gdouble line_width;
- guint line_color;
- gdouble x, y, w, h, label_width, label_height;
+ gdouble x, y;
gl_debug (DEBUG_VIEW, "START");
- /* Query properties of object. */
- gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y);
- gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h);
- line_width = gl_label_line_get_line_width(GL_LABEL_LINE(object));
- line_color = gl_label_line_get_line_color(GL_LABEL_LINE(object));
- gl_label_get_size (GL_LABEL(object->parent),
- &label_width, &label_height);
-
- /* Block widget handlers to prevent recursion */
- g_signal_handlers_block_by_func (G_OBJECT(view_line->private->line),
- line_changed_cb, view_line);
- g_signal_handlers_block_by_func (G_OBJECT(view_line->private->position),
- position_changed_cb, view_line);
- g_signal_handlers_block_by_func (G_OBJECT(view_line->private->vector),
- vector_changed_cb, view_line);
-
- /* Update widgets in property dialog */
- gl_wdgt_line_set_params (GL_WDGT_LINE (view_line->private->line),
- line_width,
- line_color);
- gl_wdgt_position_set_position (GL_WDGT_POSITION(view_line->private->position),
- x, y);
- gl_wdgt_vector_set_params (GL_WDGT_VECTOR(view_line->private->vector),
- w, h, label_width, label_height);
-
- /* Unblock widget handlers */
- g_signal_handlers_unblock_by_func (G_OBJECT(view_line->private->line),
- line_changed_cb, view_line);
- g_signal_handlers_unblock_by_func (G_OBJECT(view_line->private->position),
- position_changed_cb, view_line);
- g_signal_handlers_unblock_by_func (G_OBJECT(view_line->private->vector),
- vector_changed_cb, view_line);
-
+ gl_label_object_get_position (object, &x, &y);
+ gl_object_editor_set_position (editor, x, y);
gl_debug (DEBUG_VIEW, "END");
}
/*---------------------------------------------------------------------------*/
-/* PRIVATE. label object "moved" callback. */
+/* PRIVATE. label "changed" callback. */
/*---------------------------------------------------------------------------*/
static void
-update_dialog_from_move_cb (glLabelObject *object,
- gdouble dx,
- gdouble dy,
- glViewLine *view_line)
+update_editor_from_label_cb (glLabel *label,
+ glObjectEditor *editor)
{
- gdouble x, y;
+ gdouble label_width, label_height;
gl_debug (DEBUG_VIEW, "START");
- /* Query properties of object. */
- gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y);
-
- /* Block widget handlers to prevent recursion */
- g_signal_handlers_block_by_func (G_OBJECT(view_line->private->position),
- position_changed_cb, view_line);
-
- /* Update widgets in property dialog */
- gl_wdgt_position_set_position (GL_WDGT_POSITION(view_line->private->position),
- x, y);
-
- /* Unblock widget handlers */
- g_signal_handlers_unblock_by_func (G_OBJECT(view_line->private->position),
- position_changed_cb, view_line);
+ gl_label_get_size (label, &label_width, &label_height);
+ gl_object_editor_set_max_position (GL_OBJECT_EDITOR (editor),
+ label_width, label_height);
+ gl_object_editor_set_max_size (GL_OBJECT_EDITOR (editor),
+ label_width, label_height);
gl_debug (DEBUG_VIEW, "END");
}
}
}
+
GnomeCanvasItem *group;
glViewHighlight *highlight;
- GtkWidget *property_dialog;
+ GtkWidget *property_editor;
};
/*========================================================*/
g_object_unref (GL_VIEW_OBJECT(object)->private->object);
g_object_unref (G_OBJECT(GL_VIEW_OBJECT(object)->private->highlight));
gtk_object_destroy (GTK_OBJECT(GL_VIEW_OBJECT(object)->private->group));
- if (GL_VIEW_OBJECT(object)->private->property_dialog) {
- gtk_object_destroy (GTK_OBJECT(GL_VIEW_OBJECT(object)->private->property_dialog));
+ if (GL_VIEW_OBJECT(object)->private->property_editor) {
+ gtk_object_destroy (GTK_OBJECT(GL_VIEW_OBJECT(object)->private->property_editor));
}
G_OBJECT_CLASS (parent_class)->finalize (object);
/*****************************************************************************/
-/* Show property dialog. */
+/* Get property editor. */
/*****************************************************************************/
-void
-gl_view_object_show_dialog (glViewObject *view_object)
+GtkWidget *
+gl_view_object_get_editor (glViewObject *view_object)
{
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail (view_object && GL_IS_VIEW_OBJECT (view_object));
-
- if (view_object->private->property_dialog != NULL) {
- gtk_window_present (GTK_WINDOW (view_object->private->property_dialog));
- return;
- }
-
- if ( GL_VIEW_OBJECT_GET_CLASS(view_object)->construct_dialog != NULL ) {
+ g_return_val_if_fail (view_object && GL_IS_VIEW_OBJECT (view_object), NULL);
- view_object->private->property_dialog =
- GL_VIEW_OBJECT_GET_CLASS(view_object)->construct_dialog (view_object);
+ if ( GL_VIEW_OBJECT_GET_CLASS(view_object)->construct_editor != NULL ) {
- g_signal_connect (G_OBJECT (view_object->private->property_dialog),
+ if (view_object->private->property_editor == NULL) {
+ view_object->private->property_editor =
+ GL_VIEW_OBJECT_GET_CLASS(view_object)->construct_editor (view_object);
+ }
+ g_signal_connect (G_OBJECT (view_object->private->property_editor),
"destroy",
G_CALLBACK (gtk_widget_destroyed),
- &view_object->private->property_dialog);
+ &view_object->private->property_editor);
- gtk_widget_show_all (view_object->private->property_dialog);
+ gtk_widget_show (view_object->private->property_editor);
}
gl_debug (DEBUG_VIEW, "END");
+
+ return view_object->private->property_editor;
}
gl_debug (DEBUG_VIEW, "2BUTTON_PRESS");
switch (event->button.button) {
case 1:
- /* Also exit dragging mode w/ double-click, run dlg */
+ /* Also exit dragging mode w/ double-click */
gnome_canvas_item_ungrab (item, event->button.time);
dragging = FALSE;
gl_view_select_object (view, view_object);
- gl_view_object_show_dialog (view_object);
return TRUE;
default:
* Methods
*/
- GtkWidget * (*construct_dialog) (glViewObject *view_object);
+ GtkWidget * (*construct_editor) (glViewObject *view_object);
};
void gl_view_object_hide_highlight (glViewObject *view_object);
-void gl_view_object_show_dialog (glViewObject *view_object);
+GtkWidget *gl_view_object_get_editor (glViewObject *view_object);
void gl_view_object_select (glViewObject *view_object);
*
* view_text.c: GLabels label text object widget
*
- * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>.
+ * Copyright (C) 2001-2003 Jim Evins <evins@snaught.com>.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
#include "view-text.h"
#include "canvas-hacktext.h"
#include "view-highlight.h"
-#include "wdgt-text-entry.h"
-#include "wdgt-text-props.h"
-#include "wdgt-position.h"
+
#include "color.h"
-#include "hig.h"
+#include "object-editor.h"
+#include "stock.h"
#include "pixmaps/cursor_text.xbm"
#include "pixmaps/cursor_text_mask.xbm"
gboolean cursor_state;
guint cursor_timeout;
- /* Page 0 widgets */
- GtkWidget *text_entry;
-
- /* Page 1 widgets */
- GtkWidget *text_props;
-
- /* Page 2 widgets */
- GtkWidget *position;
};
/*========================================================*/
/* Private function prototypes. */
/*========================================================*/
-static void gl_view_text_class_init (glViewTextClass *klass);
-static void gl_view_text_instance_init (glViewText *view_text);
-static void gl_view_text_finalize (GObject *object);
+static void gl_view_text_class_init (glViewTextClass *klass);
+static void gl_view_text_instance_init (glViewText *view_text);
+static void gl_view_text_finalize (GObject *object);
-static void update_view_text_cb (glLabelObject *object,
- glViewText *view_text);
+static GtkWidget *construct_properties_editor (glViewObject *view_object);
-static GtkWidget *construct_properties_dialog (glViewObject *view_object);
+static void update_canvas_item_from_object_cb (glLabelObject *object,
+ glViewText *view_text);
-static void response_cb (GtkDialog *dialog,
- gint response,
- glViewText *view_text);
+static void update_object_from_editor_cb (glObjectEditor *editor,
+ glLabelObject *object);
-static void text_props_changed_cb (glWdgtTextProps *text_props,
- glViewText *view_text);
+static void update_editor_from_object_cb (glLabelObject *object,
+ glObjectEditor *editor);
-static void position_changed_cb (glWdgtPosition *position,
- glViewText *view_text);
+static void update_editor_from_move_cb (glLabelObject *object,
+ gdouble dx,
+ gdouble dy,
+ glObjectEditor *editor);
-static void update_dialog_cb (glLabelObject *object,
- glViewText *view_text);
+static void update_editor_from_label_cb (glLabel *label,
+ glObjectEditor *editor);
-static void update_dialog_from_move_cb (glLabelObject *object,
- gdouble dx,
- gdouble dy,
- glViewText *view_text);
+static void draw_hacktext (glViewText *view_text);
-static void draw_hacktext (glViewText *view_text);
+static void draw_cursor (glViewText *view_text);
-static void draw_cursor (glViewText *view_text);
+static void mark_set_cb (GtkTextBuffer *textbuffer,
+ GtkTextIter *iter,
+ GtkTextMark *mark,
+ glViewText *view_text);
-static void mark_set_cb (GtkTextBuffer *textbuffer,
- GtkTextIter *iter,
- GtkTextMark *mark,
- glViewText *view_text);
+static void blink_start (glViewText *view_text);
+static void blink_stop (glViewText *view_text);
+static gboolean blink_cb (glViewText *view_text);
-static void blink_start (glViewText *view_text);
-static void blink_stop (glViewText *view_text);
-static gboolean blink_cb (glViewText *view_text);
+static gint item_event_cb (GnomeCanvasItem *item,
+ GdkEvent *event,
+ glViewObject *view_object);
-static gint item_event_cb (GnomeCanvasItem *item,
- GdkEvent *event,
- glViewObject *view_object);
\f
/*****************************************************************************/
object_class->finalize = gl_view_text_finalize;
- view_object_class->construct_dialog = construct_properties_dialog;
+ view_object_class->construct_editor = construct_properties_editor;
gl_debug (DEBUG_VIEW, "END");
}
}
/*****************************************************************************/
-/* NEW text object view. */
+/* NEW text object view. */
/*****************************************************************************/
glViewObject *
gl_view_text_new (glLabelText *object,
- glView *view)
+ glView *view)
{
glViewText *view_text;
GtkMenu *menu;
draw_cursor (view_text);
g_signal_connect (G_OBJECT (object), "changed",
- G_CALLBACK (update_view_text_cb), view_text);
+ G_CALLBACK (update_canvas_item_from_object_cb), view_text);
g_signal_connect (G_OBJECT (group), "event",
G_CALLBACK (item_event_cb), view_text);
return GL_VIEW_OBJECT (view_text);
}
-/*---------------------------------------------------------------------------*/
-/* PRIVATE. label object "changed" callback. */
-/*---------------------------------------------------------------------------*/
-static void
-update_view_text_cb (glLabelObject *object,
- glViewText *view_text)
-{
- gl_debug (DEBUG_VIEW, "START");
-
- /* Adjust appearance of analogous canvas item. */
- draw_hacktext (view_text);
- draw_cursor (view_text);
-
- gl_debug (DEBUG_VIEW, "END");
-}
-
/*****************************************************************************/
-/* Create a properties dialog for a text object. */
+/* Create a properties editor for a text object. */
/*****************************************************************************/
static GtkWidget *
-construct_properties_dialog (glViewObject *view_object)
+construct_properties_editor (glViewObject *view_object)
{
- glViewText *view_text = (glViewText *)view_object;
- GtkWidget *dialog, *wsection, *wbutton;
- glLabelObject *object;
- gdouble x, y, w, h, label_width, label_height;
- GtkTextBuffer *buffer;
- gchar *font_family;
- gdouble font_size;
- GnomeFontWeight font_weight;
- gboolean font_italic_flag;
- guint color;
- GtkJustification just;
- glMerge *merge;
- GtkSizeGroup *label_size_group;
- GtkWidget *window;
+ GtkWidget *editor;
+ glViewText *view_text = (glViewText *)view_object;
+ glLabelObject *object;
+ GtkTextBuffer *buffer;
gl_debug (DEBUG_VIEW, "START");
- /* retrieve object and query parameters */
object = gl_view_object_get_object (GL_VIEW_OBJECT(view_text));
- gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y);
- buffer = gl_label_text_get_buffer(GL_LABEL_TEXT(object));
- gl_label_text_get_props (GL_LABEL_TEXT(object),
- &font_family, &font_size,
- &font_weight, &font_italic_flag,
- &color, &just);
- gl_label_get_size (GL_LABEL(object->parent),
- &label_width, &label_height);
- merge = gl_label_get_merge (GL_LABEL(object->parent));
-
- /*-----------------------------------------------------------------*/
- /* Build dialog. */
- /*-----------------------------------------------------------------*/
- window = gtk_widget_get_toplevel (
- GTK_WIDGET(gl_view_object_get_view(GL_VIEW_OBJECT(view_text))));
- dialog = gl_hig_dialog_new_with_buttons ( _("Edit text object properties"),
- GTK_WINDOW (window),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_STOCK_CLOSE,
- GTK_RESPONSE_CLOSE,
- NULL );
- gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
- g_signal_connect (G_OBJECT (dialog), "response",
- G_CALLBACK (response_cb), view_text);
-
- label_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
-
- /*---------------------------*/
- /* Text Section */
- /*---------------------------*/
- wsection = gl_hig_category_new (_("Text"));
- gl_hig_dialog_add_widget (GL_HIG_DIALOG(dialog), wsection);
- view_text->private->text_entry =
- gl_wdgt_text_entry_new (merge);
- gl_wdgt_text_entry_set_label_size_group (GL_WDGT_TEXT_ENTRY(view_text->private->text_entry),
- label_size_group);
- gl_wdgt_text_entry_set_buffer (GL_WDGT_TEXT_ENTRY(view_text->private->text_entry),
- buffer);
- gl_wdgt_text_entry_set_field_defs (GL_WDGT_TEXT_ENTRY(view_text->private->text_entry),
- merge);
- gl_hig_category_add_widget (GL_HIG_CATEGORY(wsection),
- view_text->private->text_entry);
-
-
- /*---------------------------*/
- /* Text Properties section */
- /*---------------------------*/
- wsection = gl_hig_category_new (_("Properties"));
- gl_hig_dialog_add_widget (GL_HIG_DIALOG(dialog), wsection);
- view_text->private->text_props = gl_wdgt_text_props_new ();
- gl_wdgt_text_props_set_label_size_group (GL_WDGT_TEXT_PROPS(view_text->private->text_props),
- label_size_group);
- gl_wdgt_text_props_set_params (GL_WDGT_TEXT_PROPS(view_text->private->text_props),
- font_family, font_size, font_weight,
- font_italic_flag, color, just);
- gl_hig_category_add_widget (GL_HIG_CATEGORY(wsection),
- view_text->private->text_props);
- g_signal_connect ( G_OBJECT(view_text->private->text_props),
- "changed", G_CALLBACK (text_props_changed_cb),
- view_text);
-
-
- /*----------------------------*/
- /* Position section */
- /*----------------------------*/
- wsection = gl_hig_category_new (_("Position"));
- gl_hig_dialog_add_widget (GL_HIG_DIALOG(dialog), wsection);
- view_text->private->position = gl_wdgt_position_new ();
- gl_wdgt_position_set_label_size_group (GL_WDGT_POSITION(view_text->private->position),
- label_size_group);
- gl_wdgt_position_set_params (GL_WDGT_POSITION (view_text->private->position),
- x, y,
- label_width, label_height);
- gl_hig_category_add_widget (GL_HIG_CATEGORY(wsection),
- view_text->private->position);
- g_signal_connect (G_OBJECT (view_text->private->position),
- "changed",
- G_CALLBACK(position_changed_cb), view_text);
-
-
- /*----------------------------*/
- /* Track object changes. */
- /*----------------------------*/
+
+ /* Build editor. */
+ editor = gl_object_editor_new (GL_STOCK_TEXT, _("Text object properties"),
+ GL_OBJECT_EDITOR_POSITION_PAGE,
+ GL_OBJECT_EDITOR_SIZE_PAGE,
+ GL_OBJECT_EDITOR_TEXT_PAGE,
+ GL_OBJECT_EDITOR_EDIT_PAGE,
+ 0);
+
+ buffer = gl_label_text_get_buffer (GL_LABEL_TEXT(object));
+ gl_object_editor_set_text_buffer (GL_OBJECT_EDITOR(editor), buffer);
+
+ /* Update */
+ update_editor_from_object_cb (object, GL_OBJECT_EDITOR(editor));
+ update_editor_from_move_cb (object, 0, 0, GL_OBJECT_EDITOR(editor));
+ update_editor_from_label_cb (object->parent, GL_OBJECT_EDITOR(editor));
+
+ /* Connect signals. */
+ g_signal_connect (G_OBJECT (editor), "changed",
+ G_CALLBACK(update_object_from_editor_cb), object);
g_signal_connect (G_OBJECT (object), "changed",
- G_CALLBACK (update_dialog_cb), view_text);
+ G_CALLBACK (update_editor_from_object_cb), editor);
g_signal_connect (G_OBJECT (object), "moved",
- G_CALLBACK (update_dialog_from_move_cb), view_text);
+ G_CALLBACK (update_editor_from_move_cb), editor);
+ g_signal_connect (G_OBJECT (object->parent), "size_changed",
+ G_CALLBACK (update_editor_from_label_cb), editor);
+ g_signal_connect (G_OBJECT (object->parent), "merge_changed",
+ G_CALLBACK (update_editor_from_label_cb), editor);
gl_debug (DEBUG_VIEW, "END");
- return dialog;
+ return editor;
}
/*---------------------------------------------------------------------------*/
-/* PRIVATE. "Response" callback. */
+/* PRIVATE. label object "changed" callback. */
/*---------------------------------------------------------------------------*/
static void
-response_cb (GtkDialog *dialog,
- gint response,
- glViewText *view_text)
+update_canvas_item_from_object_cb (glLabelObject *object,
+ glViewText *view_text)
{
- glLabelObject *object;
-
gl_debug (DEBUG_VIEW, "START");
- g_return_if_fail(dialog != NULL);
- g_return_if_fail(GTK_IS_DIALOG(dialog));
-
- switch(response) {
- case GTK_RESPONSE_CLOSE:
- gtk_widget_hide (GTK_WIDGET(dialog));
- break;
- case GTK_RESPONSE_DELETE_EVENT:
- /* Dialog destroyed, remove callbacks that reference it. */
- object = gl_view_object_get_object (GL_VIEW_OBJECT(view_text));
-
- g_signal_handlers_disconnect_by_func (object, update_dialog_cb,
- view_text);
- g_signal_handlers_disconnect_by_func (object, update_dialog_from_move_cb,
- view_text);
- break;
- default:
- g_print ("response = %d", response);
- g_assert_not_reached();
- }
+ /* Adjust appearance of analogous canvas item. */
+ draw_hacktext (view_text);
+ draw_cursor (view_text);
gl_debug (DEBUG_VIEW, "END");
}
/*---------------------------------------------------------------------------*/
-/* PRIVATE. text_props "changed" callback. */
+/* PRIVATE. editor "changed" callback. */
/*---------------------------------------------------------------------------*/
static void
-text_props_changed_cb (glWdgtTextProps *text_props,
- glViewText *view_text)
+update_object_from_editor_cb (glObjectEditor *editor,
+ glLabelObject *object)
{
- glLabelObject *object;
- gchar *font_family;
+ gdouble x, y, w, h;
+ gchar *font_family;
gdouble font_size;
GnomeFontWeight font_weight;
gboolean font_italic_flag;
guint color;
GtkJustification just;
-
gl_debug (DEBUG_VIEW, "START");
- object = gl_view_object_get_object (GL_VIEW_OBJECT(view_text));
+ g_signal_handlers_block_by_func (G_OBJECT(object),
+ update_editor_from_object_cb,
+ editor);
+ g_signal_handlers_block_by_func (G_OBJECT(object),
+ update_editor_from_move_cb,
+ editor);
- gl_wdgt_text_props_get_params (text_props,
- &font_family, &font_size, &font_weight,
- &font_italic_flag,
- &color, &just);
- g_signal_handlers_block_by_func (G_OBJECT(object),
- update_dialog_cb, view_text);
- gl_label_text_set_props (GL_LABEL_TEXT(object),
- font_family, font_size, font_weight,
- font_italic_flag,
- color, just);
- g_signal_handlers_unblock_by_func (G_OBJECT(object),
- update_dialog_cb, view_text);
+ gl_object_editor_get_position (editor, &x, &y);
+ gl_label_object_set_position (object, x, y);
+
+ gl_object_editor_get_size (editor, &w, &h);
+ gl_label_object_set_size (object, w, h);
+ font_family = gl_object_editor_get_font_family (editor);
+ gl_label_object_set_font_family (object, font_family);
g_free (font_family);
- gl_debug (DEBUG_VIEW, "END");
-}
+ font_size = gl_object_editor_get_font_size (editor);
+ gl_label_object_set_font_size (object, font_size);
-/*---------------------------------------------------------------------------*/
-/* PRIVATE. position "changed" callback. */
-/*---------------------------------------------------------------------------*/
-static void
-position_changed_cb (glWdgtPosition *position,
- glViewText *view_text)
-{
- glLabelObject *object;
- gdouble x, y;
+ font_weight = gl_object_editor_get_font_weight (editor);
+ gl_label_object_set_font_weight (object, font_weight);
- gl_debug (DEBUG_VIEW, "START");
+ font_italic_flag = gl_object_editor_get_font_italic_flag (editor);
+ gl_label_object_set_font_italic_flag (object, font_italic_flag);
- gl_wdgt_position_get_position (GL_WDGT_POSITION (position), &x, &y);
+ color = gl_object_editor_get_text_color (editor);
+ gl_label_object_set_text_color (object, color);
- object = gl_view_object_get_object (GL_VIEW_OBJECT(view_text));
+ just = gl_object_editor_get_text_alignment (editor);
+ gl_label_object_set_text_alignment (object, just);
- g_signal_handlers_block_by_func (G_OBJECT(object),
- update_dialog_cb, view_text);
- gl_label_object_set_position (GL_LABEL_OBJECT(object), x, y);
+
+ g_signal_handlers_unblock_by_func (G_OBJECT(object),
+ update_editor_from_object_cb,
+ editor);
g_signal_handlers_unblock_by_func (G_OBJECT(object),
- update_dialog_cb, view_text);
+ update_editor_from_move_cb,
+ editor);
gl_debug (DEBUG_VIEW, "END");
}
/* PRIVATE. label object "changed" callback. */
/*---------------------------------------------------------------------------*/
static void
-update_dialog_cb (glLabelObject *object,
- glViewText *view_text)
+update_editor_from_object_cb (glLabelObject *object,
+ glObjectEditor *editor)
{
- gdouble x, y;
- glMerge *merge;
- gchar *font_family;
+ gdouble w, h;
+ gchar *font_family;
gdouble font_size;
GnomeFontWeight font_weight;
gboolean font_italic_flag;
gl_debug (DEBUG_VIEW, "START");
- /* Query properties of object. */
+ gl_label_object_get_size (object, &w, &h);
+ gl_object_editor_set_size (editor, w, h);
+
gl_label_text_get_props (GL_LABEL_TEXT(object),
&font_family, &font_size,
&font_weight, &font_italic_flag,
&color, &just);
- gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y);
- merge = gl_label_get_merge (GL_LABEL(object->parent));
-
- /* Block widget handlers to prevent recursion */
- g_signal_handlers_block_by_func (G_OBJECT(view_text->private->text_props),
- text_props_changed_cb, view_text);
- g_signal_handlers_block_by_func (G_OBJECT(view_text->private->position),
- position_changed_cb, view_text);
-
- /* Update widgets in property dialog */
-
- gl_wdgt_text_entry_set_field_defs (GL_WDGT_TEXT_ENTRY(view_text->private->text_entry),
- merge);
- gl_wdgt_text_props_set_params (GL_WDGT_TEXT_PROPS(view_text->private->text_props),
- font_family, font_size, font_weight,
- font_italic_flag, color, just);
- gl_wdgt_position_set_position (GL_WDGT_POSITION(view_text->private->position),
- x, y);
-
- /* Unblock widget handlers */
- g_signal_handlers_unblock_by_func (G_OBJECT(view_text->private->text_props),
- text_props_changed_cb, view_text);
- g_signal_handlers_unblock_by_func (G_OBJECT(view_text->private->position),
- position_changed_cb, view_text);
+
+ gl_object_editor_set_font_family (editor, font_family);
+ g_free (font_family);
+
+ gl_object_editor_set_font_size (editor, font_size);
+
+ gl_object_editor_set_font_weight (editor, font_weight);
+
+ gl_object_editor_set_font_italic_flag (editor, font_italic_flag);
+
+ gl_object_editor_set_text_color (editor, color);
+
+ gl_object_editor_set_text_alignment (editor, just);
+
gl_debug (DEBUG_VIEW, "END");
}
/* PRIVATE. label object "moved" callback. */
/*---------------------------------------------------------------------------*/
static void
-update_dialog_from_move_cb (glLabelObject *object,
- gdouble dx,
- gdouble dy,
- glViewText *view_text)
+update_editor_from_move_cb (glLabelObject *object,
+ gdouble dx,
+ gdouble dy,
+ glObjectEditor *editor)
{
gdouble x, y;
gl_debug (DEBUG_VIEW, "START");
- /* Query properties of object. */
- gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y);
+ gl_label_object_get_position (object, &x, &y);
+ gl_object_editor_set_position (editor, x, y);
- /* Block widget handlers to prevent recursion */
- g_signal_handlers_block_by_func (G_OBJECT(view_text->private->position),
- position_changed_cb, view_text);
+ gl_debug (DEBUG_VIEW, "END");
+}
+
+/*---------------------------------------------------------------------------*/
+/* PRIVATE. label "changed" callback. */
+/*---------------------------------------------------------------------------*/
+static void
+update_editor_from_label_cb (glLabel *label,
+ glObjectEditor *editor)
+{
+ gdouble label_width, label_height;
+ glMerge *merge;
+
+ gl_debug (DEBUG_VIEW, "START");
- /* Update widgets in property dialog */
- gl_wdgt_position_set_position (GL_WDGT_POSITION(view_text->private->position),
- x, y);
+ gl_label_get_size (label, &label_width, &label_height);
+ gl_object_editor_set_max_position (GL_OBJECT_EDITOR (editor),
+ label_width, label_height);
+ gl_object_editor_set_max_size (GL_OBJECT_EDITOR (editor),
+ label_width, label_height);
- /* Unblock widget handlers */
- g_signal_handlers_unblock_by_func (G_OBJECT(view_text->private->position),
- position_changed_cb, view_text);
+ merge = gl_label_get_merge (label);
+ gl_object_editor_set_key_names (editor, merge);
gl_debug (DEBUG_VIEW, "END");
}
#define ARC_FINE 2 /* Resolution in degrees of large arcs */
#define ARC_COURSE 5 /* Resolution in degrees of small arcs */
+#define ZOOMTOFIT_PAD 16
+#define HOME_SCALE 2.0
+
/*==========================================================================*/
/* Private types. */
/*==========================================================================*/
static GdkAtom clipboard_atom = GDK_NONE;
static gdouble scales[] = {
- 8.0, 6.0, 4.0, 3.0,
- 2.0,
- 1.5, 1.0, 0.5, 0.25,
+ 4.00*HOME_SCALE,
+ 3.00*HOME_SCALE,
+ 2.00*HOME_SCALE,
+ 1.50*HOME_SCALE,
+ 1.00*HOME_SCALE,
+ 0.75*HOME_SCALE,
+ 0.67*HOME_SCALE,
+ 0.50*HOME_SCALE,
+ 0.33*HOME_SCALE,
+ 0.25*HOME_SCALE,
+ 0.20*HOME_SCALE,
+ 0.15*HOME_SCALE,
+ 0.10*HOME_SCALE,
};
#define N_SCALES G_N_ELEMENTS(scales)
-#define HOME_SCALE 2.0
+
/*==========================================================================*/
/* Local function prototypes */
static GtkWidget *gl_view_construct_canvas (glView *view);
static void gl_view_construct_selection (glView *view);
-static gdouble get_apropriate_scale (gdouble w, gdouble h);
-
static void draw_layers (glView *view);
static void label_resized_cb (glLabel *label,
gl_debug (DEBUG_VIEW, "Label size: w=%lf, h=%lf",
label_width, label_height);
- scale = get_apropriate_scale (label_width, label_height);
- gl_debug (DEBUG_VIEW, "scale =%lf", scale);
+ scale = HOME_SCALE;
+ gnome_canvas_set_pixels_per_unit (GNOME_CANVAS (view->canvas), scale);
+ view->scale = scale;
+ gl_debug (DEBUG_VIEW, "scale =%lf", scale);
gl_debug (DEBUG_VIEW, "Canvas size: w=%lf, h=%lf",
scale * label_width + 40,
scale * label_height + 40);
- gtk_widget_set_size_request (GTK_WIDGET(view->canvas),
- scale * label_width + 40,
- scale * label_height + 40);
- gnome_canvas_set_pixels_per_unit (GNOME_CANVAS (view->canvas),
- scale);
- view->scale = scale;
gnome_canvas_set_scroll_region (GNOME_CANVAS (view->canvas),
0.0, 0.0, label_width, label_height);
gl_debug (DEBUG_VIEW, "END");
}
-/*---------------------------------------------------------------------------*/
-/* PRIVATE. Determine an apropriate scale for given label & screen size */
-/*---------------------------------------------------------------------------*/
-static gdouble
-get_apropriate_scale (gdouble w, gdouble h)
-{
- gdouble w_screen, h_screen;
- gint i;
- gdouble k;
-
- gl_debug (DEBUG_VIEW, "");
-
- w_screen = (gdouble) gdk_screen_width ();
- h_screen = (gdouble) gdk_screen_height ();
-
- for (i = 0; i < N_SCALES; i++) {
- k = scales[i];
- if (k <= HOME_SCALE) {
- if ((k * w < (w_screen - 256))
- && (k * h < (h_screen - 256)))
- return k;
- }
- }
-
- return 0.25;
-}
-
/*---------------------------------------------------------------------------*/
/* PRIVATE. Create, draw and order layers. */
/*---------------------------------------------------------------------------*/
}
/*****************************************************************************/
-/* Edit properties of selected object. */
+/* Get object property editor of first selected object. */
/*****************************************************************************/
-void
-gl_view_edit_object_props (glView *view)
+GtkWidget *
+gl_view_get_editor (glView *view)
{
glViewObject *view_object;
+ GtkWidget *editor = NULL;
gl_debug (DEBUG_VIEW, "START");
g_return_if_fail (view && GL_IS_VIEW (view));
- if (gl_view_is_selection_atomic (view)) {
+ if (!gl_view_is_selection_empty (view)) {
view_object = GL_VIEW_OBJECT(view->selected_object_list->data);
- gl_view_object_show_dialog (view_object);
+ editor = gl_view_object_get_editor (view_object);
}
gl_debug (DEBUG_VIEW, "END");
+
+ return editor;
}
/*****************************************************************************/
gl_debug (DEBUG_VIEW, "END");
}
+/*****************************************************************************/
+/* Set zoom to best fit. */
+/*****************************************************************************/
+void
+gl_view_zoom_best_fit (glView *view)
+{
+ gint w_view, h_view;
+ gdouble w_label, h_label;
+ gdouble x_zoom, y_zoom, new_zoom;
+
+ gl_debug (DEBUG_VIEW, "");
+
+ if ( ! GTK_WIDGET_VISIBLE(view)) {
+ gl_view_set_zoom (view, 1.0);
+ return;
+ }
+
+ w_view = GTK_WIDGET(view)->allocation.width;
+ h_view = GTK_WIDGET(view)->allocation.height;
+
+ gl_label_get_size (GL_LABEL(view->label), &w_label, &h_label);
+
+ gl_debug (DEBUG_VIEW, "View size: %d, %d", w_view, h_view);
+ gl_debug (DEBUG_VIEW, "Label size: %g, %g", w_label, h_label);
+
+ /* Calculate best zoom level */
+ x_zoom = (double)(w_view - ZOOMTOFIT_PAD) / w_label;
+ y_zoom = (double)(h_view - ZOOMTOFIT_PAD) / h_label;
+ new_zoom = MIN (x_zoom, y_zoom) / HOME_SCALE;
+ gl_debug (DEBUG_VIEW, "Candidate scales: %g, %g => %g", x_zoom, y_zoom, new_zoom);
+
+ /* Limit */
+ new_zoom = MIN (new_zoom, scales[0]/HOME_SCALE);
+ new_zoom = MAX (new_zoom, scales[N_SCALES-1]/HOME_SCALE);
+ gl_debug (DEBUG_VIEW, "Limitted zoom: %g", new_zoom);
+
+ gl_view_set_zoom (view, new_zoom);
+}
+
/*****************************************************************************/
/* Set current zoom factor to explicit value. */
/*****************************************************************************/
menu = gtk_menu_new ();
- menuitem = gtk_image_menu_item_new_from_stock (GL_STOCK_PROPERTIES, NULL);
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
- gtk_widget_show (menuitem);
- g_signal_connect_swapped (G_OBJECT (menuitem), "activate",
- G_CALLBACK (gl_view_edit_object_props), view);
- view->atomic_selection_items =
- g_list_prepend (view->atomic_selection_items, menuitem);
-
- /*
- * Separator -------------------------
- */
- menuitem = gtk_menu_item_new ();
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), menuitem);
- gtk_widget_show (menuitem);
-
/*
* Submenu: Order
*/
void gl_view_delete_selection (glView *view);
-void gl_view_edit_object_props (glView *view);
+GtkWidget *gl_view_get_editor (glView *view);
void gl_view_raise_selection (glView *view);
void gl_view_zoom_out (glView *view);
+void gl_view_zoom_best_fit (glView *view);
+
void gl_view_set_zoom (glView *view,
gdouble scale);
+++ /dev/null
-/*
- * (GLABELS) Label and Business Card Creation program for GNOME
- *
- * wdgt_bc_data.c: barcode data widget module
- *
- * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include <config.h>
-
-#include "wdgt-bc-data.h"
-#include "merge.h"
-#include "marshal.h"
-
-#include "debug.h"
-
-/*===========================================*/
-/* Private types */
-/*===========================================*/
-
-enum {
- CHANGED,
- LAST_SIGNAL
-};
-
-typedef void (*glWdgtBCDataSignal) (GObject * object, gpointer data);
-
-/*===========================================*/
-/* Private globals */
-/*===========================================*/
-
-static glHigVBoxClass *parent_class;
-
-static gint wdgt_bc_data_signals[LAST_SIGNAL] = { 0 };
-
-/*===========================================*/
-/* Local function prototypes */
-/*===========================================*/
-
-static void gl_wdgt_bc_data_class_init (glWdgtBCDataClass *class);
-static void gl_wdgt_bc_data_instance_init (glWdgtBCData *bc_data);
-static void gl_wdgt_bc_data_finalize (GObject *object);
-static void gl_wdgt_bc_data_construct (glWdgtBCData *bc_data,
- glMerge *merge);
-
-static void changed_cb (glWdgtBCData *bc_data);
-static void radio_toggled_cb (GtkToggleButton *togglebutton,
- glWdgtBCData *bc_data);
-
-\f
-/****************************************************************************/
-/* Boilerplate Object stuff. */
-/****************************************************************************/
-guint
-gl_wdgt_bc_data_get_type (void)
-{
- static guint wdgt_bc_data_type = 0;
-
- if (!wdgt_bc_data_type) {
- GTypeInfo wdgt_bc_data_info = {
- sizeof (glWdgtBCDataClass),
- NULL,
- NULL,
- (GClassInitFunc) gl_wdgt_bc_data_class_init,
- NULL,
- NULL,
- sizeof (glWdgtBCData),
- 0,
- (GInstanceInitFunc) gl_wdgt_bc_data_instance_init,
- };
-
- wdgt_bc_data_type =
- g_type_register_static (gl_hig_vbox_get_type (),
- "glWdgtBCData",
- &wdgt_bc_data_info, 0);
- }
-
- return wdgt_bc_data_type;
-}
-
-static void
-gl_wdgt_bc_data_class_init (glWdgtBCDataClass *class)
-{
- GObjectClass *object_class;
-
- gl_debug (DEBUG_WDGT, "START");
-
- object_class = (GObjectClass *) class;
-
- parent_class = g_type_class_peek_parent (class);
-
- object_class->finalize = gl_wdgt_bc_data_finalize;
-
- wdgt_bc_data_signals[CHANGED] =
- g_signal_new ("changed",
- G_OBJECT_CLASS_TYPE(object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (glWdgtBCDataClass, changed),
- NULL, NULL,
- gl_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- gl_debug (DEBUG_WDGT, "END");
-}
-
-static void
-gl_wdgt_bc_data_instance_init (glWdgtBCData *bc_data)
-{
- gl_debug (DEBUG_WDGT, "START");
-
- bc_data->literal_radio = NULL;
- bc_data->literal_entry = NULL;
-
- bc_data->key_radio = NULL;
- bc_data->key_combo = NULL;
- bc_data->key_entry = NULL;
-
- gl_debug (DEBUG_WDGT, "END");
-}
-
-static void
-gl_wdgt_bc_data_finalize (GObject *object)
-{
- glWdgtBCData *bc_data;
- glWdgtBCDataClass *class;
-
- gl_debug (DEBUG_WDGT, "START");
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GL_IS_WDGT_BC_DATA (object));
-
- bc_data = GL_WDGT_BC_DATA (object);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-
- gl_debug (DEBUG_WDGT, "END");
-}
-
-/****************************************************************************/
-/* New widget. */
-/****************************************************************************/
-GtkWidget *
-gl_wdgt_bc_data_new (glMerge *merge)
-{
- glWdgtBCData *bc_data;
-
- gl_debug (DEBUG_WDGT, "START");
-
- bc_data = g_object_new (gl_wdgt_bc_data_get_type (), NULL);
-
- gl_wdgt_bc_data_construct (bc_data, merge);
-
- gl_debug (DEBUG_WDGT, "END");
-
- return GTK_WIDGET (bc_data);
-}
-
-/*--------------------------------------------------------------------------*/
-/* PRIVATE. Construct composite widget. */
-/*--------------------------------------------------------------------------*/
-static void
-gl_wdgt_bc_data_construct (glWdgtBCData *bc_data,
- glMerge *merge)
-{
- GtkWidget *wvbox, *whbox;
- GSList *radio_group = NULL;
- GList *keys;
-
- gl_debug (DEBUG_WDGT, "START");
-
- wvbox = GTK_WIDGET (bc_data);
-
- /* ---- Literal line ---- */
- whbox = gl_hig_hbox_new ();
- gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), whbox);
-
- /* Literal radio */
- bc_data->literal_radio = gtk_radio_button_new_with_label (radio_group,
- _
- ("Literal:"));
- radio_group =
- gtk_radio_button_get_group (GTK_RADIO_BUTTON (bc_data->literal_radio));
- g_signal_connect (G_OBJECT (bc_data->literal_radio), "toggled",
- G_CALLBACK (radio_toggled_cb),
- G_OBJECT (bc_data));
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), bc_data->literal_radio);
-
- /* Literal entry widget */
- bc_data->literal_entry = gtk_entry_new ();
- gtk_widget_set_size_request (bc_data->literal_entry, 200, -1);
- g_signal_connect_swapped (G_OBJECT (bc_data->literal_entry),
- "changed", G_CALLBACK (changed_cb),
- G_OBJECT (bc_data));
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), bc_data->literal_entry);
-
- /* ---- Key line ---- */
- whbox = gl_hig_hbox_new ();
- gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), whbox);
-
- /* Key radio */
- bc_data->key_radio = gtk_radio_button_new_with_label (radio_group,
- _("Key:"));
- g_signal_connect (G_OBJECT (bc_data->key_radio), "toggled",
- G_CALLBACK (radio_toggled_cb),
- G_OBJECT (bc_data));
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), bc_data->key_radio);
-
- /* Key entry widget */
- bc_data->key_combo = gtk_combo_new ();
- keys = gl_merge_get_key_list (merge);
- if (keys != NULL)
- gtk_combo_set_popdown_strings (GTK_COMBO (bc_data->key_combo),
- keys);
- gl_merge_free_key_list (&keys);
- bc_data->key_entry = GTK_COMBO (bc_data->key_combo)->entry;
- gtk_entry_set_editable (GTK_ENTRY (bc_data->key_entry), FALSE);
- gtk_widget_set_size_request (bc_data->key_combo, 200, -1);
- g_signal_connect_swapped (G_OBJECT (bc_data->key_entry), "changed",
- G_CALLBACK (changed_cb),
- G_OBJECT (bc_data));
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), bc_data->key_combo);
-
- gl_debug (DEBUG_WDGT, "END");
-}
-
-/*--------------------------------------------------------------------------*/
-/* PRIVATE. Callback for when any control in the widget has changed. */
-/*--------------------------------------------------------------------------*/
-static void
-changed_cb (glWdgtBCData *bc_data)
-{
- gl_debug (DEBUG_WDGT, "START");
-
- /* Emit our "changed" signal */
- g_signal_emit (G_OBJECT (bc_data), wdgt_bc_data_signals[CHANGED], 0);
-
- gl_debug (DEBUG_WDGT, "END");
-}
-
-/*--------------------------------------------------------------------------*/
-/* PRIVATE. Callback to handle toggling of radio buttons */
-/*--------------------------------------------------------------------------*/
-static void
-radio_toggled_cb (GtkToggleButton *togglebutton,
- glWdgtBCData *bc_data)
-{
- gl_debug (DEBUG_WDGT, "START");
-
- if (gtk_toggle_button_get_active
- (GTK_TOGGLE_BUTTON (bc_data->literal_radio))) {
- gtk_widget_set_sensitive (bc_data->literal_entry, TRUE);
- gtk_widget_set_sensitive (bc_data->key_combo, FALSE);
- } else {
- gtk_widget_set_sensitive (bc_data->literal_entry, FALSE);
- gtk_widget_set_sensitive (bc_data->key_combo, TRUE);
- }
-
- /* Emit our "changed" signal */
- g_signal_emit (G_OBJECT (bc_data), wdgt_bc_data_signals[CHANGED], 0);
-
- gl_debug (DEBUG_WDGT, "END");
-}
-
-/****************************************************************************/
-/* Set new field definitions. */
-/****************************************************************************/
-void
-gl_wdgt_bc_data_set_field_defs (glWdgtBCData *bc_data,
- glMerge *merge)
-{
- GList *keys;
-
- gl_debug (DEBUG_WDGT, "START");
-
- keys = gl_merge_get_key_list (merge);
- if ( keys != NULL ) {
- gtk_combo_set_popdown_strings (GTK_COMBO (bc_data->key_combo),
- keys);
- gl_merge_free_key_list (&keys);
- } else {
- keys = g_list_append (keys, "");
- gtk_combo_set_popdown_strings (GTK_COMBO (bc_data->key_combo),
- keys);
- g_list_free (keys);
- }
-
- gl_debug (DEBUG_WDGT, "END");
-}
-
-
-/****************************************************************************/
-/* Get widget data. */
-/****************************************************************************/
-glTextNode *
-gl_wdgt_bc_data_get_data (glWdgtBCData *bc_data)
-{
- glTextNode *text_node;
-
- gl_debug (DEBUG_WDGT, "START");
-
- text_node = g_new0(glTextNode,1);
-
- if (gtk_toggle_button_get_active
- (GTK_TOGGLE_BUTTON (bc_data->literal_radio))) {
- text_node->field_flag = FALSE;
- text_node->data =
- gtk_editable_get_chars (GTK_EDITABLE
- (bc_data->literal_entry), 0, -1);
- } else {
- text_node->field_flag = TRUE;
- text_node->data =
- gtk_editable_get_chars (GTK_EDITABLE (bc_data->key_entry),
- 0, -1);
- gl_debug (DEBUG_WDGT, "text_node: field_flag=%d, data=%s",
- text_node->field_flag, text_node->data);
- }
-
- gl_debug (DEBUG_WDGT, "END");
-
- return text_node;
-}
-
-/****************************************************************************/
-/* Set widget data. */
-/****************************************************************************/
-void
-gl_wdgt_bc_data_set_data (glWdgtBCData *bc_data,
- gboolean merge_flag,
- glTextNode *text_node)
-{
- gint pos;
-
- gl_debug (DEBUG_WDGT, "START");
-
- gtk_widget_set_sensitive (bc_data->key_radio, merge_flag);
-
- if (!text_node->field_flag) {
-
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
- (bc_data->literal_radio), TRUE);
-
- gtk_widget_set_sensitive (bc_data->literal_entry, TRUE);
- gtk_widget_set_sensitive (bc_data->key_combo, FALSE);
-
- g_signal_handlers_block_by_func (G_OBJECT
- (bc_data->literal_entry),
- G_CALLBACK (changed_cb),
- bc_data);
- gtk_editable_delete_text (GTK_EDITABLE (bc_data->literal_entry),
- 0, -1);
- g_signal_handlers_unblock_by_func (G_OBJECT
- (bc_data->literal_entry),
- G_CALLBACK
- (changed_cb), bc_data);
-
- pos = 0;
- gtk_editable_insert_text (GTK_EDITABLE (bc_data->literal_entry),
- text_node->data,
- strlen (text_node->data),
- &pos);
- } else {
-
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
- (bc_data->key_radio), TRUE);
-
- gtk_widget_set_sensitive (bc_data->literal_entry, FALSE);
- gtk_widget_set_sensitive (bc_data->key_combo, TRUE);
-
- g_signal_handlers_block_by_func (G_OBJECT
- (bc_data->key_entry),
- G_CALLBACK (changed_cb),
- bc_data);
- gtk_editable_delete_text (GTK_EDITABLE (bc_data->key_entry), 0,
- -1);
- g_signal_handlers_unblock_by_func (G_OBJECT
- (bc_data->key_entry),
- G_CALLBACK
- (changed_cb), bc_data);
-
- pos = 0;
- gtk_editable_insert_text (GTK_EDITABLE (bc_data->key_entry),
- text_node->data,
- strlen (text_node->data),
- &pos);
- }
-
- gl_debug (DEBUG_WDGT, "END");
-}
-
-/****************************************************************************/
-/* Set size group for internal labels */
-/****************************************************************************/
-void
-gl_wdgt_bc_data_set_label_size_group (glWdgtBCData *bc_data,
- GtkSizeGroup *label_size_group)
-{
- gl_debug (DEBUG_WDGT, "START");
-
- gtk_size_group_add_widget (label_size_group, bc_data->literal_radio);
- gtk_size_group_add_widget (label_size_group, bc_data->key_radio);
-
- gl_debug (DEBUG_WDGT, "END");
-}
+++ /dev/null
-/*
- * (GLABELS) Label and Business Card Creation program for GNOME
- *
- * wdgt_bc_data.h: barcode data widget module header file
- *
- * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef __WDGT_BC_DATA_H__
-#define __WDGT_BC_DATA_H__
-
-#include <gnome.h>
-#include "text-node.h"
-#include "hig.h"
-
-G_BEGIN_DECLS
-
-#define GL_TYPE_WDGT_BC_DATA (gl_wdgt_bc_data_get_type ())
-#define GL_WDGT_BC_DATA(obj) \
- (GTK_CHECK_CAST((obj), GL_TYPE_WDGT_BC_DATA, glWdgtBCData ))
-#define GL_WDGT_BC_DATA_CLASS(klass) \
- (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_WDGT_BC_DATA, glWdgtBCDataClass))
-#define GL_IS_WDGT_BC_DATA(obj) \
- (GTK_CHECK_TYPE ((obj), GL_TYPE_WDGT_BC_DATA))
-#define GL_IS_WDGT_BC_DATA_CLASS(klass) \
- (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_WDGT_BC_DATA))
-
-typedef struct _glWdgtBCData glWdgtBCData;
-typedef struct _glWdgtBCDataClass glWdgtBCDataClass;
-
-struct _glWdgtBCData {
- glHigVBox parent_widget;
-
- GtkWidget *literal_radio;
- GtkWidget *literal_entry;
-
- GtkWidget *key_radio;
- GtkWidget *key_combo;
- GtkWidget *key_entry;
-};
-
-struct _glWdgtBCDataClass {
- glHigVBoxClass parent_class;
-
- void (*changed) (glWdgtBCData * bc_data, gpointer user_data);
-};
-
-guint gl_wdgt_bc_data_get_type (void);
-
-GtkWidget *gl_wdgt_bc_data_new (glMerge *merge);
-
-void gl_wdgt_bc_data_set_field_defs (glWdgtBCData *bc_data,
- glMerge *merge);
-
-glTextNode *gl_wdgt_bc_data_get_data (glWdgtBCData *bc_data);
-
-void gl_wdgt_bc_data_set_data (glWdgtBCData *bc_data,
- gboolean merge_flag,
- glTextNode *text_node);
-
-void gl_wdgt_bc_data_set_label_size_group (glWdgtBCData *bc_data,
- GtkSizeGroup *label_size_group);
-
-G_END_DECLS
-
-#endif
+++ /dev/null
-/*
- * (GLABELS) Label and Business Card Creation program for GNOME
- *
- * wdgt_bc_props.c: barcode properties widget module
- *
- * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include <config.h>
-
-#include "mygal/widget-color-combo.h"
-#include "prefs.h"
-#include "wdgt-bc-props.h"
-#include "marshal.h"
-#include "color.h"
-
-#include "debug.h"
-
-/*===========================================*/
-/* Private types */
-/*===========================================*/
-
-enum {
- CHANGED,
- LAST_SIGNAL
-};
-
-typedef void (*glWdgtBCPropsSignal) (GObject * object, gpointer data);
-
-/*===========================================*/
-/* Private globals */
-/*===========================================*/
-
-static glHigVBoxClass *parent_class;
-
-static gint wdgt_bc_props_signals[LAST_SIGNAL] = { 0 };
-
-/*===========================================*/
-/* Local function prototypes */
-/*===========================================*/
-
-static void gl_wdgt_bc_props_class_init (glWdgtBCPropsClass *class);
-static void gl_wdgt_bc_props_instance_init (glWdgtBCProps *prop);
-static void gl_wdgt_bc_props_finalize (GObject *object);
-static void gl_wdgt_bc_props_construct (glWdgtBCProps *prop);
-
-static void changed_cb (glWdgtBCProps *prop);
-\f
-/***************************************************************************/
-/* Boilerplate Object stuff. */
-/***************************************************************************/
-guint
-gl_wdgt_bc_props_get_type (void)
-{
- static guint wdgt_bc_props_type = 0;
-
- if (!wdgt_bc_props_type) {
- GTypeInfo wdgt_bc_props_info = {
- sizeof (glWdgtBCPropsClass),
- NULL,
- NULL,
- (GClassInitFunc) gl_wdgt_bc_props_class_init,
- NULL,
- NULL,
- sizeof (glWdgtBCProps),
- 0,
- (GInstanceInitFunc) gl_wdgt_bc_props_instance_init,
- };
-
- wdgt_bc_props_type =
- g_type_register_static (gl_hig_vbox_get_type (),
- "glWdgtBCProps",
- &wdgt_bc_props_info, 0);
- }
-
- return wdgt_bc_props_type;
-}
-
-static void
-gl_wdgt_bc_props_class_init (glWdgtBCPropsClass *class)
-{
- GObjectClass *object_class;
-
- object_class = (GObjectClass *) class;
-
- parent_class = g_type_class_peek_parent (class);
-
- object_class->finalize = gl_wdgt_bc_props_finalize;
-
- wdgt_bc_props_signals[CHANGED] =
- g_signal_new ("changed",
- G_OBJECT_CLASS_TYPE(object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (glWdgtBCPropsClass, changed),
- NULL, NULL,
- gl_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
-}
-
-static void
-gl_wdgt_bc_props_instance_init (glWdgtBCProps *prop)
-{
- prop->color_picker = NULL;
-}
-
-static void
-gl_wdgt_bc_props_finalize (GObject * object)
-{
- glWdgtBCProps *prop;
- glWdgtBCPropsClass *class;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GL_IS_WDGT_BC_PROPS (object));
-
- prop = GL_WDGT_BC_PROPS (object);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-/***************************************************************************/
-/* New widget. */
-/***************************************************************************/
-GtkWidget *
-gl_wdgt_bc_props_new (void)
-{
- glWdgtBCProps *prop;
-
- prop = g_object_new (gl_wdgt_bc_props_get_type (), NULL);
-
- gl_wdgt_bc_props_construct (prop);
-
- return GTK_WIDGET (prop);
-}
-
-/*------------------------------------------------------------------------*/
-/* PRIVATE. Construct composite widget. */
-/*------------------------------------------------------------------------*/
-static void
-gl_wdgt_bc_props_construct (glWdgtBCProps *prop)
-{
- GtkWidget *wvbox, *whbox, *wlabel;
- ColorGroup *cg;
- GdkColor *gdk_color;
-
- wvbox = GTK_WIDGET (prop);
-
- /* ---- Color line ---- */
- whbox = gl_hig_hbox_new ();
- gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), whbox);
-
- /* Line Color Label */
- prop->color_label = gtk_label_new (_("Color:"));
- gtk_misc_set_alignment (GTK_MISC (prop->color_label), 0, 0.5);
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), prop->color_label);
-
- /* Line Color picker widget */
- cg = color_group_fetch ("line_color_group", NULL);
- gdk_color = gl_color_to_gdk_color (gl_prefs->default_line_color);
- prop->color_picker = color_combo_new (NULL, _("Default"), gdk_color, cg);
- color_combo_box_set_preview_relief (COLOR_COMBO(prop->color_picker),
- GTK_RELIEF_NORMAL);
- g_free (gdk_color);
- g_signal_connect_swapped (G_OBJECT (prop->color_picker), "color_changed",
- G_CALLBACK (changed_cb),
- G_OBJECT (prop));
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), prop->color_picker);
-}
-
-/*--------------------------------------------------------------------------*/
-/* PRIVATE. Callback for when any control in the widget has changed. */
-/*--------------------------------------------------------------------------*/
-static void
-changed_cb (glWdgtBCProps *prop)
-{
- /* Emit our "changed" signal */
- g_signal_emit (G_OBJECT (prop), wdgt_bc_props_signals[CHANGED], 0);
-}
-
-/***************************************************************************/
-/* query values from controls. */
-/***************************************************************************/
-void
-gl_wdgt_bc_props_get_params (glWdgtBCProps *prop,
- guint *color)
-{
- GdkColor *gdk_color;
- gboolean is_default;
-
- gdk_color = color_combo_get_color (COLOR_COMBO(prop->color_picker),
- &is_default);
-
- if (is_default) {
- *color = gl_prefs->default_line_color;
- } else {
- *color = gl_color_from_gdk_color (gdk_color);
- }
-}
-
-/***************************************************************************/
-/* fill in values and ranges for controls. */
-/***************************************************************************/
-void
-gl_wdgt_bc_props_set_params (glWdgtBCProps *prop,
- guint color)
-{
- GdkColor *gdk_color;
-
- gdk_color = gl_color_to_gdk_color (color);
- color_combo_set_color (COLOR_COMBO(prop->color_picker), gdk_color);
- g_free (gdk_color);
-}
-
-/****************************************************************************/
-/* Set size group for internal labels */
-/****************************************************************************/
-void
-gl_wdgt_bc_props_set_label_size_group (glWdgtBCProps *prop,
- GtkSizeGroup *label_size_group)
-{
- gtk_size_group_add_widget (label_size_group, prop->color_label);
-}
-
+++ /dev/null
-/*
- * (GLABELS) Label and Business Card Creation program for GNOME
- *
- * wdgt_bc_props.h: barcode properties widget module header file
- *
- * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef __WDGT_BC_PROPS_H__
-#define __WDGT_BC_PROPS_H__
-
-#include <gnome.h>
-#include "bc.h"
-#include "hig.h"
-
-G_BEGIN_DECLS
-
-#define GL_TYPE_WDGT_BC_PROPS (gl_wdgt_bc_props_get_type ())
-#define GL_WDGT_BC_PROPS(obj) \
- (GTK_CHECK_CAST((obj), GL_TYPE_WDGT_BC_PROPS, glWdgtBCProps ))
-#define GL_WDGT_BC_PROPS_CLASS(klass) \
- (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_WDGT_BC_PROPS, glWdgtBCPropsClass))
-#define GL_IS_WDGT_BC_PROPS(obj) \
- (GTK_CHECK_TYPE ((obj), GL_TYPE_WDGT_BC_PROPS))
-#define GL_IS_WDGT_BC_PROPS_CLASS(klass) \
- (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_WDGT_BC_PROPS))
-
-typedef struct _glWdgtBCProps glWdgtBCProps;
-typedef struct _glWdgtBCPropsClass glWdgtBCPropsClass;
-
-struct _glWdgtBCProps {
- glHigVBox parent_widget;
-
- GtkWidget *color_label;
- GtkWidget *color_picker;
-};
-
-struct _glWdgtBCPropsClass {
- glHigVBoxClass parent_class;
-
- void (*changed) (glWdgtBCProps * prop, gpointer user_data);
-};
-
-guint gl_wdgt_bc_props_get_type (void);
-
-GtkWidget *gl_wdgt_bc_props_new (void);
-
-void gl_wdgt_bc_props_get_params (glWdgtBCProps *prop,
- guint *color);
-
-void gl_wdgt_bc_props_set_params (glWdgtBCProps *prop,
- guint color);
-
-void gl_wdgt_bc_props_set_label_size_group (glWdgtBCProps *prop,
- GtkSizeGroup *label_size_group);
-
-G_END_DECLS
-
-#endif
+++ /dev/null
-/*
- * (GLABELS) Label and Business Card Creation program for GNOME
- *
- * wdgt_bc_style.c: barcode style selection widget module
- *
- * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include <config.h>
-
-#include "wdgt-bc-style.h"
-#include "marshal.h"
-
-#include "debug.h"
-
-/*===========================================*/
-/* Private types */
-/*===========================================*/
-
-enum {
- CHANGED,
- LAST_SIGNAL
-};
-
-typedef void (*glWdgtBCStyleSignal) (GObject * object, gpointer data);
-
-/*===========================================*/
-/* Private globals */
-/*===========================================*/
-
-static glHigVBoxClass *parent_class;
-
-static gint wdgt_bc_style_signals[LAST_SIGNAL] = { 0 };
-
-/*===========================================*/
-/* Local function prototypes */
-/*===========================================*/
-
-static void gl_wdgt_bc_style_class_init (glWdgtBCStyleClass *class);
-static void gl_wdgt_bc_style_instance_init (glWdgtBCStyle *bc_style);
-static void gl_wdgt_bc_style_finalize (GObject *object);
-static void gl_wdgt_bc_style_construct (glWdgtBCStyle *bc_style);
-
-static void style_changed_cb (glWdgtBCStyle *bc_style);
-static void checkbox_changed_cb (glWdgtBCStyle *bc_style);
-
-\f
-/****************************************************************************/
-/* Boilerplate Object stuff. */
-/****************************************************************************/
-guint
-gl_wdgt_bc_style_get_type (void)
-{
- static guint wdgt_bc_style_type = 0;
-
- if (!wdgt_bc_style_type) {
- GTypeInfo wdgt_bc_style_info = {
- sizeof (glWdgtBCStyleClass),
- NULL,
- NULL,
- (GClassInitFunc) gl_wdgt_bc_style_class_init,
- NULL,
- NULL,
- sizeof (glWdgtBCStyle),
- 0,
- (GInstanceInitFunc) gl_wdgt_bc_style_instance_init,
- };
-
- wdgt_bc_style_type =
- g_type_register_static (gl_hig_vbox_get_type (),
- "glWdgtBCStyle",
- &wdgt_bc_style_info, 0);
- }
-
- return wdgt_bc_style_type;
-}
-
-static void
-gl_wdgt_bc_style_class_init (glWdgtBCStyleClass *class)
-{
- GObjectClass *object_class;
-
- object_class = (GObjectClass *) class;
-
- parent_class = g_type_class_peek_parent (class);
-
- object_class->finalize = gl_wdgt_bc_style_finalize;
-
- wdgt_bc_style_signals[CHANGED] =
- g_signal_new ("changed",
- G_OBJECT_CLASS_TYPE(object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (glWdgtBCStyleClass, changed),
- NULL, NULL,
- gl_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
-}
-
-static void
-gl_wdgt_bc_style_instance_init (glWdgtBCStyle *bc_style)
-{
- bc_style->style_label = NULL;
- bc_style->style_entry = NULL;
- bc_style->text_check = NULL;
-}
-
-static void
-gl_wdgt_bc_style_finalize (GObject *object)
-{
- glWdgtBCStyle *bc_style;
- glWdgtBCStyleClass *class;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GL_IS_WDGT_BC_STYLE (object));
-
- bc_style = GL_WDGT_BC_STYLE (object);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-/****************************************************************************/
-/* New widget. */
-/****************************************************************************/
-GtkWidget *
-gl_wdgt_bc_style_new (void)
-{
- glWdgtBCStyle *bc_style;
-
- bc_style = g_object_new (gl_wdgt_bc_style_get_type (), NULL);
-
- gl_wdgt_bc_style_construct (bc_style);
-
- return GTK_WIDGET (bc_style);
-}
-
-/*--------------------------------------------------------------------------*/
-/* PRIVATE. Construct composite widget. */
-/*--------------------------------------------------------------------------*/
-static void
-gl_wdgt_bc_style_construct (glWdgtBCStyle *bc_style)
-{
- GtkWidget *wvbox, *whbox, *wcombo;
- GList *style_list;
-
- wvbox = GTK_WIDGET (bc_style);
-
- /* ---- Style line ---- */
- whbox = gl_hig_hbox_new ();
- gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), whbox);
-
- /* Style Label */
- bc_style->style_label = gtk_label_new (_("Style:"));
- gtk_misc_set_alignment (GTK_MISC (bc_style->style_label), 0, 0.5);
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), bc_style->style_label);
-
- /* Style entry widget */
- wcombo = gtk_combo_new ();
- style_list = gl_barcode_get_styles_list ();;
- gtk_combo_set_popdown_strings (GTK_COMBO (wcombo), style_list);
- gl_barcode_free_styles_list (style_list);
- bc_style->style_entry = GTK_COMBO (wcombo)->entry;
- gtk_entry_set_editable (GTK_ENTRY (bc_style->style_entry), FALSE);
- gtk_widget_set_size_request (wcombo, 200, -1);
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), wcombo);
-
-
- /* Text checkbox widget */
- bc_style->text_check =
- gtk_check_button_new_with_label (_("Text"));
- gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), bc_style->text_check);
-
-
- /* Checksum checkbox widget */
- bc_style->checksum_check =
- gtk_check_button_new_with_label (_("Checksum"));
- gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), bc_style->checksum_check);
-
-
- /* Connect signal callbacks */
- g_signal_connect_swapped (G_OBJECT (bc_style->style_entry), "changed",
- G_CALLBACK (style_changed_cb),
- G_OBJECT (bc_style));
- g_signal_connect_swapped (G_OBJECT (bc_style->text_check), "toggled",
- G_CALLBACK (checkbox_changed_cb),
- G_OBJECT (bc_style));
- g_signal_connect_swapped (G_OBJECT (bc_style->checksum_check), "toggled",
- G_CALLBACK (checkbox_changed_cb),
- G_OBJECT (bc_style));
-}
-
-/*--------------------------------------------------------------------------*/
-/* PRIVATE. Callback for when style has changed. */
-/*--------------------------------------------------------------------------*/
-static void
-style_changed_cb (glWdgtBCStyle *bc_style)
-{
- gchar *style_string;
- glBarcodeStyle style;
-
- style_string =
- gtk_editable_get_chars (GTK_EDITABLE(bc_style->style_entry),
- 0, -1);
-
- /* Don't emit if entry is empty. */
- if ( *style_string != 0 ) {
- style = gl_barcode_text_to_style (style_string);
-
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(bc_style->text_check),
- gl_barcode_can_text (style));
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(bc_style->checksum_check),
- gl_barcode_can_csum (style));
-
- gtk_widget_set_sensitive (bc_style->text_check,
- gl_barcode_text_optional (style));
- gtk_widget_set_sensitive (bc_style->checksum_check,
- gl_barcode_csum_optional (style));
-
-
- /* Emit our "changed" signal */
- g_signal_emit (G_OBJECT (bc_style),
- wdgt_bc_style_signals[CHANGED], 0);
- }
-
- g_free (style_string);
-}
-
-/*--------------------------------------------------------------------------*/
-/* PRIVATE. Callback for when either checkbox has changed. */
-/*--------------------------------------------------------------------------*/
-static void
-checkbox_changed_cb (glWdgtBCStyle *bc_style)
-{
- /* Emit our "changed" signal */
- g_signal_emit (G_OBJECT (bc_style),
- wdgt_bc_style_signals[CHANGED], 0);
-}
-
-/****************************************************************************/
-/* query values from controls. */
-/****************************************************************************/
-void
-gl_wdgt_bc_style_get_params (glWdgtBCStyle *bc_style,
- glBarcodeStyle *style,
- gboolean *text_flag,
- gboolean *checksum_flag)
-{
- gchar *style_string;
-
- style_string =
- gtk_editable_get_chars (GTK_EDITABLE(bc_style->style_entry),
- 0, -1);
- *style = gl_barcode_text_to_style (style_string);
-
- *text_flag =
- gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (bc_style->text_check));
-
- *checksum_flag =
- gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (bc_style->checksum_check));
-
- g_free (style_string);
-}
-
-/****************************************************************************/
-/* fill in values and ranges for controls. */
-/****************************************************************************/
-void
-gl_wdgt_bc_style_set_params (glWdgtBCStyle *bc_style,
- glBarcodeStyle style,
- gboolean text_flag,
- gboolean checksum_flag)
-{
- const gchar *style_string;
- gint pos;
-
- style_string = gl_barcode_style_to_text (style);
-
- g_signal_handlers_block_by_func (G_OBJECT(bc_style->style_entry),
- G_CALLBACK (style_changed_cb),
- bc_style);
- gtk_editable_delete_text (GTK_EDITABLE (bc_style->style_entry),
- 0, -1);
- g_signal_handlers_unblock_by_func (G_OBJECT(bc_style->style_entry),
- G_CALLBACK(style_changed_cb),
- bc_style);
-
- pos = 0;
- gtk_editable_insert_text (GTK_EDITABLE (bc_style->style_entry),
- style_string,
- strlen (style_string),
- &pos);
-
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (bc_style->text_check),
- text_flag);
-
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (bc_style->checksum_check),
- checksum_flag);
-
-}
-
-/****************************************************************************/
-/* Set size group for internal labels */
-/****************************************************************************/
-void
-gl_wdgt_bc_style_set_label_size_group (glWdgtBCStyle *bc_style,
- GtkSizeGroup *label_size_group)
-{
- gtk_size_group_add_widget (label_size_group, bc_style->style_label);
-}
+++ /dev/null
-/*
- * (GLABELS) Label and Business Card Creation program for GNOME
- *
- * wdgt_bc_style.h: barcode style selection widget module header file
- *
- * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef __WDGT_BC_STYLE_H__
-#define __WDGT_BC_STYLE_H__
-
-#include <gnome.h>
-#include "bc.h"
-#include "hig.h"
-
-G_BEGIN_DECLS
-
-#define GL_TYPE_WDGT_BC_STYLE (gl_wdgt_bc_style_get_type ())
-#define GL_WDGT_BC_STYLE(obj) \
- (GTK_CHECK_CAST((obj), GL_TYPE_WDGT_BC_STYLE, glWdgtBCStyle ))
-#define GL_WDGT_BC_STYLE_CLASS(klass) \
- (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_WDGT_BC_STYLE, glWdgtBCStyleClass))
-#define GL_IS_WDGT_BC_STYLE(obj) \
- (GTK_CHECK_TYPE ((obj), GL_TYPE_WDGT_BC_STYLE))
-#define GL_IS_WDGT_BC_STYLE_CLASS(klass) \
- (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_WDGT_BC_STYLE))
-
-typedef struct _glWdgtBCStyle glWdgtBCStyle;
-typedef struct _glWdgtBCStyleClass glWdgtBCStyleClass;
-
-struct _glWdgtBCStyle {
- glHigVBox parent_widget;
-
- GtkWidget *style_label;
- GtkWidget *style_entry;
-
- GtkWidget *text_check;
- GtkWidget *checksum_check;
-};
-
-struct _glWdgtBCStyleClass {
- glHigVBoxClass parent_class;
-
- void (*changed) (glWdgtBCStyle * prop, gpointer user_data);
-};
-
-guint gl_wdgt_bc_style_get_type (void);
-
-GtkWidget *gl_wdgt_bc_style_new (void);
-
-void gl_wdgt_bc_style_get_params (glWdgtBCStyle *bc_style,
- glBarcodeStyle *style,
- gboolean *text_flag,
- gboolean *checksum_flag);
-
-void gl_wdgt_bc_style_set_params (glWdgtBCStyle *bc_style,
- glBarcodeStyle style,
- gboolean text_flag,
- gboolean checksum_flag);
-
-void gl_wdgt_bc_style_set_label_size_group (glWdgtBCStyle *bc_style,
- GtkSizeGroup *label_size_group);
-
-G_END_DECLS
-
-#endif
+++ /dev/null
-/*
- * (GLABELS) Label and Business Card Creation program for GNOME
- *
- * wdgt_fill.c: fill properties widget module
- *
- * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include <config.h>
-
-#include "mygal/widget-color-combo.h"
-#include "prefs.h"
-#include "wdgt-fill.h"
-#include "marshal.h"
-#include "color.h"
-
-#include "debug.h"
-
-/*===========================================*/
-/* Private types */
-/*===========================================*/
-
-enum {
- CHANGED,
- LAST_SIGNAL
-};
-
-typedef void (*glWdgtFillSignal) (GObject * object, gpointer data);
-
-/*===========================================*/
-/* Private globals */
-/*===========================================*/
-
-static GtkContainerClass *parent_class;
-
-static gint wdgt_fill_signals[LAST_SIGNAL] = { 0 };
-
-/*===========================================*/
-/* Local function prototypes */
-/*===========================================*/
-
-static void gl_wdgt_fill_class_init (glWdgtFillClass *class);
-static void gl_wdgt_fill_instance_init (glWdgtFill *fill);
-static void gl_wdgt_fill_finalize (GObject *object);
-static void gl_wdgt_fill_construct (glWdgtFill *fill);
-
-static void changed_cb (glWdgtFill *fill);
-
-\f
-/****************************************************************************/
-/* Boilerplate Object stuff. */
-/****************************************************************************/
-guint
-gl_wdgt_fill_get_type (void)
-{
- static guint wdgt_fill_type = 0;
-
- if (!wdgt_fill_type) {
- GTypeInfo wdgt_fill_info = {
- sizeof (glWdgtFillClass),
- NULL,
- NULL,
- (GClassInitFunc) gl_wdgt_fill_class_init,
- NULL,
- NULL,
- sizeof (glWdgtFill),
- 0,
- (GInstanceInitFunc) gl_wdgt_fill_instance_init,
- };
-
- wdgt_fill_type =
- g_type_register_static (gl_hig_vbox_get_type (),
- "glWdgtFill",
- &wdgt_fill_info, 0);
- }
-
- return wdgt_fill_type;
-}
-
-static void
-gl_wdgt_fill_class_init (glWdgtFillClass *class)
-{
- GObjectClass *object_class;
-
- object_class = (GObjectClass *) class;
-
- parent_class = g_type_class_peek_parent (class);
-
- object_class->finalize = gl_wdgt_fill_finalize;
-
- wdgt_fill_signals[CHANGED] =
- g_signal_new ("changed",
- G_OBJECT_CLASS_TYPE(object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (glWdgtFillClass, changed),
- NULL, NULL,
- gl_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
-}
-
-static void
-gl_wdgt_fill_instance_init (glWdgtFill *fill)
-{
- fill->color_picker = NULL;
-}
-
-static void
-gl_wdgt_fill_finalize (GObject *object)
-{
- glWdgtFill *fill;
- glWdgtFillClass *class;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GL_IS_WDGT_FILL (object));
-
- fill = GL_WDGT_FILL (object);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-/****************************************************************************/
-/* New widget. */
-/****************************************************************************/
-GtkWidget *
-gl_wdgt_fill_new (void)
-{
- glWdgtFill *fill;
-
- fill = g_object_new (gl_wdgt_fill_get_type (), NULL);
-
- gl_wdgt_fill_construct (fill);
-
- return GTK_WIDGET (fill);
-}
-
-/*--------------------------------------------------------------------------*/
-/* PRIVATE. Construct composite widget. */
-/*--------------------------------------------------------------------------*/
-static void
-gl_wdgt_fill_construct (glWdgtFill *fill)
-{
- GtkWidget *wvbox, *whbox;
- ColorGroup *cg;
- GdkColor *gdk_color;
-
- wvbox = GTK_WIDGET (fill);
-
- /* ---- Line color line ---- */
- whbox = gl_hig_hbox_new ();
- gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), whbox);
-
- /* Fill Color Label */
- fill->color_label = gtk_label_new (_("Color:"));
- gtk_misc_set_alignment (GTK_MISC (fill->color_label), 0, 0.5);
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), fill->color_label);
-
- /* Fill Color picker widget */
- cg = color_group_fetch ("fill_color_group", NULL);
- gdk_color = gl_color_to_gdk_color (gl_prefs->default_line_color);
- fill->color_picker = color_combo_new (NULL, _("No fill"), gdk_color, cg);
- color_combo_box_set_preview_relief (COLOR_COMBO(fill->color_picker),
- GTK_RELIEF_NORMAL);
- g_free (gdk_color);
- g_signal_connect_swapped (G_OBJECT (fill->color_picker), "color_changed",
- G_CALLBACK (changed_cb),
- G_OBJECT (fill));
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), fill->color_picker);
-}
-
-/*--------------------------------------------------------------------------*/
-/* PRIVATE. Callback for when any control in the widget has changed. */
-/*--------------------------------------------------------------------------*/
-static void
-changed_cb (glWdgtFill *fill)
-{
- /* Emit our "changed" signal */
- g_signal_emit (G_OBJECT (fill), wdgt_fill_signals[CHANGED], 0);
-}
-
-/****************************************************************************/
-/* query values from controls. */
-/****************************************************************************/
-void
-gl_wdgt_fill_get_params (glWdgtFill *fill,
- guint *color)
-{
- GdkColor *gdk_color;
- gboolean is_default;
-
- gdk_color = color_combo_get_color (COLOR_COMBO(fill->color_picker),
- &is_default);
-
- if (is_default) {
- *color = GL_COLOR_NONE;
- } else {
- *color = gl_color_from_gdk_color (gdk_color);
- }
-}
-
-/****************************************************************************/
-/* fill in values and ranges for controls. */
-/****************************************************************************/
-void
-gl_wdgt_fill_set_params (glWdgtFill *fill,
- guint color)
-{
- GdkColor *gdk_color;
-
- gdk_color = gl_color_to_gdk_color (color);
- color_combo_set_color (COLOR_COMBO(fill->color_picker), gdk_color);
- g_free (gdk_color);
-}
-
-/****************************************************************************/
-/* Set size group for internal labels */
-/****************************************************************************/
-void
-gl_wdgt_fill_set_label_size_group (glWdgtFill *fill,
- GtkSizeGroup *label_size_group)
-{
- gtk_size_group_add_widget (label_size_group, fill->color_label);
-}
-
+++ /dev/null
-/*
- * (GLABELS) Label and Business Card Creation program for GNOME
- *
- * wdgt_fill.h: fill properties widget module header file
- *
- * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef __WDGT_FILL_H__
-#define __WDGT_FILL_H__
-
-#include <gnome.h>
-#include "label.h"
-#include "hig.h"
-
-G_BEGIN_DECLS
-
-#define GL_TYPE_WDGT_FILL (gl_wdgt_fill_get_type ())
-#define GL_WDGT_FILL(obj) \
- (GTK_CHECK_CAST((obj), GL_TYPE_WDGT_FILL, glWdgtFill ))
-#define GL_WDGT_FILL_CLASS(klass) \
- (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_WDGT_FILL, glWdgtFillClass))
-#define GL_IS_WDGT_FILL(obj) \
- (GTK_CHECK_TYPE ((obj), GL_TYPE_WDGT_FILL))
-#define GL_IS_WDGT_FILL_CLASS(klass) \
- (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_WDGT_FILL))
-
-typedef struct _glWdgtFill glWdgtFill;
-typedef struct _glWdgtFillClass glWdgtFillClass;
-
-struct _glWdgtFill {
- glHigVBox parent_widget;
-
- GtkWidget *color_label;
- GtkWidget *color_picker;
-};
-
-struct _glWdgtFillClass {
- glHigVBoxClass parent_class;
-
- void (*changed) (glWdgtFill * fill, gpointer user_data);
-};
-
-guint gl_wdgt_fill_get_type (void);
-
-GtkWidget *gl_wdgt_fill_new (void);
-
-void gl_wdgt_fill_get_params (glWdgtFill *fill,
- guint *color);
-
-void gl_wdgt_fill_set_params (glWdgtFill *fill,
- guint color);
-
-void gl_wdgt_fill_set_label_size_group (glWdgtFill *fill,
- GtkSizeGroup *label_size_group);
-
-G_END_DECLS
-
-#endif
+++ /dev/null
-/*
- * (GLABELS) Label and Business Card Creation program for GNOME
- *
- * wdgt_line.c: line properties widget module
- *
- * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include <config.h>
-
-#include "mygal/widget-color-combo.h"
-#include "prefs.h"
-#include "wdgt-line.h"
-#include "marshal.h"
-#include "color.h"
-
-#include "debug.h"
-
-/*===========================================*/
-/* Private types */
-/*===========================================*/
-
-enum {
- CHANGED,
- LAST_SIGNAL
-};
-
-typedef void (*glWdgtLineSignal) (GObject * object, gpointer data);
-
-/*===========================================*/
-/* Private globals */
-/*===========================================*/
-
-static GObjectClass *parent_class;
-
-static gint wdgt_line_signals[LAST_SIGNAL] = { 0 };
-
-/*===========================================*/
-/* Local function prototypes */
-/*===========================================*/
-
-static void gl_wdgt_line_class_init (glWdgtLineClass *class);
-static void gl_wdgt_line_instance_init (glWdgtLine *line);
-static void gl_wdgt_line_finalize (GObject *object);
-static void gl_wdgt_line_construct (glWdgtLine *line);
-
-static void changed_cb (glWdgtLine *line);
-
-\f
-/****************************************************************************/
-/* Boilerplate Object stuff. */
-/****************************************************************************/
-guint
-gl_wdgt_line_get_type (void)
-{
- static guint wdgt_line_type = 0;
-
- if (!wdgt_line_type) {
- GTypeInfo wdgt_line_info = {
- sizeof (glWdgtLineClass),
- NULL,
- NULL,
- (GClassInitFunc) gl_wdgt_line_class_init,
- NULL,
- NULL,
- sizeof (glWdgtLine),
- 0,
- (GInstanceInitFunc) gl_wdgt_line_instance_init,
- };
-
- wdgt_line_type =
- g_type_register_static (gl_hig_vbox_get_type (),
- "glWdgtLine",
- &wdgt_line_info, 0);
- }
-
- return wdgt_line_type;
-}
-
-static void
-gl_wdgt_line_class_init (glWdgtLineClass *class)
-{
- GObjectClass *object_class;
-
- object_class = (GObjectClass *) class;
-
- parent_class = g_type_class_peek_parent (class);
-
- object_class->finalize = gl_wdgt_line_finalize;
-
- wdgt_line_signals[CHANGED] =
- g_signal_new ("changed",
- G_OBJECT_CLASS_TYPE(object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (glWdgtLineClass, changed),
- NULL, NULL,
- gl_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
-}
-
-static void
-gl_wdgt_line_instance_init (glWdgtLine *line)
-{
- line->width_spin = NULL;
- line->color_picker = NULL;
- line->units_label = NULL;
-}
-
-static void
-gl_wdgt_line_finalize (GObject *object)
-{
- glWdgtLine *line;
- glWdgtLineClass *class;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GL_IS_WDGT_LINE (object));
-
- line = GL_WDGT_LINE (object);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-/****************************************************************************/
-/* New widget. */
-/****************************************************************************/
-GtkWidget *
-gl_wdgt_line_new (void)
-{
- glWdgtLine *line;
-
- line = g_object_new (gl_wdgt_line_get_type (), NULL);
-
- gl_wdgt_line_construct (line);
-
- return GTK_WIDGET (line);
-}
-
-/*--------------------------------------------------------------------------*/
-/* PRIVATE. Construct composite widget. */
-/*--------------------------------------------------------------------------*/
-static void
-gl_wdgt_line_construct (glWdgtLine *line)
-{
- GtkWidget *wvbox, *wframe, *whbox;
- GtkObject *adjust;
- ColorGroup *cg;
- GdkColor *gdk_color;
-
- wvbox = GTK_WIDGET (line);
-
- /* ---- Line width line ---- */
- whbox = gl_hig_hbox_new ();
- gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), whbox);
-
- /* Line Width Label */
- line->width_label = gtk_label_new (_("Width:"));
- gtk_misc_set_alignment (GTK_MISC (line->width_label), 0, 0.5);
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), line->width_label);
-
- /* Line Width widget */
- adjust = gtk_adjustment_new (1.0, 0.25, 4.0, 0.25, 1.0, 1.0);
- line->width_spin =
- gtk_spin_button_new (GTK_ADJUSTMENT (adjust), 0.25, 2);
- g_signal_connect_swapped (G_OBJECT (line->width_spin), "changed",
- G_CALLBACK (changed_cb),
- G_OBJECT (line));
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), line->width_spin);
-
- /* Line Width units */
- line->units_label = gtk_label_new (_("points"));
- gtk_misc_set_alignment (GTK_MISC (line->units_label), 0, 0.5);
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), line->units_label);
-
- /* ---- Line color line ---- */
- whbox = gl_hig_hbox_new ();
- gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), whbox);
-
- /* Line Color Label */
- line->color_label = gtk_label_new (_("Color:"));
- gtk_misc_set_alignment (GTK_MISC (line->color_label), 0, 0.5);
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), line->color_label);
-
- /* Line Color picker widget */
- cg = color_group_fetch ("line_color_group", NULL);
- gdk_color = gl_color_to_gdk_color (gl_prefs->default_line_color);
- line->color_picker = color_combo_new (NULL, _("No line"), gdk_color, cg);
- color_combo_box_set_preview_relief (COLOR_COMBO(line->color_picker),
- GTK_RELIEF_NORMAL);
- g_free (gdk_color);
- g_signal_connect_swapped (G_OBJECT (line->color_picker), "color_changed",
- G_CALLBACK (changed_cb),
- G_OBJECT (line));
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), line->color_picker);
-
-}
-
-/*--------------------------------------------------------------------------*/
-/* PRIVATE. Callback for when any control in the widget has changed. */
-/*--------------------------------------------------------------------------*/
-static void
-changed_cb (glWdgtLine *line)
-{
- /* Emit our "changed" signal */
- g_signal_emit (G_OBJECT (line), wdgt_line_signals[CHANGED], 0);
-}
-
-/****************************************************************************/
-/* query values from controls. */
-/****************************************************************************/
-void
-gl_wdgt_line_get_params (glWdgtLine *line,
- gdouble *width,
- guint *color)
-{
- GdkColor *gdk_color;
- gboolean is_default;
-
- *width =
- gtk_spin_button_get_value (GTK_SPIN_BUTTON(line->width_spin));
-
- gdk_color = color_combo_get_color (COLOR_COMBO(line->color_picker),
- &is_default);
-
- if (is_default) {
- *color = GL_COLOR_NONE;
- } else {
- *color = gl_color_from_gdk_color (gdk_color);
- }
-}
-
-/****************************************************************************/
-/* fill in values and ranges for controls. */
-/****************************************************************************/
-void
-gl_wdgt_line_set_params (glWdgtLine *line,
- gdouble width,
- guint color)
-{
- GdkColor *gdk_color;
-
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (line->width_spin), width);
-
- gdk_color = gl_color_to_gdk_color (color);
- color_combo_set_color (COLOR_COMBO(line->color_picker), gdk_color);
- g_free (gdk_color);
-
-}
-
-/****************************************************************************/
-/* Set size group for internal labels */
-/****************************************************************************/
-void
-gl_wdgt_line_set_label_size_group (glWdgtLine *line,
- GtkSizeGroup *label_size_group)
-{
- gtk_size_group_add_widget (label_size_group, line->width_label);
- gtk_size_group_add_widget (label_size_group, line->color_label);
-}
-
+++ /dev/null
-/*
- * (GLABELS) Label and Business Card Creation program for GNOME
- *
- * wdgt_line.h: line properties widget module header file
- *
- * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef __WDGT_LINE_H__
-#define __WDGT_LINE_H__
-
-#include <gnome.h>
-#include "label.h"
-#include "hig.h"
-
-G_BEGIN_DECLS
-
-#define GL_TYPE_WDGT_LINE (gl_wdgt_line_get_type ())
-#define GL_WDGT_LINE(obj) \
- (GTK_CHECK_CAST((obj), GL_TYPE_WDGT_LINE, glWdgtLine ))
-#define GL_WDGT_LINE_CLASS(klass) \
- (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_WDGT_LINE, glWdgtLineClass))
-#define GL_IS_WDGT_LINE(obj) \
- (GTK_CHECK_TYPE ((obj), GL_TYPE_WDGT_LINE))
-#define GL_IS_WDGT_LINE_CLASS(klass) \
- (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_WDGT_LINE))
-
-typedef struct _glWdgtLine glWdgtLine;
-typedef struct _glWdgtLineClass glWdgtLineClass;
-
-struct _glWdgtLine {
- glHigVBox parent_widget;
-
- GtkWidget *width_label;
- GtkWidget *width_spin;
-
- GtkWidget *color_label;
- GtkWidget *color_picker;
- GtkWidget *units_label;
-};
-
-struct _glWdgtLineClass {
- glHigVBoxClass parent_class;
-
- void (*changed) (glWdgtLine * line, gpointer user_data);
-};
-
-guint gl_wdgt_line_get_type (void);
-
-GtkWidget *gl_wdgt_line_new (void);
-
-void gl_wdgt_line_get_params (glWdgtLine *line,
- gdouble *width,
- guint *color);
-
-void gl_wdgt_line_set_params (glWdgtLine *line,
- gdouble width,
- guint color);
-
-void gl_wdgt_line_set_label_size_group (glWdgtLine *line,
- GtkSizeGroup *label_size_group);
-
-G_END_DECLS
-
-#endif
+++ /dev/null
-/*
- * (GLABELS) Label and Business Card Creation program for GNOME
- *
- * wdgt_position.c: position properties widget module
- *
- * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include <config.h>
-
-#include "wdgt-position.h"
-#include "prefs.h"
-#include "marshal.h"
-
-#include "debug.h"
-
-/*===========================================*/
-/* Private types */
-/*===========================================*/
-
-enum {
- CHANGED,
- LAST_SIGNAL
-};
-
-typedef void (*glWdgtPositionSignal) (GObject * object, gpointer data);
-
-/*===========================================*/
-/* Private globals */
-/*===========================================*/
-
-static glHigVBoxClass *parent_class;
-
-static gint wdgt_position_signals[LAST_SIGNAL] = { 0 };
-\f
-/*===========================================*/
-/* Local function prototypes */
-/*===========================================*/
-
-static void gl_wdgt_position_class_init (glWdgtPositionClass *class);
-static void gl_wdgt_position_instance_init (glWdgtPosition *position);
-static void gl_wdgt_position_finalize (GObject *object);
-static void gl_wdgt_position_construct (glWdgtPosition *position);
-
-static void changed_cb (glWdgtPosition *position);
-
-\f
-/***************************************************************************/
-/* Boilerplate Object stuff. */
-/***************************************************************************/
-guint
-gl_wdgt_position_get_type (void)
-{
- static guint wdgt_position_type = 0;
-
- if (!wdgt_position_type) {
- GTypeInfo wdgt_position_info = {
- sizeof (glWdgtPositionClass),
- NULL,
- NULL,
- (GClassInitFunc) gl_wdgt_position_class_init,
- NULL,
- NULL,
- sizeof (glWdgtPosition),
- 0,
- (GInstanceInitFunc) gl_wdgt_position_instance_init,
- };
-
- wdgt_position_type =
- g_type_register_static (gl_hig_vbox_get_type (),
- "glWdgtPosition",
- &wdgt_position_info, 0);
- }
-
- return wdgt_position_type;
-}
-
-static void
-gl_wdgt_position_class_init (glWdgtPositionClass * class)
-{
- GObjectClass *object_class;
-
- object_class = (GObjectClass *) class;
-
- parent_class = g_type_class_peek_parent (class);
-
- object_class->finalize = gl_wdgt_position_finalize;
-
- wdgt_position_signals[CHANGED] =
- g_signal_new ("changed",
- G_OBJECT_CLASS_TYPE(object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (glWdgtPositionClass, changed),
- NULL, NULL,
- gl_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
-}
-
-static void
-gl_wdgt_position_instance_init (glWdgtPosition * position)
-{
- position->x_label = NULL;
- position->x_spin = NULL;
-
- position->y_label = NULL;
- position->y_spin = NULL;
-
- position->units_label = NULL;
-}
-
-static void
-gl_wdgt_position_finalize (GObject * object)
-{
- glWdgtPosition *position;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GL_IS_WDGT_POSITION (object));
-
- position = GL_WDGT_POSITION (object);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-/***************************************************************************/
-/* New widget. */
-/***************************************************************************/
-GtkWidget *
-gl_wdgt_position_new (void)
-{
- glWdgtPosition *position;
-
- position = g_object_new (gl_wdgt_position_get_type (), NULL);
-
- gl_wdgt_position_construct (position);
-
- return GTK_WIDGET (position);
-}
-
-/*-------------------------------------------------------------------------*/
-/* PRIVATE. Construct composite widget. */
-/*-------------------------------------------------------------------------*/
-static void
-gl_wdgt_position_construct (glWdgtPosition *position)
-{
- GtkWidget *wvbox, *whbox;
- GtkObject *x_adjust, *y_adjust;
- const gchar *units_string;
- gdouble units_per_point, climb_rate;
- gint digits;
-
- gl_debug (DEBUG_WDGT, "START");
-
- units_string = gl_prefs_get_units_string ();
- units_per_point = gl_prefs_get_units_per_point ();
- climb_rate = gl_prefs_get_units_step_size ();
- digits = gl_prefs_get_units_precision ();
-
- gl_debug (DEBUG_WDGT, "units = %s", units_string);
- gl_debug (DEBUG_WDGT, "units/point = %f", units_per_point);
- gl_debug (DEBUG_WDGT, "climb_rate = %f", climb_rate);
- gl_debug (DEBUG_WDGT, "digits = %d", digits);
-
- wvbox = GTK_WIDGET (position);
-
- /* ---- X line ---- */
- whbox = gl_hig_hbox_new ();
- gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), whbox);
-
- /* X label */
- position->x_label = gtk_label_new (_("X:"));
- gtk_misc_set_alignment (GTK_MISC (position->x_label), 0, 0.5);
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), position->x_label);
-
- /* X spin */
- x_adjust = gtk_adjustment_new (0.0, 0.0, 100.0, climb_rate, 10.0, 10.0);
- position->x_spin = gtk_spin_button_new (GTK_ADJUSTMENT (x_adjust),
- climb_rate, digits);
- gtk_spin_button_set_snap_to_ticks (GTK_SPIN_BUTTON (position->x_spin),
- TRUE);
- gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (position->x_spin), TRUE);
- g_signal_connect_swapped (G_OBJECT (position->x_spin), "changed",
- G_CALLBACK (changed_cb),
- G_OBJECT (position));
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), position->x_spin);
-
- /* ---- Y line ---- */
- whbox = gl_hig_hbox_new ();
- gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), whbox);
-
- /* Y label */
- position->y_label = gtk_label_new (_("Y:"));
- gtk_misc_set_alignment (GTK_MISC (position->y_label), 0, 0.5);
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), position->y_label);
-
- /* Y spin */
- y_adjust = gtk_adjustment_new (0.0, 0.0, 100.0, climb_rate, 10.0, 10.0);
- position->y_spin = gtk_spin_button_new (GTK_ADJUSTMENT (y_adjust),
- climb_rate, digits);
- gtk_spin_button_set_snap_to_ticks (GTK_SPIN_BUTTON (position->y_spin),
- TRUE);
- gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (position->y_spin), TRUE);
- g_signal_connect_swapped (G_OBJECT (position->y_spin), "changed",
- G_CALLBACK (changed_cb),
- G_OBJECT (position));
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), position->y_spin);
-
- /* Units */
- position->units_label = gtk_label_new (units_string);
- gtk_misc_set_alignment (GTK_MISC (position->units_label), 0, 0.5);
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), position->units_label);
-
- gl_debug (DEBUG_WDGT, "END");
-}
-
-/*--------------------------------------------------------------------------*/
-/* PRIVATE. Callback for when any control in the widget has changed. */
-/*--------------------------------------------------------------------------*/
-static void
-changed_cb (glWdgtPosition *position)
-{
- /* Emit our "changed" signal */
- g_signal_emit (G_OBJECT (position), wdgt_position_signals[CHANGED], 0);
-}
-
-/***************************************************************************/
-/* query values from controls. */
-/***************************************************************************/
-void
-gl_wdgt_position_get_position (glWdgtPosition *position,
- gdouble *x,
- gdouble *y)
-{
- gdouble units_per_point;
-
- units_per_point = gl_prefs_get_units_per_point ();
-
- *x = gtk_spin_button_get_value (GTK_SPIN_BUTTON(position->x_spin));
- *y = gtk_spin_button_get_value (GTK_SPIN_BUTTON(position->y_spin));
-
- /* convert everything back to our internal units (points) */
- *x /= units_per_point;
- *y /= units_per_point;
-}
-
-/***************************************************************************/
-/* fill in values and ranges for controls. */
-/***************************************************************************/
-void
-gl_wdgt_position_set_params (glWdgtPosition *position,
- gdouble x,
- gdouble y,
- gdouble x_max,
- gdouble y_max)
-{
- GtkObject *x_adjust, *y_adjust;
- const gchar *units_string;
- gdouble units_per_point, climb_rate;
- gint digits;
-
- units_string = gl_prefs_get_units_string ();
- units_per_point = gl_prefs_get_units_per_point ();
- climb_rate = gl_prefs_get_units_step_size ();
- digits = gl_prefs_get_units_precision ();
-
- /* Put everything into our display units */
- x *= units_per_point;
- y *= units_per_point;
- x_max *= units_per_point;
- y_max *= units_per_point;
-
- /* update X/Y spin controls */
- x_adjust = gtk_adjustment_new (x, 0.0, x_max, climb_rate, 10.0, 10.0);
- gtk_spin_button_configure (GTK_SPIN_BUTTON (position->x_spin),
- GTK_ADJUSTMENT (x_adjust), climb_rate,
- digits);
- y_adjust = gtk_adjustment_new (y, 0.0, y_max, climb_rate, 10.0, 10.0);
- gtk_spin_button_configure (GTK_SPIN_BUTTON (position->y_spin),
- GTK_ADJUSTMENT (y_adjust), climb_rate,
- digits);
-
- /* Units */
- gtk_label_set_text (GTK_LABEL (position->units_label), units_string);
-
-}
-
-/***************************************************************************/
-/* fill in position info only. */
-/***************************************************************************/
-void
-gl_wdgt_position_set_position (glWdgtPosition *position,
- gdouble x,
- gdouble y)
-{
- gdouble units_per_point;
-
- gl_debug (DEBUG_WDGT, "START");
-
- units_per_point = gl_prefs_get_units_per_point ();
-
- gl_debug (DEBUG_WDGT, "units/point = %f", units_per_point);
-
- /* Put everything in our display units */
- x *= units_per_point;
- y *= units_per_point;
-
- /* update X/Y spin controls */
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (position->x_spin), x);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (position->y_spin), y);
-
- gl_debug (DEBUG_WDGT, "END");
-}
-
-/****************************************************************************/
-/* Set size group for internal labels */
-/****************************************************************************/
-void
-gl_wdgt_position_set_label_size_group (glWdgtPosition *position,
- GtkSizeGroup *label_size_group)
-{
- gtk_size_group_add_widget (label_size_group, position->x_label);
- gtk_size_group_add_widget (label_size_group, position->y_label);
-}
-
+++ /dev/null
-/*
- * (GLABELS) Label and Business Card Creation program for GNOME
- *
- * wdgt_position.h: position properties widget module header file
- *
- * Copyright (C) 2000, 2001 Jim Evins <evins@snaught.com>.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef __WDGT_POSITION_H__
-#define __WDGT_POSITION_H__
-
-#include <gnome.h>
-#include "label.h"
-#include "hig.h"
-
-G_BEGIN_DECLS
-
-#define GL_TYPE_WDGT_POSITION (gl_wdgt_position_get_type ())
-#define GL_WDGT_POSITION(obj) \
- (GTK_CHECK_CAST((obj), GL_TYPE_WDGT_POSITION, glWdgtPosition ))
-#define GL_WDGT_POSITION_CLASS(klass) \
- (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_WDGT_POSITION, glWdgtPositionClass))
-#define GL_IS_WDGT_POSITION(obj) \
- (GTK_CHECK_TYPE ((obj), GL_TYPE_WDGT_POSITION))
-#define GL_IS_WDGT_POSITION_CLASS(klass) \
- (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_WDGT_POSITION))
-
-typedef struct _glWdgtPosition glWdgtPosition;
-typedef struct _glWdgtPositionClass glWdgtPositionClass;
-
-struct _glWdgtPosition {
- glHigVBox parent_widget;
-
- GtkWidget *x_label;
- GtkWidget *x_spin;
-
- GtkWidget *y_label;
- GtkWidget *y_spin;
-
- GtkWidget *units_label;
-};
-
-struct _glWdgtPositionClass {
- glHigVBoxClass parent_class;
-
- void (*changed) (glWdgtPosition * prop, gpointer user_data);
-};
-
-guint gl_wdgt_position_get_type (void);
-
-GtkWidget *gl_wdgt_position_new (void);
-
-void gl_wdgt_position_get_position (glWdgtPosition *position,
- gdouble *x,
- gdouble *y);
-
-void gl_wdgt_position_set_params (glWdgtPosition *position,
- gdouble x,
- gdouble y,
- gdouble x_max,
- gdouble y_max);
-
-void gl_wdgt_position_set_position (glWdgtPosition *position,
- gdouble x,
- gdouble y);
-
-void gl_wdgt_position_set_label_size_group (glWdgtPosition *position,
- GtkSizeGroup *size_group);
-
-G_END_DECLS
-
-#endif
+++ /dev/null
-/*
- * (GLABELS) Label and Business Card Creation program for GNOME
- *
- * wdgt_size.c: size properties widget module
- *
- * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include <config.h>
-
-#include "wdgt-size.h"
-#include "prefs.h"
-#include "marshal.h"
-
-#include "debug.h"
-
-/*===========================================*/
-/* Private types */
-/*===========================================*/
-
-enum {
- CHANGED,
- LAST_SIGNAL
-};
-
-typedef void (*glWdgtSizeSignal) (GObject * object, gpointer data);
-
-/*===========================================*/
-/* Private globals */
-/*===========================================*/
-
-static glHigVBoxClass *parent_class;
-
-static gint wdgt_size_signals[LAST_SIGNAL] = { 0 };
-
-/*===========================================*/
-/* Local function prototypes */
-/*===========================================*/
-
-static void gl_wdgt_size_class_init (glWdgtSizeClass *class);
-static void gl_wdgt_size_instance_init (glWdgtSize *size);
-static void gl_wdgt_size_finalize (GObject *object);
-static void gl_wdgt_size_construct (glWdgtSize *size);
-
-static void aspect_toggle_cb (GtkToggleButton *togglebutton,
- gpointer user_data);
-
-static void w_spin_cb (GtkSpinButton *spinbutton,
- gpointer user_data);
-static void h_spin_cb (GtkSpinButton *spinbutton,
- gpointer user_data);
-\f
-/***************************************************************************/
-/* Boilerplate Object stuff. */
-/***************************************************************************/
-guint
-gl_wdgt_size_get_type (void)
-{
- static guint wdgt_size_type = 0;
-
- if (!wdgt_size_type) {
- GTypeInfo wdgt_size_info = {
- sizeof (glWdgtSizeClass),
- NULL,
- NULL,
- (GClassInitFunc) gl_wdgt_size_class_init,
- NULL,
- NULL,
- sizeof (glWdgtSize),
- 0,
- (GInstanceInitFunc) gl_wdgt_size_instance_init,
- };
-
- wdgt_size_type =
- g_type_register_static (gl_hig_vbox_get_type (),
- "glWdgtSize",
- &wdgt_size_info, 0);
- }
-
- return wdgt_size_type;
-}
-
-static void
-gl_wdgt_size_class_init (glWdgtSizeClass *class)
-{
- GObjectClass *object_class;
-
- object_class = (GObjectClass *) class;
-
- parent_class = g_type_class_peek_parent (class);
-
- object_class->finalize = gl_wdgt_size_finalize;
-
- wdgt_size_signals[CHANGED] =
- g_signal_new ("changed",
- G_OBJECT_CLASS_TYPE(object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (glWdgtSizeClass, changed),
- NULL, NULL,
- gl_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
-}
-
-static void
-gl_wdgt_size_instance_init (glWdgtSize *size)
-{
- size->aspect_ratio = 1.0;
-
- size->w_label = NULL;
- size->w_spin = NULL;
- size->h_label = NULL;
- size->h_spin = NULL;
-
- size->units_label = NULL;
-
- size->aspect_checkbox = NULL;
-}
-
-static void
-gl_wdgt_size_finalize (GObject *object)
-{
- glWdgtSize *size;
- glWdgtSizeClass *class;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GL_IS_WDGT_SIZE (object));
-
- size = GL_WDGT_SIZE (object);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-/***************************************************************************/
-/* New widget. */
-/***************************************************************************/
-GtkWidget *
-gl_wdgt_size_new (void)
-{
- glWdgtSize *size;
-
- size = g_object_new (gl_wdgt_size_get_type (), NULL);
-
- gl_wdgt_size_construct (size);
-
- return GTK_WIDGET (size);
-}
-
-/*-------------------------------------------------------------------------*/
-/* PRIVATE. Construct composite widget. */
-/*-------------------------------------------------------------------------*/
-static void
-gl_wdgt_size_construct (glWdgtSize *size)
-{
- GtkWidget *wvbox, *whbox;
- GtkObject *w_adjust, *h_adjust;
- const gchar *units_string;
- gdouble units_per_point, climb_rate;
- gint digits;
-
- units_string = gl_prefs_get_units_string ();
- units_per_point = gl_prefs_get_units_per_point ();
- climb_rate = gl_prefs_get_units_step_size ();
- digits = gl_prefs_get_units_precision ();
-
- wvbox = GTK_WIDGET (size);
-
- /* ---- W line ---- */
- whbox = gl_hig_hbox_new ();
- gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), whbox);
-
- /* W Label */
- size->w_label = gtk_label_new (_("Width:"));
- gtk_misc_set_alignment (GTK_MISC (size->w_label), 0, 0.5);
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), size->w_label);
-
- /* W spin */
- w_adjust = gtk_adjustment_new (climb_rate, climb_rate, 100.0,
- climb_rate, 10.0, 10.0);
- size->w_spin = gtk_spin_button_new (GTK_ADJUSTMENT (w_adjust),
- climb_rate, digits);
- gtk_spin_button_set_snap_to_ticks (GTK_SPIN_BUTTON (size->w_spin),
- TRUE);
- gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (size->w_spin), TRUE);
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), size->w_spin);
-
- /* ---- H line ---- */
- whbox = gl_hig_hbox_new ();
- gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), whbox);
-
- /* H label */
- size->h_label = gtk_label_new (_("Height:"));
- gtk_misc_set_alignment (GTK_MISC (size->h_label), 0, 0.5);
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), size->h_label);
-
- /* H spin */
- h_adjust = gtk_adjustment_new (climb_rate, climb_rate,
- 100.0, climb_rate, 10.0, 10.0);
- size->h_spin = gtk_spin_button_new (GTK_ADJUSTMENT (h_adjust),
- climb_rate, digits);
- gtk_spin_button_set_snap_to_ticks (GTK_SPIN_BUTTON (size->h_spin),
- TRUE);
- gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (size->h_spin), TRUE);
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), size->h_spin);
-
- /* Units */
- size->units_label = gtk_label_new (units_string);
- gtk_misc_set_alignment (GTK_MISC (size->units_label), 0, 0.5);
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), size->units_label);
-
- /* Maintain aspect ratio checkbox */
- size->aspect_checkbox =
- gtk_check_button_new_with_label (_
- ("Maintain current aspect ratio"));
- gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), size->aspect_checkbox);
-
- /* Connect signals to controls */
- g_signal_connect (G_OBJECT (size->aspect_checkbox), "toggled",
- G_CALLBACK (aspect_toggle_cb), size);
- g_signal_connect (G_OBJECT (size->w_spin), "changed",
- G_CALLBACK (w_spin_cb), size);
- g_signal_connect (G_OBJECT (size->h_spin), "changed",
- G_CALLBACK (h_spin_cb), size);
-}
-
-/*--------------------------------------------------------------------------*/
-/* PRIVATE. Maintain aspect ratio checkbox callback. */
-/*--------------------------------------------------------------------------*/
-static void
-aspect_toggle_cb (GtkToggleButton *togglebutton,
- gpointer user_data)
-{
- glWdgtSize *size = GL_WDGT_SIZE (user_data);
- GtkAdjustment *w_adjust, *h_adjust;
-
- if (gtk_toggle_button_get_active (togglebutton)) {
-
- size->w =
- gtk_spin_button_get_value (GTK_SPIN_BUTTON(size->w_spin));
- size->h =
- gtk_spin_button_get_value (GTK_SPIN_BUTTON(size->h_spin));
-
- size->aspect_ratio = size->h / size->w;
-
- /* We have a new aspect ratio, adjust one of the maxes accordingly */
- if ((size->h_max_orig / size->w_max_orig) < size->aspect_ratio) {
- size->w_max = size->h_max_orig / size->aspect_ratio;
- size->h_max = size->h_max_orig;
- } else {
- size->w_max = size->w_max_orig;
- size->h_max = size->w_max_orig * size->aspect_ratio;
- }
-
- } else {
-
- /* Reset maximums */
- size->w_max = size->w_max_orig;
- size->h_max = size->h_max_orig;
-
- }
-
- g_signal_handlers_block_by_func (GTK_OBJECT (size->w_spin),
- G_CALLBACK (w_spin_cb),
- user_data);
- g_signal_handlers_block_by_func (GTK_OBJECT (size->h_spin),
- G_CALLBACK (h_spin_cb),
- user_data);
- w_adjust =
- gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (size->w_spin));
- w_adjust->upper = size->w_max;
- gtk_spin_button_update (GTK_SPIN_BUTTON (size->w_spin));
- h_adjust =
- gtk_spin_button_get_adjustment (GTK_SPIN_BUTTON (size->h_spin));
- h_adjust->upper = size->h_max;
- gtk_spin_button_update (GTK_SPIN_BUTTON (size->h_spin));
- g_signal_handlers_unblock_by_func (GTK_OBJECT (size->w_spin),
- G_CALLBACK (w_spin_cb),
- user_data);
- g_signal_handlers_unblock_by_func (GTK_OBJECT (size->h_spin),
- G_CALLBACK (h_spin_cb),
- user_data);
-
- /* Emit our "changed" signal */
- g_signal_emit (G_OBJECT (size), wdgt_size_signals[CHANGED], 0);
-
-}
-
-/*--------------------------------------------------------------------------*/
-/* PRIVATE. W spin button changed callback. */
-/*--------------------------------------------------------------------------*/
-static void
-w_spin_cb (GtkSpinButton *spinbutton,
- gpointer user_data)
-{
- glWdgtSize *size = GL_WDGT_SIZE (user_data);
- GtkToggleButton *toggle = GTK_TOGGLE_BUTTON (size->aspect_checkbox);
-
- size->w =
- gtk_spin_button_get_value (GTK_SPIN_BUTTON (size->w_spin));
-
- if (gtk_toggle_button_get_active (toggle)) {
-
- size->h = size->w * size->aspect_ratio;
-
- /* Update our sibling control, blocking recursion. */
- g_signal_handlers_block_by_func (GTK_OBJECT (size->h_spin),
- G_CALLBACK (h_spin_cb),
- user_data);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (size->h_spin),
- size->h);
- g_signal_handlers_unblock_by_func (GTK_OBJECT (size->h_spin),
- G_CALLBACK (h_spin_cb),
- user_data);
- }
-
- /* Emit our "changed" signal */
- g_signal_emit (G_OBJECT (size), wdgt_size_signals[CHANGED], 0);
-
-}
-
-/*--------------------------------------------------------------------------*/
-/* PRIVATE. H spin button changed callback. */
-/*--------------------------------------------------------------------------*/
-static void
-h_spin_cb (GtkSpinButton *spinbutton,
- gpointer user_data)
-{
- glWdgtSize *size = GL_WDGT_SIZE (user_data);
- GtkToggleButton *toggle = GTK_TOGGLE_BUTTON (size->aspect_checkbox);
-
- size->h =
- gtk_spin_button_get_value (GTK_SPIN_BUTTON (size->h_spin));
-
- if (gtk_toggle_button_get_active (toggle)) {
-
- size->w = size->h / size->aspect_ratio;
-
- /* Update our sibling control, blocking recursion. */
- g_signal_handlers_block_by_func (GTK_OBJECT (size->w_spin),
- G_CALLBACK (w_spin_cb),
- user_data);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (size->w_spin),
- size->w);
- g_signal_handlers_unblock_by_func (GTK_OBJECT (size->w_spin),
- G_CALLBACK (w_spin_cb),
- user_data);
- }
-
- /* Emit our "changed" signal */
- g_signal_emit (G_OBJECT (size), wdgt_size_signals[CHANGED], 0);
-
-}
-
-/***************************************************************************/
-/* query values from controls. */
-/***************************************************************************/
-void
-gl_wdgt_size_get_size (glWdgtSize *size,
- gdouble *w,
- gdouble *h,
- gboolean *keep_aspect_ratio_flag)
-{
- gdouble units_per_point;
-
- units_per_point = gl_prefs_get_units_per_point ();
-
- *w = gtk_spin_button_get_value (GTK_SPIN_BUTTON(size->w_spin));
- *h = gtk_spin_button_get_value (GTK_SPIN_BUTTON(size->h_spin));
-
- *keep_aspect_ratio_flag =
- gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
- (size->aspect_checkbox));
-
- /* convert everything back to our internal units (points) */
- *w /= units_per_point;
- *h /= units_per_point;
-}
-
-/***************************************************************************/
-/* set values and ranges for controls. */
-/***************************************************************************/
-void
-gl_wdgt_size_set_params (glWdgtSize *size,
- gdouble w,
- gdouble h,
- gboolean keep_aspect_ratio_flag,
- gdouble w_max,
- gdouble h_max)
-{
- GtkObject *w_adjust, *h_adjust;
- const gchar *units_string;
- gdouble units_per_point, climb_rate;
- gint digits;
-
- units_string = gl_prefs_get_units_string ();
- units_per_point = gl_prefs_get_units_per_point ();
- climb_rate = gl_prefs_get_units_step_size ();
- digits = gl_prefs_get_units_precision ();
-
- /* Put everything into our display units */
- size->w = w * units_per_point;
- size->h = h * units_per_point;
- size->w_max = w_max * units_per_point;
- size->h_max = h_max * units_per_point;
-
- /* Squirrel away copies of our original maximums */
- size->w_max_orig = size->w_max;
- size->h_max_orig = size->h_max;
-
- size->aspect_ratio = size->h / size->w;
- if (keep_aspect_ratio_flag) {
-
- /* When tracking aspect ratio, adjust one of the maxes */
- if ((size->h_max / size->w_max) < size->aspect_ratio) {
- size->w_max = size->h_max / size->aspect_ratio;
- } else {
- size->h_max = size->w_max * size->aspect_ratio;
- }
-
- /* before adjusting w & h, limit to max values */
- if (size->w > size->w_max)
- size->w = size->w_max;
- if (size->h > size->h_max)
- size->h = size->h_max;
-
- }
-
- /* update W/H spin controls */
- w_adjust = gtk_adjustment_new (size->w, climb_rate, size->w_max,
- climb_rate, 10.0, 10.0);
- gtk_spin_button_configure (GTK_SPIN_BUTTON (size->w_spin),
- GTK_ADJUSTMENT (w_adjust), climb_rate,
- digits);
- h_adjust =
- gtk_adjustment_new (size->h, climb_rate, size->h_max, climb_rate,
- 10.0, 10.0);
- gtk_spin_button_configure (GTK_SPIN_BUTTON (size->h_spin),
- GTK_ADJUSTMENT (h_adjust), climb_rate,
- digits);
-
- gtk_label_set_text (GTK_LABEL (size->units_label), units_string);
-
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (size->aspect_checkbox),
- keep_aspect_ratio_flag);
-
-}
-
-/***************************************************************************/
-/* set size only. */
-/***************************************************************************/
-void
-gl_wdgt_size_set_size (glWdgtSize *size,
- gdouble w,
- gdouble h)
-{
- gdouble units_per_point;
-
- units_per_point = gl_prefs_get_units_per_point ();
-
- /* Put everything into our display units */
- size->w = w * units_per_point;
- size->h = h * units_per_point;
-
- /* update aspect ratio */
- size->aspect_ratio = size->h / size->w;
-
- /* update W/H spin controls */
- g_signal_handlers_block_by_func (GTK_OBJECT (size->w_spin),
- G_CALLBACK (w_spin_cb),
- size);
- g_signal_handlers_block_by_func (GTK_OBJECT (size->h_spin),
- G_CALLBACK (h_spin_cb),
- size);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (size->w_spin), size->w);
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (size->h_spin), size->h);
- g_signal_handlers_unblock_by_func (GTK_OBJECT (size->w_spin),
- G_CALLBACK (w_spin_cb),
- size);
- g_signal_handlers_unblock_by_func (GTK_OBJECT (size->h_spin),
- G_CALLBACK (h_spin_cb),
- size);
-}
-
-/****************************************************************************/
-/* Set size group for internal labels */
-/****************************************************************************/
-void
-gl_wdgt_size_set_label_size_group (glWdgtSize *size,
- GtkSizeGroup *label_size_group)
-{
- gtk_size_group_add_widget (label_size_group, size->w_label);
- gtk_size_group_add_widget (label_size_group, size->h_label);
-}
+++ /dev/null
-/*
- * (GLABELS) Label and Business Card Creation program for GNOME
- *
- * wdgt_size.h: size properties widget module header file
- *
- * Copyright (C) 2000, 2001 Jim Evins <evins@snaught.com>.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef __WDGT_SIZE_H__
-#define __WDGT_SIZE_H__
-
-#include <gnome.h>
-#include "label.h"
-#include "hig.h"
-
-G_BEGIN_DECLS
-
-#define GL_TYPE_WDGT_SIZE (gl_wdgt_size_get_type ())
-#define GL_WDGT_SIZE(obj) \
- (GTK_CHECK_CAST((obj), GL_TYPE_WDGT_SIZE, glWdgtSize ))
-#define GL_WDGT_SIZE_CLASS(klass) \
- (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_WDGT_SIZE, glWdgtSizeClass))
-#define GL_IS_WDGT_SIZE(obj) \
- (GTK_CHECK_TYPE ((obj), GL_TYPE_WDGT_SIZE))
-#define GL_IS_WDGT_SIZE_CLASS(klass) \
- (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_WDGT_SIZE))
-
-typedef struct _glWdgtSize glWdgtSize;
-typedef struct _glWdgtSizeClass glWdgtSizeClass;
-
-struct _glWdgtSize {
- glHigVBox parent_widget;
-
- gdouble w, h;
- gdouble aspect_ratio;
- gdouble w_max, h_max;
- gdouble w_max_orig, h_max_orig;
-
- GtkWidget *w_label;
- GtkWidget *w_spin;
-
- GtkWidget *h_label;
- GtkWidget *h_spin;
- GtkWidget *units_label;
-
- GtkWidget *aspect_checkbox;
-};
-
-struct _glWdgtSizeClass {
- glHigVBoxClass parent_class;
-
- void (*changed) (glWdgtSize * size, gpointer user_data);
-};
-
-guint gl_wdgt_size_get_type (void);
-
-GtkWidget *gl_wdgt_size_new (void);
-
-void gl_wdgt_size_get_size (glWdgtSize *size,
- gdouble *w,
- gdouble *h,
- gboolean *keep_aspect_ratio_flag);
-
-void gl_wdgt_size_set_params (glWdgtSize *size,
- gdouble w,
- gdouble h,
- gboolean keep_aspect_ratio_flag,
- gdouble w_max,
- gdouble h_max);
-
-void gl_wdgt_size_set_size (glWdgtSize *size,
- gdouble w,
- gdouble h);
-
-void gl_wdgt_size_set_label_size_group (glWdgtSize *size,
- GtkSizeGroup *label_size_group);
-
-
-G_END_DECLS
-
-#endif
+++ /dev/null
-/*
- * (GLABELS) Label and Business Card Creation program for GNOME
- *
- * wdgt_text_entry.c: text entry widget module
- *
- * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include <config.h>
-
-#include "wdgt-text-entry.h"
-#include "merge.h"
-#include "text-node.h"
-#include "marshal.h"
-
-#include "debug.h"
-
-/*===========================================*/
-/* Private types */
-/*===========================================*/
-
-typedef void (*glWdgtTextEntrySignal) (GObject * object, gpointer data);
-
-/*===========================================*/
-/* Private globals */
-/*===========================================*/
-
-static glHigVBoxClass *parent_class;
-
-/*===========================================*/
-/* Local function prototypes */
-/*===========================================*/
-
-static void gl_wdgt_text_entry_class_init (glWdgtTextEntryClass *class);
-static void gl_wdgt_text_entry_instance_init (glWdgtTextEntry *text_entry);
-static void gl_wdgt_text_entry_finalize (GObject *object);
-static void gl_wdgt_text_entry_construct (glWdgtTextEntry *text_entry,
- glMerge *merge);
-
-static void insert_cb (glWdgtTextEntry *text_entry);
-\f
-/****************************************************************************/
-/* Boilerplate Object stuff. */
-/****************************************************************************/
-guint
-gl_wdgt_text_entry_get_type (void)
-{
- static guint wdgt_text_entry_type = 0;
-
- if (!wdgt_text_entry_type) {
- GTypeInfo wdgt_text_entry_info = {
- sizeof (glWdgtTextEntryClass),
- NULL,
- NULL,
- (GClassInitFunc) gl_wdgt_text_entry_class_init,
- NULL,
- NULL,
- sizeof (glWdgtTextEntry),
- 0,
- (GInstanceInitFunc) gl_wdgt_text_entry_instance_init,
- };
-
- wdgt_text_entry_type =
- g_type_register_static (gl_hig_vbox_get_type (),
- "glWdgtTextEntry",
- &wdgt_text_entry_info, 0);
- }
-
- return wdgt_text_entry_type;
-}
-
-static void
-gl_wdgt_text_entry_class_init (glWdgtTextEntryClass * class)
-{
- GObjectClass *object_class;
-
- gl_debug (DEBUG_WDGT, "START");
-
- object_class = (GObjectClass *) class;
-
- parent_class = g_type_class_peek_parent (class);
-
- object_class->finalize = gl_wdgt_text_entry_finalize;
-
- gl_debug (DEBUG_WDGT, "END");
-}
-
-static void
-gl_wdgt_text_entry_instance_init (glWdgtTextEntry *text_entry)
-{
- gl_debug (DEBUG_WDGT, "START");
-
- text_entry->text_entry = NULL;
-
- text_entry->key_combo = NULL;
- text_entry->key_entry = NULL;
- text_entry->insert_button = NULL;
-
- gl_debug (DEBUG_WDGT, "END");
-}
-
-static void
-gl_wdgt_text_entry_finalize (GObject *object)
-{
- glWdgtTextEntry *text_entry;
- glWdgtTextEntryClass *class;
-
- gl_debug (DEBUG_WDGT, "START");
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GL_IS_WDGT_TEXT_ENTRY (object));
-
- text_entry = GL_WDGT_TEXT_ENTRY (object);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-
- gl_debug (DEBUG_WDGT, "END");
-}
-
-/****************************************************************************/
-/* New widget. */
-/****************************************************************************/
-GtkWidget *
-gl_wdgt_text_entry_new (glMerge *merge)
-{
- glWdgtTextEntry *text_entry;
-
- gl_debug (DEBUG_WDGT, "START");
-
- text_entry = g_object_new (gl_wdgt_text_entry_get_type (), NULL);
-
- gl_wdgt_text_entry_construct (text_entry, merge);
-
- gl_debug (DEBUG_WDGT, "END");
-
- return GTK_WIDGET (text_entry);
-}
-
-/*--------------------------------------------------------------------------*/
-/* PRIVATE. Construct composite widget. */
-/*--------------------------------------------------------------------------*/
-static void
-gl_wdgt_text_entry_construct (glWdgtTextEntry *text_entry,
- glMerge *merge)
-{
- GtkWidget *wvbox, *whbox, *wscroll;
- GList *keys;
-
- gl_debug (DEBUG_WDGT, "START");
-
- wvbox = GTK_WIDGET (text_entry);
-
- /* ---- Entry line ---- */
- whbox = gl_hig_hbox_new ();
- gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), whbox);
-
- /* Text Label */
- text_entry->edit_label = gtk_label_new (_("Edit text:"));
- gtk_misc_set_alignment (GTK_MISC (text_entry->edit_label), 0, 0);
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), text_entry->edit_label);
-
- /* Actual text entry widget */
- wscroll = gtk_scrolled_window_new (NULL, NULL);
- gtk_widget_set_size_request (wscroll, -1, 70);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (wscroll),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
- gl_hig_hbox_add_widget_justify (GL_HIG_HBOX(whbox), wscroll);
- text_entry->text_entry = gtk_text_view_new ();
- text_entry->text_buffer =
- gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_entry->text_entry));
- gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (wscroll),
- text_entry->text_entry);
-
- /* ---- Merge field line ---- */
- whbox = gl_hig_hbox_new ();
- gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), whbox);
-
- /* Insert merge field label */
- text_entry->key_label = gtk_label_new (_("Key:"));
- gtk_misc_set_alignment (GTK_MISC (text_entry->key_label), 0, 0.5);
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), text_entry->key_label);
-
- /* Key entry widget */
- text_entry->key_combo = gtk_combo_new ();
- keys = gl_merge_get_key_list (merge);
- if (keys != NULL)
- gtk_combo_set_popdown_strings (GTK_COMBO (text_entry->key_combo),
- keys);
- gl_merge_free_key_list (&keys);
- text_entry->key_entry = GTK_COMBO (text_entry->key_combo)->entry;
- gtk_entry_set_editable (GTK_ENTRY (text_entry->key_entry), FALSE);
- gtk_widget_set_size_request (text_entry->key_combo, 200, -1);
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), text_entry->key_combo);
-
- /* Insert button */
- text_entry->insert_button =
- gtk_button_new_with_label (_("Insert merge field"));
- g_signal_connect_swapped (G_OBJECT (text_entry->insert_button),
- "clicked", G_CALLBACK (insert_cb),
- G_OBJECT (text_entry));
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), text_entry->insert_button);
-
- gl_debug (DEBUG_WDGT, "END");
-}
-
-/*--------------------------------------------------------------------------*/
-/* PRIVATE. Callback to insert field into text buffer. */
-/*--------------------------------------------------------------------------*/
-static void
-insert_cb (glWdgtTextEntry *text_entry)
-{
- GtkTextBuffer *buffer;
- gchar *key, *field;
-
- gl_debug (DEBUG_WDGT, "START");
-
- key =
- gtk_editable_get_chars (GTK_EDITABLE (text_entry->key_entry), 0,
- -1);
- field = g_strdup_printf ("${%s}", key);
- gl_debug (DEBUG_WDGT, "Inserting %s", field);
-
- buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text_entry->text_entry));
- gtk_text_buffer_insert_at_cursor (buffer, field, -1);
-
- g_free (field);
- g_free (key);
-
-
- gl_debug (DEBUG_WDGT, "END");
-}
-
-/****************************************************************************/
-/* Set new field definitions. */
-/****************************************************************************/
-void
-gl_wdgt_text_entry_set_field_defs (glWdgtTextEntry *text_entry,
- glMerge *merge)
-{
- GList *keys;
-
- gtk_widget_set_sensitive (text_entry->key_combo, merge != NULL);
- gtk_widget_set_sensitive (text_entry->insert_button, merge != NULL);
-
- keys = gl_merge_get_key_list (merge);
- if ( keys != NULL ) {
- gtk_combo_set_popdown_strings (GTK_COMBO (text_entry->key_combo),
- keys);
- gl_merge_free_key_list (&keys);
- } else {
- keys = g_list_append (keys, "");
- gtk_combo_set_popdown_strings (GTK_COMBO (text_entry->key_combo),
- keys);
- g_list_free (keys);
- }
-}
-
-/****************************************************************************/
-/* Set text buffer */
-/****************************************************************************/
-void
-gl_wdgt_text_entry_set_buffer (glWdgtTextEntry *text_entry,
- GtkTextBuffer *buffer)
-{
- text_entry->text_buffer = buffer;
-
- gtk_text_view_set_buffer (GTK_TEXT_VIEW(text_entry->text_entry), buffer);
-}
-
-/*****************************************************************************/
-/* Set size group for internal labels */
-/*****************************************************************************/
-void
-gl_wdgt_text_entry_set_label_size_group (glWdgtTextEntry *text_entry,
- GtkSizeGroup *label_size_group)
-{
- gtk_size_group_add_widget (label_size_group, text_entry->edit_label);
- gtk_size_group_add_widget (label_size_group, text_entry->key_label);
-}
-
+++ /dev/null
-/*
- * (GLABELS) Label and Business Card Creation program for GNOME
- *
- * wdgt_text_entry.h: text entry widget module header file
- *
- * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef __WDGT_TEXT_ENTRY_H__
-#define __WDGT_TEXT_ENTRY_H__
-
-#include <gnome.h>
-#include "merge.h"
-#include "hig.h"
-
-G_BEGIN_DECLS
-
-#define GL_TYPE_WDGT_TEXT_ENTRY (gl_wdgt_text_entry_get_type ())
-#define GL_WDGT_TEXT_ENTRY(obj) \
- (GTK_CHECK_CAST((obj), GL_TYPE_WDGT_TEXT_ENTRY, glWdgtTextEntry ))
-#define GL_WDGT_TEXT_ENTRY_CLASS(klass) \
- (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_WDGT_TEXT_ENTRY, glWdgtTextEntryClass))
-#define GL_IS_WDGT_TEXT_ENTRY(obj) \
- (GTK_CHECK_TYPE ((obj), GL_TYPE_WDGT_TEXT_ENTRY))
-#define GL_IS_WDGT_TEXT_ENTRY_CLASS(klass) \
- (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_WDGT_TEXT_ENTRY))
-
-typedef struct _glWdgtTextEntry glWdgtTextEntry;
-typedef struct _glWdgtTextEntryClass glWdgtTextEntryClass;
-
-struct _glWdgtTextEntry {
- glHigVBox parent_widget;
-
- GtkWidget *edit_label;
- GtkWidget *text_entry;
-
- GtkWidget *key_label;
- GtkWidget *key_combo;
- GtkWidget *key_entry;
- GtkWidget *insert_button;
-
- GtkTextBuffer *text_buffer;
-};
-
-struct _glWdgtTextEntryClass {
- glHigVBoxClass parent_class;
-
- void (*changed) (glWdgtTextEntry * text_entry, gpointer user_data);
-};
-
-guint gl_wdgt_text_entry_get_type (void);
-
-GtkWidget *gl_wdgt_text_entry_new (glMerge *merge);
-
-void gl_wdgt_text_entry_set_field_defs (glWdgtTextEntry *text_entry,
- glMerge *merge);
-
-void gl_wdgt_text_entry_set_buffer (glWdgtTextEntry *text_entry,
- GtkTextBuffer *buffer);
-
-void gl_wdgt_text_entry_set_label_size_group (glWdgtTextEntry *text_entry,
- GtkSizeGroup *label_size_group);
-
-G_END_DECLS
-
-#endif
+++ /dev/null
-/*
- * (GLABELS) Label and Business Card Creation program for GNOME
- *
- * wdgt_text_props.c: text properties widget module
- *
- * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include <config.h>
-
-#include <gnome.h>
-
-#include "mygal/widget-color-combo.h"
-#include "prefs.h"
-#include "wdgt-text-props.h"
-#include "marshal.h"
-#include "color.h"
-
-#include "debug.h"
-
-/*===========================================*/
-/* Private types */
-/*===========================================*/
-
-enum {
- CHANGED,
- LAST_SIGNAL
-};
-
-typedef void (*glWdgtTextPropsSignal) (GObject *object, gpointer data);
-
-/*===========================================*/
-/* Private globals */
-/*===========================================*/
-
-static GObjectClass *parent_class;
-
-static gint wdgt_text_props_signals[LAST_SIGNAL] = { 0 };
-
-/*===========================================*/
-/* Local function prototypes */
-/*===========================================*/
-
-static void gl_wdgt_text_props_class_init (glWdgtTextPropsClass *class);
-static void gl_wdgt_text_props_instance_init (glWdgtTextProps *text);
-static void gl_wdgt_text_props_finalize (GObject *object);
-static void gl_wdgt_text_props_construct (glWdgtTextProps *text);
-
-static void family_changed_cb (GtkEntry *entry,
- glWdgtTextProps *text);
-
-static void changed_cb (glWdgtTextProps *text);
-
-static void just_toggled_cb (GtkToggleButton *togglebutton,
- gpointer user_data);
-\f
-/*****************************************************************************/
-/* Boilerplate Object stuff. */
-/*****************************************************************************/
-guint
-gl_wdgt_text_props_get_type (void)
-{
- static guint wdgt_text_props_type = 0;
-
- if (!wdgt_text_props_type) {
- GTypeInfo wdgt_text_props_info = {
- sizeof (glWdgtTextPropsClass),
- NULL,
- NULL,
- (GClassInitFunc) gl_wdgt_text_props_class_init,
- NULL,
- NULL,
- sizeof (glWdgtTextProps),
- 0,
- (GInstanceInitFunc) gl_wdgt_text_props_instance_init,
- };
-
- wdgt_text_props_type =
- g_type_register_static (gl_hig_vbox_get_type (),
- "glWdgtTextProps",
- &wdgt_text_props_info, 0);
- }
-
- return wdgt_text_props_type;
-}
-
-static void
-gl_wdgt_text_props_class_init (glWdgtTextPropsClass *class)
-{
- GObjectClass *object_class;
-
- object_class = (GObjectClass *) class;
-
- parent_class = g_type_class_peek_parent (class);
-
- object_class->finalize = gl_wdgt_text_props_finalize;
-
- wdgt_text_props_signals[CHANGED] =
- g_signal_new ("changed",
- G_OBJECT_CLASS_TYPE(object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (glWdgtTextPropsClass, changed),
- NULL, NULL,
- gl_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
-}
-
-static void
-gl_wdgt_text_props_instance_init (glWdgtTextProps *text)
-{
- text->font_family_entry = NULL;
- text->font_size_spin = NULL;
- text->font_b_button = NULL;
- text->font_i_button = NULL;
-
- text->color_picker = NULL;
-
- text->left_button = NULL;
- text->right_button = NULL;
- text->center_button = NULL;
-}
-
-static void
-gl_wdgt_text_props_finalize (GObject *object)
-{
- glWdgtTextProps *text;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GL_IS_WDGT_TEXT_PROPS (object));
-
- text = GL_WDGT_TEXT_PROPS (object);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-/*****************************************************************************/
-/* New widget. */
-/*****************************************************************************/
-GtkWidget *
-gl_wdgt_text_props_new (void)
-{
- glWdgtTextProps *text;
-
- text = g_object_new (gl_wdgt_text_props_get_type (), NULL);
-
- gl_wdgt_text_props_construct (text);
-
- return GTK_WIDGET (text);
-}
-
-/*--------------------------------------------------------------------------*/
-/* PRIVATE. Construct composite widget. */
-/*--------------------------------------------------------------------------*/
-static void
-gl_wdgt_text_props_construct (glWdgtTextProps *text)
-{
- GtkWidget *wvbox, *whbox, *wcombo, *wbhbox;
- GList *family_names = NULL;
- GtkObject *adjust;
- ColorGroup *cg;
- GdkColor *gdk_color;
-
- wvbox = GTK_WIDGET (text);
-
- /* ---- Font line ---- */
- whbox = gl_hig_hbox_new ();
- gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), whbox);
-
- /* Font label */
- text->font_label = gtk_label_new (_("Font:"));
- gtk_misc_set_alignment (GTK_MISC (text->font_label), 0, 0.5);
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), text->font_label);
-
- /* Font family entry widget */
- wcombo = gtk_combo_new ();
- family_names = gnome_font_family_list ();
- gtk_combo_set_popdown_strings (GTK_COMBO (wcombo), family_names);
- gnome_font_family_list_free (family_names);
- text->font_family_entry = GTK_COMBO (wcombo)->entry;
- gtk_combo_set_value_in_list (GTK_COMBO(wcombo), TRUE, FALSE);
- gtk_entry_set_editable (GTK_ENTRY (text->font_family_entry), FALSE);
- gtk_widget_set_size_request (wcombo, 200, -1);
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), wcombo);
- g_signal_connect (G_OBJECT (text->font_family_entry),
- "changed", G_CALLBACK (family_changed_cb), text);
-
- /* Font size entry widget */
- adjust = gtk_adjustment_new (1.0, 1.0, 250.0, 1.0, 10.0, 10.0);
- text->font_size_spin =
- gtk_spin_button_new (GTK_ADJUSTMENT (adjust), 1.0, 0);
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), text->font_size_spin);
- g_signal_connect_swapped (G_OBJECT (text->font_size_spin), "changed",
- G_CALLBACK (changed_cb),
- G_OBJECT (text));
-
- /* Font weight/italic button widgets */
- text->font_b_button = gtk_toggle_button_new ();
- gtk_container_add (GTK_CONTAINER (text->font_b_button),
- gtk_image_new_from_stock (GTK_STOCK_BOLD,
- GTK_ICON_SIZE_BUTTON));
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), text->font_b_button);
- g_signal_connect_swapped (G_OBJECT (text->font_b_button), "toggled",
- G_CALLBACK (changed_cb),
- G_OBJECT (text));
- text->font_i_button = gtk_toggle_button_new ();
- gtk_container_add (GTK_CONTAINER (text->font_i_button),
- gtk_image_new_from_stock (GTK_STOCK_ITALIC,
- GTK_ICON_SIZE_BUTTON));
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), text->font_i_button);
- g_signal_connect_swapped (G_OBJECT (text->font_i_button), "toggled",
- G_CALLBACK (changed_cb),
- G_OBJECT (text));
-
- /* ---- Color line ---- */
- whbox = gl_hig_hbox_new ();
- gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), whbox);
-
- /* Text Color Label */
- text->color_label = gtk_label_new (_("Color:"));
- gtk_misc_set_alignment (GTK_MISC (text->color_label), 0, 0.5);
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), text->color_label);
-
- /* Text Color picker widget */
- cg = color_group_fetch ("text_color_group", NULL);
- gdk_color = gl_color_to_gdk_color (gl_prefs->default_line_color);
- text->color_picker = color_combo_new (NULL, _("Default"), gdk_color, cg);
- color_combo_box_set_preview_relief (COLOR_COMBO(text->color_picker),
- GTK_RELIEF_NORMAL);
- g_free (gdk_color);
- g_signal_connect_swapped (G_OBJECT (text->color_picker), "color_changed",
- G_CALLBACK (changed_cb),
- G_OBJECT (text));
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), text->color_picker);
-
- /* ---- Alignment line ---- */
- whbox = gl_hig_hbox_new ();
- gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), whbox);
-
- /* Alignment label */
- text->alignment_label = gtk_label_new (_("Alignment:"));
- gtk_misc_set_alignment (GTK_MISC (text->alignment_label), 0, 0.5);
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), text->alignment_label);
-
- /* Justification entry widget */
- text->left_button = gtk_toggle_button_new ();
- gtk_container_add (GTK_CONTAINER (text->left_button),
- gtk_image_new_from_stock (GTK_STOCK_JUSTIFY_LEFT,
- GTK_ICON_SIZE_BUTTON));
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), text->left_button);
- text->center_button = gtk_toggle_button_new ();
- gtk_container_add (GTK_CONTAINER (text->center_button),
- gtk_image_new_from_stock (GTK_STOCK_JUSTIFY_CENTER,
- GTK_ICON_SIZE_BUTTON));
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), text->center_button);
- text->right_button = gtk_toggle_button_new ();
- gtk_container_add (GTK_CONTAINER (text->right_button),
- gtk_image_new_from_stock (GTK_STOCK_JUSTIFY_RIGHT,
- GTK_ICON_SIZE_BUTTON));
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), text->right_button);
-
- /* Now connect a callback that makes these toggles mutually exclusive */
- g_signal_connect (G_OBJECT (text->left_button), "toggled",
- G_CALLBACK (just_toggled_cb), text);
- g_signal_connect (G_OBJECT (text->center_button), "toggled",
- G_CALLBACK (just_toggled_cb), text);
- g_signal_connect (G_OBJECT (text->right_button), "toggled",
- G_CALLBACK (just_toggled_cb), text);
-
-}
-
-/*--------------------------------------------------------------------------*/
-/* PRIVATE. modify widget due to change in selection */
-/*--------------------------------------------------------------------------*/
-static void
-family_changed_cb (GtkEntry *entry,
- glWdgtTextProps *text)
-{
- gchar *family_name;
-
- family_name = gtk_editable_get_chars (GTK_EDITABLE (entry), 0, -1);
- if ( strlen(family_name) ) {
- /* Emit our "changed" signal */
- g_signal_emit (G_OBJECT (text),
- wdgt_text_props_signals[CHANGED], 0);
- }
- g_free (family_name);
-}
-
-/*--------------------------------------------------------------------------*/
-/* PRIVATE. Callback for when any control in the widget has changed. */
-/*--------------------------------------------------------------------------*/
-static void
-changed_cb (glWdgtTextProps *text)
-{
- /* Emit our "changed" signal */
- g_signal_emit (G_OBJECT (text), wdgt_text_props_signals[CHANGED], 0);
-}
-\f
-/*--------------------------------------------------------------------------*/
-/* PRIVATE. Justify toggle button callback. */
-/*--------------------------------------------------------------------------*/
-static void
-just_toggled_cb (GtkToggleButton *togglebutton,
- gpointer user_data)
-{
- glWdgtTextProps *text = GL_WDGT_TEXT_PROPS (user_data);
-
- if (gtk_toggle_button_get_active (togglebutton)) {
-
- if (GTK_WIDGET (togglebutton) == GTK_WIDGET (text->left_button)) {
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
- (text->center_button),
- FALSE);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
- (text->right_button),
- FALSE);
- } else if (GTK_WIDGET (togglebutton) ==
- GTK_WIDGET (text->center_button)) {
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
- (text->left_button),
- FALSE);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
- (text->right_button),
- FALSE);
- } else if (GTK_WIDGET (togglebutton) ==
- GTK_WIDGET (text->right_button)) {
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
- (text->left_button),
- FALSE);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
- (text->center_button),
- FALSE);
- }
-
- }
-
- /* Emit our "changed" signal */
- g_signal_emit (G_OBJECT (text), wdgt_text_props_signals[CHANGED], 0);
-}
-\f
-/*****************************************************************************/
-/* query values from controls. */
-/*****************************************************************************/
-void
-gl_wdgt_text_props_get_params (glWdgtTextProps *text,
- gchar **font_family,
- gdouble *font_size,
- GnomeFontWeight *font_weight,
- gboolean *font_italic_flag,
- guint *color,
- GtkJustification *just)
-{
- GdkColor *gdk_color;
- gboolean is_default;
-
- /* ------ Get updated font information ------ */
- *font_family =
- gtk_editable_get_chars (GTK_EDITABLE (text->font_family_entry), 0,
- -1);
- *font_size =
- gtk_spin_button_get_value (GTK_SPIN_BUTTON(text->font_size_spin));
- if (gtk_toggle_button_get_active
- (GTK_TOGGLE_BUTTON (text->font_b_button))) {
- *font_weight = GNOME_FONT_BOLD;
- } else {
- *font_weight = GNOME_FONT_BOOK;
- }
- *font_italic_flag =
- gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON
- (text->font_i_button));
-
- /* ------ Get updated color ------ */
- gdk_color = color_combo_get_color (COLOR_COMBO(text->color_picker),
- &is_default);
-
- if (is_default) {
- *color = gl_prefs->default_text_color;
- } else {
- *color = gl_color_from_gdk_color (gdk_color);
- }
-
- /* ------- Get updated justification ------ */
- if (gtk_toggle_button_get_active
- (GTK_TOGGLE_BUTTON (text->left_button))) {
- *just = GTK_JUSTIFY_LEFT;
- } else
- if (gtk_toggle_button_get_active
- (GTK_TOGGLE_BUTTON (text->right_button))) {
- *just = GTK_JUSTIFY_RIGHT;
- } else
- if (gtk_toggle_button_get_active
- (GTK_TOGGLE_BUTTON (text->center_button))) {
- *just = GTK_JUSTIFY_CENTER;
- } else {
- *just = GTK_JUSTIFY_LEFT; /* Should not happen. */
- }
-
-}
-
-/*****************************************************************************/
-/* fill in values and ranges for controls. */
-/*****************************************************************************/
-void
-gl_wdgt_text_props_set_params (glWdgtTextProps *text,
- gchar *font_family,
- gdouble font_size,
- GnomeFontWeight font_weight,
- gboolean font_italic_flag,
- guint color,
- GtkJustification just)
-{
- GList *family_names;
- gchar *good_font_family;
- GdkColor *gdk_color;
-
- /* Make sure we have a valid font family. if not provide a good default. */
- family_names = gnome_font_family_list ();
- if (g_list_find_custom (family_names, font_family, (GCompareFunc)g_utf8_collate)) {
- good_font_family = g_strdup (font_family);
- } else {
- if (family_names != NULL) {
- good_font_family = g_strdup (family_names->data); /* 1st entry */
- } else {
- good_font_family = NULL;
- }
- }
- gnome_font_family_list_free (family_names);
-
- gtk_entry_set_text (GTK_ENTRY (text->font_family_entry), good_font_family);
- g_free (good_font_family);
-
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (text->font_size_spin),
- font_size);
-
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (text->font_b_button),
- (font_weight == GNOME_FONT_BOLD));
-
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (text->font_i_button),
- font_italic_flag);
-
- gdk_color = gl_color_to_gdk_color (color);
- color_combo_set_color (COLOR_COMBO(text->color_picker), gdk_color);
- g_free (gdk_color);
-
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (text->left_button),
- (just == GTK_JUSTIFY_LEFT));
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (text->center_button),
- (just == GTK_JUSTIFY_CENTER));
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (text->right_button),
- (just == GTK_JUSTIFY_RIGHT));
-}
-
-/*****************************************************************************/
-/* Set size group for internal labels */
-/*****************************************************************************/
-void
-gl_wdgt_text_props_set_label_size_group (glWdgtTextProps *text,
- GtkSizeGroup *label_size_group)
-{
- gtk_size_group_add_widget (label_size_group, text->font_label);
- gtk_size_group_add_widget (label_size_group, text->color_label);
- gtk_size_group_add_widget (label_size_group, text->alignment_label);
-}
-
+++ /dev/null
-/*
- * (GLABELS) Label and Business Card Creation program for GNOME
- *
- * wdgt_text_props.h: text properties widget module header file
- *
- * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef __WDGT_TEXT_PROPS_H__
-#define __WDGT_TEXT_PROPS_H__
-
-#include <gtk/gtk.h>
-#include <libgnomeprint/gnome-font.h>
-#include "label.h"
-#include "hig.h"
-
-G_BEGIN_DECLS
-
-#define GL_TYPE_WDGT_TEXT_PROPS (gl_wdgt_text_props_get_type ())
-#define GL_WDGT_TEXT_PROPS(obj) \
- (GTK_CHECK_CAST((obj), GL_TYPE_WDGT_TEXT_PROPS, glWdgtTextProps ))
-#define GL_WDGT_TEXT_PROPS_CLASS(klass) \
- (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_WDGT_TEXT_PROPS, glWdgtTextPropsClass))
-#define GL_IS_WDGT_TEXT_PROPS(obj) \
- (GTK_CHECK_TYPE ((obj), GL_TYPE_WDGT_TEXT_PROPS))
-#define GL_IS_WDGT_TEXT_PROPS_CLASS(klass) \
- (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_WDGT_TEXT_PROPS))
-
-typedef struct _glWdgtTextProps glWdgtTextProps;
-typedef struct _glWdgtTextPropsClass glWdgtTextPropsClass;
-
-struct _glWdgtTextProps {
- glHigVBox parent_widget;
-
- GtkWidget *font_label;
- GtkWidget *font_family_entry;
- GtkWidget *font_size_spin;
- GtkWidget *font_b_button;
- GtkWidget *font_i_button;
-
- GtkWidget *color_label;
- GtkWidget *color_picker;
-
- GtkWidget *alignment_label;
- GtkWidget *left_button, *right_button, *center_button;
-};
-
-struct _glWdgtTextPropsClass {
- glHigVBoxClass parent_class;
-
- void (*changed) (glWdgtTextProps * text, gpointer user_data);
-};
-
-guint gl_wdgt_text_props_get_type (void);
-
-GtkWidget *gl_wdgt_text_props_new (void);
-
-void gl_wdgt_text_props_get_params (glWdgtTextProps *text,
- gchar **font_family,
- gdouble *font_size,
- GnomeFontWeight *font_weight,
- gboolean *font_italic_flag,
- guint *color,
- GtkJustification *just);
-
-void gl_wdgt_text_props_set_params (glWdgtTextProps *text,
- gchar *font_family,
- gdouble font_size,
- GnomeFontWeight font_weight,
- gboolean font_italic_flag,
- guint color,
- GtkJustification just);
-
-void gl_wdgt_text_props_set_label_size_group (glWdgtTextProps *text,
- GtkSizeGroup *size_grp);
-
-G_END_DECLS
-
-#endif
+++ /dev/null
-/*
- * (GLABELS) Label and Business Card Creation program for GNOME
- *
- * wdgt_vector.c: vector properties widget module
- *
- * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#include <config.h>
-
-#include "wdgt-vector.h"
-#include "prefs.h"
-#include "marshal.h"
-
-#include "debug.h"
-
-#include <math.h>
-
-#define LENGTH(x,y) sqrt( (x)*(x) + (y)*(y) )
-#define ANGLE(x,y) ( (180.0/G_PI)*atan2( -(y), (x) ) )
-#define COMP_X(l,a) ( (l) * cos( (G_PI/180.0)*(a) ) )
-#define COMP_Y(l,a) ( -(l) * sin( (G_PI/180.0)*(a) ) )
-
-/*===========================================*/
-/* Private types */
-/*===========================================*/
-
-enum {
- CHANGED,
- LAST_SIGNAL
-};
-
-typedef void (*glWdgtVectorSignal) (GObject * object, gpointer data);
-
-/*===========================================*/
-/* Private globals */
-/*===========================================*/
-
-static glHigVBoxClass *parent_class;
-
-static gint wdgt_vector_signals[LAST_SIGNAL] = { 0 };
-
-/*===========================================*/
-/* Local function prototypes */
-/*===========================================*/
-
-static void gl_wdgt_vector_class_init (glWdgtVectorClass *class);
-static void gl_wdgt_vector_instance_init (glWdgtVector *vector);
-static void gl_wdgt_vector_finalize (GObject *object);
-static void gl_wdgt_vector_construct (glWdgtVector *vector);
-
-static void changed_cb (glWdgtVector *vector);
-
-/****************************************************************************/
-/* Boilerplate Object stuff. */
-/****************************************************************************/
-guint
-gl_wdgt_vector_get_type (void)
-{
- static guint wdgt_vector_type = 0;
-
- if (!wdgt_vector_type) {
- GTypeInfo wdgt_vector_info = {
- sizeof (glWdgtVectorClass),
- NULL,
- NULL,
- (GClassInitFunc) gl_wdgt_vector_class_init,
- NULL,
- NULL,
- sizeof (glWdgtVector),
- 0,
- (GInstanceInitFunc) gl_wdgt_vector_instance_init,
- };
-
- wdgt_vector_type =
- g_type_register_static (gl_hig_vbox_get_type (),
- "glWdgtVector",
- &wdgt_vector_info, 0);
- }
-
- return wdgt_vector_type;
-}
-
-static void
-gl_wdgt_vector_class_init (glWdgtVectorClass *class)
-{
- GObjectClass *object_class;
-
- object_class = (GObjectClass *) class;
-
- parent_class = g_type_class_peek_parent (class);
-
- object_class->finalize = gl_wdgt_vector_finalize;
-
- wdgt_vector_signals[CHANGED] =
- g_signal_new ("changed",
- G_OBJECT_CLASS_TYPE(object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (glWdgtVectorClass, changed),
- NULL, NULL,
- gl_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
-}
-
-static void
-gl_wdgt_vector_instance_init (glWdgtVector *vector)
-{
- vector->len_label = NULL;
- vector->len_spin = NULL;
- vector->len_units_label = NULL;
-
- vector->angle_label = NULL;
- vector->angle_spin = NULL;
- vector->angle_units_label = NULL;
-}
-
-static void
-gl_wdgt_vector_finalize (GObject *object)
-{
- glWdgtVector *vector;
- glWdgtVectorClass *class;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (GL_IS_WDGT_VECTOR (object));
-
- vector = GL_WDGT_VECTOR (object);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-/****************************************************************************/
-/* New widget. */
-/****************************************************************************/
-GtkWidget *
-gl_wdgt_vector_new (void)
-{
- glWdgtVector *vector;
-
- vector = g_object_new (gl_wdgt_vector_get_type (), NULL);
-
- gl_wdgt_vector_construct (vector);
-
- return GTK_WIDGET (vector);
-}
-
-/*-------------------------------------------------------------------------*/
-/* PRIVATE. Construct composite widget. */
-/*-------------------------------------------------------------------------*/
-static void
-gl_wdgt_vector_construct (glWdgtVector *vector)
-{
- GtkWidget *wvbox, *whbox;
- GtkObject *adjust;
- const gchar *units_string;
- gdouble units_per_point, climb_rate;
- gint digits;
-
- units_string = gl_prefs_get_units_string ();
- units_per_point = gl_prefs_get_units_per_point ();
- climb_rate = gl_prefs_get_units_step_size ();
- digits = gl_prefs_get_units_precision ();
-
- wvbox = GTK_WIDGET (vector);
-
- /* ---- Length line ---- */
- whbox = gl_hig_hbox_new ();
- gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), whbox);
-
- /* Length label */
- vector->len_label = gtk_label_new (_("Length:"));
- gtk_misc_set_alignment (GTK_MISC (vector->len_label), 0, 0.5);
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), vector->len_label);
-
- /* Length spin */
- adjust = gtk_adjustment_new (climb_rate, climb_rate, 100.0, climb_rate,
- 10.0, 10.0);
- vector->len_spin = gtk_spin_button_new (GTK_ADJUSTMENT (adjust),
- climb_rate, digits);
- gtk_spin_button_set_snap_to_ticks (GTK_SPIN_BUTTON (vector->len_spin),
- TRUE);
- gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (vector->len_spin), TRUE);
- g_signal_connect_swapped (G_OBJECT (vector->len_spin), "changed",
- G_CALLBACK (changed_cb),
- G_OBJECT (vector));
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), vector->len_spin);
-
- /* Length units label */
- vector->len_units_label = gtk_label_new (units_string);
- gtk_misc_set_alignment (GTK_MISC (vector->len_units_label), 0, 0.5);
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), vector->len_units_label);
-
- /* ---- Angle line ---- */
- whbox = gl_hig_hbox_new ();
- gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), whbox);
-
- /* Angle label */
- vector->angle_label = gtk_label_new (_("Angle:"));
- gtk_misc_set_alignment (GTK_MISC (vector->angle_label), 0, 0.5);
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), vector->angle_label);
-
- /* Angle spin */
- adjust = gtk_adjustment_new (0.0, -180.0, +180.0, 1.0, 10.0, 10.0);
- vector->angle_spin =
- gtk_spin_button_new (GTK_ADJUSTMENT (adjust), 1.0, 0);
- gtk_spin_button_set_snap_to_ticks (GTK_SPIN_BUTTON (vector->angle_spin),
- TRUE);
- gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (vector->angle_spin),
- TRUE);
- g_signal_connect_swapped (G_OBJECT (vector->angle_spin), "changed",
- G_CALLBACK (changed_cb),
- G_OBJECT (vector));
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), vector->angle_spin);
-
- /* Angle units label */
- vector->angle_units_label = gtk_label_new (_("degrees"));
- gtk_misc_set_alignment (GTK_MISC (vector->angle_units_label), 0, 0.5);
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), vector->angle_units_label);
-}
-
-/*--------------------------------------------------------------------------*/
-/* PRIVATE. Callback for when any control in the widget has changed. */
-/*--------------------------------------------------------------------------*/
-static void
-changed_cb (glWdgtVector * vector)
-{
- /* Emit our "changed" signal */
- g_signal_emit (G_OBJECT (vector), wdgt_vector_signals[CHANGED], 0);
-}
-
-/****************************************************************************/
-/* query values from controls. */
-/****************************************************************************/
-void
-gl_wdgt_vector_get_params (glWdgtVector *vector,
- gdouble *dx,
- gdouble *dy)
-{
- gdouble length, angle;
- gdouble units_per_point;
-
- units_per_point = gl_prefs_get_units_per_point ();
-
- length =
- gtk_spin_button_get_value (GTK_SPIN_BUTTON(vector->len_spin));
- angle =
- gtk_spin_button_get_value (GTK_SPIN_BUTTON(vector->angle_spin));
-
- length /= units_per_point;
-
- *dx = COMP_X (length, angle);
- *dy = COMP_Y (length, angle);
-}
-
-/****************************************************************************/
-/* set values and ranges for controls. */
-/****************************************************************************/
-void
-gl_wdgt_vector_set_params (glWdgtVector *vector,
- gdouble dx,
- gdouble dy,
- gdouble x_max,
- gdouble y_max)
-{
- GtkObject *length_adjust;
- gdouble length, angle;
- const gchar *units_string;
- gdouble units_per_point, climb_rate;
- gint digits;
-
- units_string = gl_prefs_get_units_string ();
- units_per_point = gl_prefs_get_units_per_point ();
- climb_rate = gl_prefs_get_units_step_size ();
- digits = gl_prefs_get_units_precision ();
-
- /* Put everything into our display units */
- dx *= units_per_point;
- dy *= units_per_point;
- x_max *= units_per_point;
- y_max *= units_per_point;
-
- length = LENGTH (dx, dy);
- angle = ANGLE (dx, dy);
-
- length_adjust = gtk_adjustment_new (length, 0.0, LENGTH (x_max, y_max),
- climb_rate, 10.0, 10.0);
- gtk_spin_button_configure (GTK_SPIN_BUTTON (vector->len_spin),
- GTK_ADJUSTMENT (length_adjust),
- climb_rate, digits);
- gtk_spin_button_update (GTK_SPIN_BUTTON (vector->len_spin));
-
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (vector->angle_spin), angle);
-}
-
-/****************************************************************************/
-/* Set size group for internal labels */
-/****************************************************************************/
-void
-gl_wdgt_vector_set_label_size_group (glWdgtVector *vector,
- GtkSizeGroup *label_size_group)
-{
- gtk_size_group_add_widget (label_size_group, vector->len_label);
- gtk_size_group_add_widget (label_size_group, vector->angle_label);
-}
+++ /dev/null
-/*
- * (GLABELS) Label and Business Card Creation program for GNOME
- *
- * wdgt_vector.h: vector properties widget module header file
- *
- * Copyright (C) 2001-2002 Jim Evins <evins@snaught.com>.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef __WDGT_VECTOR_H__
-#define __WDGT_VECTOR_H__
-
-#include <gnome.h>
-#include "label.h"
-#include "hig.h"
-
-G_BEGIN_DECLS
-
-#define GL_TYPE_WDGT_VECTOR (gl_wdgt_vector_get_type ())
-#define GL_WDGT_VECTOR(obj) \
- (GTK_CHECK_CAST((obj), GL_TYPE_WDGT_VECTOR, glWdgtVector ))
-#define GL_WDGT_VECTOR_CLASS(klass) \
- (GTK_CHECK_CLASS_CAST ((klass), GL_TYPE_WDGT_VECTOR, glWdgtVectorClass))
-#define GL_IS_WDGT_VECTOR(obj) \
- (GTK_CHECK_TYPE ((obj), GL_TYPE_WDGT_VECTOR))
-#define GL_IS_WDGT_VECTOR_CLASS(klass) \
- (GTK_CHECK_CLASS_TYPE ((klass), GL_TYPE_WDGT_VECTOR))
-
-typedef struct _glWdgtVector glWdgtVector;
-typedef struct _glWdgtVectorClass glWdgtVectorClass;
-
-struct _glWdgtVector {
- glHigVBox parent_widget;
-
- GtkWidget *len_label;
- GtkWidget *len_spin;
- GtkWidget *len_units_label;
-
- GtkWidget *angle_label;
- GtkWidget *angle_spin;
- GtkWidget *angle_units_label;
-};
-
-struct _glWdgtVectorClass {
- glHigVBoxClass parent_class;
-
- void (*changed) (glWdgtVector * vector, gpointer user_data);
-};
-
-guint gl_wdgt_vector_get_type (void);
-
-GtkWidget *gl_wdgt_vector_new (void);
-
-void gl_wdgt_vector_get_params (glWdgtVector *vector,
- gdouble *dx,
- gdouble *dy);
-
-void gl_wdgt_vector_set_params (glWdgtVector *vector,
- gdouble dx,
- gdouble dy,
- gdouble x_max,
- gdouble y_max);
-
-void gl_wdgt_vector_set_label_size_group (glWdgtVector *vector,
- GtkSizeGroup *label_size_group);
-
-G_END_DECLS
-
-#endif
/* Private macros and constants. */
/*============================================================================*/
-#define DEFAULT_WINDOW_WIDTH 700
+#define DEFAULT_WINDOW_WIDTH 788
#define DEFAULT_WINDOW_HEIGHT 560
#define CURSOR_INFO_WIDTH 150
window->property_bar =
GL_UI_PROPERTY_BAR(gl_ui_property_bar_new (ui_component));
+ window->sidebar =
+ GL_UI_SIDEBAR(gl_ui_sidebar_new (ui_component));
gtk_window_set_default_size (GTK_WINDOW (window),
DEFAULT_WINDOW_WIDTH,
gl_ui_update_all (window->uic, GL_VIEW(window->view));
gl_ui_property_bar_set_view (window->property_bar, GL_VIEW(window->view));
+ gl_ui_sidebar_set_view (window->sidebar, GL_VIEW(window->view));
string = g_strdup_printf ("%3.0f%%",
100.0*gl_view_get_zoom (GL_VIEW(window->view)));
#include "label.h"
#include "ui-property-bar.h"
+#include "ui-sidebar.h"
G_BEGIN_DECLS
GtkWidget *view;
glUIPropertyBar *property_bar;
+ glUISidebar *sidebar;
GtkWidget *cursor_info;
GtkWidget *cursor_info_frame;