Fri, 03 Sep 2010 07:28:41 +0000
merge of '6780237a96eeae80ce228502c6ab378052777367'
and '00b022749a3f398567ccbe083507f804b5d5f7d9'
| 11475 | 1 | /* |
|
15931
716b5fac1895
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents:
15884
diff
changeset
|
2 | * pidgin |
| 11475 | 3 | * |
|
15931
716b5fac1895
Re-sed the copyright notices so they don't all talk about Purple.
Richard Laager <rlaager@pidgin.im>
parents:
15884
diff
changeset
|
4 | * Pidgin is the legal property of its developers, whose names are too numerous |
| 11475 | 5 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 6 | * source distribution. | |
| 7 | * | |
| 8 | * This program is free software; you can redistribute it and/or modify | |
| 9 | * it under the terms of the GNU General Public License as published by | |
| 10 | * the Free Software Foundation; either version 2 of the License, or | |
| 11 | * (at your option) any later version. | |
| 12 | * | |
| 13 | * This program is distributed in the hope that it will be useful, | |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 | * GNU General Public License for more details. | |
| 17 | * | |
| 18 | * You should have received a copy of the GNU General Public License | |
| 19 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
17243
diff
changeset
|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 11475 | 21 | * |
| 22 | */ | |
| 23 | ||
|
13566
04a368d40d16
[gaim-migrate @ 15944]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13476
diff
changeset
|
24 | #include "internal.h" |
| 11475 | 25 | #include "blist.h" |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
26 | #include "debug.h" |
| 11475 | 27 | |
| 28 | #include "gtkwhiteboard.h" | |
| 17243 | 29 | #include "gtkutils.h" |
| 11475 | 30 | |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
31 | /****************************************************************************** |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
32 | * Prototypes |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
33 | *****************************************************************************/ |
| 15884 | 34 | static void pidgin_whiteboard_create(PurpleWhiteboard *wb); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
35 | |
| 15884 | 36 | static void pidgin_whiteboard_destroy(PurpleWhiteboard *wb); |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
37 | static gboolean whiteboard_close_cb(GtkWidget *widget, GdkEvent *event, PidginWhiteboard *gtkwb); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
38 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
39 | /*static void pidginwhiteboard_button_start_press(GtkButton *button, gpointer data); */ |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
40 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
41 | static gboolean pidgin_whiteboard_configure_event(GtkWidget *widget, GdkEventConfigure *event, gpointer data); |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
42 | static gboolean pidgin_whiteboard_expose_event(GtkWidget *widget, GdkEventExpose *event, gpointer data); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
43 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
44 | static gboolean pidgin_whiteboard_brush_down(GtkWidget *widget, GdkEventButton *event, gpointer data); |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
45 | static gboolean pidgin_whiteboard_brush_motion(GtkWidget *widget, GdkEventMotion *event, gpointer data); |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
46 | static gboolean pidgin_whiteboard_brush_up(GtkWidget *widget, GdkEventButton *event, gpointer data); |
| 11475 | 47 | |
| 15884 | 48 | static void pidgin_whiteboard_draw_brush_point(PurpleWhiteboard *wb, |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
49 | int x, int y, int color, int size); |
| 15884 | 50 | static void pidgin_whiteboard_draw_brush_line(PurpleWhiteboard *wb, int x0, int y0, |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
51 | int x1, int y1, int color, int size); |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
52 | |
| 15884 | 53 | static void pidgin_whiteboard_set_dimensions(PurpleWhiteboard *wb, int width, int height); |
| 54 | static void pidgin_whiteboard_set_brush(PurpleWhiteboard *wb, int size, int color); | |
| 55 | static void pidgin_whiteboard_clear(PurpleWhiteboard *wb); | |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
56 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
57 | static void pidgin_whiteboard_button_clear_press(GtkWidget *widget, gpointer data); |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
58 | static void pidgin_whiteboard_button_save_press(GtkWidget *widget, gpointer data); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
59 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
60 | static void pidgin_whiteboard_set_canvas_as_icon(PidginWhiteboard *gtkwb); |
| 11475 | 61 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
62 | static void pidgin_whiteboard_rgb24_to_rgb48(int color_rgb, GdkColor *color); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
63 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
64 | static void color_select_dialog(GtkWidget *widget, PidginWhiteboard *gtkwb); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
65 | |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
66 | /****************************************************************************** |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
67 | * Globals |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
68 | *****************************************************************************/ |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
69 | /* |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
70 | GList *buttonList = NULL; |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
71 | GdkColor DefaultColor[PALETTE_NUM_COLORS]; |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
72 | */ |
| 11475 | 73 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
74 | static int LastX; /* Tracks last position of the mouse when drawing */ |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
75 | static int LastY; |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
76 | static int MotionCount; /* Tracks how many brush motions made */ |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
77 | static int BrushState = BRUSH_STATE_UP; |
| 11475 | 78 | |
| 15884 | 79 | static PurpleWhiteboardUiOps ui_ops = |
| 11475 | 80 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
81 | pidgin_whiteboard_create, |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
82 | pidgin_whiteboard_destroy, |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
83 | pidgin_whiteboard_set_dimensions, |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
84 | pidgin_whiteboard_set_brush, |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
85 | pidgin_whiteboard_draw_brush_point, |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
86 | pidgin_whiteboard_draw_brush_line, |
|
16752
e6bcb1628c57
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
15931
diff
changeset
|
87 | pidgin_whiteboard_clear, |
|
e6bcb1628c57
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
15931
diff
changeset
|
88 | NULL, |
|
e6bcb1628c57
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
15931
diff
changeset
|
89 | NULL, |
|
e6bcb1628c57
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
15931
diff
changeset
|
90 | NULL, |
|
e6bcb1628c57
Patch from John 'rekkanoryo' Bailey to add the padding struct members in pidgin
Gary Kramlich <grim@reaperworld.com>
parents:
15931
diff
changeset
|
91 | NULL |
| 11475 | 92 | }; |
| 93 | ||
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
94 | /****************************************************************************** |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
95 | * API |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
96 | *****************************************************************************/ |
| 15884 | 97 | PurpleWhiteboardUiOps *pidgin_whiteboard_get_ui_ops(void) |
| 11475 | 98 | { |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
99 | return &ui_ops; |
| 11475 | 100 | } |
| 101 | ||
| 15884 | 102 | static void pidgin_whiteboard_create(PurpleWhiteboard *wb) |
| 11475 | 103 | { |
| 15884 | 104 | PurpleBuddy *buddy; |
| 11475 | 105 | GtkWidget *window; |
| 106 | GtkWidget *drawing_area; | |
|
12039
eaa207b93455
[gaim-migrate @ 14332]
Daniel Atallah <datallah@pidgin.im>
parents:
12022
diff
changeset
|
107 | GtkWidget *vbox_controls; |
| 11475 | 108 | GtkWidget *hbox_canvas_and_controls; |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
109 | |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
110 | /* |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
111 | -------------------------- |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
112 | |[][][][palette[][][][][]| |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
113 | |------------------------| |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
114 | | canvas | con | |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
115 | | | trol| |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
116 | | | s | |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
117 | | | | |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
118 | | | | |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
119 | -------------------------- |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
120 | */ |
| 11475 | 121 | GtkWidget *clear_button; |
| 122 | GtkWidget *save_button; | |
|
12039
eaa207b93455
[gaim-migrate @ 14332]
Daniel Atallah <datallah@pidgin.im>
parents:
12022
diff
changeset
|
123 | GtkWidget *color_button; |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
124 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
125 | PidginWhiteboard *gtkwb = g_new0(PidginWhiteboard, 1); |
|
11506
5fdbdf55cbe9
[gaim-migrate @ 13751]
Richard Laager <rlaager@pidgin.im>
parents:
11484
diff
changeset
|
126 | |
| 11475 | 127 | gtkwb->wb = wb; |
| 128 | wb->ui_data = gtkwb; | |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
129 | |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
130 | /* Get dimensions (default?) for the whiteboard canvas */ |
| 15884 | 131 | if (!purple_whiteboard_get_dimensions(wb, >kwb->width, >kwb->height)) |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11938
diff
changeset
|
132 | { |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11938
diff
changeset
|
133 | /* Give some initial board-size */ |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11938
diff
changeset
|
134 | gtkwb->width = 300; |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11938
diff
changeset
|
135 | gtkwb->height = 250; |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11938
diff
changeset
|
136 | } |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11938
diff
changeset
|
137 | |
| 15884 | 138 | if (!purple_whiteboard_get_brush(wb, >kwb->brush_size, >kwb->brush_color)) |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11938
diff
changeset
|
139 | { |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11938
diff
changeset
|
140 | /* Give some initial brush-info */ |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11938
diff
changeset
|
141 | gtkwb->brush_size = 2; |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11938
diff
changeset
|
142 | gtkwb->brush_color = 0xff0000; |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11938
diff
changeset
|
143 | } |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
144 | |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
145 | /* Try and set window title as the name of the buddy, else just use their |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
146 | * username |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
147 | */ |
| 15884 | 148 | buddy = purple_find_buddy(wb->account, wb->who); |
|
13637
4b26c6541540
[gaim-migrate @ 16034]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
13566
diff
changeset
|
149 | |
| 17213 | 150 | window = pidgin_create_window(buddy != NULL ? purple_buddy_get_contact_alias(buddy) : wb->who, 0, NULL, FALSE); |
| 151 | gtkwb->window = window; | |
| 152 | gtk_widget_set_name(window, wb->who); | |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
153 | |
|
13468
eb08475cc34d
[gaim-migrate @ 15842]
Richard Laager <rlaager@pidgin.im>
parents:
13411
diff
changeset
|
154 | g_signal_connect(G_OBJECT(window), "delete_event", |
|
eb08475cc34d
[gaim-migrate @ 15842]
Richard Laager <rlaager@pidgin.im>
parents:
13411
diff
changeset
|
155 | G_CALLBACK(whiteboard_close_cb), gtkwb); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
156 | |
|
12039
eaa207b93455
[gaim-migrate @ 14332]
Daniel Atallah <datallah@pidgin.im>
parents:
12022
diff
changeset
|
157 | #if 0 |
|
eaa207b93455
[gaim-migrate @ 14332]
Daniel Atallah <datallah@pidgin.im>
parents:
12022
diff
changeset
|
158 | int i; |
|
eaa207b93455
[gaim-migrate @ 14332]
Daniel Atallah <datallah@pidgin.im>
parents:
12022
diff
changeset
|
159 | |
|
eaa207b93455
[gaim-migrate @ 14332]
Daniel Atallah <datallah@pidgin.im>
parents:
12022
diff
changeset
|
160 | GtkWidget *hbox_palette; |
|
eaa207b93455
[gaim-migrate @ 14332]
Daniel Atallah <datallah@pidgin.im>
parents:
12022
diff
changeset
|
161 | GtkWidget *vbox_palette_above_canvas_and_controls; |
|
eaa207b93455
[gaim-migrate @ 14332]
Daniel Atallah <datallah@pidgin.im>
parents:
12022
diff
changeset
|
162 | GtkWidget *palette_color_box[PALETTE_NUM_COLORS]; |
|
eaa207b93455
[gaim-migrate @ 14332]
Daniel Atallah <datallah@pidgin.im>
parents:
12022
diff
changeset
|
163 | |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
164 | /* Create vertical box to place palette above the canvas and controls */ |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
165 | vbox_palette_above_canvas_and_controls = gtk_vbox_new(FALSE, 0); |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
166 | gtk_container_add(GTK_CONTAINER(window), vbox_palette_above_canvas_and_controls); |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
167 | gtk_widget_show(vbox_palette_above_canvas_and_controls); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
168 | |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
169 | /* Create horizontal box for the palette and all its entries */ |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
170 | hbox_palette = gtk_hbox_new(FALSE, 0); |
|
12039
eaa207b93455
[gaim-migrate @ 14332]
Daniel Atallah <datallah@pidgin.im>
parents:
12022
diff
changeset
|
171 | gtk_box_pack_start(GTK_BOX(vbox_palette_above_canvas_and_controls), |
| 15882 | 172 | hbox_palette, FALSE, FALSE, PIDGIN_HIG_BORDER); |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
173 | gtk_widget_show(hbox_palette); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
174 | |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
175 | /* Create horizontal box to seperate the canvas from the controls */ |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
176 | hbox_canvas_and_controls = gtk_hbox_new(FALSE, 0); |
|
12039
eaa207b93455
[gaim-migrate @ 14332]
Daniel Atallah <datallah@pidgin.im>
parents:
12022
diff
changeset
|
177 | gtk_box_pack_start(GTK_BOX(vbox_palette_above_canvas_and_controls), |
| 15882 | 178 | hbox_canvas_and_controls, FALSE, FALSE, PIDGIN_HIG_BORDER); |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
179 | gtk_widget_show(hbox_canvas_and_controls); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
180 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
181 | for(i = 0; i < PALETTE_NUM_COLORS; i++) |
| 11475 | 182 | { |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
183 | palette_color_box[i] = gtk_image_new_from_pixbuf(NULL); |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
184 | gtk_widget_set_size_request(palette_color_box[i], gtkwb->width / PALETTE_NUM_COLORS ,32); |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
185 | gtk_container_add(GTK_CONTAINER(hbox_palette), palette_color_box[i]); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
186 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
187 | gtk_widget_show(palette_color_box[i]); |
| 11475 | 188 | } |
|
12039
eaa207b93455
[gaim-migrate @ 14332]
Daniel Atallah <datallah@pidgin.im>
parents:
12022
diff
changeset
|
189 | #endif |
|
eaa207b93455
[gaim-migrate @ 14332]
Daniel Atallah <datallah@pidgin.im>
parents:
12022
diff
changeset
|
190 | |
|
eaa207b93455
[gaim-migrate @ 14332]
Daniel Atallah <datallah@pidgin.im>
parents:
12022
diff
changeset
|
191 | hbox_canvas_and_controls = gtk_hbox_new(FALSE, 0); |
|
eaa207b93455
[gaim-migrate @ 14332]
Daniel Atallah <datallah@pidgin.im>
parents:
12022
diff
changeset
|
192 | gtk_widget_show(hbox_canvas_and_controls); |
|
eaa207b93455
[gaim-migrate @ 14332]
Daniel Atallah <datallah@pidgin.im>
parents:
12022
diff
changeset
|
193 | |
|
eaa207b93455
[gaim-migrate @ 14332]
Daniel Atallah <datallah@pidgin.im>
parents:
12022
diff
changeset
|
194 | gtk_container_add(GTK_CONTAINER(window), hbox_canvas_and_controls); |
| 15882 | 195 | gtk_container_set_border_width(GTK_CONTAINER(window), PIDGIN_HIG_BORDER); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
196 | |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
197 | /* Create the drawing area */ |
| 11475 | 198 | drawing_area = gtk_drawing_area_new(); |
| 199 | gtkwb->drawing_area = drawing_area; | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
200 | gtk_widget_set_size_request(GTK_WIDGET(drawing_area), gtkwb->width, gtkwb->height); |
| 15882 | 201 | gtk_box_pack_start(GTK_BOX(hbox_canvas_and_controls), drawing_area, TRUE, TRUE, PIDGIN_HIG_BOX_SPACE); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
202 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
203 | gtk_widget_show(drawing_area); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
204 | |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
205 | /* Signals used to handle backing pixmap */ |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
206 | g_signal_connect(G_OBJECT(drawing_area), "expose_event", |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
207 | G_CALLBACK(pidgin_whiteboard_expose_event), gtkwb); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
208 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
209 | g_signal_connect(G_OBJECT(drawing_area), "configure_event", |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
210 | G_CALLBACK(pidgin_whiteboard_configure_event), gtkwb); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
211 | |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
212 | /* Event signals */ |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
213 | g_signal_connect(G_OBJECT(drawing_area), "button_press_event", |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
214 | G_CALLBACK(pidgin_whiteboard_brush_down), gtkwb); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
215 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
216 | g_signal_connect(G_OBJECT(drawing_area), "motion_notify_event", |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
217 | G_CALLBACK(pidgin_whiteboard_brush_motion), gtkwb); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
218 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
219 | g_signal_connect(G_OBJECT(drawing_area), "button_release_event", |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
220 | G_CALLBACK(pidgin_whiteboard_brush_up), gtkwb); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
221 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
222 | gtk_widget_set_events(drawing_area, |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
223 | GDK_EXPOSURE_MASK | |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
224 | GDK_LEAVE_NOTIFY_MASK | |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
225 | GDK_BUTTON_PRESS_MASK | |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
226 | GDK_POINTER_MOTION_MASK | |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
227 | GDK_BUTTON_RELEASE_MASK | |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
228 | GDK_POINTER_MOTION_HINT_MASK); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
229 | |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
230 | /* Create vertical box to contain the controls */ |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
231 | vbox_controls = gtk_vbox_new(FALSE, 0); |
|
12039
eaa207b93455
[gaim-migrate @ 14332]
Daniel Atallah <datallah@pidgin.im>
parents:
12022
diff
changeset
|
232 | gtk_box_pack_start(GTK_BOX(hbox_canvas_and_controls), |
| 15882 | 233 | vbox_controls, FALSE, FALSE, PIDGIN_HIG_BOX_SPACE); |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
234 | gtk_widget_show(vbox_controls); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
235 | |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
236 | /* Add a clear button */ |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
237 | clear_button = gtk_button_new_from_stock(GTK_STOCK_CLEAR); |
| 15882 | 238 | gtk_box_pack_start(GTK_BOX(vbox_controls), clear_button, FALSE, FALSE, PIDGIN_HIG_BOX_SPACE); |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
239 | gtk_widget_show(clear_button); |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
240 | g_signal_connect(G_OBJECT(clear_button), "clicked", |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
241 | G_CALLBACK(pidgin_whiteboard_button_clear_press), gtkwb); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
242 | |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
243 | /* Add a save button */ |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
244 | save_button = gtk_button_new_from_stock(GTK_STOCK_SAVE); |
| 15882 | 245 | gtk_box_pack_start(GTK_BOX(vbox_controls), save_button, FALSE, FALSE, PIDGIN_HIG_BOX_SPACE); |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
246 | gtk_widget_show(save_button); |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
247 | |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
248 | g_signal_connect(G_OBJECT(save_button), "clicked", |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
249 | G_CALLBACK(pidgin_whiteboard_button_save_press), gtkwb); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
250 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
251 | /* Add a color selector */ |
|
12039
eaa207b93455
[gaim-migrate @ 14332]
Daniel Atallah <datallah@pidgin.im>
parents:
12022
diff
changeset
|
252 | color_button = gtk_button_new_from_stock(GTK_STOCK_SELECT_COLOR); |
| 15882 | 253 | gtk_box_pack_start(GTK_BOX(vbox_controls), color_button, FALSE, FALSE, PIDGIN_HIG_BOX_SPACE); |
|
12039
eaa207b93455
[gaim-migrate @ 14332]
Daniel Atallah <datallah@pidgin.im>
parents:
12022
diff
changeset
|
254 | gtk_widget_show(color_button); |
|
eaa207b93455
[gaim-migrate @ 14332]
Daniel Atallah <datallah@pidgin.im>
parents:
12022
diff
changeset
|
255 | g_signal_connect(G_OBJECT(color_button), "clicked", |
|
eaa207b93455
[gaim-migrate @ 14332]
Daniel Atallah <datallah@pidgin.im>
parents:
12022
diff
changeset
|
256 | G_CALLBACK(color_select_dialog), gtkwb); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
257 | |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
258 | /* Make all this (window) visible */ |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
259 | gtk_widget_show(window); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
260 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
261 | pidgin_whiteboard_set_canvas_as_icon(gtkwb); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
262 | |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
263 | /* TODO Specific protocol/whiteboard assignment here? Needs a UI Op? */ |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
264 | /* Set default brush size and color */ |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
265 | /* |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
266 | ds->brush_size = DOODLE_BRUSH_MEDIUM; |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
267 | ds->brush_color = 0; |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
268 | */ |
| 11475 | 269 | } |
| 270 | ||
| 15884 | 271 | static void pidgin_whiteboard_destroy(PurpleWhiteboard *wb) |
| 11475 | 272 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
273 | PidginWhiteboard *gtkwb; |
|
28137
e9ba2df9038c
Close the colour selection dialog when the whiteboard window is closed.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26820
diff
changeset
|
274 | GtkWidget *colour_dialog; |
|
13468
eb08475cc34d
[gaim-migrate @ 15842]
Richard Laager <rlaager@pidgin.im>
parents:
13411
diff
changeset
|
275 | |
|
eb08475cc34d
[gaim-migrate @ 15842]
Richard Laager <rlaager@pidgin.im>
parents:
13411
diff
changeset
|
276 | g_return_if_fail(wb != NULL); |
|
eb08475cc34d
[gaim-migrate @ 15842]
Richard Laager <rlaager@pidgin.im>
parents:
13411
diff
changeset
|
277 | gtkwb = wb->ui_data; |
|
eb08475cc34d
[gaim-migrate @ 15842]
Richard Laager <rlaager@pidgin.im>
parents:
13411
diff
changeset
|
278 | g_return_if_fail(gtkwb != NULL); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
279 | |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
280 | /* TODO Ask if user wants to save picture before the session is closed */ |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
281 | |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
282 | /* Clear graphical memory */ |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
283 | if(gtkwb->pixmap) |
| 11475 | 284 | { |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
285 | g_object_unref(gtkwb->pixmap); |
| 11475 | 286 | gtkwb->pixmap = NULL; |
| 287 | } | |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
288 | |
|
28137
e9ba2df9038c
Close the colour selection dialog when the whiteboard window is closed.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26820
diff
changeset
|
289 | colour_dialog = g_object_get_data(G_OBJECT(gtkwb->window), "colour-dialog"); |
|
e9ba2df9038c
Close the colour selection dialog when the whiteboard window is closed.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26820
diff
changeset
|
290 | if (colour_dialog) { |
|
e9ba2df9038c
Close the colour selection dialog when the whiteboard window is closed.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26820
diff
changeset
|
291 | gtk_widget_destroy(colour_dialog); |
|
e9ba2df9038c
Close the colour selection dialog when the whiteboard window is closed.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26820
diff
changeset
|
292 | g_object_set_data(G_OBJECT(gtkwb->window), "colour-dialog", NULL); |
|
e9ba2df9038c
Close the colour selection dialog when the whiteboard window is closed.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26820
diff
changeset
|
293 | } |
|
e9ba2df9038c
Close the colour selection dialog when the whiteboard window is closed.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26820
diff
changeset
|
294 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
295 | if(gtkwb->window) |
| 11475 | 296 | { |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
297 | gtk_widget_destroy(gtkwb->window); |
| 11475 | 298 | gtkwb->window = NULL; |
| 299 | } | |
|
13468
eb08475cc34d
[gaim-migrate @ 15842]
Richard Laager <rlaager@pidgin.im>
parents:
13411
diff
changeset
|
300 | g_free(gtkwb); |
|
eb08475cc34d
[gaim-migrate @ 15842]
Richard Laager <rlaager@pidgin.im>
parents:
13411
diff
changeset
|
301 | wb->ui_data = NULL; |
| 11475 | 302 | } |
| 303 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
304 | static gboolean whiteboard_close_cb(GtkWidget *widget, GdkEvent *event, PidginWhiteboard *gtkwb) |
| 11475 | 305 | { |
| 15884 | 306 | PurpleWhiteboard *wb; |
|
13411
3ccc9f3e3e29
[gaim-migrate @ 15785]
Richard Laager <rlaager@pidgin.im>
parents:
12039
diff
changeset
|
307 | |
|
13476
8fdb0b79d370
[gaim-migrate @ 15851]
Mark Doliner <markdoliner@pidgin.im>
parents:
13468
diff
changeset
|
308 | g_return_val_if_fail(gtkwb != NULL, FALSE); |
|
13411
3ccc9f3e3e29
[gaim-migrate @ 15785]
Richard Laager <rlaager@pidgin.im>
parents:
12039
diff
changeset
|
309 | wb = gtkwb->wb; |
|
13476
8fdb0b79d370
[gaim-migrate @ 15851]
Mark Doliner <markdoliner@pidgin.im>
parents:
13468
diff
changeset
|
310 | g_return_val_if_fail(wb != NULL, FALSE); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
311 | |
| 15884 | 312 | purple_whiteboard_destroy(wb); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
313 | |
|
13468
eb08475cc34d
[gaim-migrate @ 15842]
Richard Laager <rlaager@pidgin.im>
parents:
13411
diff
changeset
|
314 | return FALSE; |
| 11475 | 315 | } |
| 316 | ||
| 317 | /* | |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
318 | * Whiteboard start button on conversation window (move this code to gtkconv? |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
319 | * and use new prpl_info member?) |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
320 | */ |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
321 | #if 0 |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
322 | static void pidginwhiteboard_button_start_press(GtkButton *button, gpointer data) |
| 11475 | 323 | { |
| 15884 | 324 | PurpleConversation *conv = data; |
| 325 | PurpleAccount *account = purple_conversation_get_account(conv); | |
| 326 | PurpleConnection *gc = purple_account_get_connection(account); | |
| 327 | char *to = (char*)(purple_conversation_get_name(conv)); | |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
328 | |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
329 | /* Only handle this if local client requested Doodle session (else local |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
330 | * client would have sent one) |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
331 | */ |
| 15884 | 332 | PurpleWhiteboard *wb = purple_whiteboard_get(account, to); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
333 | |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
334 | /* Write a local message to this conversation showing that a request for a |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
335 | * Doodle session has been made |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
336 | */ |
|
13468
eb08475cc34d
[gaim-migrate @ 15842]
Richard Laager <rlaager@pidgin.im>
parents:
13411
diff
changeset
|
337 | /* XXXX because otherwise gettext will see this string, even though it's |
|
eb08475cc34d
[gaim-migrate @ 15842]
Richard Laager <rlaager@pidgin.im>
parents:
13411
diff
changeset
|
338 | * in an #if 0 block. Remove the XXXX if you want to use this code. |
|
eb08475cc34d
[gaim-migrate @ 15842]
Richard Laager <rlaager@pidgin.im>
parents:
13411
diff
changeset
|
339 | * But, it really shouldn't be a Yahoo-specific string. ;) */ |
| 15884 | 340 | purple_conv_im_write(PURPLE_CONV_IM(conv), "", XXXX_("Sent Doodle request."), |
| 341 | PURPLE_MESSAGE_NICK | PURPLE_MESSAGE_RECV, time(NULL)); | |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
342 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
343 | yahoo_doodle_command_send_request(gc, to); |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
344 | yahoo_doodle_command_send_ready(gc, to); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
345 | |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
346 | /* Insert this 'session' in the list. At this point, it's only a requested |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
347 | * session. |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
348 | */ |
| 15884 | 349 | wb = purple_whiteboard_create(account, to, DOODLE_STATE_REQUESTING); |
| 11475 | 350 | } |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
351 | #endif |
| 11475 | 352 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
353 | static gboolean pidgin_whiteboard_configure_event(GtkWidget *widget, GdkEventConfigure *event, gpointer data) |
| 11475 | 354 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
355 | PidginWhiteboard *gtkwb = (PidginWhiteboard*)data; |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
356 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
357 | GdkPixmap *pixmap = gtkwb->pixmap; |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
358 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
359 | if(pixmap) |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
360 | g_object_unref(pixmap); |
| 11475 | 361 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
362 | pixmap = gdk_pixmap_new(widget->window, |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
363 | widget->allocation.width, |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
364 | widget->allocation.height, |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
365 | -1); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
366 | |
| 11475 | 367 | gtkwb->pixmap = pixmap; |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
368 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
369 | gdk_draw_rectangle(pixmap, |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
370 | widget->style->white_gc, |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
371 | TRUE, |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
372 | 0, 0, |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
373 | widget->allocation.width, |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
374 | widget->allocation.height); |
| 11475 | 375 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
376 | return TRUE; |
| 11475 | 377 | } |
| 378 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
379 | static gboolean pidgin_whiteboard_expose_event(GtkWidget *widget, GdkEventExpose *event, gpointer data) |
| 11475 | 380 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
381 | PidginWhiteboard *gtkwb = (PidginWhiteboard*)(data); |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
382 | GdkPixmap *pixmap = gtkwb->pixmap; |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
383 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
384 | gdk_draw_drawable(widget->window, |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
385 | widget->style->fg_gc[GTK_WIDGET_STATE(widget)], |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
386 | pixmap, |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
387 | event->area.x, event->area.y, |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
388 | event->area.x, event->area.y, |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
389 | event->area.width, event->area.height); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
390 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
391 | return FALSE; |
| 11475 | 392 | } |
| 393 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
394 | static gboolean pidgin_whiteboard_brush_down(GtkWidget *widget, GdkEventButton *event, gpointer data) |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
395 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
396 | PidginWhiteboard *gtkwb = (PidginWhiteboard*)data; |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
397 | GdkPixmap *pixmap = gtkwb->pixmap; |
| 11475 | 398 | |
| 15884 | 399 | PurpleWhiteboard *wb = gtkwb->wb; |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
400 | GList *draw_list = wb->draw_list; |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
401 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
402 | if(BrushState != BRUSH_STATE_UP) |
| 11475 | 403 | { |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
404 | /* Potential double-click DOWN to DOWN? */ |
| 11475 | 405 | BrushState = BRUSH_STATE_DOWN; |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
406 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
407 | /* return FALSE; */ |
| 11475 | 408 | } |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
409 | |
| 11475 | 410 | BrushState = BRUSH_STATE_DOWN; |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
411 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
412 | if(event->button == 1 && pixmap != NULL) |
| 11475 | 413 | { |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
414 | /* Check if draw_list has contents; if so, clear it */ |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
415 | if(draw_list) |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
416 | { |
| 15884 | 417 | purple_whiteboard_draw_list_destroy(draw_list); |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
418 | draw_list = NULL; |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
419 | } |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
420 | |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
421 | /* Set tracking variables */ |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
422 | LastX = event->x; |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
423 | LastY = event->y; |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
424 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
425 | MotionCount = 0; |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
426 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
427 | draw_list = g_list_append(draw_list, GINT_TO_POINTER(LastX)); |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
428 | draw_list = g_list_append(draw_list, GINT_TO_POINTER(LastY)); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
429 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
430 | pidgin_whiteboard_draw_brush_point(gtkwb->wb, |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
431 | event->x, event->y, |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
432 | gtkwb->brush_color, gtkwb->brush_size); |
| 11475 | 433 | } |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
434 | |
| 11475 | 435 | wb->draw_list = draw_list; |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
436 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
437 | return TRUE; |
| 11475 | 438 | } |
| 439 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
440 | static gboolean pidgin_whiteboard_brush_motion(GtkWidget *widget, GdkEventMotion *event, gpointer data) |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
441 | { |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
442 | int x; |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
443 | int y; |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
444 | int dx; |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
445 | int dy; |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
446 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
447 | GdkModifierType state; |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
448 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
449 | PidginWhiteboard *gtkwb = (PidginWhiteboard*)data; |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
450 | GdkPixmap *pixmap = gtkwb->pixmap; |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
451 | |
| 15884 | 452 | PurpleWhiteboard *wb = gtkwb->wb; |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
453 | GList *draw_list = wb->draw_list; |
| 11475 | 454 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
455 | if(event->is_hint) |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
456 | gdk_window_get_pointer(event->window, &x, &y, &state); |
| 11475 | 457 | else |
| 458 | { | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
459 | x = event->x; |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
460 | y = event->y; |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
461 | state = event->state; |
| 11475 | 462 | } |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
463 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
464 | if(state & GDK_BUTTON1_MASK && pixmap != NULL) |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
465 | { |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
466 | if((BrushState != BRUSH_STATE_DOWN) && (BrushState != BRUSH_STATE_MOTION)) |
| 11475 | 467 | { |
| 15884 | 468 | purple_debug_error("gtkwhiteboard", "***Bad brush state transition %d to MOTION\n", BrushState); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
469 | |
| 11475 | 470 | BrushState = BRUSH_STATE_MOTION; |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
471 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
472 | return FALSE; |
| 11475 | 473 | } |
| 474 | BrushState = BRUSH_STATE_MOTION; | |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
475 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
476 | dx = x - LastX; |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
477 | dy = y - LastY; |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
478 | |
| 11475 | 479 | MotionCount++; |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
480 | |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
481 | /* NOTE 100 is a temporary constant for how many deltas/motions in a |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
482 | * stroke (needs UI Ops?) |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
483 | */ |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
484 | if(MotionCount == 100) |
| 11475 | 485 | { |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
486 | draw_list = g_list_append(draw_list, GINT_TO_POINTER(dx)); |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
487 | draw_list = g_list_append(draw_list, GINT_TO_POINTER(dy)); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
488 | |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11938
diff
changeset
|
489 | /* Send draw list to the draw_list handler */ |
| 15884 | 490 | purple_whiteboard_send_draw_list(gtkwb->wb, draw_list); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
491 | |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
492 | /* The brush stroke is finished, clear the list for another one */ |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
493 | if(draw_list) |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
494 | { |
| 15884 | 495 | purple_whiteboard_draw_list_destroy(draw_list); |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
496 | draw_list = NULL; |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
497 | } |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
498 | |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
499 | /* Reset motion tracking */ |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
500 | MotionCount = 0; |
| 11475 | 501 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
502 | draw_list = g_list_append(draw_list, GINT_TO_POINTER(LastX)); |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
503 | draw_list = g_list_append(draw_list, GINT_TO_POINTER(LastY)); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
504 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
505 | dx = x - LastX; |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
506 | dy = y - LastY; |
| 11475 | 507 | } |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
508 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
509 | draw_list = g_list_append(draw_list, GINT_TO_POINTER(dx)); |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
510 | draw_list = g_list_append(draw_list, GINT_TO_POINTER(dy)); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
511 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
512 | pidgin_whiteboard_draw_brush_line(gtkwb->wb, |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
513 | LastX, LastY, |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
514 | x, y, |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
515 | gtkwb->brush_color, gtkwb->brush_size); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
516 | |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
517 | /* Set tracking variables */ |
| 11475 | 518 | LastX = x; |
| 519 | LastY = y; | |
| 520 | } | |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
521 | |
| 11475 | 522 | wb->draw_list = draw_list; |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
523 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
524 | return TRUE; |
| 11475 | 525 | } |
| 526 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
527 | static gboolean pidgin_whiteboard_brush_up(GtkWidget *widget, GdkEventButton *event, gpointer data) |
| 11475 | 528 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
529 | PidginWhiteboard *gtkwb = (PidginWhiteboard*)data; |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
530 | GdkPixmap *pixmap = gtkwb->pixmap; |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
531 | |
| 15884 | 532 | PurpleWhiteboard *wb = gtkwb->wb; |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
533 | GList *draw_list = wb->draw_list; |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
534 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
535 | if((BrushState != BRUSH_STATE_DOWN) && (BrushState != BRUSH_STATE_MOTION)) |
| 11475 | 536 | { |
| 15884 | 537 | purple_debug_error("gtkwhiteboard", "***Bad brush state transition %d to UP\n", BrushState); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
538 | |
| 11475 | 539 | BrushState = BRUSH_STATE_UP; |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
540 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
541 | return FALSE; |
| 11475 | 542 | } |
| 543 | BrushState = BRUSH_STATE_UP; | |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
544 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
545 | if(event->button == 1 && pixmap != NULL) |
| 11475 | 546 | { |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
547 | /* If the brush was never moved, express two sets of two deltas That's a |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
548 | * 'point,' but not for Yahoo! |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
549 | */ |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
550 | /* if((event->x == LastX) && (event->y == LastY)) */ |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
551 | if(MotionCount == 0) |
| 11475 | 552 | { |
| 553 | int index; | |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
554 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
555 | /* For Yahoo!, a (0 0) indicates the end of drawing */ |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
556 | /* FIXME: Yahoo Doodle specific! */ |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
557 | for(index = 0; index < 2; index++) |
| 11475 | 558 | { |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
559 | draw_list = g_list_append(draw_list, 0); |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
560 | draw_list = g_list_append(draw_list, 0); |
| 11475 | 561 | } |
| 562 | } | |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
563 | /* |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
564 | else |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
565 | MotionCount = 0; |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
566 | */ |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
567 | |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
568 | /* Send draw list to prpl draw_list handler */ |
| 15884 | 569 | purple_whiteboard_send_draw_list(gtkwb->wb, draw_list); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
570 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
571 | pidgin_whiteboard_set_canvas_as_icon(gtkwb); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
572 | |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
573 | /* The brush stroke is finished, clear the list for another one */ |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
574 | if(draw_list) |
| 15884 | 575 | purple_whiteboard_draw_list_destroy(draw_list); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
576 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
577 | wb->draw_list = NULL; |
| 11475 | 578 | } |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
579 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
580 | return TRUE; |
| 11475 | 581 | } |
| 582 | ||
| 15884 | 583 | static void pidgin_whiteboard_draw_brush_point(PurpleWhiteboard *wb, int x, int y, int color, int size) |
| 11475 | 584 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
585 | PidginWhiteboard *gtkwb = wb->ui_data; |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
586 | GtkWidget *widget = gtkwb->drawing_area; |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
587 | GdkPixmap *pixmap = gtkwb->pixmap; |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
588 | |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
589 | GdkRectangle update_rect; |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
590 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
591 | GdkGC *gfx_con = gdk_gc_new(pixmap); |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
592 | GdkColor col; |
|
11506
5fdbdf55cbe9
[gaim-migrate @ 13751]
Richard Laager <rlaager@pidgin.im>
parents:
11484
diff
changeset
|
593 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
594 | update_rect.x = x - size / 2; |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
595 | update_rect.y = y - size / 2; |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
596 | update_rect.width = size; |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
597 | update_rect.height = size; |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
598 | |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
599 | /* Interpret and convert color */ |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
600 | pidgin_whiteboard_rgb24_to_rgb48(color, &col); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
601 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
602 | gdk_gc_set_rgb_fg_color(gfx_con, &col); |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
603 | /* gdk_gc_set_rgb_bg_color(gfx_con, &col); */ |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
604 | |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
605 | /* NOTE 5 is a size constant for now... this is because of how poorly the |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
606 | * gdk_draw_arc draws small circles |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
607 | */ |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
608 | if(size < 5) |
| 11475 | 609 | { |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
610 | /* Draw a rectangle/square */ |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
611 | gdk_draw_rectangle(pixmap, |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
612 | gfx_con, |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
613 | TRUE, |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
614 | update_rect.x, update_rect.y, |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
615 | update_rect.width, update_rect.height); |
| 11475 | 616 | } |
| 617 | else | |
| 618 | { | |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
619 | /* Draw a circle */ |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
620 | gdk_draw_arc(pixmap, |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
621 | gfx_con, |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
622 | TRUE, |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
623 | update_rect.x, update_rect.y, |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
624 | update_rect.width, update_rect.height, |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
625 | 0, FULL_CIRCLE_DEGREES); |
| 11475 | 626 | } |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
627 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
628 | gtk_widget_queue_draw_area(widget, |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
629 | update_rect.x, update_rect.y, |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
630 | update_rect.width, update_rect.height); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
631 | |
|
26820
76f90ca8f6f2
Use g_object_ref/unref instead of the deprecated versions.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25888
diff
changeset
|
632 | g_object_unref(G_OBJECT(gfx_con)); |
| 11475 | 633 | } |
| 634 | ||
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
635 | /* Uses Bresenham's algorithm (as provided by Wikipedia) */ |
| 15884 | 636 | static void pidgin_whiteboard_draw_brush_line(PurpleWhiteboard *wb, int x0, int y0, int x1, int y1, int color, int size) |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
637 | { |
| 11475 | 638 | int temp; |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
639 | |
| 11475 | 640 | int xstep; |
| 641 | int ystep; | |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
642 | |
|
11506
5fdbdf55cbe9
[gaim-migrate @ 13751]
Richard Laager <rlaager@pidgin.im>
parents:
11484
diff
changeset
|
643 | int dx; |
|
5fdbdf55cbe9
[gaim-migrate @ 13751]
Richard Laager <rlaager@pidgin.im>
parents:
11484
diff
changeset
|
644 | int dy; |
|
5fdbdf55cbe9
[gaim-migrate @ 13751]
Richard Laager <rlaager@pidgin.im>
parents:
11484
diff
changeset
|
645 | |
|
5fdbdf55cbe9
[gaim-migrate @ 13751]
Richard Laager <rlaager@pidgin.im>
parents:
11484
diff
changeset
|
646 | int error; |
|
5fdbdf55cbe9
[gaim-migrate @ 13751]
Richard Laager <rlaager@pidgin.im>
parents:
11484
diff
changeset
|
647 | int derror; |
|
5fdbdf55cbe9
[gaim-migrate @ 13751]
Richard Laager <rlaager@pidgin.im>
parents:
11484
diff
changeset
|
648 | |
|
5fdbdf55cbe9
[gaim-migrate @ 13751]
Richard Laager <rlaager@pidgin.im>
parents:
11484
diff
changeset
|
649 | int x; |
|
5fdbdf55cbe9
[gaim-migrate @ 13751]
Richard Laager <rlaager@pidgin.im>
parents:
11484
diff
changeset
|
650 | int y; |
|
5fdbdf55cbe9
[gaim-migrate @ 13751]
Richard Laager <rlaager@pidgin.im>
parents:
11484
diff
changeset
|
651 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
652 | gboolean steep = abs(y1 - y0) > abs(x1 - x0); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
653 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
654 | if(steep) |
| 11475 | 655 | { |
| 656 | temp = x0; x0 = y0; y0 = temp; | |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
657 | temp = x1; x1 = y1; y1 = temp; |
| 11475 | 658 | } |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
659 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
660 | dx = abs(x1 - x0); |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
661 | dy = abs(y1 - y0); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
662 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
663 | error = 0; |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
664 | derror = dy; |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
665 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
666 | x = x0; |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
667 | y = y0; |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
668 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
669 | if(x0 < x1) |
| 11475 | 670 | xstep = 1; |
| 671 | else | |
| 672 | xstep = -1; | |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
673 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
674 | if(y0 < y1) |
| 11475 | 675 | ystep = 1; |
| 676 | else | |
| 677 | ystep = -1; | |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
678 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
679 | if(steep) |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
680 | pidgin_whiteboard_draw_brush_point(wb, y, x, color, size); |
| 11475 | 681 | else |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
682 | pidgin_whiteboard_draw_brush_point(wb, x, y, color, size); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
683 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
684 | while(x != x1) |
| 11475 | 685 | { |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
686 | x += xstep; |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
687 | error += derror; |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
688 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
689 | if((error * 2) >= dx) |
| 11475 | 690 | { |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
691 | y += ystep; |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
692 | error -= dx; |
| 11475 | 693 | } |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
694 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
695 | if(steep) |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
696 | pidgin_whiteboard_draw_brush_point(wb, y, x, color, size); |
| 11475 | 697 | else |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
698 | pidgin_whiteboard_draw_brush_point(wb, x, y, color, size); |
| 11475 | 699 | } |
| 700 | } | |
| 701 | ||
| 15884 | 702 | static void pidgin_whiteboard_set_dimensions(PurpleWhiteboard *wb, int width, int height) |
| 11475 | 703 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
704 | PidginWhiteboard *gtkwb = wb->ui_data; |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
705 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
706 | gtkwb->width = width; |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
707 | gtkwb->height = height; |
| 11475 | 708 | } |
| 709 | ||
| 15884 | 710 | static void pidgin_whiteboard_set_brush(PurpleWhiteboard *wb, int size, int color) |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11938
diff
changeset
|
711 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
712 | PidginWhiteboard *gtkwb = wb->ui_data; |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11938
diff
changeset
|
713 | |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11938
diff
changeset
|
714 | gtkwb->brush_size = size; |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11938
diff
changeset
|
715 | gtkwb->brush_color = color; |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11938
diff
changeset
|
716 | } |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11938
diff
changeset
|
717 | |
| 15884 | 718 | static void pidgin_whiteboard_clear(PurpleWhiteboard *wb) |
| 11475 | 719 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
720 | PidginWhiteboard *gtkwb = wb->ui_data; |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
721 | GdkPixmap *pixmap = gtkwb->pixmap; |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
722 | GtkWidget *drawing_area = gtkwb->drawing_area; |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
723 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
724 | gdk_draw_rectangle(pixmap, |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
725 | drawing_area->style->white_gc, |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
726 | TRUE, |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
727 | 0, 0, |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
728 | drawing_area->allocation.width, |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
729 | drawing_area->allocation.height); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
730 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
731 | gtk_widget_queue_draw_area(drawing_area, |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
732 | 0, 0, |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
733 | drawing_area->allocation.width, |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
734 | drawing_area->allocation.height); |
| 11475 | 735 | } |
| 736 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
737 | static void pidgin_whiteboard_button_clear_press(GtkWidget *widget, gpointer data) |
| 11475 | 738 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
739 | PidginWhiteboard *gtkwb = (PidginWhiteboard*)(data); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
740 | |
|
29325
45a011117ac5
Display a confirmation prompt when attempting to clear the whiteboard.
Kartik Mohta <kartikmohta@gmail.com>
parents:
28981
diff
changeset
|
741 | /* Confirm whether the user really wants to clear */ |
|
45a011117ac5
Display a confirmation prompt when attempting to clear the whiteboard.
Kartik Mohta <kartikmohta@gmail.com>
parents:
28981
diff
changeset
|
742 | GtkWidget *dialog = gtk_message_dialog_new(GTK_WINDOW(gtkwb->window), |
|
45a011117ac5
Display a confirmation prompt when attempting to clear the whiteboard.
Kartik Mohta <kartikmohta@gmail.com>
parents:
28981
diff
changeset
|
743 | GTK_DIALOG_DESTROY_WITH_PARENT, |
|
45a011117ac5
Display a confirmation prompt when attempting to clear the whiteboard.
Kartik Mohta <kartikmohta@gmail.com>
parents:
28981
diff
changeset
|
744 | GTK_MESSAGE_QUESTION, |
|
45a011117ac5
Display a confirmation prompt when attempting to clear the whiteboard.
Kartik Mohta <kartikmohta@gmail.com>
parents:
28981
diff
changeset
|
745 | GTK_BUTTONS_YES_NO, |
|
45a011117ac5
Display a confirmation prompt when attempting to clear the whiteboard.
Kartik Mohta <kartikmohta@gmail.com>
parents:
28981
diff
changeset
|
746 | _("Do you really want to clear?")); |
|
45a011117ac5
Display a confirmation prompt when attempting to clear the whiteboard.
Kartik Mohta <kartikmohta@gmail.com>
parents:
28981
diff
changeset
|
747 | gint response = gtk_dialog_run(GTK_DIALOG(dialog)); |
|
45a011117ac5
Display a confirmation prompt when attempting to clear the whiteboard.
Kartik Mohta <kartikmohta@gmail.com>
parents:
28981
diff
changeset
|
748 | gtk_widget_destroy(dialog); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
749 | |
|
29325
45a011117ac5
Display a confirmation prompt when attempting to clear the whiteboard.
Kartik Mohta <kartikmohta@gmail.com>
parents:
28981
diff
changeset
|
750 | if (response == GTK_RESPONSE_YES) |
|
45a011117ac5
Display a confirmation prompt when attempting to clear the whiteboard.
Kartik Mohta <kartikmohta@gmail.com>
parents:
28981
diff
changeset
|
751 | { |
|
45a011117ac5
Display a confirmation prompt when attempting to clear the whiteboard.
Kartik Mohta <kartikmohta@gmail.com>
parents:
28981
diff
changeset
|
752 | pidgin_whiteboard_clear(gtkwb->wb); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
753 | |
|
29325
45a011117ac5
Display a confirmation prompt when attempting to clear the whiteboard.
Kartik Mohta <kartikmohta@gmail.com>
parents:
28981
diff
changeset
|
754 | pidgin_whiteboard_set_canvas_as_icon(gtkwb); |
|
45a011117ac5
Display a confirmation prompt when attempting to clear the whiteboard.
Kartik Mohta <kartikmohta@gmail.com>
parents:
28981
diff
changeset
|
755 | |
|
45a011117ac5
Display a confirmation prompt when attempting to clear the whiteboard.
Kartik Mohta <kartikmohta@gmail.com>
parents:
28981
diff
changeset
|
756 | /* Do protocol specific clearing procedures */ |
|
45a011117ac5
Display a confirmation prompt when attempting to clear the whiteboard.
Kartik Mohta <kartikmohta@gmail.com>
parents:
28981
diff
changeset
|
757 | purple_whiteboard_send_clear(gtkwb->wb); |
|
45a011117ac5
Display a confirmation prompt when attempting to clear the whiteboard.
Kartik Mohta <kartikmohta@gmail.com>
parents:
28981
diff
changeset
|
758 | } |
| 11475 | 759 | } |
| 760 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
761 | static void pidgin_whiteboard_button_save_press(GtkWidget *widget, gpointer data) |
| 11475 | 762 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
763 | PidginWhiteboard *gtkwb = (PidginWhiteboard*)(data); |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
764 | GdkPixbuf *pixbuf; |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
765 | |
| 11475 | 766 | GtkWidget *dialog; |
| 767 | ||
|
11506
5fdbdf55cbe9
[gaim-migrate @ 13751]
Richard Laager <rlaager@pidgin.im>
parents:
11484
diff
changeset
|
768 | int result; |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
769 | |
|
13566
04a368d40d16
[gaim-migrate @ 15944]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13476
diff
changeset
|
770 | dialog = gtk_file_chooser_dialog_new (_("Save File"), |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
771 | GTK_WINDOW(gtkwb->window), |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
772 | GTK_FILE_CHOOSER_ACTION_SAVE, |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
773 | GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
774 | GTK_STOCK_SAVE, GTK_RESPONSE_ACCEPT, |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
775 | NULL); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
776 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
777 | /* gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(dialog), (gboolean)(TRUE)); */ |
| 11475 | 778 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
779 | /* if(user_edited_a_new_document) */ |
| 11475 | 780 | { |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
781 | /* gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dialog), default_folder_for_saving); */ |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
782 | gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(dialog), "whiteboard.jpg"); |
| 11475 | 783 | } |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
784 | /* |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
785 | else |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
786 | gtk_file_chooser_set_filename (GTK_FILE_CHOOSER (dialog), filename_for_existing_document); |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
787 | */ |
|
29496
8807ee3e55c5
Start of killing off unneeded GTK_CHECK_VERSION checks in pidgin. Refs #10024
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28137
diff
changeset
|
788 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
789 | result = gtk_dialog_run(GTK_DIALOG(dialog)); |
| 11475 | 790 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
791 | if(result == GTK_RESPONSE_ACCEPT) |
| 11475 | 792 | { |
| 793 | char *filename; | |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
794 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
795 | filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(dialog)); |
|
29496
8807ee3e55c5
Start of killing off unneeded GTK_CHECK_VERSION checks in pidgin. Refs #10024
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
28137
diff
changeset
|
796 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
797 | gtk_widget_destroy(dialog); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
798 | |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
799 | /* Makes an icon from the whiteboard's canvas 'image' */ |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
800 | pixbuf = gdk_pixbuf_get_from_drawable(NULL, |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
801 | (GdkDrawable*)(gtkwb->pixmap), |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
802 | gdk_drawable_get_colormap(gtkwb->pixmap), |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
803 | 0, 0, |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
804 | 0, 0, |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
805 | gtkwb->width, gtkwb->height); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
806 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
807 | if(gdk_pixbuf_save(pixbuf, filename, "jpeg", NULL, "quality", "100", NULL)) |
| 15884 | 808 | purple_debug_info("gtkwhiteboard", "File Saved...\n"); |
| 11475 | 809 | else |
| 15884 | 810 | purple_debug_info("gtkwhiteboard", "File not Saved... Error\n"); |
| 11558 | 811 | g_free(filename); |
| 11475 | 812 | } |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
813 | else if(result == GTK_RESPONSE_CANCEL) |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
814 | { |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
815 | gtk_widget_destroy(dialog); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
816 | |
|
28137
e9ba2df9038c
Close the colour selection dialog when the whiteboard window is closed.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26820
diff
changeset
|
817 | purple_debug_info("gtkwhiteboard", "File not Saved... Cancelled\n"); |
| 11475 | 818 | } |
| 819 | } | |
| 820 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
821 | static void pidgin_whiteboard_set_canvas_as_icon(PidginWhiteboard *gtkwb) |
| 11475 | 822 | { |
| 823 | GdkPixbuf *pixbuf; | |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
824 | |
|
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
825 | /* Makes an icon from the whiteboard's canvas 'image' */ |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
826 | pixbuf = gdk_pixbuf_get_from_drawable(NULL, |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
827 | (GdkDrawable*)(gtkwb->pixmap), |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
828 | gdk_drawable_get_colormap(gtkwb->pixmap), |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
829 | 0, 0, |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
830 | 0, 0, |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
831 | gtkwb->width, gtkwb->height); |
|
11802
b97b3fea95ce
[gaim-migrate @ 14093]
Gary Kramlich <grim@reaperworld.com>
parents:
11558
diff
changeset
|
832 | |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
833 | gtk_window_set_icon((GtkWindow*)(gtkwb->window), pixbuf); |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
834 | } |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
835 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
836 | static void pidgin_whiteboard_rgb24_to_rgb48(int color_rgb, GdkColor *color) |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
837 | { |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
838 | color->red = (color_rgb >> 8) | 0xFF; |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
839 | color->green = (color_rgb & 0xFF00) | 0xFF; |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
840 | color->blue = ((color_rgb & 0xFF) << 8) | 0xFF; |
| 11475 | 841 | } |
| 842 | ||
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
843 | static void |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
844 | change_color_cb(GtkColorSelection *selection, PidginWhiteboard *gtkwb) |
| 11475 | 845 | { |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
846 | GdkColor color; |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
847 | int old_size = 5; |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
848 | int old_color = 0; |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11938
diff
changeset
|
849 | int new_color; |
| 15884 | 850 | PurpleWhiteboard *wb = gtkwb->wb; |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
851 | |
|
12039
eaa207b93455
[gaim-migrate @ 14332]
Daniel Atallah <datallah@pidgin.im>
parents:
12022
diff
changeset
|
852 | gtk_color_selection_get_current_color(selection, &color); |
|
12022
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11938
diff
changeset
|
853 | new_color = (color.red & 0xFF00) << 8; |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11938
diff
changeset
|
854 | new_color |= (color.green & 0xFF00); |
|
c03fe7e2cd1d
[gaim-migrate @ 14315]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11938
diff
changeset
|
855 | new_color |= (color.blue & 0xFF00) >> 8; |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11829
diff
changeset
|
856 | |
| 15884 | 857 | purple_whiteboard_get_brush(wb, &old_size, &old_color); |
| 858 | purple_whiteboard_send_brush(wb, old_size, new_color); | |
| 11475 | 859 | } |
|
12039
eaa207b93455
[gaim-migrate @ 14332]
Daniel Atallah <datallah@pidgin.im>
parents:
12022
diff
changeset
|
860 | |
|
28137
e9ba2df9038c
Close the colour selection dialog when the whiteboard window is closed.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26820
diff
changeset
|
861 | static void color_selection_dialog_destroy(GtkWidget *w, PidginWhiteboard *gtkwb) |
|
12039
eaa207b93455
[gaim-migrate @ 14332]
Daniel Atallah <datallah@pidgin.im>
parents:
12022
diff
changeset
|
862 | { |
|
28137
e9ba2df9038c
Close the colour selection dialog when the whiteboard window is closed.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26820
diff
changeset
|
863 | GtkWidget *dialog = g_object_get_data(G_OBJECT(gtkwb->window), "colour-dialog"); |
|
e9ba2df9038c
Close the colour selection dialog when the whiteboard window is closed.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26820
diff
changeset
|
864 | gtk_widget_destroy(dialog); |
|
e9ba2df9038c
Close the colour selection dialog when the whiteboard window is closed.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26820
diff
changeset
|
865 | g_object_set_data(G_OBJECT(gtkwb->window), "colour-dialog", NULL); |
|
12039
eaa207b93455
[gaim-migrate @ 14332]
Daniel Atallah <datallah@pidgin.im>
parents:
12022
diff
changeset
|
866 | } |
|
eaa207b93455
[gaim-migrate @ 14332]
Daniel Atallah <datallah@pidgin.im>
parents:
12022
diff
changeset
|
867 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
868 | static void color_select_dialog(GtkWidget *widget, PidginWhiteboard *gtkwb) |
|
12039
eaa207b93455
[gaim-migrate @ 14332]
Daniel Atallah <datallah@pidgin.im>
parents:
12022
diff
changeset
|
869 | { |
|
eaa207b93455
[gaim-migrate @ 14332]
Daniel Atallah <datallah@pidgin.im>
parents:
12022
diff
changeset
|
870 | GdkColor color; |
|
eaa207b93455
[gaim-migrate @ 14332]
Daniel Atallah <datallah@pidgin.im>
parents:
12022
diff
changeset
|
871 | GtkColorSelectionDialog *dialog; |
|
25888
d0fdd378a635
Remove trailing whitespace
Mark Doliner <markdoliner@pidgin.im>
parents:
19859
diff
changeset
|
872 | |
|
13566
04a368d40d16
[gaim-migrate @ 15944]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
13476
diff
changeset
|
873 | dialog = (GtkColorSelectionDialog *)gtk_color_selection_dialog_new(_("Select color")); |
|
28137
e9ba2df9038c
Close the colour selection dialog when the whiteboard window is closed.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26820
diff
changeset
|
874 | g_object_set_data(G_OBJECT(gtkwb->window), "colour-dialog", dialog); |
|
12039
eaa207b93455
[gaim-migrate @ 14332]
Daniel Atallah <datallah@pidgin.im>
parents:
12022
diff
changeset
|
875 | |
|
eaa207b93455
[gaim-migrate @ 14332]
Daniel Atallah <datallah@pidgin.im>
parents:
12022
diff
changeset
|
876 | g_signal_connect(G_OBJECT(dialog->colorsel), "color-changed", |
|
eaa207b93455
[gaim-migrate @ 14332]
Daniel Atallah <datallah@pidgin.im>
parents:
12022
diff
changeset
|
877 | G_CALLBACK(change_color_cb), gtkwb); |
|
eaa207b93455
[gaim-migrate @ 14332]
Daniel Atallah <datallah@pidgin.im>
parents:
12022
diff
changeset
|
878 | |
|
eaa207b93455
[gaim-migrate @ 14332]
Daniel Atallah <datallah@pidgin.im>
parents:
12022
diff
changeset
|
879 | gtk_widget_destroy(dialog->cancel_button); |
|
eaa207b93455
[gaim-migrate @ 14332]
Daniel Atallah <datallah@pidgin.im>
parents:
12022
diff
changeset
|
880 | gtk_widget_destroy(dialog->help_button); |
|
eaa207b93455
[gaim-migrate @ 14332]
Daniel Atallah <datallah@pidgin.im>
parents:
12022
diff
changeset
|
881 | |
|
eaa207b93455
[gaim-migrate @ 14332]
Daniel Atallah <datallah@pidgin.im>
parents:
12022
diff
changeset
|
882 | g_signal_connect(G_OBJECT(dialog->ok_button), "clicked", |
|
28137
e9ba2df9038c
Close the colour selection dialog when the whiteboard window is closed.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
26820
diff
changeset
|
883 | G_CALLBACK(color_selection_dialog_destroy), gtkwb); |
|
12039
eaa207b93455
[gaim-migrate @ 14332]
Daniel Atallah <datallah@pidgin.im>
parents:
12022
diff
changeset
|
884 | |
|
eaa207b93455
[gaim-migrate @ 14332]
Daniel Atallah <datallah@pidgin.im>
parents:
12022
diff
changeset
|
885 | gtk_color_selection_set_has_palette(GTK_COLOR_SELECTION(dialog->colorsel), TRUE); |
|
eaa207b93455
[gaim-migrate @ 14332]
Daniel Atallah <datallah@pidgin.im>
parents:
12022
diff
changeset
|
886 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
887 | pidgin_whiteboard_rgb24_to_rgb48(gtkwb->brush_color, &color); |
|
12039
eaa207b93455
[gaim-migrate @ 14332]
Daniel Atallah <datallah@pidgin.im>
parents:
12022
diff
changeset
|
888 | gtk_color_selection_set_current_color(GTK_COLOR_SELECTION(dialog->colorsel), &color); |
|
eaa207b93455
[gaim-migrate @ 14332]
Daniel Atallah <datallah@pidgin.im>
parents:
12022
diff
changeset
|
889 | |
|
eaa207b93455
[gaim-migrate @ 14332]
Daniel Atallah <datallah@pidgin.im>
parents:
12022
diff
changeset
|
890 | gtk_widget_show_all(GTK_WIDGET(dialog)); |
|
eaa207b93455
[gaim-migrate @ 14332]
Daniel Atallah <datallah@pidgin.im>
parents:
12022
diff
changeset
|
891 | } |
|
eaa207b93455
[gaim-migrate @ 14332]
Daniel Atallah <datallah@pidgin.im>
parents:
12022
diff
changeset
|
892 |