diff options
Diffstat (limited to 'widgets')
-rw-r--r-- | widgets/Makefile.am | 2 | ||||
-rw-r--r-- | widgets/e-cursors.c | 128 | ||||
-rw-r--r-- | widgets/e-cursors.h | 33 | ||||
-rw-r--r-- | widgets/shortcut-bar/e-icon-bar.c | 4 |
4 files changed, 1 insertions, 166 deletions
diff --git a/widgets/Makefile.am b/widgets/Makefile.am index e2659cac03..a826550575 100644 --- a/widgets/Makefile.am +++ b/widgets/Makefile.am @@ -15,8 +15,6 @@ libevolutionwidgets_a_SOURCES = \ e-canvas.h \ e-canvas-utils.c \ e-canvas-utils.h \ - e-cursors.c \ - e-cursors.h \ e-minicard.c \ e-minicard.h \ e-minicard-label.c \ diff --git a/widgets/e-cursors.c b/widgets/e-cursors.c deleted file mode 100644 index 150b84b90a..0000000000 --- a/widgets/e-cursors.c +++ /dev/null @@ -1,128 +0,0 @@ -/* - * cursors.c: cursor handling for Evolution. - * copied from Gnumeric. - * - * Authors: - * Miguel de Icaza (miguel@gnu.org) - */ -#include <config.h> -#include <gnome.h> -#include "e-cursors.h" - -static GdkColor black, white; - -#define GDK_INTERNAL_CURSOR -1 - -typedef struct { - GdkCursor *cursor; - int hot_x, hot_y; - char **xpm; -} CursorDef; - -static CursorDef cursors [] = { - { NULL, GDK_INTERNAL_CURSOR, GDK_CROSSHAIR, NULL }, - { NULL, GDK_INTERNAL_CURSOR, GDK_LEFT_PTR, NULL }, - { NULL, GDK_INTERNAL_CURSOR, GDK_FLEUR, NULL }, - { NULL, GDK_INTERNAL_CURSOR, GDK_SB_H_DOUBLE_ARROW, NULL }, - { NULL, GDK_INTERNAL_CURSOR, GDK_SB_V_DOUBLE_ARROW, NULL }, - { NULL, 0, 0, NULL } -}; - - -static void -create_bitmap_and_mask_from_xpm (GdkBitmap **bitmap, GdkBitmap **mask, gchar **xpm) -{ - int height, width, colors; - char pixmap_buffer [(32 * 32)/8]; - char mask_buffer [(32 * 32)/8]; - int x, y, pix, yofs; - int transparent_color, black_color; - - sscanf (xpm [0], "%d %d %d %d", &height, &width, &colors, &pix); - - g_assert (height == 32); - g_assert (width == 32); - g_assert (colors <= 3); - - transparent_color = ' '; - black_color = '.'; - - yofs = colors + 1; - for (y = 0; y < 32; y++){ - for (x = 0; x < 32;){ - char 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) -{ - GdkColormap *colormap; - int i; - - colormap = gtk_widget_get_default_colormap (); - gdk_color_white (colormap, &white); - gdk_color_black (colormap, &black); - - for (i = 0; cursors [i].hot_x; i++){ - GdkBitmap *bitmap, *mask; - - if (cursors [i].hot_x < 0) - cursors [i].cursor = gdk_cursor_new (cursors [i].hot_y); - else { - 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, - &black, &white, - cursors [i].hot_x, - cursors [i].hot_y); - } - } - - g_assert (i == E_NUM_CURSORS); -} - -void -e_cursors_shutdown (void) -{ - int i; - - for (i = 0; cursors [i].hot_x; i++) - gdk_cursor_destroy (cursors [i].cursor); -} - - -/* Returns a cursor given its type */ -GdkCursor * -e_cursor_get (ECursorType type) -{ - g_return_val_if_fail (type >= 0 && type < E_NUM_CURSORS, NULL); - - return cursors [type].cursor; -} diff --git a/widgets/e-cursors.h b/widgets/e-cursors.h deleted file mode 100644 index 771e5f6d4d..0000000000 --- a/widgets/e-cursors.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef E_CURSORS_H -#define E_CURSORS_H - -/* Copied from Gnumeric */ - -typedef enum { - E_CURSOR_THIN_CROSS, - E_CURSOR_ARROW, - E_CURSOR_MOVE, - E_CURSOR_SIZE_X, - E_CURSOR_SIZE_Y, - E_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); - -#endif /* E_CURSORS_H */ - diff --git a/widgets/shortcut-bar/e-icon-bar.c b/widgets/shortcut-bar/e-icon-bar.c index 04c0c83e6f..1c87453507 100644 --- a/widgets/shortcut-bar/e-icon-bar.c +++ b/widgets/shortcut-bar/e-icon-bar.c @@ -250,7 +250,7 @@ e_icon_bar_new (void) GtkWidget *icon_bar; icon_bar = GTK_WIDGET (gtk_type_new (e_icon_bar_get_type ())); - + GNOME_CANVAS(icon_bar)->aa = 1; return icon_bar; } @@ -399,9 +399,7 @@ e_icon_bar_recalc_item_positions (EIconBar *icon_bar) "GnomeCanvasPixbuf::x", (gdouble)icon_bar->icon_x, "GnomeCanvasPixbuf::y", (gdouble)item->icon_y, "GnomeCanvasPixbuf::width", (gdouble)icon_bar->icon_w, - "GnomeCanvasPixbuf::width_set", TRUE, "GnomeCanvasPixbuf::height", (gdouble)icon_bar->icon_h, - "GnomeCanvasPixbuf::height_set", TRUE, NULL); y += item->item_height + icon_bar->spacing; |