Mercurial > pidgin.yaz
comparison src/whiteboard.h @ 11914:2219f4bf4a57
[gaim-migrate @ 14205]
SF Patch #1342017 from sadrul
"This patch allows a user to change brush color during
the doodle-session.
This patch is mostly a rough one to get an idea whether
the approach is correct. To make things simple, I have
kept brush_size and brush_color in GaimGtkWhiteboard,
although it's there in doodle_session. It could be in
either place, although I would think it's best to be in
GaimGtkWhiteboard because any/most implementations of
doodle-ing would have these attributes. So keeping them
within the prpl may not be the best option?
Anyway, considering the brush-size and color stay at
the prpl for now, I have introduced two functions in
GaimWhiteboardPrplOps to get/set the size and color of
the brush from the prpl.
rekkanoryo (using Y! 7) and I (using gaim) have tested
this, and it seemed to work OK."
Plus, I cleaned up a whole bunch of code.
My apologies for this all being committed together, but it was a case of "Oh, this will be quick." that lead into hours of making intertwined changes.
committer: Tailor Script <tailor@pidgin.im>
author | Richard Laager <rlaager@wiktel.com> |
---|---|
date | Mon, 31 Oct 2005 02:19:51 +0000 |
parents | 2e3a6dcebaf3 |
children | 9d562dde0a3a |
comparison
equal
deleted
inserted
replaced
11913:b3105d119a17 | 11914:2219f4bf4a57 |
---|---|
35 /** | 35 /** |
36 * A GaimWhiteboard | 36 * A GaimWhiteboard |
37 */ | 37 */ |
38 typedef struct _GaimWhiteboard | 38 typedef struct _GaimWhiteboard |
39 { | 39 { |
40 int state; /**< State of whiteboard session */ | 40 int state; /**< State of whiteboard session */ |
41 | 41 |
42 GaimAccount *account; /**< Account associated with this session */ | 42 GaimAccount *account; /**< Account associated with this session */ |
43 char *who; /**< Name of the remote user */ | 43 char *who; /**< Name of the remote user */ |
44 | 44 |
45 void *ui_data; /**< Graphical user-interface data */ | 45 void *ui_data; /**< Graphical user-interface data */ |
46 void *proto_data; /**< Protocol specific data */ | 46 void *proto_data; /**< Protocol specific data */ |
47 GaimWhiteboardPrplOps *prpl_ops; /**< Protocol-plugin operations */ | 47 GaimWhiteboardPrplOps *prpl_ops; /**< Protocol-plugin operations */ |
48 | 48 |
49 GList *draw_list; /**< List of drawing elements/deltas to send */ | 49 GList *draw_list; /**< List of drawing elements/deltas to send */ |
50 } GaimWhiteboard; | 50 } GaimWhiteboard; |
51 | 51 |
52 /** | 52 /** |
53 * The GaimWhiteboard UI Operations | 53 * The GaimWhiteboard UI Operations |
54 */ | 54 */ |
55 typedef struct _GaimWhiteboardUiOps | 55 typedef struct _GaimWhiteboardUiOps |
56 { | 56 { |
57 void ( *create )( GaimWhiteboard *wb ); /**< create function */ | 57 void (*create)(GaimWhiteboard *wb); /**< create function */ |
58 void ( *destroy )( GaimWhiteboard *wb ); /**< destory function */ | 58 void (*destroy)(GaimWhiteboard *wb); /**< destory function */ |
59 void ( *set_dimensions)( GaimWhiteboard *wb, int width, int height ); /**< set_dimensions function */ | 59 void (*set_dimensions)(GaimWhiteboard *wb, int width, int height); /**< set_dimensions function */ |
60 void ( *draw_point )( GaimWhiteboard *wb, int x, int y, int color, int size ); /**< draw_point function */ | 60 void (*draw_point)(GaimWhiteboard *wb, int x, int y, |
61 void ( *draw_line )( GaimWhiteboard *wb, int x1, int y1, int x2, int y2, int color, int size ); /**< draw_line function */ | 61 int color, int size); /**< draw_point function */ |
62 void ( *clear )( GaimWhiteboard *wb ); /**< clear function */ | 62 void (*draw_line)(GaimWhiteboard *wb, int x1, int y1, |
63 int x2, int y2, | |
64 int color, int size); /**< draw_line function */ | |
65 void (*clear)(GaimWhiteboard *wb); /**< clear function */ | |
63 } GaimWhiteboardUiOps; | 66 } GaimWhiteboardUiOps; |
64 | 67 |
65 /** | 68 /** |
66 * GaimWhiteboard PRPL Operations | 69 * GaimWhiteboard PRPL Operations |
67 */ | 70 */ |
68 struct _GaimWhiteboardPrplOps | 71 struct _GaimWhiteboardPrplOps |
69 { | 72 { |
70 void ( *start )( GaimWhiteboard *wb ); /**< start function */ | 73 void (*start)(GaimWhiteboard *wb); /**< start function */ |
71 void ( *end )( GaimWhiteboard *wb ); /**< end function */ | 74 void (*end)(GaimWhiteboard *wb); /**< end function */ |
72 void ( *get_dimensions )( GaimWhiteboard *wb, int *width, int *height ); /**< get_dimensions function */ | 75 void (*get_dimensions)(GaimWhiteboard *wb, int *width, int *height); /**< get_dimensions function */ |
73 void ( *set_dimensions )( GaimWhiteboard *wb, int width, int height ); /**< set_dimensions function */ | 76 void (*set_dimensions)(GaimWhiteboard *wb, int width, int height); /**< set_dimensions function */ |
74 void ( *send_draw_list )( GaimWhiteboard *wb, GList *draw_list ); /**< send_draw_list function */ | 77 void (*get_brush) (GaimWhiteboard *wb, int *size, int *color); /**< get the brush size and color */ |
75 void ( *clear )( GaimWhiteboard *wb ); /**< clear function */ | 78 void (*set_brush) (GaimWhiteboard *wb, int size, int color); /**< set the brush size and color */ |
79 void (*send_draw_list)(GaimWhiteboard *wb, GList *draw_list); /**< send_draw_list function */ | |
80 void (*clear)(GaimWhiteboard *wb); /**< clear function */ | |
76 }; | 81 }; |
77 | 82 |
78 #ifdef __cplusplus | 83 #ifdef __cplusplus |
79 extern "C" { | 84 extern "C" { |
80 #endif /* __cplusplus */ | 85 #endif /* __cplusplus */ |
87 /** | 92 /** |
88 * Sets the UI Operations | 93 * Sets the UI Operations |
89 * | 94 * |
90 * @param ops The UI Operations to set | 95 * @param ops The UI Operations to set |
91 */ | 96 */ |
92 void gaim_whiteboard_set_ui_ops( GaimWhiteboardUiOps *ops ); | 97 void gaim_whiteboard_set_ui_ops(GaimWhiteboardUiOps *ops); |
93 | 98 |
94 /** | 99 /** |
95 * Creates a whiteboard | 100 * Creates a whiteboard |
96 * | 101 * |
97 * @param account The account. | 102 * @param account The account. |
98 * @param who Who you're drawing with. | 103 * @param who Who you're drawing with. |
99 * @param state The state. | 104 * @param state The state. |
100 * | 105 * |
101 * @return The new whiteboard | 106 * @return The new whiteboard |
102 */ | 107 */ |
103 GaimWhiteboard *gaim_whiteboard_create( GaimAccount *account, char *who, int state ); | 108 GaimWhiteboard *gaim_whiteboard_create(GaimAccount *account, const char *who, int state); |
104 | 109 |
105 /** | 110 /** |
106 * Destroys a whiteboard | 111 * Destroys a whiteboard |
107 * | 112 * |
108 * @param wb The whiteboard. | 113 * @param wb The whiteboard. |
109 */ | 114 */ |
110 void gaim_whiteboard_destroy( GaimWhiteboard *wb ); | 115 void gaim_whiteboard_destroy(GaimWhiteboard *wb); |
111 | 116 |
112 /** | 117 /** |
113 * Starts a whiteboard | 118 * Starts a whiteboard |
114 * | 119 * |
115 * @param wb The whiteboard. | 120 * @param wb The whiteboard. |
116 */ | 121 */ |
117 void gaim_whiteboard_start( GaimWhiteboard *wb ); | 122 void gaim_whiteboard_start(GaimWhiteboard *wb); |
118 | 123 |
119 /** | 124 /** |
120 * Finds a whiteboard from an account and user. | 125 * Finds a whiteboard from an account and user. |
121 * | 126 * |
122 * @param account The account. | 127 * @param account The account. |
123 * @param who The user. | 128 * @param who The user. |
124 * | 129 * |
125 * @return The whiteboard if found, otherwise @c NULL. | 130 * @return The whiteboard if found, otherwise @c NULL. |
126 */ | 131 */ |
127 GaimWhiteboard *gaim_whiteboard_get_session( GaimAccount *account, char *who ); | 132 GaimWhiteboard *gaim_whiteboard_get_session(GaimAccount *account, const char *who); |
128 | 133 |
129 /** | 134 /** |
130 * Destorys a drawing list for a whiteboard | 135 * Destorys a drawing list for a whiteboard |
131 * | 136 * |
132 * @param draw_list The drawing list. | 137 * @param draw_list The drawing list. |
133 * | |
134 * @return The start of the new drawing list (?) | |
135 */ | 138 */ |
136 GList *gaim_whiteboard_draw_list_destroy( GList *draw_list ); | 139 void gaim_whiteboard_draw_list_destroy(GList *draw_list); |
137 | 140 |
138 /** | 141 /** |
139 * Sets the dimensions for a whiteboard. | 142 * Sets the dimensions for a whiteboard. |
140 * | 143 * |
141 * @param wb The whiteboard. | 144 * @param wb The whiteboard. |
142 * @param width The width. | 145 * @param width The width. |
143 * @param height The height. | 146 * @param height The height. |
144 */ | 147 */ |
145 void gaim_whiteboard_set_dimensions( GaimWhiteboard *wb, int width, int height ); | 148 void gaim_whiteboard_set_dimensions(GaimWhiteboard *wb, int width, int height); |
146 | 149 |
147 /** | 150 /** |
148 * Draws a point on a whiteboard. | 151 * Draws a point on a whiteboard. |
149 * | 152 * |
150 * @param wb The whiteboard. | 153 * @param wb The whiteboard. |
151 * @param x The x coordinate. | 154 * @param x The x coordinate. |
152 * @param y The y coordinate. | 155 * @param y The y coordinate. |
153 * @param color The color to use. | 156 * @param color The color to use. |
154 * @param size The brush size. | 157 * @param size The brush size. |
155 */ | 158 */ |
156 void gaim_whiteboard_draw_point( GaimWhiteboard *wb, int x, int y, int color, int size ); | 159 void gaim_whiteboard_draw_point(GaimWhiteboard *wb, int x, int y, int color, int size); |
157 | 160 |
158 /** | 161 /** |
159 * Draws a line on a whiteboard | 162 * Draws a line on a whiteboard |
160 * | 163 * |
161 * @param wb The whiteboard. | 164 * @param wb The whiteboard. |
164 * @param x2 The bottom-right x coordinate. | 167 * @param x2 The bottom-right x coordinate. |
165 * @param y2 The bottom-right y coordinate. | 168 * @param y2 The bottom-right y coordinate. |
166 * @param color The color to use. | 169 * @param color The color to use. |
167 * @param size The brush size. | 170 * @param size The brush size. |
168 */ | 171 */ |
169 void gaim_whiteboard_draw_line( GaimWhiteboard *wb, int x1, int y1, int x2, int y2, int color, int size ); | 172 void gaim_whiteboard_draw_line(GaimWhiteboard *wb, int x1, int y1, int x2, int y2, int color, int size); |
170 | 173 |
171 /** | 174 /** |
172 * Clears a whiteboard | 175 * Clears a whiteboard |
173 * | 176 * |
174 * @param wb The whiteboard. | 177 * @param wb The whiteboard. |
175 */ | 178 */ |
176 void gaim_whiteboard_clear( GaimWhiteboard *wb ); | 179 void gaim_whiteboard_clear(GaimWhiteboard *wb); |
177 | 180 |
178 /*@}*/ | 181 /*@}*/ |
179 | 182 |
180 #ifdef __cplusplus | 183 #ifdef __cplusplus |
181 } | 184 } |