[dia/zbrown/gresource-icons: 7/12] Use standard cursors as much as possible
- From: Zander <zbrown src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dia/zbrown/gresource-icons: 7/12] Use standard cursors as much as possible
- Date: Fri, 1 Mar 2019 23:37:34 +0000 (UTC)
commit faaa640e8486877ad8d4544cec827506b09021fc
Author: Zander Brown <zbrown gnome org>
Date: Mon Feb 11 18:32:51 2019 +0000
Use standard cursors as much as possible
app/create_object.c | 65 ++++----
app/cursor.c | 99 ++----------
app/cursor.h | 12 +-
app/dia.gresource.xml | 1 +
app/display.c | 170 ++++++++++++---------
app/display.h | 3 +-
.../dia-cursor-create.png} | Bin
app/magnify.c | 12 +-
app/modify_tool.c | 118 +++++++-------
app/pixmaps/cursor-create-data.png | Bin 196 -> 0 bytes
app/pixmaps/cursor-hand-closed.png | Bin 205 -> 0 bytes
app/pixmaps/cursor-hand-open.png | Bin 223 -> 0 bytes
app/pixmaps/cursor-magnify-minus.png | Bin 250 -> 0 bytes
app/pixmaps/cursor-magnify-plus.png | Bin 268 -> 0 bytes
app/pixmaps/meson.build | 8 +-
app/scroll_tool.c | 21 +--
app/textedit_tool.c | 14 +-
17 files changed, 232 insertions(+), 291 deletions(-)
---
diff --git a/app/create_object.c b/app/create_object.c
index 6804123b..a88bf975 100644
--- a/app/create_object.c
+++ b/app/create_object.c
@@ -31,6 +31,7 @@
#include "object.h"
#include "intl.h"
#include "menus.h"
+#include "widgets.h"
static void create_object_button_press(CreateObjectTool *tool, GdkEventButton *event,
DDisplay *ddisp);
@@ -84,7 +85,7 @@ create_object_button_press(CreateObjectTool *tool, GdkEventButton *event,
(obj->ops->move)(obj, &origpoint);
}
}
-
+
if (!(event->state & GDK_SHIFT_MASK)) {
/* Not Multi-select => remove current selection */
diagram_remove_all_selected(ddisp->diagram, TRUE);
@@ -100,16 +101,16 @@ create_object_button_press(CreateObjectTool *tool, GdkEventButton *event,
object_add_updates(obj, ddisp->diagram);
ddisplay_do_update_menu_sensitivity(ddisp);
diagram_flush(ddisp->diagram);
-
+
if (handle2 != NULL) {
tool->handle = handle2;
tool->moving = TRUE;
tool->last_to = handle2->pos;
-
+
gdk_pointer_grab (gtk_widget_get_window(ddisp->canvas), FALSE,
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON1_MOTION_MASK | GDK_BUTTON_RELEASE_MASK,
NULL, NULL, event->time);
- ddisplay_set_all_cursor(get_cursor(CURSOR_SCROLL));
+ ddisplay_set_all_cursor_name (NULL, "move");
} else {
diagram_update_extents(ddisp->diagram);
tool->moving = FALSE;
@@ -147,14 +148,14 @@ create_object_button_release(CreateObjectTool *tool, GdkEventButton *event,
}
- parent_candidates =
- layer_find_objects_containing_rectangle(obj->parent_layer,
+ parent_candidates =
+ layer_find_objects_containing_rectangle(obj->parent_layer,
&obj->bounding_box);
/* whole object must be within another object to parent it */
for (; parent_candidates != NULL; parent_candidates = g_list_next(parent_candidates)) {
DiaObject *parent_obj = (DiaObject *) parent_candidates->data;
- if (obj != parent_obj
+ if (obj != parent_obj
&& object_within_parent(obj, parent_obj)) {
Change *change = undo_parenting(ddisp->diagram, parent_obj, obj, TRUE);
(change->apply)(change, ddisp->diagram);
@@ -169,7 +170,7 @@ create_object_button_release(CreateObjectTool *tool, GdkEventButton *event,
list = g_list_prepend(list, tool->obj);
- undo_insert_objects(ddisp->diagram, list, 1);
+ undo_insert_objects(ddisp->diagram, list, 1);
if (tool->moving) {
if (tool->handle->connect_type != HANDLE_NONCONNECTABLE) {
@@ -179,16 +180,16 @@ create_object_button_release(CreateObjectTool *tool, GdkEventButton *event,
}
tool->moving = FALSE;
tool->handle = NULL;
- tool->obj = NULL;
+ tool->obj = NULL;
}
-
+
{
/* remove position from status bar */
GtkStatusbar *statusbar = GTK_STATUSBAR (ddisp->modified_status);
guint context_id = gtk_statusbar_get_context_id (statusbar, "ObjectPos");
gtk_statusbar_pop (statusbar, context_id);
}
-
+
highlight_reset_all(ddisp->diagram);
reset = prefs.reset_tools_after_create != tool->invert_persistence;
/* kind of backward: first starting editing to see if it is possible at all, than GUI reflection */
@@ -200,7 +201,7 @@ create_object_button_release(CreateObjectTool *tool, GdkEventButton *event,
diagram_modified(ddisp->diagram);
undo_set_transactionpoint(ddisp->diagram->undo);
-
+
if (reset)
tool_reset();
ddisplay_set_all_cursor(default_cursor);
@@ -219,7 +220,7 @@ create_object_motion(CreateObjectTool *tool, GdkEventMotion *event,
if (!tool->moving)
return;
-
+
ddisplay_untransform_coords(ddisp, event->x, event->y, &to.x, &to.y);
/* make sure the new object is restricted to its parent */
@@ -230,21 +231,21 @@ create_object_motion(CreateObjectTool *tool, GdkEventMotion *event,
tool->handle->connect_type != HANDLE_NONCONNECTABLE) {
connectionpoint =
object_find_connectpoint_display(ddisp, &to, tool->obj, TRUE);
-
+
if (connectionpoint != NULL) {
to = connectionpoint->pos;
highlight_object(connectionpoint->object, DIA_HIGHLIGHT_CONNECTIONPOINT, ddisp->diagram);
- ddisplay_set_all_cursor(get_cursor(CURSOR_CONNECT));
+ ddisplay_set_all_cursor_name (NULL, "crosshair");
}
}
-
+
if (connectionpoint == NULL) {
/* No connectionopoint near, then snap to grid (if enabled) */
snap_to_grid(ddisp, &to.x, &to.y);
highlight_reset_all(ddisp->diagram);
- ddisplay_set_all_cursor(get_cursor(CURSOR_SCROLL));
+ ddisplay_set_all_cursor_name (NULL, "move");
}
-
+
object_add_updates(tool->obj, ddisp->diagram);
tool->obj->ops->move_handle(tool->obj, tool->handle, &to, connectionpoint,
HANDLE_MOVE_CREATE, 0);
@@ -253,22 +254,22 @@ create_object_motion(CreateObjectTool *tool, GdkEventMotion *event,
/* Put current mouse position in status bar */
statusbar = GTK_STATUSBAR (ddisp->modified_status);
context_id = gtk_statusbar_get_context_id (statusbar, "ObjectPos");
-
+
postext = g_strdup_printf("%.3f, %.3f - %.3f, %.3f",
tool->obj->bounding_box.left,
tool->obj->bounding_box.top,
tool->obj->bounding_box.right,
tool->obj->bounding_box.bottom);
-
- gtk_statusbar_pop (statusbar, context_id);
+
+ gtk_statusbar_pop (statusbar, context_id);
gtk_statusbar_push (statusbar, context_id, postext);
g_free(postext);
-
+
diagram_flush(ddisp->diagram);
tool->last_to = to;
-
+
return;
}
@@ -286,14 +287,26 @@ create_create_object_tool(DiaObjectType *objtype, void *user_data,
tool->tool.button_release_func = (ButtonReleaseFunc) &create_object_button_release;
tool->tool.motion_func = (MotionFunc) &create_object_motion;
tool->tool.double_click_func = (DoubleClickFunc) &create_object_double_click;
-
+
tool->objtype = objtype;
tool->user_data = user_data;
tool->moving = FALSE;
tool->invert_persistence = invert_persistence;
- ddisplay_set_all_cursor(get_cursor(CURSOR_CREATE));
-
+ {
+ GdkDisplay *disp;
+ GdkCursor *cursor;
+
+ disp = gdk_display_get_default ();
+
+ cursor = gdk_cursor_new_from_pixbuf (disp,
+ pixbuf_from_resource ("/org/gnome/Dia/icons/dia-cursor-create.png"),
+ 0, 0);
+
+
+ ddisplay_set_all_cursor (cursor);
+ }
+
return (Tool *) tool;
}
diff --git a/app/cursor.c b/app/cursor.c
index 4dd45ade..964357bb 100644
--- a/app/cursor.c
+++ b/app/cursor.c
@@ -20,104 +20,27 @@
#include <gdk/gdk.h>
-#define DIA_CURSOR GDK_LAST_CURSOR
-
#include "display.h"
#include "cursor.h"
-#include "dia-app-icons.h"
-
-static struct {
- /* Can't use a union because it can't be statically initialized
- (except for the first element) */
- int gdk_cursor_number;
- const guint8 *data;
- int hot_x;
- int hot_y;
- GdkCursor *cursor;
-} cursors[MAX_CURSORS] = {
- { GDK_LEFT_PTR }, /* CURSOR_POINT */
- { DIA_CURSOR, /* CURSOR_CREATE */
- dia_cursor_create_icon,
- 0, 0},
- { GDK_FLEUR }, /* CURSOR_SCROLL */
- { DIA_CURSOR, /* CURSOR_GRAB */
- dia_cursor_hand_open_icon,
- 10, 10 },
- { DIA_CURSOR, /* CURSOR_GRABBING */
- dia_cursor_hand_closed_icon,
- 10, 10 },
- { DIA_CURSOR, /* CURSOR_ZOOM_OUT */
- dia_cursor_magnify_minus_icon,
- 8, 8 },
- { DIA_CURSOR, /* CURSOR_ZOOM_IN */
- dia_cursor_magnify_plus_icon,
- 8, 8 },
- { GDK_CROSS_REVERSE }, /* CURSOR_CONNECT */
- { GDK_XTERM }, /* CURSOR_XTERM */
+static int cursors[MAX_CURSORS] = {
/* for safety reasons these should be last and must be in the same order HANDLE_RESIZE_* */
- { GDK_TOP_LEFT_CORNER },/* CURSOR_DIRECTION_0 + NW */
- { GDK_TOP_SIDE },/* N */
- { GDK_TOP_RIGHT_CORNER },/* NE */
- { GDK_LEFT_SIDE },/* W */
- { GDK_RIGHT_SIDE },/* E */
- { GDK_BOTTOM_LEFT_CORNER },/* SE */
- { GDK_BOTTOM_SIDE },/* S */
- { GDK_BOTTOM_RIGHT_CORNER }, /* SW */
+ GDK_TOP_LEFT_CORNER, /* CURSOR_DIRECTION_0 + NW */
+ GDK_TOP_SIDE, /* N */
+ GDK_TOP_RIGHT_CORNER, /* NE */
+ GDK_LEFT_SIDE, /* W */
+ GDK_RIGHT_SIDE, /* E */
+ GDK_BOTTOM_LEFT_CORNER, /* SE */
+ GDK_BOTTOM_SIDE, /* S */
+ GDK_BOTTOM_RIGHT_CORNER, /* SW */
};
-
-static GdkCursor *create_cursor(GdkWindow *window,
- const guint8 *data,
- int hot_x, int hot_y);
-
GdkCursor *
-get_cursor(DiaCursorType ctype)
+direction_cursor (DiaCursorType ctype)
{
if (ctype >= G_N_ELEMENTS (cursors)) {
return NULL;
}
- if (cursors[ctype].cursor == NULL) {
- GdkCursor *new_cursor = NULL;
-
- if (cursors[ctype].gdk_cursor_number != DIA_CURSOR) {
- new_cursor = gdk_cursor_new(cursors[ctype].gdk_cursor_number);
- } else {
- DDisplay *active_display = ddisplay_active ();
- if (active_display != NULL)
- new_cursor = create_cursor(gtk_widget_get_window(active_display->canvas),
- cursors[ctype].data,
- cursors[ctype].hot_x,
- cursors[ctype].hot_y);
- }
- cursors[ctype].cursor = new_cursor;
- }
-
- return cursors[ctype].cursor;
-}
-
-GdkCursor *
-create_cursor(GdkWindow *window,
- const guint8 *data,
- int hot_x, int hot_y)
-{
- GdkPixbuf *pixbuf;
- GdkCursor *cursor;
- GdkDisplay *display;
-
- g_return_val_if_fail(window != NULL, NULL);
-#if GTK_CHECK_VERSION (2,24,0)
- display = gdk_window_get_display (window);
-#else
- display = gdk_drawable_get_display (GDK_DRAWABLE (window));
-#endif
-
- pixbuf = gdk_pixbuf_new_from_inline(-1, data, FALSE, NULL);
-
- cursor = gdk_cursor_new_from_pixbuf (display, pixbuf, hot_x,hot_y);
- g_assert(cursor != NULL);
-
- g_object_unref(pixbuf);
- return cursor;
+ return gdk_cursor_new (cursors[ctype]);
}
diff --git a/app/cursor.h b/app/cursor.h
index 2b185cfb..2ada50dd 100644
--- a/app/cursor.h
+++ b/app/cursor.h
@@ -21,19 +21,9 @@
by a toolkit */
typedef enum {
- CURSOR_POINT,
- CURSOR_CREATE,
- CURSOR_SCROLL,
- CURSOR_GRAB,
- CURSOR_GRABBING,
- CURSOR_ZOOM_OUT,
- CURSOR_ZOOM_IN,
- CURSOR_CONNECT,
- CURSOR_XTERM,
CURSOR_DIRECTION_0, /* there are eight of them */
CURSOR_DIRECTION_7 = CURSOR_DIRECTION_0 + 7,
MAX_CURSORS
} DiaCursorType;
-/* Preferred way to get a cursor */
-GdkCursor *get_cursor(DiaCursorType ctype);
+GdkCursor *direction_cursor (DiaCursorType ctype);
diff --git a/app/dia.gresource.xml b/app/dia.gresource.xml
index 5578993d..d8b13f1b 100644
--- a/app/dia.gresource.xml
+++ b/app/dia.gresource.xml
@@ -2,6 +2,7 @@
<gresources>
<gresource prefix="/org/gnome/Dia">
<file>icons/org.gnome.Dia.png</file>
+ <file>icons/dia-cursor-create.png</file>
<file>icons/dia-group.png</file>
<file>icons/dia-ungroup.png</file>
<file>icons/dia-grid-on.png</file>
diff --git a/app/display.c b/app/display.c
index a6210880..64b32919 100644
--- a/app/display.c
+++ b/app/display.c
@@ -71,7 +71,7 @@ update_zoom_status(DDisplay *ddisp)
zoom_text = g_strdup_printf("%.0f%%",
ddisp->zoom_factor * 100.0 / DDISPLAY_NORMAL_ZOOM);
- integrated_ui_toolbar_set_zoom_text (ddisp->common_toolbar, zoom_text);
+ integrated_ui_toolbar_set_zoom_text (ddisp->common_toolbar, zoom_text);
}
else
{
@@ -103,8 +103,8 @@ selection_changed (Diagram* dia, int n, DDisplay* ddisp)
{
gchar *msg;
- /* http://www.gnu.org/software/gettext/manual/html_chapter/gettext_10.html#SEC150
- * Althoug the single objects wont get triggered here some languages have variations on the other
numbers
+ /* http://www.gnu.org/software/gettext/manual/html_chapter/gettext_10.html#SEC150
+ * Althoug the single objects wont get triggered here some languages have variations on the other numbers
*/
msg = g_strdup_printf (ngettext ("Selection of %d object", "Selection of %d objects", n), n);
gtk_statusbar_pop (statusbar, context_id);
@@ -126,7 +126,7 @@ selection_changed (Diagram* dia, int n, DDisplay* ddisp)
}
else
{
- gtk_statusbar_pop (statusbar, context_id);
+ gtk_statusbar_pop (statusbar, context_id);
}
/* selection-changed signal can also be emitted from outside of the dia core */
ddisplay_do_update_menu_sensitivity (ddisp);
@@ -152,7 +152,7 @@ initialize_display_widgets(DDisplay *ddisp)
G_CALLBACK (ddisplay_im_context_preedit_changed),
ddisp);
ddisp->preedit_attrs = NULL;
-
+
filename = strrchr(dia->filename, G_DIR_SEPARATOR);
if (filename==NULL) {
filename = dia->filename;
@@ -181,7 +181,7 @@ copy_display(DDisplay *orig_ddisp)
{
DDisplay *ddisp;
Diagram *dia = orig_ddisp->diagram;
-
+
ddisp = g_new0(DDisplay,1);
ddisp->diagram = orig_ddisp->diagram;
@@ -192,18 +192,18 @@ copy_display(DDisplay *orig_ddisp)
ddisp->show_cx_pts = orig_ddisp->show_cx_pts;
-
+
ddisp->autoscroll = orig_ddisp->autoscroll;
ddisp->mainpoint_magnetism = orig_ddisp->mainpoint_magnetism;
ddisp->aa_renderer = orig_ddisp->aa_renderer;
-
+
ddisp->update_areas = orig_ddisp->update_areas;
ddisp->display_areas = orig_ddisp->display_areas;
ddisp->update_id = 0;
ddisp->clicked_position.x = ddisp->clicked_position.y = 0.0;
-
+
diagram_add_ddisplay(dia, ddisp);
g_signal_connect (dia, "selection_changed", G_CALLBACK(selection_changed), ddisp);
ddisp->origo = orig_ddisp->origo;
@@ -225,7 +225,7 @@ new_display(Diagram *dia)
DDisplay *ddisp;
Rectangle visible;
int preset;
-
+
ddisp = g_new0(DDisplay,1);
ddisp->diagram = dia;
@@ -234,29 +234,29 @@ new_display(Diagram *dia)
ddisp->grid.visible = prefs.grid.visible;
preset = GPOINTER_TO_INT (g_object_get_data (G_OBJECT(dia), "show-grid"));
- if (preset != 0)
+ if (preset != 0)
ddisp->grid.visible = (preset > 0 ? TRUE : FALSE);
ddisp->grid.snap = prefs.grid.snap;
preset = GPOINTER_TO_INT (g_object_get_data (G_OBJECT(dia), "snap-to-grid"));
- if (preset != 0)
+ if (preset != 0)
ddisp->grid.snap = (preset > 0 ? TRUE : FALSE);
ddisp->show_cx_pts = prefs.show_cx_pts;
preset = GPOINTER_TO_INT (g_object_get_data (G_OBJECT(dia), "show-connection-points"));
- if (preset != 0)
+ if (preset != 0)
ddisp->show_cx_pts = (preset > 0 ? TRUE : FALSE);
ddisp->autoscroll = TRUE;
ddisp->mainpoint_magnetism = prefs.snap_object;
preset = GPOINTER_TO_INT (g_object_get_data (G_OBJECT(dia), "snap-to-object"));
- if (preset != 0)
+ if (preset != 0)
ddisp->mainpoint_magnetism = (preset > 0 ? TRUE : FALSE);
ddisp->aa_renderer = prefs.view_antialiased;
preset = GPOINTER_TO_INT (g_object_get_data (G_OBJECT(dia), "antialiased"));
- if (preset != 0)
+ if (preset != 0)
ddisp->aa_renderer = (preset > 0 ? TRUE : FALSE);
-
+
ddisp->update_areas = NULL;
ddisp->display_areas = NULL;
ddisp->update_id = 0;
@@ -294,7 +294,7 @@ ddisplay_transform_coords_double(DDisplay *ddisp,
Rectangle *visible = &ddisp->visible;
double width = dia_renderer_get_width_pixels (ddisp->renderer);
double height = dia_renderer_get_height_pixels (ddisp->renderer);
-
+
*xi = (x - visible->left) * (real)width / (visible->right - visible->left);
*yi = (y - visible->top) * (real)height / (visible->bottom - visible->top);
}
@@ -308,7 +308,7 @@ ddisplay_transform_coords(DDisplay *ddisp,
Rectangle *visible = &ddisp->visible;
int width = dia_renderer_get_width_pixels (ddisp->renderer);
int height = dia_renderer_get_height_pixels (ddisp->renderer);
-
+
*xi = ROUND ( (x - visible->left) * (real)width /
(visible->right - visible->left) );
*yi = ROUND ( (y - visible->top) * (real)height /
@@ -338,7 +338,7 @@ ddisplay_untransform_coords(DDisplay *ddisp,
Rectangle *visible = &ddisp->visible;
int width = dia_renderer_get_width_pixels (ddisp->renderer);
int height = dia_renderer_get_height_pixels (ddisp->renderer);
-
+
*x = visible->left + xi*(visible->right - visible->left) / (real)width;
*y = visible->top + yi*(visible->bottom - visible->top) / (real)height;
}
@@ -390,7 +390,7 @@ ddisplay_free_update_areas(DDisplay *ddisp)
ddisp->update_areas = NULL;
}
-/** Marks the entire visible area for update.
+/** Marks the entire visible area for update.
* Throws out old updates, since everything will be updated anyway.
*/
void
@@ -449,19 +449,19 @@ ddisplay_add_update(DDisplay *ddisp, const Rectangle *rect)
rectangle_union(r, rect);
rectangle_intersection(r, &ddisp->visible);
}
-
+
visible = &ddisp->visible;
left = floor( (r->left - visible->left) * (real)width /
(visible->right - visible->left) ) - 1;
top = floor( (r->top - visible->top) * (real)height /
- (visible->bottom - visible->top) ) - 1;
+ (visible->bottom - visible->top) ) - 1;
right = ceil( (r->right - visible->left) * (real)width /
(visible->right - visible->left) ) + 1;
bottom = ceil( (r->bottom - visible->top) * (real)height /
(visible->bottom - visible->top) ) + 1;
ddisplay_add_display_area(ddisp,
- left, top,
+ left, top,
right, bottom);
}
@@ -479,14 +479,14 @@ ddisplay_add_display_area(DDisplay *ddisp,
if (top < 0)
top = 0;
if (right > dia_renderer_get_width_pixels (ddisp->renderer))
- right = dia_renderer_get_width_pixels (ddisp->renderer);
+ right = dia_renderer_get_width_pixels (ddisp->renderer);
if (bottom > dia_renderer_get_height_pixels (ddisp->renderer))
- bottom = dia_renderer_get_height_pixels (ddisp->renderer);
-
+ bottom = dia_renderer_get_height_pixels (ddisp->renderer);
+
/* draw some rectangles to show where updates are...*/
/*
- gdk_draw_rectangle(gtk_widget_get_window(ddisp->canvas),
- gtk_widget_get_style(ddisp->canvas)->black_gc, TRUE,
+ gdk_draw_rectangle(gtk_widget_get_window(ddisp->canvas),
+ gtk_widget_get_style(ddisp->canvas)->black_gc, TRUE,
left, top, right-left,bottom-top);
*/
/* Temporarily just do a union of all Irectangles: */
@@ -497,7 +497,7 @@ ddisplay_add_display_area(DDisplay *ddisp,
ddisp->display_areas = g_slist_prepend(ddisp->display_areas, r);
} else {
r = (IRectangle *) ddisp->display_areas->data;
-
+
r->top = MIN( r->top, top );
r->bottom = MAX( r->bottom, bottom );
r->left = MIN( r->left, left );
@@ -523,7 +523,7 @@ ddisplay_update_handler(DDisplay *ddisp)
if (l != NULL)
{
totrect = *(Rectangle *) l->data;
-
+
g_return_val_if_fail ( renderer->clip_region_clear != NULL
&& renderer->clip_region_add_rect != NULL, FALSE);
@@ -534,7 +534,7 @@ ddisplay_update_handler(DDisplay *ddisp)
rectangle_union(&totrect, r);
renderer->clip_region_add_rect (ddisp->renderer, r);
-
+
l = g_slist_next(l);
}
/* Free update_areas list: */
@@ -544,7 +544,7 @@ ddisplay_update_handler(DDisplay *ddisp)
totrect.right += 0.1;
totrect.top -= 0.1;
totrect.bottom += 0.1;
-
+
ddisplay_render_pixmap(ddisp, &totrect);
}
@@ -553,11 +553,11 @@ ddisplay_update_handler(DDisplay *ddisp)
ir = (IRectangle *) l->data;
g_return_val_if_fail (renderer->copy_to_window, FALSE);
- renderer->copy_to_window(ddisp->renderer,
+ renderer->copy_to_window(ddisp->renderer,
gtk_widget_get_window(ddisp->canvas),
ir->left, ir->top,
ir->right - ir->left, ir->bottom - ir->top);
-
+
l = g_slist_next(l);
}
@@ -602,7 +602,7 @@ ddisplay_obj_render(DiaObject *obj, DiaRenderer *renderer,
else /* maybe the renderer does not support highlighting */
DIA_RENDERER_GET_CLASS(renderer)->draw_object(renderer, obj, NULL);
- if (ddisp->show_cx_pts &&
+ if (ddisp->show_cx_pts &&
obj->parent_layer != NULL && obj->parent_layer->connectable) {
object_draw_connectionpoints(obj, ddisp);
}
@@ -618,7 +618,7 @@ ddisplay_render_pixmap(DDisplay *ddisp, Rectangle *update)
#ifdef TRACES
GTimer *timer;
#endif
-
+
if (ddisp->renderer==NULL) {
printf("ERROR! Renderer was NULL!!\n");
return;
@@ -717,13 +717,13 @@ ddisplay_set_origo(DDisplay *ddisp, coord x, coord y)
if (ddisp->zoom_factor<DDISPLAY_MIN_ZOOM)
ddisp->zoom_factor = DDISPLAY_MIN_ZOOM;
-
+
if (ddisp->zoom_factor > DDISPLAY_MAX_ZOOM)
ddisp->zoom_factor = DDISPLAY_MAX_ZOOM;
width = dia_renderer_get_width_pixels (ddisp->renderer);
height = dia_renderer_get_height_pixels (ddisp->renderer);
-
+
visible->left = ddisp->origo.x;
visible->top = ddisp->origo.y;
visible->right = ddisp->origo.x + ddisplay_untransform_length(ddisp, width);
@@ -761,7 +761,7 @@ ddisplay_zoom(DDisplay *ddisp, Point *point, real magnify)
ddisplay_set_origo(ddisp, point->x - width/2.0, point->y - height/2.0);
-
+
ddisplay_update_scrollbars(ddisp);
ddisplay_add_update_all(ddisp);
ddisplay_flush(ddisp);
@@ -785,9 +785,9 @@ ddisplay_zoom_middle(DDisplay *ddisp, real magnify)
}
/*
- When using the mouse wheel button to zoom in and out, it is more
- intuitive to maintain the drawing zoom center-point based on the
- cursor position. This can help orientation and prevent the drawing
+ When using the mouse wheel button to zoom in and out, it is more
+ intuitive to maintain the drawing zoom center-point based on the
+ cursor position. This can help orientation and prevent the drawing
from "jumping" around while zooming in and out.
*/
void
@@ -884,7 +884,7 @@ ddisplay_autoscroll(DDisplay *ddisp, int x, int y)
{
guint16 width, height;
Point scroll;
-
+
if (! ddisp->autoscroll)
return FALSE;
@@ -921,7 +921,7 @@ ddisplay_autoscroll(DDisplay *ddisp, int x, int y)
scrolled = ddisplay_scroll(ddisp, &scroll);
if (scrolled) {
- ddisplay_flush(ddisp);
+ ddisplay_flush(ddisp);
return TRUE;
}
}
@@ -929,7 +929,7 @@ ddisplay_autoscroll(DDisplay *ddisp, int x, int y)
}
/** Scroll the display by delta (diagram coords) */
-gboolean
+gboolean
ddisplay_scroll(DDisplay *ddisp, Point *delta)
{
Rectangle *visible = &ddisp->visible;
@@ -953,7 +953,7 @@ ddisplay_scroll(DDisplay *ddisp, Point *delta)
if (new_origo.y < extents.top - ex_height)
new_origo.y = extents.top - ex_height;
-
+
if (new_origo.y+height > extents.bottom + ex_height)
new_origo.y = extents.bottom - height + ex_height;
@@ -973,7 +973,7 @@ void ddisplay_scroll_up(DDisplay *ddisp)
delta.x = 0;
delta.y = -(ddisp->visible.bottom - ddisp->visible.top)/4.0;
-
+
ddisplay_scroll(ddisp, &delta);
}
@@ -983,7 +983,7 @@ void ddisplay_scroll_down(DDisplay *ddisp)
delta.x = 0;
delta.y = (ddisp->visible.bottom - ddisp->visible.top)/4.0;
-
+
ddisplay_scroll(ddisp, &delta);
}
@@ -993,7 +993,7 @@ void ddisplay_scroll_left(DDisplay *ddisp)
delta.x = -(ddisp->visible.right - ddisp->visible.left)/4.0;
delta.y = 0;
-
+
ddisplay_scroll(ddisp, &delta);
}
@@ -1003,11 +1003,11 @@ void ddisplay_scroll_right(DDisplay *ddisp)
delta.x = (ddisp->visible.right - ddisp->visible.left)/4.0;
delta.y = 0;
-
+
ddisplay_scroll(ddisp, &delta);
}
-/** Scroll display to have the diagram point p at the center.
+/** Scroll display to have the diagram point p at the center.
* Returns TRUE if anything changed. */
gboolean
ddisplay_scroll_center_point(DDisplay *ddisp, Point *p)
@@ -1073,13 +1073,13 @@ ddisplay_present_object(DDisplay *ddisp, DiaObject *obj)
/*!
* Remember the last clicked point given in pixel coodinates
*/
-void
+void
ddisplay_set_clicked_point(DDisplay *ddisp, int x, int y)
{
Point pt;
ddisplay_untransform_coords(ddisp, x, y, &pt.x, &pt.y);
-
+
ddisp->clicked_position = pt;
}
@@ -1121,12 +1121,12 @@ new_aa_renderer (DDisplay *ddisp)
"transform", dia_transform_new (&ddisp->visible, &ddisp->zoom_factor),
NULL);
return renderer;
- }
+ }
/* we really should not come here but instead disable the menu command earlier */
message_warning (_("No antialiased renderer found"));
/* fallback: built-in libart renderer */
- return new_gdk_renderer (ddisp);
+ return new_gdk_renderer (ddisp);
}
void
@@ -1193,7 +1193,7 @@ ddisplay_active_diagram(void)
return ddisp->diagram;
}
-static void
+static void
ddisp_destroy(DDisplay *ddisp)
{
g_signal_handlers_disconnect_by_func (ddisp->diagram, selection_changed, ddisp);
@@ -1226,7 +1226,7 @@ are_you_sure_close_dialog_respond(GtkWidget *widget, /* the dialog */
gboolean close_ddisp = TRUE;
switch (response_id) {
- case GTK_RESPONSE_YES :
+ case GTK_RESPONSE_YES :
/* save changes */
if (ddisp->diagram->unsaved) {
/* we have to open the file dlg, close this one first */
@@ -1284,7 +1284,7 @@ ddisplay_close(DDisplay *ddisp)
if (!fname)
fname = _("<unnamed>");
- dialog = gtk_message_dialog_new(GTK_WINDOW (ddisp->shell),
+ dialog = gtk_message_dialog_new(GTK_WINDOW (ddisp->shell),
GTK_DIALOG_MODAL,
GTK_MESSAGE_QUESTION,
GTK_BUTTONS_NONE, /* no standard buttons */
@@ -1333,7 +1333,7 @@ display_update_menu_state(DDisplay *ddisp)
show_cx_pts = GTK_TOGGLE_ACTION (menus_get_action ("ViewShowconnectionpoints"));
antialiased = GTK_TOGGLE_ACTION (menus_get_action ("ViewAntialiased"));
- gtk_action_set_sensitive (menus_get_action ("ViewAntialiased"),
+ gtk_action_set_sensitive (menus_get_action ("ViewAntialiased"),
g_type_from_name ("DiaCairoInteractiveRenderer") != 0 || g_type_from_name
("DiaLibartRenderer") != 0);
ddisplay_do_update_menu_sensitivity (ddisp);
@@ -1353,17 +1353,17 @@ display_update_menu_state(DDisplay *ddisp)
gtk_toggle_action_set_active (snap_to_grid,
ddisp->grid.snap);
gtk_toggle_action_set_active (show_cx_pts,
- ddisp->show_cx_pts);
+ ddisp->show_cx_pts);
gtk_toggle_action_set_active (antialiased,
ddisp->aa_renderer);
}
-void
+void
ddisplay_do_update_menu_sensitivity (DDisplay *ddisp)
{
Diagram *dia;
-
+
if (ddisp == NULL) {
gtk_action_group_set_sensitive (menus_get_display_actions (), FALSE);
return;
@@ -1387,7 +1387,7 @@ ddisplay_really_destroy(DDisplay *ddisp)
g_source_remove (ddisp->update_id);
ddisp->update_id = 0;
}
-
+
if (ddisp->diagram) {
diagram_remove_ddisplay(ddisp->diagram, ddisp);
/* if we are the last user of the diagram it will be unref'ed */
@@ -1414,7 +1414,7 @@ ddisplay_set_title(DDisplay *ddisp, char *title)
gtk_window_set_title (GTK_WINDOW (ddisp->shell), title);
else
{
- GtkNotebook *notebook = g_object_get_data (G_OBJECT (ddisp->shell),
+ GtkNotebook *notebook = g_object_get_data (G_OBJECT (ddisp->shell),
DIA_MAIN_NOTEBOOK);
/* Find the page with ddisp then set the label on the tab */
gint num_pages = gtk_notebook_get_n_pages (notebook);
@@ -1452,7 +1452,7 @@ ddisplay_set_all_cursor(GdkCursor *cursor)
GSList *slist;
current_cursor = cursor;
-
+
list = dia_open_diagrams();
while (list != NULL) {
dia = (Diagram *) list->data;
@@ -1462,14 +1462,32 @@ ddisplay_set_all_cursor(GdkCursor *cursor)
ddisp = (DDisplay *) slist->data;
ddisplay_set_cursor(ddisp, cursor);
-
+
slist = g_slist_next(slist);
}
-
+
list = g_list_next(list);
}
}
+void
+ddisplay_set_all_cursor_name (GdkDisplay *disp,
+ const gchar *cursor_name)
+{
+ GdkDisplay *actual_disp;
+ GdkCursor *cursor;
+
+ if (disp) {
+ actual_disp = disp;
+ } else {
+ actual_disp = gdk_display_get_default ();
+ }
+
+ cursor = gdk_cursor_new_from_name (actual_disp, cursor_name);
+
+ ddisplay_set_all_cursor (cursor);
+}
+
void
ddisplay_set_cursor(DDisplay *ddisp, GdkCursor *cursor)
{
@@ -1486,7 +1504,7 @@ gboolean display_get_rulers_showing(DDisplay *ddisp) {
/**
* Shows the rulers and sets flag ddisp->rulers_are_showing. This
- * is needed to detect whether a show() has been issued. There is a
+ * is needed to detect whether a show() has been issued. There is a
* delay between the time that gtk_widget_show() is called and the time
* when GTK_WIDGET_IS_VISIBLE(w) will indicate true.
* @param ddisp The display to show the rulers on.
@@ -1514,7 +1532,7 @@ void display_rulers_show (DDisplay *ddisp)
/**
* Hides the rulers and resets the flag ddisp->rulers_are_showing. This
- * is needed to detect whether a hide() has been issued. There is a
+ * is needed to detect whether a hide() has been issued. There is a
* delay between the time that gtk_widget_hide() is called and the time
* when GTK_WIDGET_IS_VISIBLE(w) will indicate false.
* @param ddisp The display to hide the rulers on.
@@ -1528,7 +1546,7 @@ void display_rulers_hide (DDisplay *ddisp)
gtk_widget_hide (ddisp->origin);
gtk_widget_hide (ddisp->hrule);
gtk_widget_hide (ddisp->vrule);
-
+
#if GTK_CHECK_VERSION(2,20,0)
if (gtk_widget_get_visible (parent))
#else
@@ -1540,7 +1558,7 @@ void display_rulers_hide (DDisplay *ddisp)
}
}
-void
+void
ddisplay_update_statusbar(DDisplay *ddisp)
{
update_zoom_status (ddisp);
@@ -1571,7 +1589,7 @@ display_set_active(DDisplay *ddisp)
NULL);
}
} else {
- GtkNotebook *notebook = g_object_get_data (G_OBJECT (ddisp->shell),
+ GtkNotebook *notebook = g_object_get_data (G_OBJECT (ddisp->shell),
DIA_MAIN_NOTEBOOK);
/* Find the page with ddisp then set the label on the tab */
gint num_pages = gtk_notebook_get_n_pages (notebook);
@@ -1618,12 +1636,12 @@ ddisplay_im_context_preedit_reset(DDisplay *ddisp, Focus *focus)
if (focus != NULL) {
int i;
ObjectChange *change;
-
+
for (i = 0; i < g_utf8_strlen(ddisp->preedit_string, -1); i++) {
(focus->key_event)(focus, 0, GDK_BackSpace, NULL, 0, &change);
}
}
-
+
g_free(ddisp->preedit_string);
ddisp->preedit_string = NULL;
}
@@ -1674,7 +1692,7 @@ ddisplay_show_all (DDisplay *ddisp)
Point middle;
g_return_if_fail (ddisp != NULL);
-
+
dia = ddisp->diagram;
width = dia_renderer_get_width_pixels (ddisp->renderer);
@@ -1706,7 +1724,7 @@ ddisplay_show_all (DDisplay *ddisp)
(dia->data->extents.bottom - dia->data->extents.top) / 2.0;
}
- ddisplay_zoom (ddisp, &middle,
+ ddisplay_zoom (ddisp, &middle,
((magnify_x<magnify_y)?magnify_x:magnify_y)/1.05);
ddisplay_update_scrollbars(ddisp);
diff --git a/app/display.h b/app/display.h
index 2fef0f05..6ec1a7f6 100644
--- a/app/display.h
+++ b/app/display.h
@@ -164,7 +164,8 @@ void ddisplay_close(DDisplay *ddisp);
void ddisplay_set_title(DDisplay *ddisp, char *title);
void ddisplay_set_cursor(DDisplay *ddisp, GdkCursor *cursor);
void ddisplay_set_all_cursor(GdkCursor *cursor);
-
+void ddisplay_set_all_cursor_name (GdkDisplay *disp,
+ const gchar *cursor);
void ddisplay_set_clicked_point(DDisplay *ddisp, int x, int y);
Point ddisplay_get_clicked_position(DDisplay *ddisp);
diff --git a/app/pixmaps/cursor-create.png b/app/icons/dia-cursor-create.png
similarity index 100%
rename from app/pixmaps/cursor-create.png
rename to app/icons/dia-cursor-create.png
diff --git a/app/magnify.c b/app/magnify.c
index df4a84b7..4be94772 100644
--- a/app/magnify.c
+++ b/app/magnify.c
@@ -59,7 +59,7 @@ magnify_button_release(MagnifyTool *tool, GdkEventButton *event,
tool->box_active = FALSE;
visible = &ddisp->visible;
-
+
ddisplay_untransform_coords(ddisp, tool->x, tool->y, &p1.x, &p1.y);
ddisplay_untransform_coords(ddisp, event->x, event->y, &p2.x, &p2.y);
@@ -113,7 +113,7 @@ magnify_motion(MagnifyTool *tool, GdkEventMotion *event,
if (tool->gc == NULL) {
tool->gc = gdk_gc_new(gtk_widget_get_window(ddisp->canvas));
- gdk_gc_set_line_attributes(tool->gc, 1, GDK_LINE_ON_OFF_DASH,
+ gdk_gc_set_line_attributes(tool->gc, 1, GDK_LINE_ON_OFF_DASH,
GDK_CAP_BUTT, GDK_JOIN_MITER);
gdk_gc_set_foreground(tool->gc, &white);
gdk_gc_set_function(tool->gc, GDK_XOR);
@@ -140,14 +140,14 @@ void
set_zoom_out(Tool *tool)
{
((MagnifyTool *)tool)->zoom_out = TRUE;
- ddisplay_set_all_cursor(get_cursor(CURSOR_ZOOM_OUT));
+ ddisplay_set_all_cursor_name (NULL, "zoom-out");
}
void
set_zoom_in(Tool *tool)
{
((MagnifyTool *)tool)->zoom_out = FALSE;
- ddisplay_set_all_cursor(get_cursor(CURSOR_ZOOM_IN));
+ ddisplay_set_all_cursor_name (NULL, "zoom-in");
}
Tool *
@@ -166,8 +166,8 @@ create_magnify_tool(void)
tool->box_active = FALSE;
tool->zoom_out = FALSE;
- ddisplay_set_all_cursor(get_cursor(CURSOR_ZOOM_IN));
-
+ ddisplay_set_all_cursor_name (NULL, "zoom-in");
+
return (Tool *) tool;
}
diff --git a/app/modify_tool.c b/app/modify_tool.c
index a7f96784..3931a785 100644
--- a/app/modify_tool.c
+++ b/app/modify_tool.c
@@ -73,7 +73,7 @@ struct _ModifyTool {
Point start_box;
Point end_box;
- gboolean auto_scrolled; /* TRUE if the diagram auto scrolled last time
+ gboolean auto_scrolled; /* TRUE if the diagram auto scrolled last time
modify_motion was called */
/* Undo info: */
Point *orig_pos;
@@ -98,11 +98,11 @@ create_modify_tool(void)
tool->auto_scrolled = FALSE;
tool->orig_pos = NULL;
-
+
return (Tool *)tool;
}
-static ModifierKeys
+static ModifierKeys
gdk_event_to_dia_ModifierKeys(guint event_state)
{
ModifierKeys mod = MODIFIER_NONE;
@@ -146,7 +146,7 @@ gdk_event_to_dia_ModifierKeys(guint event_state)
return mod;
}
-
+
void
free_modify_tool(Tool *tool)
{
@@ -163,13 +163,13 @@ click_select_object(DDisplay *ddisp, Point *clickedpoint,
Diagram *diagram;
real click_distance;
DiaObject *obj;
-
+
diagram = ddisp->diagram;
-
+
/* Find the closest object to select it: */
click_distance = ddisplay_untransform_length(ddisp, 3.0);
-
+
obj = diagram_find_clicked_object(diagram, clickedpoint,
click_distance);
@@ -177,7 +177,7 @@ click_select_object(DDisplay *ddisp, Point *clickedpoint,
/* Selected an object. */
GList *already;
/*printf("Selected object!\n");*/
-
+
already = g_list_find(diagram->data->selected, obj);
if (already == NULL) { /* Not already selected */
/*printf("Not already selected\n");*/
@@ -186,10 +186,10 @@ click_select_object(DDisplay *ddisp, Point *clickedpoint,
/* Not Multi-select => remove current selection */
diagram_remove_all_selected(diagram, TRUE);
}
-
+
diagram_select(diagram, obj);
/* To be removed once text edit mode is stable. By then,
- * we don't want to automatically edit selected objects.
+ * we don't want to automatically edit selected objects.
textedit_activate_object(ddisp, obj, clickedpoint);
*/
@@ -206,7 +206,7 @@ click_select_object(DDisplay *ddisp, Point *clickedpoint,
*/
object_add_updates_list(diagram->data->selected, diagram);
diagram_flush(diagram);
-
+
if (event->state & GDK_SHIFT_MASK) { /* Multi-select */
/* Remove the selected selected */
ddisplay_do_update_menu_sensitivity(ddisp);
@@ -235,7 +235,7 @@ static int do_if_clicked_handle(DDisplay *ddisp, ModifyTool *tool,
{
DiaObject *obj;
Handle *handle;
-
+
handle = NULL;
diagram_find_closest_handle(ddisp->diagram, &handle, &obj, clickedpoint);
if (handle_is_clicked(ddisp, handle, clickedpoint)) {
@@ -249,7 +249,7 @@ static int do_if_clicked_handle(DDisplay *ddisp, ModifyTool *tool,
NULL, NULL, event->time);
tool->start_at = handle->pos;
tool->start_time = time_micro();
- ddisplay_set_all_cursor(get_cursor(CURSOR_SCROLL));
+ ddisplay_set_all_cursor_name (NULL, "move");
return TRUE;
}
return FALSE;
@@ -271,7 +271,7 @@ modify_button_press(ModifyTool *tool, GdkEventButton *event,
some_selected = g_list_length (ddisp->diagram->data->selected) > 1;
if (!some_selected && do_if_clicked_handle(ddisp, tool, &clickedpoint, event))
return;
-
+
clicked_obj = click_select_object(ddisp, &clickedpoint, event);
if (!some_selected && do_if_clicked_handle(ddisp, tool, &clickedpoint, event))
return;
@@ -288,7 +288,7 @@ modify_button_press(ModifyTool *tool, GdkEventButton *event,
NULL, NULL, event->time);
tool->start_at = clickedpoint;
tool->start_time = time_micro();
- ddisplay_set_all_cursor(get_cursor(CURSOR_SCROLL));
+ ddisplay_set_all_cursor_name (NULL, "move");
} else {
tool->state = STATE_BOX_SELECT;
tool->start_box = clickedpoint;
@@ -301,7 +301,7 @@ modify_button_press(ModifyTool *tool, GdkEventButton *event,
color_convert(&color_white, &white);
tool->gc = gdk_gc_new(gtk_widget_get_window(ddisp->canvas));
- gdk_gc_set_line_attributes(tool->gc, 1, GDK_LINE_ON_OFF_DASH,
+ gdk_gc_set_line_attributes(tool->gc, 1, GDK_LINE_ON_OFF_DASH,
GDK_CAP_BUTT, GDK_JOIN_MITER);
gdk_gc_set_foreground(tool->gc, &white);
gdk_gc_set_function(tool->gc, GDK_XOR);
@@ -325,7 +325,7 @@ modify_button_hold(ModifyTool *tool, GdkEventButton *event,
Point clickedpoint;
switch (tool->state) {
- case STATE_MOVE_OBJECT:
+ case STATE_MOVE_OBJECT:
/* A button hold is as if user was moving object - if it is
* a text object and can be edited, then the move is cancelled */
ddisplay_untransform_coords(ddisp,
@@ -342,7 +342,7 @@ modify_button_hold(ModifyTool *tool, GdkEventButton *event,
/* Activate Text Edit */
gtk_action_activate (menus_get_action ("ToolsTextedit"));
}
- }
+ }
break;
case STATE_MOVE_HANDLE:
break;
@@ -361,13 +361,13 @@ modify_double_click(ModifyTool *tool, GdkEventButton *event,
{
Point clickedpoint;
DiaObject *clicked_obj;
-
+
ddisplay_untransform_coords(ddisp,
(int)event->x, (int)event->y,
&clickedpoint.x, &clickedpoint.y);
clicked_obj = click_select_object(ddisp, &clickedpoint, event);
-
+
if ( clicked_obj != NULL ) {
object_list_properties_show(ddisp->diagram, ddisp->diagram->data->selected);
} else { /* No object selected */
@@ -410,7 +410,7 @@ modify_move_already(ModifyTool *tool, DDisplay *ddisp, Point *to)
if (settings == NULL) {
g_message(_("Couldn't get GTK+ settings"));
} else {
- g_object_get(G_OBJECT(settings),
+ g_object_get(G_OBJECT(settings),
"gtk-double-click-time", &double_click_time, NULL);
}
settings_taken = TRUE;
@@ -454,13 +454,13 @@ modify_motion(ModifyTool *tool, GdkEventMotion *event,
&& handle->id >= HANDLE_RESIZE_NW && handle->id <= HANDLE_RESIZE_SE
&& handle_is_clicked(ddisp, handle, &to)
&& g_list_length (ddisp->diagram->data->selected) == 1)
- ddisplay_set_all_cursor(get_cursor(CURSOR_DIRECTION_0 + handle->id));
+ ddisplay_set_all_cursor (direction_cursor (CURSOR_DIRECTION_0 + handle->id));
else
- ddisplay_set_all_cursor(get_cursor(CURSOR_POINT));
+ ddisplay_set_all_cursor_name (NULL, "default");
return; /* Fast path... */
}
auto_scroll = ddisplay_autoscroll(ddisp, event->x, event->y);
-
+
if (!modify_move_already(tool, ddisp, &to)) return;
switch (tool->state) {
@@ -482,7 +482,7 @@ modify_motion(ModifyTool *tool, GdkEventMotion *event,
}
g_list_free (pla);
}
-
+
if (tool->break_connections)
diagram_unconnect_selected(ddisp->diagram); /* Pushes UNDO info */
@@ -494,9 +494,9 @@ modify_motion(ModifyTool *tool, GdkEventMotion *event,
point_add(&to, &tool->move_compensate);
snap_to_grid(ddisp, &to.x, &to.y);
-
+
now = tool->object->position;
-
+
delta = to;
point_sub(&delta, &now);
@@ -523,16 +523,16 @@ modify_motion(ModifyTool *tool, GdkEventMotion *event,
gchar *postext;
GtkStatusbar *statusbar = GTK_STATUSBAR (ddisp->modified_status);
guint context_id = gtk_statusbar_get_context_id (statusbar, "ObjectPos");
- gtk_statusbar_pop (statusbar, context_id);
+ gtk_statusbar_pop (statusbar, context_id);
postext = g_strdup_printf("%.3f, %.3f - %.3f, %.3f",
tool->object->bounding_box.left,
tool->object->bounding_box.top,
tool->object->bounding_box.right,
tool->object->bounding_box.bottom);
-
- gtk_statusbar_pop (statusbar, context_id);
+
+ gtk_statusbar_pop (statusbar, context_id);
gtk_statusbar_push (statusbar, context_id, postext);
-
+
g_free(postext);
}
@@ -567,13 +567,13 @@ modify_motion(ModifyTool *tool, GdkEventMotion *event,
type = DIA_HIGHLIGHT_CONNECTIONPOINT;
}
highlight_object(connectionpoint->object, type, ddisp->diagram);
- ddisplay_set_all_cursor(get_cursor(CURSOR_CONNECT));
+ ddisplay_set_all_cursor_name (NULL, "crosshair");
}
}
if (connectionpoint == NULL) {
/* No connectionopoint near, then snap to grid (if enabled) */
snap_to_grid(ddisp, &to.x, &to.y);
- ddisplay_set_all_cursor(get_cursor(CURSOR_SCROLL));
+ ddisplay_set_all_cursor_name (NULL, "move");
}
if (tool->break_connections) {
@@ -581,7 +581,7 @@ modify_motion(ModifyTool *tool, GdkEventMotion *event,
if (tool->handle->connected_to!=NULL) {
Change *change = undo_unconnect(ddisp->diagram, tool->object,
tool->handle);
-
+
(change->apply)(change, ddisp->diagram);
}
}
@@ -605,7 +605,7 @@ modify_motion(ModifyTool *tool, GdkEventMotion *event,
gchar *postext;
GtkStatusbar *statusbar = GTK_STATUSBAR (ddisp->modified_status);
guint context_id = gtk_statusbar_get_context_id (statusbar, "ObjectPos");
-
+
if (tool->object) { /* play safe */
real w = tool->object->bounding_box.right - tool->object->bounding_box.left;
real h = tool->object->bounding_box.bottom - tool->object->bounding_box.top;
@@ -613,25 +613,25 @@ modify_motion(ModifyTool *tool, GdkEventMotion *event,
} else {
postext = g_strdup_printf("%.3f, %.3f", to.x, to.y);
}
-
- gtk_statusbar_pop (statusbar, context_id);
+
+ gtk_statusbar_pop (statusbar, context_id);
gtk_statusbar_push (statusbar, context_id, postext);
g_free(postext);
}
-
+
object_add_updates(tool->object, ddisp->diagram);
/* Handle undo */
if (tool->object)
- objchange = tool->object->ops->move_handle(tool->object, tool->handle,
+ objchange = tool->object->ops->move_handle(tool->object, tool->handle,
&to, connectionpoint,
HANDLE_MOVE_USER,
gdk_event_to_dia_ModifierKeys(event->state));
if (objchange != NULL) {
undo_object_change(ddisp->diagram, tool->object, objchange);
}
object_add_updates(tool->object, ddisp->diagram);
-
+
diagram_update_connections_selection(ddisp->diagram);
diagram_flush(ddisp->diagram);
break;
@@ -660,7 +660,7 @@ modify_motion(ModifyTool *tool, GdkEventMotion *event,
tool->x2 - tool->x1, tool->y2 - tool->y1);
break;
case STATE_NONE:
-
+
break;
default:
message_error("Internal error: Strange state in modify_tool\n");
@@ -670,7 +670,7 @@ modify_motion(ModifyTool *tool, GdkEventMotion *event,
tool->auto_scrolled = auto_scroll;
}
-/** Find the list of objects selected by current rubberbanding.
+/** Find the list of objects selected by current rubberbanding.
* The list should be freed after use. */
static GList *
find_selected_objects(DDisplay *ddisp, ModifyTool *tool)
@@ -680,8 +680,8 @@ find_selected_objects(DDisplay *ddisp, ModifyTool *tool)
r.right = MAX(tool->start_box.x, tool->end_box.x);
r.top = MIN(tool->start_box.y, tool->end_box.y);
r.bottom = MAX(tool->start_box.y, tool->end_box.y);
-
- if (prefs.reverse_rubberbanding_intersects &&
+
+ if (prefs.reverse_rubberbanding_intersects &&
tool->start_box.x > tool->end_box.x) {
return
layer_find_objects_intersecting_rectangle(ddisp->diagram->data->active_layer, &r);
@@ -699,7 +699,7 @@ modify_button_release(ModifyTool *tool, GdkEventButton *event,
GList *list;
int i;
ObjectChange *objchange;
-
+
tool->break_connections = FALSE;
ddisplay_set_all_cursor(default_cursor);
@@ -737,7 +737,7 @@ modify_button_release(ModifyTool *tool, GdkEventButton *event,
undo_move_objects(ddisp->diagram, tool->orig_pos, dest_pos,
parent_list_affected(ddisp->diagram->data->selected));
}
-
+
ddisplay_connect_selected(ddisp); /* pushes UNDO info */
diagram_update_extents(ddisp->diagram);
diagram_modified(ddisp->diagram);
@@ -756,7 +756,7 @@ modify_button_release(ModifyTool *tool, GdkEventButton *event,
undo_move_handle(ddisp->diagram, tool->handle, tool->object,
*tool->orig_pos, tool->last_to, gdk_event_to_dia_ModifierKeys(event->state));
}
-
+
/* Final move: */
object_add_updates(tool->object, ddisp->diagram);
objchange = tool->object->ops->move_handle(tool->object, tool->handle,
@@ -773,10 +773,10 @@ modify_button_release(ModifyTool *tool, GdkEventButton *event,
object_connect_display(ddisp, tool->object, tool->handle, TRUE); /* pushes UNDO info */
diagram_update_connections_selection(ddisp->diagram);
}
-
+
highlight_reset_all(ddisp->diagram);
diagram_flush(ddisp->diagram);
-
+
diagram_modified(ddisp->diagram);
diagram_update_extents(ddisp->diagram);
@@ -789,7 +789,7 @@ modify_button_release(ModifyTool *tool, GdkEventButton *event,
break;
case STATE_BOX_SELECT:
-
+
gdk_pointer_ungrab (event->time);
/* Remove last box: */
if (!tool->auto_scrolled) {
@@ -802,7 +802,7 @@ modify_button_release(ModifyTool *tool, GdkEventButton *event,
GList *list, *list_to_free;
list = list_to_free = find_selected_objects(ddisp, tool);
-
+
if (selection_style == SELECT_REPLACE &&
!(event->state & GDK_SHIFT_MASK)) {
/* Not Multi-select => Remove all selected */
@@ -814,11 +814,11 @@ modify_button_release(ModifyTool *tool, GdkEventButton *event,
while (list != NULL) {
DiaObject *obj = (DiaObject *)list->data;
-
+
if (diagram_is_selected(ddisp->diagram, obj)) {
intersection = g_list_append(intersection, obj);
}
-
+
list = g_list_next(list);
}
list = intersection;
@@ -834,11 +834,11 @@ modify_button_release(ModifyTool *tool, GdkEventButton *event,
} else {
while (list != NULL) {
DiaObject *obj = (DiaObject *)list->data;
-
+
if (selection_style == SELECT_REMOVE) {
if (diagram_is_selected(ddisp->diagram, obj))
diagram_unselect_object(ddisp->diagram, obj);
- } else if (selection_style == SELECT_INVERT) {
+ } else if (selection_style == SELECT_INVERT) {
if (diagram_is_selected(ddisp->diagram, obj))
diagram_unselect_object(ddisp->diagram, obj);
else
@@ -847,15 +847,15 @@ modify_button_release(ModifyTool *tool, GdkEventButton *event,
if (!diagram_is_selected(ddisp->diagram, obj))
diagram_select(ddisp->diagram, obj);
}
-
+
list = g_list_next(list);
}
}
g_list_free(list_to_free);
-
+
}
-
+
ddisplay_do_update_menu_sensitivity(ddisp);
ddisplay_flush(ddisp);
@@ -865,7 +865,7 @@ modify_button_release(ModifyTool *tool, GdkEventButton *event,
break;
default:
message_error("Internal error: Strange state in modify_tool\n");
-
+
}
}
diff --git a/app/pixmaps/meson.build b/app/pixmaps/meson.build
index df8c4553..69dedf1f 100644
--- a/app/pixmaps/meson.build
+++ b/app/pixmaps/meson.build
@@ -1,10 +1,4 @@
-icons = [
- 'cursor-create.png',
- 'cursor-hand-open.png',
- 'cursor-hand-closed.png',
- 'cursor-magnify-minus.png',
- 'cursor-magnify-plus.png'
-]
+icons = []
#TODO: this is duplicated in app/pixmaps, lib/pixmaps and objects/standard/pixmaps.
# Remove from all three once we port from gdk_pixbuf_csource to GResource.
diff --git a/app/scroll_tool.c b/app/scroll_tool.c
index e9ce9ff6..0dbf24ed 100644
--- a/app/scroll_tool.c
+++ b/app/scroll_tool.c
@@ -48,8 +48,8 @@ create_scroll_tool(void)
tool->scrolling = FALSE;
tool->use_hand = TRUE;
- ddisplay_set_all_cursor(get_cursor(CURSOR_GRAB));
-
+ ddisplay_set_all_cursor_name (NULL, "grab");
+
return (Tool *)tool;
}
@@ -76,9 +76,9 @@ scroll_button_press(ScrollTool *tool, GdkEventButton *event,
tool->use_hand = (event->state & GDK_SHIFT_MASK) == 0;
if (tool->use_hand)
- ddisplay_set_all_cursor(get_cursor(CURSOR_GRABBING));
+ ddisplay_set_all_cursor_name (NULL, "grabbing");
else
- ddisplay_set_all_cursor(get_cursor(CURSOR_SCROLL));
+ ddisplay_set_all_cursor_name (NULL, "move");
ddisplay_untransform_coords(ddisp,
(int)event->x, (int)event->y,
@@ -103,13 +103,13 @@ scroll_motion(ScrollTool *tool, GdkEventMotion *event,
/* try to minimise the number of cursor type changes */
if ((event->state & GDK_SHIFT_MASK) == 0) {
if (!tool->use_hand) {
- tool->use_hand = TRUE;
- ddisplay_set_all_cursor(get_cursor(CURSOR_GRAB));
+ tool->use_hand = TRUE;
+ ddisplay_set_all_cursor_name (NULL, "grab");
}
} else
if (tool->use_hand) {
tool->use_hand = FALSE;
- ddisplay_set_all_cursor(get_cursor(CURSOR_SCROLL));
+ ddisplay_set_all_cursor_name (NULL, "move");
}
return;
}
@@ -146,9 +146,10 @@ scroll_button_release(ScrollTool *tool, GdkEventButton *event,
{
tool->use_hand = (event->state & GDK_SHIFT_MASK) == 0;
if (tool->use_hand) {
- ddisplay_set_all_cursor(get_cursor(CURSOR_GRAB));
- } else
- ddisplay_set_all_cursor(get_cursor(CURSOR_SCROLL));
+ ddisplay_set_all_cursor_name (NULL, "grab");
+ } else {
+ ddisplay_set_all_cursor_name (NULL, "move");
+ }
tool->scrolling = FALSE;
}
diff --git a/app/textedit_tool.c b/app/textedit_tool.c
index 55ed0f27..00bbb885 100644
--- a/app/textedit_tool.c
+++ b/app/textedit_tool.c
@@ -37,18 +37,18 @@ click_select_object(DDisplay *ddisp, Point *clickedpoint,
real click_distance = ddisplay_untransform_length(ddisp, 3.0);
Diagram *diagram = ddisp->diagram;
DiaObject *obj;
-
+
ddisplay_untransform_coords(ddisp,
(int)event->x, (int)event->y,
&clickedpoint->x, &clickedpoint->y);
obj = diagram_find_clicked_object (diagram, clickedpoint, click_distance);
-
+
if (obj) {
/* Selected an object. */
GList *already;
/*printf("Selected object!\n");*/
-
+
already = g_list_find(diagram->data->selected, obj);
if (already == NULL) { /* Not already selected */
if (!(event->state & GDK_SHIFT_MASK)) {
@@ -64,7 +64,7 @@ click_select_object(DDisplay *ddisp, Point *clickedpoint,
return obj;
}
- return obj;
+ return obj;
}
static void
@@ -101,7 +101,7 @@ textedit_button_release(TexteditTool *tool, GdkEventButton *event,
{
Point clickedpoint;
DiaObject *obj = click_select_object (ddisp, &clickedpoint, event);
-
+
if (obj) {
ddisplay_do_update_menu_sensitivity(ddisp);
@@ -140,8 +140,8 @@ create_textedit_tool(void)
tool->tool.button_release_func = (ButtonReleaseFunc) &textedit_button_release;
tool->tool.motion_func = (MotionFunc) &textedit_motion;
tool->tool.double_click_func = (DoubleClickFunc) &textedit_double_click;
-
- ddisplay_set_all_cursor(get_cursor(CURSOR_XTERM));
+
+ ddisplay_set_all_cursor_name (NULL, "text");
ddisp = ddisplay_active();
if (ddisp) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]