<cmd name="ToolsLowerObjects"
_tip="Lower object to bottom"/>
- <cmd name="HelpContents" _label="Contents" _tip="Open the gedit manual"
+ <cmd name="HelpContents" _label="Contents" _tip="Open the glabels manual"
accel="F1" pixtype="stock" pixname="gtk-help"/>
- <cmd name="About" _label="About..." _tip="About this application"
+ <cmd name="About" _label="About..." _tip="About glabels"
pixtype="stock" pixname="About"/>
</dockitem>
+<status resize_grip="1">
+ <item name="main"/>
+ <control name="Zoom"/>
+ <control name="Cursor"/>
+</status>
+
</Root>
#include "debug.h"
-/*========================================================*/
-/* Private macros and constants. */
-/*========================================================*/
+/*=======================================================================================*/
+/* Private macros and constants. */
+/*=======================================================================================*/
#define GLABELS_UI_XML GLABELS_UI_DIR "glabels-ui.xml"
-/*========================================================*/
-/* Private types. */
-/*========================================================*/
+/*=======================================================================================*/
+/* Private types. */
+/*=======================================================================================*/
-/*===========================================*/
-/* Private globals */
-/*===========================================*/
+/*=======================================================================================*/
+/* Private globals */
+/*=======================================================================================*/
static BonoboUIVerb gl_ui_verbs [] = {
BONOBO_UI_VERB ("FileNew", gl_cmd_file_new),
};
-/*===========================================*/
-/* Local function prototypes */
-/*===========================================*/
+/*=======================================================================================*/
+/* Local function prototypes */
+/*=======================================================================================*/
-static void view_menu_item_toggled_cb (
- BonoboUIComponent *ui_component,
- const char *path,
- Bonobo_UIComponent_EventType type,
- const char *state,
- BonoboWindow *win);
+static void view_menu_item_toggled_cb (BonoboUIComponent *ui_component,
+ const char *path,
+ Bonobo_UIComponent_EventType type,
+ const char *state,
+ BonoboWindow *win);
-static void set_app_main_toolbar_style (BonoboUIComponent *ui_component);
-static void set_app_drawing_toolbar_style (BonoboUIComponent *ui_component);
+static void set_app_main_toolbar_style (BonoboUIComponent *ui_component);
-static void
-set_verb_sensitive (BonoboUIComponent *ui_component,
- gchar *cname,
- gboolean sensitive);
-static void
-set_verb_list_sensitive (BonoboUIComponent *ui_component,
- gchar **vlist,
- gboolean sensitive);
-static void
-set_verb_state (BonoboUIComponent *ui_component,
- gchar *cname,
- gboolean state);
+static void set_app_drawing_toolbar_style (BonoboUIComponent *ui_component);
+
+static void set_verb_sensitive (BonoboUIComponent *ui_component,
+ gchar *cname,
+ gboolean sensitive);
+
+static void set_verb_list_sensitive (BonoboUIComponent *ui_component,
+ gchar **vlist,
+ gboolean sensitive);
+
+static void set_verb_state (BonoboUIComponent *ui_component,
+ gchar *cname,
+ gboolean state);
\f
/*****************************************************************************/
void
gl_ui_init (BonoboUIComponent *ui_component,
- BonoboWindow *win)
+ BonoboWindow *win,
+ GtkWidget *cursor_info_frame,
+ GtkWidget *zoom_info_frame)
{
- GnomeRecentView *recent_view;
+ GnomeRecentView *recent_view;
GnomeRecentModel *recent_model;
+ BonoboControl *control;
gl_debug (DEBUG_UI, "START");
set_verb_list_sensitive (ui_component, doc_verbs, FALSE);
- /* add a GeditRecentView object */
+ /* Status bar */
+ bonobo_ui_component_set_prop (ui_component,
+ "/status", "hidden", "0", NULL);
+
+ control = bonobo_control_new (cursor_info_frame);
+ bonobo_ui_component_object_set (ui_component,
+ "/status/Cursor", BONOBO_OBJREF (control), NULL);
+ bonobo_object_unref (BONOBO_OBJECT (control));
+ bonobo_ui_component_set_prop (ui_component,
+ "/status/Cursor", "hidden", "0", NULL);
+
+ control = bonobo_control_new (zoom_info_frame);
+ bonobo_ui_component_object_set (ui_component,
+ "/status/Zoom", BONOBO_OBJREF (control), NULL);
+ bonobo_object_unref (BONOBO_OBJECT (control));
+ bonobo_ui_component_set_prop (ui_component,
+ "/status/Zoom", "hidden", "0", NULL);
+
+
+ /* add a GeditRecentView object */
recent_model = gl_recent_get_model ();
recent_view =
GNOME_RECENT_VIEW (gnome_recent_view_bonobo_new (ui_component,
#include "view.h"
-extern void gl_ui_init (BonoboUIComponent *ui_component,
- BonoboWindow *win);
+G_BEGIN_DECLS
-extern void gl_ui_update_all (BonoboUIComponent *ui_component,
- glView *view);
+void gl_ui_init (BonoboUIComponent *ui_component,
+ BonoboWindow *win,
+ GtkWidget *cursor_info_frame,
+ GtkWidget *zoom_info_frame);
-extern void gl_ui_update_nodoc (BonoboUIComponent *ui_component);
+void gl_ui_update_all (BonoboUIComponent *ui_component,
+ glView *view);
-extern void gl_ui_update_modified_verbs (BonoboUIComponent *ui_component,
- glLabel *label);
+void gl_ui_update_nodoc (BonoboUIComponent *ui_component);
-extern void gl_ui_update_selection_verbs (BonoboUIComponent *ui_component,
- glView *view);
+void gl_ui_update_modified_verbs (BonoboUIComponent *ui_component,
+ glLabel *label);
-extern void gl_ui_update_undo_redo_verbs (BonoboUIComponent *ui_component,
- glLabel *label);
+void gl_ui_update_selection_verbs (BonoboUIComponent *ui_component,
+ glView *view);
+
+void gl_ui_update_undo_redo_verbs (BonoboUIComponent *ui_component,
+ glLabel *label);
+
+G_END_DECLS
#endif /* __GL_UI_H__ */
#include "debug.h"
-/*========================================================*/
-/* Private macros and constants. */
-/*========================================================*/
+/*==========================================================================*/
+/* Private macros and constants. */
+/*==========================================================================*/
#define SEL_LINE_COLOR GL_COLOR_A (0, 0, 255, 128)
#define SEL_FILL_COLOR GL_COLOR_A (192, 192, 255, 128)
-/*========================================================*/
-/* Private types. */
-/*========================================================*/
+
+/*==========================================================================*/
+/* Private types. */
+/*==========================================================================*/
enum {
SELECTION_CHANGED,
LAST_SIGNAL
};
-/*===========================================*/
-/* Private globals */
-/*===========================================*/
+
+/*==========================================================================*/
+/* Private globals */
+/*==========================================================================*/
static GtkContainerClass *parent_class;
0.0
};
-/*===========================================*/
-/* Local function prototypes */
-/*===========================================*/
+
+/*==========================================================================*/
+/* Local function prototypes */
+/*==========================================================================*/
static void gl_view_class_init (glViewClass *class);
static void gl_view_init (glView *view);
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET (glViewClass, mode_changed),
NULL, NULL,
- gl_marshal_VOID__STRING,
+ gl_marshal_VOID__VOID,
G_TYPE_NONE,
- 1, G_TYPE_STRING);
+ 0);
gl_debug (DEBUG_VIEW, "END");
}
gnome_canvas_window_to_world (canvas,
event->motion.x,
event->motion.y, &x, &y);
- g_signal_emit (G_OBJECT(view), signals[ZOOM_CHANGED], 0, x, y);
+ g_signal_emit (G_OBJECT(view), signals[POINTER_MOVED], 0, x, y);
if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) {
gnome_canvas_item_set (item,
"x1", MIN (x, x0),
void (*pointer_moved) (glView *view,
gdouble x, gdouble y, gpointer user_data);
void (*mode_changed) (glView *view,
- gchar *modeline, gpointer user_data);
+ gpointer user_data);
};
-extern guint gl_view_get_type (void);
+G_BEGIN_DECLS
-extern GtkWidget *gl_view_new (glLabel *label);
+guint gl_view_get_type (void);
-extern void gl_view_raise_fg (glView *view);
+GtkWidget *gl_view_new (glLabel *label);
-extern void gl_view_arrow_mode (glView *view);
-extern void gl_view_object_create_mode (glView *view,
- glLabelObjectType type);
-extern void gl_view_select_object (glView *view,
- glViewObject *view_object);
-extern void gl_view_unselect_object (glView *view,
- glViewObject *view_object);
-extern void gl_view_select_all (glView *view);
-extern void gl_view_unselect_all (glView *view);
-extern void gl_view_select_region (glView *view,
- gdouble x1,
- gdouble y1,
- gdouble x2,
- gdouble y2);
+void gl_view_raise_fg (glView *view);
-extern gboolean gl_view_is_selection_empty (glView *view);
-extern gboolean gl_view_is_selection_atomic(glView *view);
-extern void gl_view_delete_selection (glView *view);
-extern void gl_view_edit_object_props (glView *view);
-extern void gl_view_raise_selection (glView *view);
-extern void gl_view_lower_selection (glView *view);
+void gl_view_arrow_mode (glView *view);
-extern void gl_view_cut (glView *view);
-extern void gl_view_copy (glView *view);
-extern void gl_view_paste (glView *view);
+void gl_view_object_create_mode (glView *view,
+ glLabelObjectType type);
-extern void gl_view_zoom_in (glView *view);
-extern void gl_view_zoom_out (glView *view);
-extern void gl_view_set_zoom (glView *view, gdouble scale);
-extern gdouble gl_view_get_zoom (glView *view);
-extern int gl_view_item_event_handler (GnomeCanvasItem *item,
- GdkEvent *event,
- glViewObject *view_object);
+void gl_view_select_object (glView *view,
+ glViewObject *view_object);
+
+void gl_view_unselect_object (glView *view,
+ glViewObject *view_object);
+
+void gl_view_select_all (glView *view);
+
+void gl_view_unselect_all (glView *view);
+
+void gl_view_select_region (glView *view,
+ gdouble x1,
+ gdouble y1,
+ gdouble x2,
+ gdouble y2);
+
+gboolean gl_view_is_selection_empty (glView *view);
+
+gboolean gl_view_is_selection_atomic(glView *view);
+
+void gl_view_delete_selection (glView *view);
+
+void gl_view_edit_object_props (glView *view);
+
+void gl_view_raise_selection (glView *view);
+
+void gl_view_lower_selection (glView *view);
+
+void gl_view_cut (glView *view);
+
+void gl_view_copy (glView *view);
+
+void gl_view_paste (glView *view);
+
+
+void gl_view_zoom_in (glView *view);
+
+void gl_view_zoom_out (glView *view);
+
+void gl_view_set_zoom (glView *view,
+ gdouble scale);
+
+gdouble gl_view_get_zoom (glView *view);
+
+
+int gl_view_item_event_handler (GnomeCanvasItem *item,
+ GdkEvent *event,
+ glViewObject *view_object);
+
+G_END_DECLS
#endif
#include "debug.h"
-/*========================================================*/
-/* Private macros and constants. */
-/*========================================================*/
+/*============================================================================*/
+/* Private macros and constants. */
+/*============================================================================*/
+
#define DEFAULT_WINDOW_WIDTH 500
#define DEFAULT_WINDOW_HEIGHT 375
+#define CURSOR_INFO_WIDTH 150
+#define ZOOM_INFO_WIDTH 50
-/*===========================================*/
-/* Private globals */
-/*===========================================*/
+/*============================================================================*/
+/* Private globals */
+/*============================================================================*/
static BonoboWindowClass *parent_class;
static GList *window_list = NULL;
-/*===========================================*/
-/* Local function prototypes */
-/*===========================================*/
+/*============================================================================*/
+/* Local function prototypes */
+/*============================================================================*/
static void gl_window_class_init (glWindowClass *class);
static void gl_window_init (glWindow *window);
static void selection_changed_cb (glView *view,
glWindow *window);
+static void zoom_changed_cb (glView *view,
+ gdouble zoom,
+ glWindow *window);
+
static void name_changed_cb (glLabel *label,
glWindow *window);
bonobo_ui_component_set_container (ui_component,
BONOBO_OBJREF (ui_container),
NULL);
- gl_ui_init (ui_component, BONOBO_WINDOW (window));
+
+ window->cursor_info = gtk_label_new (NULL);
+ gtk_widget_set_size_request (window->cursor_info, CURSOR_INFO_WIDTH, -1);
+ window->cursor_info_frame = gtk_frame_new (NULL);
+ gtk_frame_set_shadow_type (GTK_FRAME(window->cursor_info_frame), GTK_SHADOW_IN);
+ gtk_container_add (GTK_CONTAINER(window->cursor_info_frame), window->cursor_info);
+ gtk_widget_show_all (window->cursor_info_frame);
+
+ window->zoom_info = gtk_label_new (NULL);
+ gtk_widget_set_size_request (window->zoom_info, ZOOM_INFO_WIDTH, -1);
+ window->zoom_info_frame = gtk_frame_new (NULL);
+ gtk_frame_set_shadow_type (GTK_FRAME(window->zoom_info_frame), GTK_SHADOW_IN);
+ gtk_container_add (GTK_CONTAINER(window->zoom_info_frame), window->zoom_info);
+ gtk_widget_show_all (window->zoom_info_frame);
+
+ gl_ui_init (ui_component,
+ BONOBO_WINDOW (window),
+ window->cursor_info_frame,
+ window->zoom_info_frame);
gtk_window_set_default_size (GTK_WINDOW (window),
DEFAULT_WINDOW_WIDTH,
gl_window_set_label (glWindow *window,
glLabel *label)
{
+ gchar *string;
+
gl_debug (DEBUG_WINDOW, "START");
g_return_if_fail (GL_IS_WINDOW (window));
gl_ui_update_all (window->uic, GL_VIEW(window->view));
+ string = g_strdup_printf ("%3.0f%%",
+ 100.0*gl_view_get_zoom (GL_VIEW(window->view)));
+ gtk_label_set_text (GTK_LABEL(window->zoom_info), string);
+ g_free (string);
+
g_signal_connect (G_OBJECT(window->view), "selection_changed",
G_CALLBACK(selection_changed_cb), window);
+ g_signal_connect (G_OBJECT(window->view), "zoom_changed",
+ G_CALLBACK(zoom_changed_cb), window);
+
g_signal_connect (G_OBJECT(label), "name_changed",
G_CALLBACK(name_changed_cb), window);
gl_debug (DEBUG_WINDOW, "END");
}
+/*---------------------------------------------------------------------------*/
+/* PRIVATE. View "zoom state changed" callback. */
+/*---------------------------------------------------------------------------*/
+static void
+zoom_changed_cb (glView *view,
+ gdouble zoom,
+ glWindow *window)
+{
+ gchar *string;
+
+ gl_debug (DEBUG_WINDOW, "START");
+
+ g_return_if_fail (view && GL_IS_VIEW (view));
+ g_return_if_fail (window && GL_IS_WINDOW (window));
+
+ string = g_strdup_printf ("%3.0f%%", 100.0*zoom);
+ gtk_label_set_text (GTK_LABEL(window->zoom_info), string);
+ g_free (string);
+
+ gl_debug (DEBUG_WINDOW, "END");
+}
+
/*---------------------------------------------------------------------------*/
/* PRIVATE. Label "name changed" callback. */
/*---------------------------------------------------------------------------*/
BonoboUIComponent *uic;
GtkWidget *view;
+
+ GtkWidget *cursor_info;
+ GtkWidget *cursor_info_frame;
+ GtkWidget *zoom_info;
+ GtkWidget *zoom_info_frame;
};
struct _glWindowClass {