diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2009-11-10 09:40:07 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2009-11-10 10:19:20 +0800 |
commit | 5beeca1f80c3a618feeeb2c5b7e09cc47b64387d (patch) | |
tree | 10a64d9c5ee58b63f908a173451135c6447ddd90 /widgets | |
parent | bd5d405fe311361f27c78cd48682d2e067273d27 (diff) | |
download | gsoc2013-evolution-5beeca1f80c3a618feeeb2c5b7e09cc47b64387d.tar.gz gsoc2013-evolution-5beeca1f80c3a618feeeb2c5b7e09cc47b64387d.tar.zst gsoc2013-evolution-5beeca1f80c3a618feeeb2c5b7e09cc47b64387d.zip |
Kill e-cursor(s) (both of them).
Diffstat (limited to 'widgets')
-rw-r--r-- | widgets/misc/Makefile.am | 6 | ||||
-rw-r--r-- | widgets/misc/e-cursors.c | 159 | ||||
-rw-r--r-- | widgets/misc/e-cursors.h | 68 | ||||
-rw-r--r-- | widgets/misc/pixmaps/Makefile.am | 11 | ||||
-rw-r--r-- | widgets/misc/pixmaps/cursor_cross.xpm | 38 | ||||
-rw-r--r-- | widgets/misc/pixmaps/cursor_hand_closed.xpm | 38 | ||||
-rw-r--r-- | widgets/misc/pixmaps/cursor_hand_open.xpm | 38 | ||||
-rw-r--r-- | widgets/misc/pixmaps/cursor_zoom_in.xpm | 37 | ||||
-rw-r--r-- | widgets/misc/pixmaps/cursor_zoom_out.xpm | 37 | ||||
-rw-r--r-- | widgets/table/e-table-header-item.c | 14 | ||||
-rw-r--r-- | widgets/table/e-table-header-item.h | 1 |
11 files changed, 10 insertions, 437 deletions
diff --git a/widgets/misc/Makefile.am b/widgets/misc/Makefile.am index f847021985..e43494b879 100644 --- a/widgets/misc/Makefile.am +++ b/widgets/misc/Makefile.am @@ -45,7 +45,6 @@ widgetsinclude_HEADERS = \ e-charset-combo-box.h \ e-colors.h \ e-combo-cell-editable.h \ - e-cursors.h \ e-dateedit.h \ e-gui-utils.h \ e-hinted-entry.h \ @@ -121,7 +120,6 @@ libemiscwidgets_la_SOURCES = \ e-charset-combo-box.c \ e-colors.c \ e-combo-cell-editable.c \ - e-cursors.c \ e-dateedit.c \ e-gui-utils.c \ e-hinted-entry.c \ @@ -227,8 +225,4 @@ EXTRA_DIST = \ e-pilot-settings.c \ ChangeLog.pre-1-4 -dist-hook: - -mkdir $(distdir)/pixmaps - cp $(srcdir)/pixmaps/*.xpm $(distdir)/pixmaps - -include $(top_srcdir)/git.mk diff --git a/widgets/misc/e-cursors.c b/widgets/misc/e-cursors.c deleted file mode 100644 index 4ec2717d1c..0000000000 --- a/widgets/misc/e-cursors.c +++ /dev/null @@ -1,159 +0,0 @@ -/* - * e-cursors.c - cursor handling for gnumeric - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) version 3. - * - * 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see <http://www.gnu.org/licenses/> - * - * - * Authors: - * Miguel de Icaza (miguel@gnu.org) - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#include <config.h> - -#include <stdio.h> - -#include "e-colors.h" -#include "e-cursors.h" - -#include "pixmaps/cursor_cross.xpm" -#include "pixmaps/cursor_zoom_in.xpm" -#include "pixmaps/cursor_zoom_out.xpm" -#include "pixmaps/cursor_hand_open.xpm" -#include "pixmaps/cursor_hand_closed.xpm" - -#define GDK_INTERNAL_CURSOR -1 - -typedef struct { - GdkCursor *cursor; - gint hot_x, hot_y; - const gchar **xpm; -} CursorDef; - -static CursorDef cursors [] = { - { NULL, 17, 17, cursor_cross_xpm }, - { NULL, GDK_INTERNAL_CURSOR, GDK_CROSSHAIR, NULL }, - { NULL, GDK_INTERNAL_CURSOR, GDK_ARROW, NULL }, - { NULL, GDK_INTERNAL_CURSOR, GDK_FLEUR, NULL }, - { NULL, 24, 24, cursor_zoom_in_xpm }, - { NULL, 24, 24, cursor_zoom_out_xpm }, - { NULL, GDK_INTERNAL_CURSOR, GDK_SB_H_DOUBLE_ARROW, NULL }, - { NULL, GDK_INTERNAL_CURSOR, GDK_SB_V_DOUBLE_ARROW, NULL }, - { NULL, GDK_INTERNAL_CURSOR, GDK_SIZING, NULL }, - { NULL, GDK_INTERNAL_CURSOR, GDK_SIZING, NULL }, - { NULL, GDK_INTERNAL_CURSOR, GDK_HAND2, NULL }, - { NULL, 10, 10, cursor_hand_open_xpm }, - { NULL, 10, 10, cursor_hand_closed_xpm }, - { NULL, GDK_INTERNAL_CURSOR, GDK_XTERM, NULL }, - { NULL, 0, 0, NULL } -}; - -static void -create_bitmap_and_mask_from_xpm (GdkBitmap **bitmap, GdkBitmap **mask, const gchar **xpm) -{ - gint height, width, colors; - gchar pixmap_buffer [(32 * 32)/8]; - gchar mask_buffer [(32 * 32)/8]; - gint x, y, pix, yofs; - gint transparent_color, black_color; - - sscanf (xpm [0], "%d %d %d %d", &height, &width, &colors, &pix); - - g_return_if_fail (height == 32); - g_return_if_fail (width == 32); - g_return_if_fail (colors <= 3); - - transparent_color = ' '; - black_color = '.'; - - yofs = colors + 1; - for (y = 0; y < 32; y++) { - for (x = 0; x < 32;) { - gchar value = 0, maskv = 0; - - for (pix = 0; pix < 8; pix++, x++) { - if (xpm [y + yofs][x] != transparent_color) { - maskv |= 1 << pix; - - /* - * Invert the colours here because it seems - * to workaround a bug the Matrox G100 Xserver? - * We reverse the foreground & background in the next - * routine to compensate. - */ - if (xpm [y + yofs][x] == black_color) { - value |= 1 << pix; - } - } - } - pixmap_buffer [(y * 4 + x/8)-1] = value; - mask_buffer [(y * 4 + x/8)-1] = maskv; - } - } - *bitmap = gdk_bitmap_create_from_data (NULL, pixmap_buffer, 32, 32); - *mask = gdk_bitmap_create_from_data (NULL, mask_buffer, 32, 32); -} - -void -e_cursors_init (void) -{ - gint i; - - e_color_init (); - - for (i = 0; cursors [i].hot_x; i++) { - if (cursors [i].hot_x < 0) - cursors [i].cursor = gdk_cursor_new (cursors [i].hot_y); - else { - GdkBitmap *bitmap = NULL, *mask = NULL; - - create_bitmap_and_mask_from_xpm (&bitmap, &mask, cursors [i].xpm); - - /* The foreground and background colours are reversed. - * See comment above for explanation. - */ - cursors [i].cursor = - gdk_cursor_new_from_pixmap ( - bitmap, mask, - &e_black, &e_white, - cursors [i].hot_x, - cursors [i].hot_y); - - g_object_unref (bitmap); - g_object_unref (mask); - } - } - - g_return_if_fail (i == E_CURSOR_NUM_CURSORS); -} - -void -e_cursors_shutdown (void) -{ - gint i; - - for (i = 0; cursors [i].hot_x; i++) - gdk_cursor_unref (cursors [i].cursor); -} - -/* Returns a cursor given its type */ -GdkCursor * -e_cursor_get (ECursorType type) -{ - g_return_val_if_fail (type < E_CURSOR_NUM_CURSORS, NULL); - - return cursors [type].cursor; -} diff --git a/widgets/misc/e-cursors.h b/widgets/misc/e-cursors.h deleted file mode 100644 index 23ac7c0899..0000000000 --- a/widgets/misc/e-cursors.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) version 3. - * - * 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see <http://www.gnu.org/licenses/> - * - * - * Authors: - * Miguel de Icaza (miguel@gnu.org) - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifndef GNOME_APP_LIB_CURSORS_H -#define GNOME_APP_LIB_CURSORS_H - -#include <gdk/gdk.h> - -G_BEGIN_DECLS - -typedef enum { - E_CURSOR_FAT_CROSS, - E_CURSOR_THIN_CROSS, - E_CURSOR_ARROW, - E_CURSOR_MOVE, - E_CURSOR_ZOOM_IN, - E_CURSOR_ZOOM_OUT, - E_CURSOR_SIZE_X, - E_CURSOR_SIZE_Y, - E_CURSOR_SIZE_TL, - E_CURSOR_SIZE_TR, - E_CURSOR_PRESS, - E_CURSOR_HAND_OPEN, - E_CURSOR_HAND_CLOSED, - E_CURSOR_XTERM, - E_CURSOR_NUM_CURSORS -} ECursorType; - -void e_cursors_init (void); -void e_cursors_shutdown (void); - -#define e_cursor_set(win, c) \ -G_STMT_START { \ - if (win) \ - gdk_window_set_cursor (win, e_cursor_get (c)); \ -} G_STMT_END - -#define e_cursor_set_widget(w, c) \ -G_STMT_START { \ - if (GTK_WIDGET (w)->window) \ - gdk_window_set_cursor (GTK_WIDGET (w)->window, e_cursor_get (c)); \ -} G_STMT_END - -GdkCursor *e_cursor_get (ECursorType type); - -G_END_DECLS - -#endif /* GNOME_APP_LIB_CURSORS_H */ diff --git a/widgets/misc/pixmaps/Makefile.am b/widgets/misc/pixmaps/Makefile.am deleted file mode 100644 index fa86dee8fb..0000000000 --- a/widgets/misc/pixmaps/Makefile.am +++ /dev/null @@ -1,11 +0,0 @@ -pixmaps = \ - cursor_cross.xpm \ - cursor_hand_closed.xpm \ - cursor_hand_open.xpm \ - cursor_zoom_in.xpm \ - cursor_zoom_out.xpm - -EXTRA_DIST = \ - $(pixmaps) - --include $(top_srcdir)/git.mk diff --git a/widgets/misc/pixmaps/cursor_cross.xpm b/widgets/misc/pixmaps/cursor_cross.xpm deleted file mode 100644 index 6a865148fb..0000000000 --- a/widgets/misc/pixmaps/cursor_cross.xpm +++ /dev/null @@ -1,38 +0,0 @@ -/* XPM */ -static const gchar *cursor_cross_xpm[] = { -"32 32 3 1", -" c None", -". c #000000", -"+ c #FFFFFF", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ....... ", -" .+++++.. ", -" .+++++.. ", -" .+++++.. ", -" .+++++.. ", -" ......+++++...... ", -" .+++++++++++++++.. ", -" .+++++++++++++++.. ", -" .+++++++++++++++.. ", -" .+++++++++++++++.. ", -" .+++++++++++++++.. ", -" ......+++++....... ", -" .....+++++....... ", -" .+++++.. ", -" .+++++.. ", -" .+++++.. ", -" ........ ", -" ....... ", -" ", -" ", -" ", -" ", -" ", -" ", -" "}; diff --git a/widgets/misc/pixmaps/cursor_hand_closed.xpm b/widgets/misc/pixmaps/cursor_hand_closed.xpm deleted file mode 100644 index 24450ed2a5..0000000000 --- a/widgets/misc/pixmaps/cursor_hand_closed.xpm +++ /dev/null @@ -1,38 +0,0 @@ -/* XPM */ -static const gchar *cursor_hand_closed_xpm[] = { -"32 32 3 1", -" c None", -". c #000000", -"+ c #FFFFFF", -" ", -" ", -" ", -" ", -" ", -" .. ", -" ..++... ", -" .+++++++.. ", -" .+++++++++. ", -" ...+++++++++. ", -" .++.+++++++++. ", -" .++++++++++++. ", -" .+++++++++++. ", -" .++++++++++. ", -" .+++++++++. ", -" .+++++++. ", -" .++++++. ", -" .++++++. ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" "}; diff --git a/widgets/misc/pixmaps/cursor_hand_open.xpm b/widgets/misc/pixmaps/cursor_hand_open.xpm deleted file mode 100644 index 2491b18e3b..0000000000 --- a/widgets/misc/pixmaps/cursor_hand_open.xpm +++ /dev/null @@ -1,38 +0,0 @@ -/* XPM */ -static const gchar *cursor_hand_open_xpm[] = { -"32 32 3 1", -" c None", -". c #000000", -"+ c #FFFFFF", -" ", -" ", -" .. ", -" .. .++... ", -" .++..++.++. ", -" .++..++.++. . ", -" .++.++.++..+. ", -" .++.++.++.++. ", -" .. .+++++++.++. ", -" .++..++++++++++. ", -" .+++.+++++++++. ", -" .++++++++++++. ", -" .+++++++++++. ", -" .++++++++++. ", -" .+++++++++. ", -" .+++++++. ", -" .++++++. ", -" .++++++. ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" "}; diff --git a/widgets/misc/pixmaps/cursor_zoom_in.xpm b/widgets/misc/pixmaps/cursor_zoom_in.xpm deleted file mode 100644 index 19e483fd65..0000000000 --- a/widgets/misc/pixmaps/cursor_zoom_in.xpm +++ /dev/null @@ -1,37 +0,0 @@ -/* XPM */ -static const gchar *cursor_zoom_in_xpm[] = { -"32 32 2 1", -" c None", -". c #000000", -" ", -" ", -" ", -" ", -" ", -" ", -" ...... ", -" .. .. ", -" .. .. ", -" . . ", -" . ... . ", -" . ... . ", -" . ....... . ", -" . ....... . ", -" . ... . ", -" . ... .. ", -" .. . . ", -" .. . . . ", -" ........ . . ", -" ..... . . . ", -" . . . ", -" . . . ", -" . . . ", -" . . . ", -" . . ", -" . . ", -" .. ", -" ", -" ", -" ", -" ", -" "}; diff --git a/widgets/misc/pixmaps/cursor_zoom_out.xpm b/widgets/misc/pixmaps/cursor_zoom_out.xpm deleted file mode 100644 index 9748fa1143..0000000000 --- a/widgets/misc/pixmaps/cursor_zoom_out.xpm +++ /dev/null @@ -1,37 +0,0 @@ -/* XPM */ -static const gchar *cursor_zoom_out_xpm[] = { -"32 32 2 1", -" c None", -". c #000000", -" ", -" ", -" ", -" ", -" ", -" ", -" ...... ", -" .. .. ", -" .. .. ", -" . . ", -" . . ", -" . . ", -" . ....... . ", -" . ....... . ", -" . . ", -" . .. ", -" .. . . ", -" .. . . . ", -" ........ . . ", -" ..... . . . ", -" . . . ", -" . . . ", -" . . . ", -" . . . ", -" . . ", -" . . ", -" .. ", -" ", -" ", -" ", -" ", -" "}; diff --git a/widgets/table/e-table-header-item.c b/widgets/table/e-table-header-item.c index 684c92037a..2b601c44b6 100644 --- a/widgets/table/e-table-header-item.c +++ b/widgets/table/e-table-header-item.c @@ -38,7 +38,6 @@ #include "e-util/e-util.h" #include "e-util/e-xml-utils.h" #include "misc/e-canvas.h" -#include "misc/e-cursors.h" #include "misc/e-gui-utils.h" #include "misc/e-popup-menu.h" @@ -121,6 +120,11 @@ ethi_dispose (GObject *object) { scroll_off (ethi); + if (ethi->resize_cursor) { + gdk_cursor_unref (ethi->resize_cursor); + ethi->resize_cursor = NULL; + } + if (ethi->dnd_code) { g_free (ethi->dnd_code); ethi->dnd_code = NULL; @@ -1081,10 +1085,9 @@ set_cursor (ETableHeaderItem *ethi, gint pos) } if (resizable) - e_cursor_set (canvas->window, E_CURSOR_SIZE_X); + gdk_window_set_cursor (canvas->window, ethi->resize_cursor); else gdk_window_set_cursor (canvas->window, NULL); - /* e_cursor_set (canvas->window, E_CURSOR_ARROW);*/ } static void @@ -1695,7 +1698,6 @@ ethi_event (GnomeCanvasItem *item, GdkEvent *e) case GDK_LEAVE_NOTIFY: gdk_window_set_cursor (GTK_WIDGET (canvas)->window, NULL); - /* e_cursor_set (GTK_WIDGET (canvas)->window, E_CURSOR_ARROW);*/ break; case GDK_MOTION_NOTIFY: @@ -1711,7 +1713,7 @@ ethi_event (GnomeCanvasItem *item, GdkEvent *e) gnome_canvas_item_grab (item, GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, - e_cursor_get (E_CURSOR_SIZE_X), + ethi->resize_cursor, e->button.time); } @@ -1952,6 +1954,8 @@ ethi_init (ETableHeaderItem *ethi) { GnomeCanvasItem *item = GNOME_CANVAS_ITEM (ethi); + ethi->resize_cursor = gdk_cursor_new (GDK_SB_H_DOUBLE_ARROW); + ethi->resize_col = -1; item->x1 = 0; diff --git a/widgets/table/e-table-header-item.h b/widgets/table/e-table-header-item.h index db2aeb3508..17e6e964f3 100644 --- a/widgets/table/e-table-header-item.h +++ b/widgets/table/e-table-header-item.h @@ -44,6 +44,7 @@ typedef struct { ETableHeader *eth; GdkCursor *change_cursor; + GdkCursor *resize_cursor; short height, width; PangoFontDescription *font_desc; |