annotate src/gtkwhiteboard.c @ 11882:c0e0fcd75926

[gaim-migrate @ 14173] "make distcheck" fixes for the mono plugin loader (aka. Makefile rewrites) committer: Tailor Script <tailor@pidgin.im>
author Stu Tomlinson <stu@nosnilmot.com>
date Sat, 29 Oct 2005 02:01:55 +0000
parents 4669e7461968
children 2219f4bf4a57
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
1 /*
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
2 * gaim
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
3 *
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
4 * Gaim is the legal property of its developers, whose names are too numerous
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
6 * source distribution.
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
7 *
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
11 * (at your option) any later version.
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
12 *
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
16 * GNU General Public License for more details.
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
17 *
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
21 *
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
22 */
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
23
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
24 #include <stdlib.h>
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
25
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
26 #include "blist.h"
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
27
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
28 #include "gtkwhiteboard.h"
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
29
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
30 /******************************************************************************
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
31 * Prototypes
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
32 *****************************************************************************/
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
33 static void gaim_gtk_whiteboard_create( GaimWhiteboard *wb );
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
34
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
35 static void gaim_gtk_whiteboard_destroy( GaimWhiteboard *wb );
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
36 static void gaim_gtk_whiteboard_exit( GtkWidget *widget, gpointer data );
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
37
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
38 /*static void gaim_gtkwhiteboard_button_start_press( GtkButton *button, gpointer data ); */
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
39
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
40 static gboolean gaim_gtk_whiteboard_configure_event( GtkWidget *widget, GdkEventConfigure *event, gpointer data );
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
41 static gboolean gaim_gtk_whiteboard_expose_event( GtkWidget *widget, GdkEventExpose *event, gpointer data );
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
42
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
43 static gboolean gaim_gtk_whiteboard_brush_down( GtkWidget *widget, GdkEventButton *event, gpointer data );
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
44 static gboolean gaim_gtk_whiteboard_brush_motion( GtkWidget *widget, GdkEventMotion *event, gpointer data );
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
45 static gboolean gaim_gtk_whiteboard_brush_up( GtkWidget *widget, GdkEventButton *event, gpointer data );
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
46
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
47 static void gaim_gtk_whiteboard_draw_brush_point( GaimWhiteboard *wb,
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
48 int x, int y, int color, int size );
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
49 static void gaim_gtk_whiteboard_draw_brush_line( GaimWhiteboard *wb,
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
50 int x0, int y0, int x1, int y1, int color, int size );
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
51
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
52 static void gaim_gtk_whiteboard_set_dimensions( GaimWhiteboard *wb, int width, int height );
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
53 static void gaim_gtk_whiteboard_clear( GaimWhiteboard *wb );
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
54
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
55 static void gaim_gtk_whiteboard_button_clear_press( GtkWidget *widget, gpointer data );
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
56 static void gaim_gtk_whiteboard_button_save_press( GtkWidget *widget, gpointer data );
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
57
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
58 static void gaim_gtk_whiteboard_set_canvas_as_icon( GaimGtkWhiteboard *gtkwb );
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
59
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
60 static void gaim_gtk_whiteboard_rgb24_to_rgb48( int color_rgb, GdkColor *color );
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
61
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
62 /******************************************************************************
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
63 * Globals
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
64 *****************************************************************************/
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
65 /*
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
66 GList *buttonList = NULL;
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
67 GdkColor DefaultColor[PALETTE_NUM_COLORS];
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
68 */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
69
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
70 static gboolean LocalShutdownRequest;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
71
11829
4669e7461968 [gaim-migrate @ 14120]
Richard Laager <rlaager@wiktel.com>
parents: 11802
diff changeset
72 static int LastX; /* Tracks last position of the mouse when drawing */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
73 static int LastY;
11829
4669e7461968 [gaim-migrate @ 14120]
Richard Laager <rlaager@wiktel.com>
parents: 11802
diff changeset
74 static int MotionCount; /* Tracks how many brush motions made */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
75 static int BrushState = BRUSH_STATE_UP;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
76
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
77 static GaimWhiteboardUiOps ui_ops =
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
78 {
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
79 gaim_gtk_whiteboard_create,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
80 gaim_gtk_whiteboard_destroy,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
81 gaim_gtk_whiteboard_set_dimensions,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
82 gaim_gtk_whiteboard_draw_brush_point,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
83 gaim_gtk_whiteboard_draw_brush_line,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
84 gaim_gtk_whiteboard_clear
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
85 };
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
86
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
87 /******************************************************************************
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
88 * API
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
89 *****************************************************************************/
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
90 GaimWhiteboardUiOps *gaim_gtk_whiteboard_get_ui_ops( void )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
91 {
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
92 return( &ui_ops );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
93 }
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
94
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
95 void gaim_gtk_whiteboard_create( GaimWhiteboard *wb )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
96 {
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
97 int i;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
98
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
99 GtkWidget *window;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
100 GtkWidget *drawing_area;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
101
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
102 GtkWidget *hbox_palette;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
103 GtkWidget *vbox_palette_above_canvas_and_controls;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
104 GtkWidget *hbox_canvas_and_controls;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
105 GtkWidget *vbox_controls;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
106
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
107 /*
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
108 --------------------------
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
109 |[][][][palette[][][][][]|
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
110 |------------------------|
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
111 | canvas | con |
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
112 | | trol|
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
113 | | s |
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
114 | | |
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
115 | | |
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
116 --------------------------
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
117 */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
118 GtkWidget *clear_button;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
119 GtkWidget *save_button;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
120
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
121 GtkWidget *palette_color_box[PALETTE_NUM_COLORS];
11484
4539174a88bd [gaim-migrate @ 13726]
Richard Laager <rlaager@wiktel.com>
parents: 11475
diff changeset
122 /* GdkPixbuf *palette_color_area[PALETTE_NUM_COLORS]; */
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
123
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
124 GaimGtkWhiteboard *gtkwb = g_new0( GaimGtkWhiteboard, 1 );
11506
88d504770c60 [gaim-migrate @ 13751]
Richard Laager <rlaager@wiktel.com>
parents: 11484
diff changeset
125
88d504770c60 [gaim-migrate @ 13751]
Richard Laager <rlaager@wiktel.com>
parents: 11484
diff changeset
126 const char *window_title;
88d504770c60 [gaim-migrate @ 13751]
Richard Laager <rlaager@wiktel.com>
parents: 11484
diff changeset
127
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
128 gtkwb->wb = wb;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
129 wb->ui_data = gtkwb;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
130
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
131 /* Get dimensions (default?) for the whiteboard canvas */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
132 if( wb->prpl_ops && wb->prpl_ops->get_dimensions )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
133 wb->prpl_ops->get_dimensions( wb, &gtkwb->width, &gtkwb->height );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
134
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
135 window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
136 gtkwb->window = window;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
137 gtk_widget_set_name( window, wb->who );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
138
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
139 /* Try and set window title as the name of the buddy, else just use their
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
140 * username
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
141 */
11506
88d504770c60 [gaim-migrate @ 13751]
Richard Laager <rlaager@wiktel.com>
parents: 11484
diff changeset
142 window_title = gaim_contact_get_alias( gaim_buddy_get_contact( gaim_find_buddy( wb->account, wb->who ) ) );
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
143 if( window_title )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
144 gtk_window_set_title( ( GtkWindow* )( window ), window_title );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
145 else
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
146 gtk_window_set_title( ( GtkWindow* )( window ), wb->who );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
147
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
148 gtk_window_set_resizable( ( GtkWindow* )( window ), FALSE );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
149
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
150 g_signal_connect( G_OBJECT( window ), "destroy",
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
151 G_CALLBACK( gaim_gtk_whiteboard_exit ), ( gpointer )( gtkwb ) );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
152
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
153 /* Create vertical box to place palette above the canvas and controls */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
154 vbox_palette_above_canvas_and_controls = gtk_vbox_new( FALSE, 0 );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
155 gtk_container_add( GTK_CONTAINER( window ), vbox_palette_above_canvas_and_controls );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
156 gtk_widget_show( vbox_palette_above_canvas_and_controls );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
157
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
158 /* Create horizontal box for the palette and all its entries */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
159 hbox_palette = gtk_hbox_new( FALSE, 0 );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
160 gtk_container_add( GTK_CONTAINER( vbox_palette_above_canvas_and_controls ), hbox_palette );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
161 gtk_widget_show( hbox_palette );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
162
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
163 /* Create horizontal box to seperate the canvas from the controls */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
164 hbox_canvas_and_controls = gtk_hbox_new( FALSE, 0 );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
165 gtk_container_add( GTK_CONTAINER( vbox_palette_above_canvas_and_controls ), hbox_canvas_and_controls );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
166 gtk_widget_show( hbox_canvas_and_controls );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
167
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
168 for( i = 0; i < PALETTE_NUM_COLORS; i++ )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
169 {
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
170 /* palette_color_area[i] = */
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
171
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
172 palette_color_box[i] = gtk_image_new_from_pixbuf( NULL );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
173 gtk_widget_set_size_request( palette_color_box[i], gtkwb->width / PALETTE_NUM_COLORS ,32 );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
174 gtk_container_add( GTK_CONTAINER( hbox_palette ), palette_color_box[i] );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
175
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
176 gtk_widget_show( palette_color_box[i] );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
177 }
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
178
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
179 /* Create the drawing area */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
180 drawing_area = gtk_drawing_area_new();
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
181 gtkwb->drawing_area = drawing_area;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
182 gtk_widget_set_size_request( GTK_WIDGET( drawing_area ), gtkwb->width, gtkwb->height );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
183 gtk_box_pack_start( GTK_BOX( hbox_canvas_and_controls ), drawing_area, TRUE, TRUE, 8 );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
184
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
185 gtk_widget_show( drawing_area );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
186
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
187 /* Signals used to handle backing pixmap */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
188 g_signal_connect( G_OBJECT( drawing_area ), "expose_event",
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
189 G_CALLBACK( gaim_gtk_whiteboard_expose_event ), ( gpointer )( gtkwb ) );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
190
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
191 g_signal_connect( G_OBJECT( drawing_area ), "configure_event",
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
192 G_CALLBACK( gaim_gtk_whiteboard_configure_event ), ( gpointer )( gtkwb ) );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
193
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
194 /* Event signals */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
195 g_signal_connect( G_OBJECT( drawing_area ), "button_press_event",
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
196 G_CALLBACK( gaim_gtk_whiteboard_brush_down ), ( gpointer )( gtkwb ) );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
197
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
198 g_signal_connect( G_OBJECT( drawing_area ), "motion_notify_event",
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
199 G_CALLBACK( gaim_gtk_whiteboard_brush_motion ), ( gpointer )( gtkwb ) );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
200
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
201 g_signal_connect( G_OBJECT( drawing_area ), "button_release_event",
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
202 G_CALLBACK( gaim_gtk_whiteboard_brush_up ), ( gpointer )( gtkwb ) );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
203
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
204 gtk_widget_set_events( drawing_area, GDK_EXPOSURE_MASK |
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
205 GDK_LEAVE_NOTIFY_MASK |
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
206 GDK_BUTTON_PRESS_MASK |
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
207 GDK_POINTER_MOTION_MASK |
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
208 GDK_BUTTON_RELEASE_MASK |
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
209 GDK_POINTER_MOTION_HINT_MASK );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
210
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
211 /* Create vertical box to contain the controls */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
212 vbox_controls = gtk_vbox_new( FALSE, 0 );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
213 gtk_container_add( GTK_CONTAINER( hbox_canvas_and_controls ), vbox_controls );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
214 gtk_widget_show( vbox_controls );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
215
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
216 /* Add a clear button */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
217 clear_button = gtk_button_new_with_label( "Clear" );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
218 gtk_widget_set_size_request( clear_button, 96 ,32 );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
219 gtk_box_pack_start( GTK_BOX( vbox_controls ), clear_button, FALSE, FALSE, 0 );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
220 gtk_widget_show( clear_button );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
221
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
222 g_signal_connect( G_OBJECT( clear_button ), "clicked",
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
223 G_CALLBACK( gaim_gtk_whiteboard_button_clear_press ), ( gpointer )( gtkwb ) );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
224
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
225 /* Add a save button */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
226 save_button = gtk_button_new_with_label( "Save" );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
227 gtk_widget_set_size_request( save_button, 96 ,32 );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
228 gtk_box_pack_start( GTK_BOX( vbox_controls ), save_button, FALSE, FALSE, 8 );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
229 gtk_widget_show( save_button );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
230
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
231 g_signal_connect( G_OBJECT( save_button ), "clicked",
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
232 G_CALLBACK( gaim_gtk_whiteboard_button_save_press ), ( gpointer )( gtkwb ) );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
233
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
234 /* Make all this (window) visible */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
235 gtk_widget_show( window );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
236
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
237 gaim_gtk_whiteboard_set_canvas_as_icon( gtkwb );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
238
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
239 /* TODO Specific protocol/whiteboard assignment here? Needs a UI Op? */
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
240 /* Set default brush size and color */
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
241 /*
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
242 ds->brush_size = DOODLE_BRUSH_MEDIUM;
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
243 ds->brush_color = 0;
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
244 */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
245 }
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
246
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
247 void gaim_gtk_whiteboard_destroy( GaimWhiteboard *wb )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
248 {
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
249 GaimGtkWhiteboard *gtkwb = wb->ui_data;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
250
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
251 /* TODO Ask if user wants to save picture before the session is closed */
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
252
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
253 /* Clear graphical memory */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
254 if( gtkwb->pixmap )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
255 {
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
256 g_object_unref( gtkwb->pixmap );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
257 gtkwb->pixmap = NULL;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
258 }
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
259
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
260 if( gtkwb->window )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
261 {
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
262 gtk_widget_destroy( gtkwb->window );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
263 gtkwb->window = NULL;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
264 }
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
265 }
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
266
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
267 void gaim_gtk_whiteboard_exit( GtkWidget *widget, gpointer data )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
268 {
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
269 GaimGtkWhiteboard *gtkwb = ( GaimGtkWhiteboard* )( data );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
270 GaimWhiteboard *wb = gtkwb->wb;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
271
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
272 if( gtkwb->window && gtkwb->pixmap )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
273 {
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
274 LocalShutdownRequest = TRUE;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
275
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
276 gaim_gtk_whiteboard_destroy( wb );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
277 }
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
278 else
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
279 LocalShutdownRequest = FALSE;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
280
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
281 if( gtkwb )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
282 {
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
283 g_free( gtkwb );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
284
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
285 gtkwb = NULL;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
286 wb->ui_data = NULL;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
287 }
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
288
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
289 /* Destroy whiteboard core, if the local user exited the whiteboard window */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
290 if( wb && LocalShutdownRequest )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
291 {
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
292 gaim_whiteboard_destroy( wb );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
293 wb = NULL;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
294 }
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
295 }
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
296
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
297 /*
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
298 * Whiteboard start button on conversation window (move this code to gtkconv?
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
299 * and use new prpl_info member?)
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
300 */
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
301 #if 0
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
302 void gaim_gtkwhiteboard_button_start_press( GtkButton *button, gpointer data )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
303 {
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
304 GaimConversation *conv = data;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
305 GaimAccount *account = gaim_conversation_get_account( conv );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
306 GaimConnection *gc = gaim_account_get_connection( account );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
307 char *to = ( char* )( gaim_conversation_get_name( conv ) );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
308
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
309 /* Only handle this if local client requested Doodle session (else local
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
310 * client would have sent one)
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
311 */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
312 GaimWhiteboard *wb = gaim_whiteboard_get( account, to );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
313
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
314 /* Write a local message to this conversation showing that a request for a
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
315 * Doodle session has been made
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
316 */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
317 gaim_conv_im_write( GAIM_CONV_IM( conv ), "", _("Sent Doodle request."),
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
318 GAIM_MESSAGE_NICK | GAIM_MESSAGE_RECV, time( NULL ) );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
319
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
320 yahoo_doodle_command_send_request( gc, to );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
321 yahoo_doodle_command_send_ready( gc, to );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
322
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
323 /* Insert this 'session' in the list. At this point, it's only a requested
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
324 * session.
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
325 */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
326 wb = gaim_whiteboard_create( account, to, DOODLE_STATE_REQUESTING );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
327 }
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
328 #endif
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
329
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
330 gboolean gaim_gtk_whiteboard_configure_event( GtkWidget *widget, GdkEventConfigure *event, gpointer data )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
331 {
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
332 GaimGtkWhiteboard *gtkwb = ( GaimGtkWhiteboard* )( data );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
333
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
334 GdkPixmap *pixmap = gtkwb->pixmap;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
335
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
336 if( pixmap )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
337 g_object_unref( pixmap );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
338
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
339 pixmap = gdk_pixmap_new( widget->window,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
340 widget->allocation.width,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
341 widget->allocation.height,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
342 -1 );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
343
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
344 gtkwb->pixmap = pixmap;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
345
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
346 gdk_draw_rectangle( pixmap,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
347 widget->style->white_gc,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
348 TRUE,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
349 0, 0,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
350 widget->allocation.width,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
351 widget->allocation.height );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
352
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
353 return( TRUE );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
354 }
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
355
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
356 gboolean gaim_gtk_whiteboard_expose_event( GtkWidget *widget, GdkEventExpose *event, gpointer data )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
357 {
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
358 GaimGtkWhiteboard *gtkwb = ( GaimGtkWhiteboard* )( data );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
359 GdkPixmap *pixmap = gtkwb->pixmap;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
360
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
361 gdk_draw_drawable( widget->window,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
362 widget->style->fg_gc[GTK_WIDGET_STATE( widget )],
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
363 pixmap,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
364 event->area.x, event->area.y,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
365 event->area.x, event->area.y,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
366 event->area.width, event->area.height );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
367
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
368 return( FALSE );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
369 }
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
370
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
371 gboolean gaim_gtk_whiteboard_brush_down( GtkWidget *widget, GdkEventButton *event, gpointer data )
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
372 {
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
373 GaimGtkWhiteboard *gtkwb = ( GaimGtkWhiteboard* )( data );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
374 GdkPixmap *pixmap = gtkwb->pixmap;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
375
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
376 GaimWhiteboard *wb = gtkwb->wb;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
377 GList *draw_list = wb->draw_list;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
378
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
379 int *x0 = NULL;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
380 int *y0 = NULL;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
381
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
382 if( BrushState != BRUSH_STATE_UP )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
383 {
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
384 /* Potential double-click DOWN to DOWN? */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
385 BrushState = BRUSH_STATE_DOWN;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
386
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
387 /* return( FALSE ); */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
388 }
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
389
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
390 BrushState = BRUSH_STATE_DOWN;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
391
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
392 if( event->button == 1 && pixmap != NULL )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
393 {
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
394 /* Check if draw_list has contents; if so, clear it */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
395 if( draw_list )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
396 draw_list = gaim_whiteboard_draw_list_destroy( draw_list );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
397
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
398 x0 = g_new0( int, 1 );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
399 y0 = g_new0( int, 1 );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
400
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
401 *x0 = event->x;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
402 *y0 = event->y;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
403
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
404 /* Set tracking variables */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
405 LastX = *x0;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
406 LastY = *y0;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
407
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
408 MotionCount = 0;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
409
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
410 draw_list = g_list_append( draw_list, ( gpointer )( x0 ) );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
411 draw_list = g_list_append( draw_list, ( gpointer )( y0 ) );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
412
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
413 gaim_gtk_whiteboard_draw_brush_point( gtkwb->wb,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
414 event->x, event->y,
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
415 0,5 );
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
416 /* gtkwb->brush_color, gtkwb->brush_size ); NOTE temp const prot uiop */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
417 }
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
418
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
419 wb->draw_list = draw_list;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
420
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
421 return( TRUE );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
422 }
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
423
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
424 gboolean gaim_gtk_whiteboard_brush_motion( GtkWidget *widget, GdkEventMotion *event, gpointer data )
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
425 {
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
426 int x;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
427 int y;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
428 int *dx;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
429 int *dy;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
430
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
431 GdkModifierType state;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
432
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
433 GaimGtkWhiteboard *gtkwb = ( GaimGtkWhiteboard* )( data );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
434 GdkPixmap *pixmap = gtkwb->pixmap;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
435
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
436 GaimWhiteboard *wb = gtkwb->wb;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
437 GList *draw_list = wb->draw_list;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
438
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
439 if( event->is_hint )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
440 gdk_window_get_pointer( event->window, &x, &y, &state );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
441 else
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
442 {
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
443 x = event->x;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
444 y = event->y;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
445 state = event->state;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
446 }
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
447
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
448 if( state & GDK_BUTTON1_MASK && pixmap != NULL )
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
449 {
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
450 if( ( BrushState != BRUSH_STATE_DOWN ) && ( BrushState != BRUSH_STATE_MOTION ) )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
451 {
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
452 g_print( "***Bad brush state transition %d to MOTION\n", BrushState );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
453
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
454 BrushState = BRUSH_STATE_MOTION;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
455
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
456 return( FALSE );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
457 }
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
458 BrushState = BRUSH_STATE_MOTION;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
459
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
460 dx = g_new0( int, 1 );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
461 dy = g_new0( int, 1 );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
462
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
463 *dx = x - LastX;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
464 *dy = y - LastY;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
465
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
466 MotionCount++;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
467
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
468 /* NOTE 100 is a temporary constant for how many deltas/motions in a
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
469 * stroke (needs UI Ops?)
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
470 */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
471 if( MotionCount == 100 )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
472 {
11506
88d504770c60 [gaim-migrate @ 13751]
Richard Laager <rlaager@wiktel.com>
parents: 11484
diff changeset
473 int *x0 = g_new0( int, 1 );
88d504770c60 [gaim-migrate @ 13751]
Richard Laager <rlaager@wiktel.com>
parents: 11484
diff changeset
474 int *y0 = g_new0( int, 1 );
88d504770c60 [gaim-migrate @ 13751]
Richard Laager <rlaager@wiktel.com>
parents: 11484
diff changeset
475
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
476 draw_list = g_list_append( draw_list, ( gpointer )( dx ) );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
477 draw_list = g_list_append( draw_list, ( gpointer )( dy ) );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
478
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
479 /* Send draw list to prpl draw_list handler */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
480 if( gtkwb->wb->prpl_ops && gtkwb->wb->prpl_ops->send_draw_list )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
481 gtkwb->wb->prpl_ops->send_draw_list( gtkwb->wb, draw_list );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
482
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
483 /* The brush stroke is finished, clear the list for another one */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
484 if( draw_list )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
485 draw_list = gaim_whiteboard_draw_list_destroy( draw_list );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
486
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
487 *x0 = LastX;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
488 *y0 = LastY;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
489
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
490 /* Reset motion tracking */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
491 MotionCount = 0;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
492
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
493 draw_list = g_list_append( draw_list, ( gpointer )( x0 ) );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
494 draw_list = g_list_append( draw_list, ( gpointer )( y0 ) );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
495
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
496 dx = g_new0( int, 1 );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
497 dy = g_new0( int, 1 );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
498
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
499 *dx = x - LastX;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
500 *dy = y - LastY;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
501 }
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
502
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
503 draw_list = g_list_append( draw_list, ( gpointer )( dx ) );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
504 draw_list = g_list_append( draw_list, ( gpointer )( dy ) );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
505
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
506 gaim_gtk_whiteboard_draw_brush_line( gtkwb->wb,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
507 LastX, LastY,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
508 x, y,
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
509 0, 5 );
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
510 /*gtkwb->brush_color, gtkwb->brush_size ); temp const proto ui ops? */
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
511
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
512 /* Set tracking variables */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
513 LastX = x;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
514 LastY = y;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
515 }
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
516
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
517 wb->draw_list = draw_list;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
518
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
519 return( TRUE );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
520 }
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
521
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
522 gboolean gaim_gtk_whiteboard_brush_up( GtkWidget *widget, GdkEventButton *event, gpointer data )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
523 {
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
524 GaimGtkWhiteboard *gtkwb = ( GaimGtkWhiteboard* )( data );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
525 GdkPixmap *pixmap = gtkwb->pixmap;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
526
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
527 GaimWhiteboard *wb = gtkwb->wb;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
528 GList *draw_list = wb->draw_list;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
529
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
530 if( ( BrushState != BRUSH_STATE_DOWN ) && ( BrushState != BRUSH_STATE_MOTION ) )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
531 {
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
532 g_print( "***Bad brush state transition %d to UP\n", BrushState );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
533
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
534 BrushState = BRUSH_STATE_UP;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
535
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
536 return( FALSE );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
537 }
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
538 BrushState = BRUSH_STATE_UP;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
539
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
540 if( event->button == 1 && pixmap != NULL )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
541 {
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
542 /* If the brush was never moved, express two sets of two deltas That's a
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
543 * 'point,' but not for Yahoo!
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
544 */
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
545 /* if( ( event->x == LastX ) && ( event->y == LastY ) ) */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
546 if( MotionCount == 0 )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
547 {
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
548 int index;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
549
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
550 for( index = 0; index < 2; index++ )/* NOTE Yahoo Doodle specific! */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
551 {
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
552 int *x0 = NULL;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
553 int *y0 = NULL;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
554
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
555 x0 = g_new0( int, 1 );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
556 y0 = g_new0( int, 1 );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
557
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
558 draw_list = g_list_append( draw_list, ( gpointer )( x0 ) );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
559 draw_list = g_list_append( draw_list, ( gpointer )( y0 ) );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
560 }
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
561 }
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
562 /*
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
563 else
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
564 MotionCount = 0;
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
565 */
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
566
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
567 /* Send draw list to prpl draw_list handler */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
568 if( gtkwb->wb->prpl_ops && gtkwb->wb->prpl_ops->send_draw_list )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
569 gtkwb->wb->prpl_ops->send_draw_list( gtkwb->wb, draw_list );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
570
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
571 gaim_gtk_whiteboard_set_canvas_as_icon( gtkwb );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
572
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
573 /* The brush stroke is finished, clear the list for another one */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
574 if( draw_list )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
575 draw_list = gaim_whiteboard_draw_list_destroy( draw_list );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
576
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
577 wb->draw_list = draw_list;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
578 }
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
579
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
580 return( TRUE );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
581 }
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
582
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
583 /* void gaim_gtk_whiteboard_draw_brush_point( GtkWidget *widget, GaimGtkWhiteboard *gtkwb,
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
584 int x, int y, int color, int size )
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
585 */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
586 void gaim_gtk_whiteboard_draw_brush_point( GaimWhiteboard *wb, int x, int y, int color, int size )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
587 {
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
588 GaimGtkWhiteboard *gtkwb = wb->ui_data;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
589 GtkWidget *widget = gtkwb->drawing_area;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
590 GdkPixmap *pixmap = gtkwb->pixmap;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
591
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
592 GdkRectangle update_rect;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
593
11506
88d504770c60 [gaim-migrate @ 13751]
Richard Laager <rlaager@wiktel.com>
parents: 11484
diff changeset
594 GdkGC *gfx_con = gdk_gc_new( pixmap );
88d504770c60 [gaim-migrate @ 13751]
Richard Laager <rlaager@wiktel.com>
parents: 11484
diff changeset
595 GdkColor col;
88d504770c60 [gaim-migrate @ 13751]
Richard Laager <rlaager@wiktel.com>
parents: 11484
diff changeset
596
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
597 update_rect.x = x - size / 2;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
598 update_rect.y = y - size / 2;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
599 update_rect.width = size;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
600 update_rect.height = size;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
601
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
602 /* Interpret and convert color */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
603 gaim_gtk_whiteboard_rgb24_to_rgb48( color, &col );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
604
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
605 gdk_gc_set_rgb_fg_color( gfx_con, &col );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
606 /* gdk_gc_set_rgb_bg_color( gfx_con, &col ); */
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
607
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
608 /* NOTE 5 is a size constant for now... this is because of how poorly the
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
609 * gdk_draw_arc draws small circles
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
610 */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
611 if( size < 5 )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
612 {
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
613 /* Draw a rectangle/square */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
614 gdk_draw_rectangle( pixmap,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
615 gfx_con,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
616 TRUE,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
617 update_rect.x, update_rect.y,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
618 update_rect.width, update_rect.height );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
619 }
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
620 else
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
621 {
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
622 /* Draw a circle */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
623 gdk_draw_arc( pixmap,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
624 gfx_con,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
625 TRUE,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
626 update_rect.x, update_rect.y,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
627 update_rect.width, update_rect.height,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
628 0, FULL_CIRCLE_DEGREES );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
629 }
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
630
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
631 gtk_widget_queue_draw_area( widget,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
632 update_rect.x, update_rect.y,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
633 update_rect.width, update_rect.height );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
634
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
635 gdk_gc_unref( gfx_con );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
636 }
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
637
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
638 /* Uses Bresenham's algorithm (as provided by Wikipedia) */
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
639 /* void gaim_gtk_whiteboard_draw_brush_line( GtkWidget *widget, GaimGtkWhiteboard *gtkwb,
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
640 int x0, int y0, int x1, int y1, int color, int size )
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
641 */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
642 void gaim_gtk_whiteboard_draw_brush_line( GaimWhiteboard *wb, int x0, int y0, int x1, int y1, int color, int size )
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
643 {
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
644 int temp;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
645
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
646 int xstep;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
647 int ystep;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
648
11506
88d504770c60 [gaim-migrate @ 13751]
Richard Laager <rlaager@wiktel.com>
parents: 11484
diff changeset
649 int dx;
88d504770c60 [gaim-migrate @ 13751]
Richard Laager <rlaager@wiktel.com>
parents: 11484
diff changeset
650 int dy;
88d504770c60 [gaim-migrate @ 13751]
Richard Laager <rlaager@wiktel.com>
parents: 11484
diff changeset
651
88d504770c60 [gaim-migrate @ 13751]
Richard Laager <rlaager@wiktel.com>
parents: 11484
diff changeset
652 int error;
88d504770c60 [gaim-migrate @ 13751]
Richard Laager <rlaager@wiktel.com>
parents: 11484
diff changeset
653 int derror;
88d504770c60 [gaim-migrate @ 13751]
Richard Laager <rlaager@wiktel.com>
parents: 11484
diff changeset
654
88d504770c60 [gaim-migrate @ 13751]
Richard Laager <rlaager@wiktel.com>
parents: 11484
diff changeset
655 int x;
88d504770c60 [gaim-migrate @ 13751]
Richard Laager <rlaager@wiktel.com>
parents: 11484
diff changeset
656 int y;
88d504770c60 [gaim-migrate @ 13751]
Richard Laager <rlaager@wiktel.com>
parents: 11484
diff changeset
657
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
658 gboolean steep = abs( y1 - y0 ) > abs( x1 - x0 );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
659
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
660 if( steep )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
661 {
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
662 temp = x0; x0 = y0; y0 = temp;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
663 temp = x1; x1 = y1; y1 = temp;
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
664 }
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
665
11506
88d504770c60 [gaim-migrate @ 13751]
Richard Laager <rlaager@wiktel.com>
parents: 11484
diff changeset
666 dx = abs( x1 - x0 );
88d504770c60 [gaim-migrate @ 13751]
Richard Laager <rlaager@wiktel.com>
parents: 11484
diff changeset
667 dy = abs( y1 - y0 );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
668
11506
88d504770c60 [gaim-migrate @ 13751]
Richard Laager <rlaager@wiktel.com>
parents: 11484
diff changeset
669 error = 0;
88d504770c60 [gaim-migrate @ 13751]
Richard Laager <rlaager@wiktel.com>
parents: 11484
diff changeset
670 derror = dy;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
671
11506
88d504770c60 [gaim-migrate @ 13751]
Richard Laager <rlaager@wiktel.com>
parents: 11484
diff changeset
672 x = x0;
88d504770c60 [gaim-migrate @ 13751]
Richard Laager <rlaager@wiktel.com>
parents: 11484
diff changeset
673 y = y0;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
674
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
675 if( x0 < x1 )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
676 xstep = 1;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
677 else
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
678 xstep = -1;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
679
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
680 if( y0 < y1 )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
681 ystep = 1;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
682 else
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
683 ystep = -1;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
684
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
685 if( steep )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
686 gaim_gtk_whiteboard_draw_brush_point( wb, y, x, color, size );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
687 else
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
688 gaim_gtk_whiteboard_draw_brush_point( wb, x, y, color, size );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
689
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
690 while( x != x1 )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
691 {
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
692 x = x + xstep;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
693 error = error + derror;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
694
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
695 if( ( error * 2 ) >= dx )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
696 {
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
697 y = y + ystep;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
698 error = error - dx;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
699 }
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
700
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
701 if( steep )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
702 gaim_gtk_whiteboard_draw_brush_point( wb, y, x, color, size );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
703 else
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
704 gaim_gtk_whiteboard_draw_brush_point( wb, x, y, color, size );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
705 }
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
706 }
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
707
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
708 void gaim_gtk_whiteboard_set_dimensions( GaimWhiteboard *wb, int width, int height )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
709 {
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
710 GaimGtkWhiteboard *gtkwb = wb->ui_data;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
711
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
712 gtkwb->width = width;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
713 gtkwb->height = height;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
714 }
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
715
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
716 void gaim_gtk_whiteboard_clear( GaimWhiteboard *wb )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
717 {
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
718 GaimGtkWhiteboard *gtkwb = wb->ui_data;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
719 GdkPixmap *pixmap = gtkwb->pixmap;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
720 GtkWidget *drawing_area = gtkwb->drawing_area;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
721
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
722 gdk_draw_rectangle( pixmap,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
723 drawing_area->style->white_gc,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
724 TRUE,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
725 0, 0,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
726 drawing_area->allocation.width, drawing_area->allocation.height );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
727
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
728 gtk_widget_queue_draw_area( drawing_area,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
729 0, 0,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
730 drawing_area->allocation.width, drawing_area->allocation.height );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
731 }
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
732
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
733 void gaim_gtk_whiteboard_button_clear_press( GtkWidget *widget, gpointer data )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
734 {
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
735 GaimGtkWhiteboard *gtkwb = ( GaimGtkWhiteboard* )( data );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
736
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
737 gaim_gtk_whiteboard_clear( gtkwb->wb );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
738
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
739 gaim_gtk_whiteboard_set_canvas_as_icon( gtkwb );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
740
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
741 /* Do protocol specific clearing procedures */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
742 if( gtkwb->wb->prpl_ops && gtkwb->wb->prpl_ops->clear )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
743 gtkwb->wb->prpl_ops->clear( gtkwb->wb );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
744 }
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
745
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
746 void gaim_gtk_whiteboard_button_save_press( GtkWidget *widget, gpointer data )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
747 {
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
748 GaimGtkWhiteboard *gtkwb = ( GaimGtkWhiteboard* )( data );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
749 GdkPixbuf *pixbuf;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
750
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
751 GtkWidget *dialog;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
752
11506
88d504770c60 [gaim-migrate @ 13751]
Richard Laager <rlaager@wiktel.com>
parents: 11484
diff changeset
753 int result;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
754
11558
19941a47405c [gaim-migrate @ 13820]
Sean Egan <seanegan@gmail.com>
parents: 11506
diff changeset
755 #if GTK_CHECK_VERSION(2,4,0) /* FILECHOOSER */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
756 dialog = gtk_file_chooser_dialog_new ("Save File",
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
757 GTK_WINDOW(gtkwb->window),
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
758 GTK_FILE_CHOOSER_ACTION_SAVE,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
759 GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
760 GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
761 NULL );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
762
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
763 /* gtk_file_chooser_set_do_overwrite_confirmation( GTK_FILE_CHOOSER( dialog ), (gboolean)(TRUE) ); */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
764
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
765 /* if( user_edited_a_new_document ) */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
766 {
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
767 /* gtk_file_chooser_set_current_folder( GTK_FILE_CHOOSER( dialog ), default_folder_for_saving ); */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
768 gtk_file_chooser_set_current_name( GTK_FILE_CHOOSER( dialog ), "whiteboard.jpg" );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
769 }
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
770 /*
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
771 else
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
772 gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (dialog), filename_for_existing_document);
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
773 */
11558
19941a47405c [gaim-migrate @ 13820]
Sean Egan <seanegan@gmail.com>
parents: 11506
diff changeset
774 #else
19941a47405c [gaim-migrate @ 13820]
Sean Egan <seanegan@gmail.com>
parents: 11506
diff changeset
775 dialog = gtk_file_selection_new("Save File");
19941a47405c [gaim-migrate @ 13820]
Sean Egan <seanegan@gmail.com>
parents: 11506
diff changeset
776 gtk_file_selection_set_filename(GTK_FILE_SELECTION(dialog), "whiteboard.jpg");
19941a47405c [gaim-migrate @ 13820]
Sean Egan <seanegan@gmail.com>
parents: 11506
diff changeset
777 #endif
11506
88d504770c60 [gaim-migrate @ 13751]
Richard Laager <rlaager@wiktel.com>
parents: 11484
diff changeset
778 result = gtk_dialog_run( GTK_DIALOG( dialog ) );
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
779
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
780 if( result == GTK_RESPONSE_ACCEPT )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
781 {
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
782 char *filename;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
783
11558
19941a47405c [gaim-migrate @ 13820]
Sean Egan <seanegan@gmail.com>
parents: 11506
diff changeset
784 #if GTK_CHECK_VERSION(2,4,0) /* FILECHOOSER */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
785 filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER( dialog ) );
11558
19941a47405c [gaim-migrate @ 13820]
Sean Egan <seanegan@gmail.com>
parents: 11506
diff changeset
786 #else
19941a47405c [gaim-migrate @ 13820]
Sean Egan <seanegan@gmail.com>
parents: 11506
diff changeset
787 filename = g_strdup(gtk_file_selection_get_filename(GTK_FILE_SELECTION(dialog)));
19941a47405c [gaim-migrate @ 13820]
Sean Egan <seanegan@gmail.com>
parents: 11506
diff changeset
788 #endif
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
789 gtk_widget_destroy( dialog );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
790
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
791 /* Makes an icon from the whiteboard's canvas 'image' */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
792 pixbuf = gdk_pixbuf_get_from_drawable( NULL,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
793 ( GdkDrawable* )( gtkwb->pixmap ),
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
794 gdk_drawable_get_colormap( gtkwb->pixmap ),
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
795 0, 0,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
796 0, 0,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
797 gtkwb->width, gtkwb->height );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
798
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
799 if( gdk_pixbuf_save( pixbuf,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
800 filename,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
801 "jpeg",
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
802 NULL,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
803 "quality",
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
804 "100",
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
805 NULL ) )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
806 g_print( "File Saved...\n" );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
807 else
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
808 g_print( "File not Saved... Error\n" );
11558
19941a47405c [gaim-migrate @ 13820]
Sean Egan <seanegan@gmail.com>
parents: 11506
diff changeset
809 g_free(filename);
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
810 }
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
811 else
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
812 if( result == GTK_RESPONSE_CANCEL )
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
813 {
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
814 gtk_widget_destroy( dialog );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
815
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
816 g_print( "File not Saved... Canceled\n" );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
817 }
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
818 }
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
819
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
820 void gaim_gtk_whiteboard_set_canvas_as_icon( GaimGtkWhiteboard *gtkwb )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
821 {
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
822 GdkPixbuf *pixbuf;
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
823
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
824 /* Makes an icon from the whiteboard's canvas 'image' */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
825 pixbuf = gdk_pixbuf_get_from_drawable( NULL,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
826 ( GdkDrawable* )( gtkwb->pixmap ),
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
827 gdk_drawable_get_colormap( gtkwb->pixmap ),
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
828 0, 0,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
829 0, 0,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
830 gtkwb->width, gtkwb->height );
11802
2e3a6dcebaf3 [gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents: 11558
diff changeset
831
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
832 gtk_window_set_icon( ( GtkWindow* )( gtkwb->window ), pixbuf );
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
833 }
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
834
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
835 void gaim_gtk_whiteboard_rgb24_to_rgb48( int color_rgb, GdkColor *color )
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
836 {
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
837 color->red = ( color_rgb >> 8 ) | 0xFF;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
838 color->green = ( color_rgb & 0xFF00 ) | 0xFF;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
839 color->blue = ( ( color_rgb & 0xFF ) << 8 ) | 0xFF;
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
840 }
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
diff changeset
841