gaim/gaim

b7d392d68507
Parents c902dd8c275d
Children 4d9ea3462c35
Plugin form almost completely gone. Front-end and back-end developed;
however, not bound because lack of UI operations, currently.
--- a/src/gtkwhiteboard.c Wed Jul 13 22:02:56 2005 -0400
+++ b/src/gtkwhiteboard.c Tue Jul 19 23:14:35 2005 -0400
@@ -21,3 +21,641 @@
*
*/
+// INCLUDES ============================================================================================
+
+#include "gtkwhiteboard.h"
+
+// GLOBALS =============================================================================================
+
+//GList *buttonList = NULL;
+
+int LastX; // Tracks last position of the mouse when drawing
+int LastY;
+int MotionCount; // Tracks how many brush motions made
+int BrushState = BRUSH_STATE_UP;
+
+// FUNCTIONS ============================================================================================
+
+GaimGtkWhiteboard *gaim_gtkwhiteboard_create( GaimWhiteboard *wb )
+{
+ //int i;
+
+ GtkWidget *window;
+ GtkWidget *drawing_area;
+
+ GtkWidget *hbox_palette;
+ GtkWidget *vbox_palette_above_canvas_and_controls;
+ GtkWidget *hbox_canvas_and_controls;
+ GtkWidget *vbox_controls;
+
+ // --------------------------
+ // |[][][][palette[][][][][]|
+ // |------------------------|
+ // | canvas | con |
+ // | | trol|
+ // | | s |
+ // | | |
+ // | | |
+ // --------------------------
+
+ GtkWidget *clear_button;
+ GtkWidget *save_button;
+
+ //GtkWidget *color_box[PALETTE_NUM_OF_COLORS];
+
+ GaimGtkWhiteboard *gtkwb = g_new0( GaimGtkWhiteboard, 1 );
+
+ window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
+ gtkwb->window = window;
+ gtk_widget_set_name( window, wb->who );
+ gtk_window_set_title( ( GtkWindow* )( window ), wb->who ); // TODO Try and use alias first
+ gtk_window_set_resizable( ( GtkWindow* )( window ), FALSE );
+
+ g_signal_connect( G_OBJECT( window ), "destroy",
+ G_CALLBACK( gaim_gtkwhiteboard_exit ), ( gpointer )( gtkwb ) );
+
+ // Create vertical box to place palette above the canvas and controls
+ vbox_palette_above_canvas_and_controls = gtk_vbox_new( FALSE, 0 );
+ gtk_container_add( GTK_CONTAINER( window ), vbox_palette_above_canvas_and_controls );
+ gtk_widget_show( vbox_palette_above_canvas_and_controls );
+
+ // Create horizontal box for the palette and all its entries
+ hbox_palette = gtk_hbox_new( FALSE, 0 );
+ gtk_container_add( GTK_CONTAINER( vbox_palette_above_canvas_and_controls ), hbox_palette );
+ gtk_widget_show( hbox_palette );
+
+ // Create horizontal box to seperate the canvas from the controls
+ hbox_canvas_and_controls = gtk_hbox_new( FALSE, 0 );
+ gtk_container_add( GTK_CONTAINER( vbox_palette_above_canvas_and_controls ), hbox_canvas_and_controls );
+ gtk_widget_show( hbox_canvas_and_controls );
+/*
+ for( i = 0; i < PALETTE_NUM_OF_COLORS; i++ )
+ {
+ color_box[i] = gtk_label_new( NULL );
+ gtk_widget_set_size_request( color_box[i], DOODLE_CANVAS_WIDTH / PALETTE_NUM_OF_COLORS ,32 );
+ gtk_container_add( GTK_CONTAINER( hbox_palette ), color_box[i] );
+ gtk_widget_show( color_box[i] );
+ }
+*/
+ // Create the drawing area
+ drawing_area = gtk_drawing_area_new();
+ gtkwb->drawing_area = drawing_area;
+ // NOTE Protocol specific needs UI_OP?
+ gtk_widget_set_size_request( GTK_WIDGET( drawing_area ), 320, 240 );
+ gtk_box_pack_start( GTK_BOX( hbox_canvas_and_controls ), drawing_area, TRUE, TRUE, 8 );
+
+ gtk_widget_show( drawing_area );
+
+ // Signals used to handle backing pixmap
+ g_signal_connect( G_OBJECT( drawing_area ), "expose_event",
+ G_CALLBACK( gaim_gtkwhiteboard_expose_event ), ( gpointer )( gtkwb ) );
+
+ g_signal_connect( G_OBJECT( drawing_area ), "configure_event",
+ G_CALLBACK( gaim_gtkwhiteboard_configure_event ), ( gpointer )( gtkwb ) );
+
+ // Event signals
+ g_signal_connect( G_OBJECT( drawing_area ), "button_press_event",
+ G_CALLBACK( gaim_gtkwhiteboard_brush_down ), ( gpointer )( gtkwb ) );
+
+ g_signal_connect( G_OBJECT( drawing_area ), "motion_notify_event",
+ G_CALLBACK( gaim_gtkwhiteboard_brush_motion ), ( gpointer )( gtkwb ) );
+
+ g_signal_connect( G_OBJECT( drawing_area ), "button_release_event",
+ G_CALLBACK( gaim_gtkwhiteboard_brush_up ), ( gpointer )( gtkwb ) );
+
+ gtk_widget_set_events( drawing_area, GDK_EXPOSURE_MASK |
+ GDK_LEAVE_NOTIFY_MASK |
+ GDK_BUTTON_PRESS_MASK |
+ GDK_POINTER_MOTION_MASK |
+ GDK_BUTTON_RELEASE_MASK |
+ GDK_POINTER_MOTION_HINT_MASK );
+
+ // Create vertical box to contain the controls
+ vbox_controls = gtk_vbox_new( FALSE, 0 );
+ gtk_container_add( GTK_CONTAINER( hbox_canvas_and_controls ), vbox_controls );
+ gtk_widget_show( vbox_controls );
+
+ // Add a clear button
+ clear_button = gtk_button_new_with_label( "Clear" );
+ gtk_widget_set_size_request( clear_button, 96 ,32 );
+ gtk_box_pack_start( GTK_BOX( vbox_controls ), clear_button, FALSE, FALSE, 0 );
+ gtk_widget_show( clear_button );
+
+ g_signal_connect( G_OBJECT( clear_button ), "clicked",
+ G_CALLBACK( gaim_gtkwhiteboard_button_clear_press ), ( gpointer )( gtkwb ) );
+
+ // Add a save button
+ save_button = gtk_button_new_with_label( "Save" );
+ gtk_widget_set_size_request( save_button, 96 ,32 );
+ gtk_box_pack_start( GTK_BOX( vbox_controls ), save_button, FALSE, FALSE, 8 );
+ gtk_widget_show( save_button );
+
+ // Make all this (window) visible
+ gtk_widget_show( window );
+
+ gaim_gtkwhiteboard_set_canvas_as_icon( gtkwb );
+
+ // TODO Specific protocol/whiteboard assignment here? Needs a UI Op?
+ // Set default brush size and color
+ //ds->brush_size = DOODLE_BRUSH_MEDIUM;
+ //ds->brush_color = 0; // black
+
+ return( gtkwb );
+}
+
+// ------------------------------------------------------------------------------------------------------
+
+void gaim_gtkwhiteboard_destroy( GaimGtkWhiteboard *gtkwb )
+{
+ // TODO Ask if user wants to save picture before the session is closed
+
+ // Clear pixmap memory before we remove this session from the Doodle session list
+ if( gtkwb->pixmap )
+ g_object_unref( gtkwb->pixmap );
+
+ // NOTE Correct order below? Will it break anything?
+ gaim_whiteboard_destroy( gtkwb->wb );
+
+ if( gtkwb )
+ g_free( gtkwb );
+}
+
+// ------------------------------------------------------------------------------------------------------
+
+void gaim_gtkwhiteboard_exit( GtkWidget *widget, gpointer data )
+{
+ GaimGtkWhiteboard *gtkwb = ( GaimGtkWhiteboard* )( data );
+
+ gaim_gtkwhiteboard_destroy( gtkwb );
+}
+
+// ------------------------------------------------------------------------------------------------------
+/*
+// Whiteboard start button on conversation window (ooo boy... figure this one out)
+void gaim_gtkwhiteboard_button_start_press( GtkButton *button, gpointer data )
+{
+ GaimConversation *conv = data;
+ GaimAccount *account = gaim_conversation_get_account( conv );
+ GaimConnection *gc = gaim_account_get_connection( account );
+ char *to = ( char* )( gaim_conversation_get_name( conv ) );
+
+ // Only handle this if local client requested Doodle session (else local client would have sent one)
+ GaimWhiteboard *wb = gaim_whiteboard_get( account, from );
+
+ // Write a local message to this conversation showing that
+ // a request for a Doodle session has been made
+ gaim_conv_im_write( GAIM_CONV_IM( conv ), "", _("Sent Doodle request."),
+ GAIM_MESSAGE_NICK | GAIM_MESSAGE_RECV, time( NULL ) );
+
+ yahoo_doodle_command_send_request( gc, to );
+ yahoo_doodle_command_send_ready( gc, to );
+
+ // Insert this 'session' in the list. At this point, it's only a requested session.
+ wb = gaim_whiteboard_create( account, from, DOODLE_STATE_REQUESTING );
+}
+*/
+// ------------------------------------------------------------------------------------------------------
+
+gboolean gaim_gtkwhiteboard_configure_event( GtkWidget *widget, GdkEventConfigure *event, gpointer data )
+{
+ GaimGtkWhiteboard *gtkwb = ( GaimGtkWhiteboard* )( data );
+
+ GdkPixmap *pixmap = gtkwb->pixmap;
+
+ //g_print( "goodle_doodle_session_configure_event | %s\n", ds->who );
+
+ if( pixmap )
+ g_object_unref( pixmap );
+
+ pixmap = gdk_pixmap_new( widget->window,
+ widget->allocation.width,
+ widget->allocation.height,
+ -1 );
+
+ gtkwb->pixmap = pixmap;
+
+ gdk_draw_rectangle( pixmap,
+ widget->style->white_gc,
+ TRUE,
+ 0, 0,
+ widget->allocation.width,
+ widget->allocation.height );
+
+ return( TRUE );
+}
+
+// ------------------------------------------------------------------------------------------------------
+
+gboolean gaim_gtkwhiteboard_expose_event( GtkWidget *widget, GdkEventExpose *event, gpointer data )
+{
+ GaimGtkWhiteboard *gtkwb = ( GaimGtkWhiteboard* )( data );
+ GdkPixmap *pixmap = gtkwb->pixmap;
+
+ //g_print( "goodle_doodle_session_expose_event | %s\n", ds->who );
+
+ gdk_draw_drawable( widget->window,
+ widget->style->fg_gc[GTK_WIDGET_STATE( widget )],
+ pixmap,
+ event->area.x, event->area.y,
+ event->area.x, event->area.y,
+ event->area.width, event->area.height );
+
+ return( FALSE );
+}
+
+// ------------------------------------------------------------------------------------------------------
+
+gboolean gaim_gtkwhiteboard_brush_down( GtkWidget *widget, GdkEventButton *event, gpointer data )
+{
+ GaimGtkWhiteboard *gtkwb = ( GaimGtkWhiteboard* )( data );
+ GdkPixmap *pixmap = gtkwb->pixmap;
+
+ GList *d_list = gtkwb->wb->draw_list;
+
+ int *brush_color = NULL;
+ int *brush_size = NULL;
+ int *x0 = NULL;
+ int *y0 = NULL;
+
+ if( BrushState != BRUSH_STATE_UP )
+ {
+ // Potential double-click DOWN to DOWN?
+
+ g_print( "***Bad brush state transition %d to DOWN\n", BrushState );
+
+ BrushState = BRUSH_STATE_DOWN;
+
+ //return( FALSE );
+ }
+
+ BrushState = BRUSH_STATE_DOWN;
+
+ //g_print( "BRUSH_DOWN | %s\n", ds->who );
+
+ if( event->button == 1 && pixmap != NULL )
+ {
+ // Check if draw_list has contents; if so, clear it
+ if( d_list )
+ gaim_whiteboard_draw_list_destroy( d_list );
+
+ brush_color = g_new0( int, 1 );
+ brush_size = g_new0( int, 1 );
+ x0 = g_new0( int, 1 );
+ y0 = g_new0( int, 1 );
+
+ //*brush_color = gtkwb->brush_color;
+ //*brush_size = gtkwb->brush_size;
+ *x0 = event->x;
+ *y0 = event->y;
+
+ // Set tracking variables
+ LastX = *x0;
+ LastY = *y0;
+ MotionCount = 0;
+
+ d_list = g_list_append( d_list, ( gpointer )( brush_color ) );
+ d_list = g_list_append( d_list, ( gpointer )( brush_size ) );
+ d_list = g_list_append( d_list, ( gpointer )( x0 ) );
+ d_list = g_list_append( d_list, ( gpointer )( y0 ) );
+
+ gaim_gtkwhiteboard_draw_brush_point( widget, gtkwb,
+ event->x, event->y,
+ 0,5 );//gtkwb->brush_color, gtkwb->brush_size ); NOTE temp const proto uiop
+ }
+
+ return( TRUE );
+}
+
+// ------------------------------------------------------------------------------------------------------
+
+gboolean gaim_gtkwhiteboard_brush_motion( GtkWidget *widget, GdkEventMotion *event, gpointer data )
+{
+ int x;
+ int y;
+ int *dx;
+ int *dy;
+ GdkModifierType state;
+
+ GaimGtkWhiteboard *gtkwb = ( GaimGtkWhiteboard* )( data );
+ GdkPixmap *pixmap = gtkwb->pixmap;
+
+ GList *d_list = gtkwb->wb->draw_list;
+
+ //g_print( "BRUSH_MOTION | %s\n", ds->who );
+
+ if( event->is_hint )
+ gdk_window_get_pointer( event->window, &x, &y, &state );
+ else
+ {
+ x = event->x;
+ y = event->y;
+ state = event->state;
+ }
+
+ if( state & GDK_BUTTON1_MASK && pixmap != NULL )
+ {
+ if( ( BrushState != BRUSH_STATE_DOWN ) && ( BrushState != BRUSH_STATE_MOTION ) )
+ {
+ g_print( "***Bad brush state transition %d to MOTION\n", BrushState );
+
+ BrushState = BRUSH_STATE_MOTION;
+
+ return( FALSE );
+ }
+ BrushState = BRUSH_STATE_MOTION;
+
+ dx = g_new0( int, 1 );
+ dy = g_new0( int, 1 );
+
+ *dx = x - LastX;
+ *dy = y - LastY;
+
+ MotionCount++;
+
+ // NOTE 100 is a temporary constant for how many deltas/motions in a stroke (needs UI Ops?)
+ if( MotionCount == 100 )
+ {
+ d_list = g_list_append( d_list, ( gpointer )( dx ) );
+ d_list = g_list_append( d_list, ( gpointer )( dy ) );
+
+ //NOTE Protocol specific here too... UI Ops?
+
+ //char* message = goodle_doodle_session_build_draw_string( d_list );
+ //yahoo_doodle_command_send_draw( ds->gc, ds->who, message );
+
+ // The brush stroke is finished, clear the list for another one
+ gaim_whiteboard_draw_list_destroy( d_list );
+
+ int *brush_color = g_new0( int, 1 );
+ int *brush_size = g_new0( int, 1 );
+ int *x0 = g_new0( int, 1 );
+ int *y0 = g_new0( int, 1 );
+
+ //*brush_color = gtkwb->brush_color;
+ //*brush_size = gtkwb->brush_size;
+ *x0 = LastX;
+ *y0 = LastY;
+
+ // Reset motion tracking
+ MotionCount = 0;
+
+ d_list = g_list_append( d_list, ( gpointer )( brush_color ) );
+ d_list = g_list_append( d_list, ( gpointer )( brush_size ) );
+ d_list = g_list_append( d_list, ( gpointer )( x0 ) );
+ d_list = g_list_append( d_list, ( gpointer )( y0 ) );
+ }
+ //else
+ {
+ dx = g_new0( int, 1 );
+ dy = g_new0( int, 1 );
+
+ *dx = x - LastX;
+ *dy = y - LastY;
+
+ d_list = g_list_append( d_list, ( gpointer )( dx ) );
+ d_list = g_list_append( d_list, ( gpointer )( dy ) );
+ }
+
+ gaim_gtkwhiteboard_draw_brush_line( gtkwb->drawing_area, gtkwb,
+ LastX, LastY,
+ x, y,
+ 0, 5 );//gtkwb->brush_color, gtkwb->brush_size ); temp const proto ui ops?
+
+ // Set tracking variables
+ LastX = x;
+ LastY = y;
+ }
+
+ return( TRUE );
+}
+
+// ------------------------------------------------------------------------------------------------------
+
+gboolean gaim_gtkwhiteboard_brush_up( GtkWidget *widget, GdkEventButton *event, gpointer data )
+{
+ GaimGtkWhiteboard *gtkwb = ( GaimGtkWhiteboard* )( data );
+ GdkPixmap *pixmap = gtkwb->pixmap;
+
+ GList *d_list = gtkwb->wb->draw_list;
+
+ //g_print( "BRUSH_UP | %s\n", ds->who );
+
+ if( ( BrushState != BRUSH_STATE_DOWN ) && ( BrushState != BRUSH_STATE_MOTION ) )
+ {
+ g_print( "***Bad brush state transition %d to UP\n", BrushState );
+
+ BrushState = BRUSH_STATE_UP;
+
+ return( FALSE );
+ }
+ BrushState = BRUSH_STATE_UP;
+
+ if( event->button == 1 && pixmap != NULL )
+ {
+ // If the brush was never moved, express two sets of two deltas
+ // That's a 'point,' but not for Yahoo!
+ //if( ( event->x == LastX ) && ( event->y == LastY ) )
+ if( MotionCount == 0 )
+ {
+ int index;
+
+ for( index = 0; index < 2; index++ )
+ {
+ int *x0 = NULL;
+ int *y0 = NULL;
+
+ x0 = g_new0( int, 1 );
+ y0 = g_new0( int, 1 );
+
+ d_list = g_list_append( d_list, ( gpointer )( x0 ) );
+ d_list = g_list_append( d_list, ( gpointer )( y0 ) );
+ }
+ }
+ //else
+ // MotionCount = 0;
+
+ //char* message = goodle_doodle_session_build_draw_string( drawList );
+ //yahoo_doodle_command_send_draw( ds->gc, ds->who, message );
+
+ gaim_gtkwhiteboard_set_canvas_as_icon( gtkwb );
+
+ // The brush stroke is finished, clear the list for another one
+ gaim_whiteboard_draw_list_destroy( d_list );
+ }
+
+ return( TRUE );
+}
+
+// ------------------------------------------------------------------------------------------------------
+
+void gaim_gtkwhiteboard_draw_brush_point( GtkWidget *widget, GaimGtkWhiteboard *gtkwb,
+ int x, int y, int color, int size )
+{
+ GdkPixmap *pixmap = gtkwb->pixmap;
+
+ //g_print( "goodle_doodle_session_draw_brush | %s\n", ds->who );
+
+ GdkRectangle update_rect;
+
+ update_rect.x = x - size / 2;
+ update_rect.y = y - size / 2;
+ update_rect.width = size;
+ update_rect.height = size;
+
+ // Interpret and convert color
+ GdkGC *gfx_con = gdk_gc_new( pixmap );
+ GdkColor col;
+
+ gaim_gtkwhiteboard_rgb24_to_rgb48( color, &col );
+
+ gdk_gc_set_rgb_fg_color( gfx_con, &col );
+ //gdk_gc_set_rgb_bg_color( gfx_con, &col );
+
+ // NOTE 5 is a size constant for now... this is because of how poorly the gdk_draw_arc draws small circles
+ if( size < 5 )
+ {
+ // Draw a rectangle/square
+ gdk_draw_rectangle( pixmap,
+ gfx_con,
+ TRUE,
+ update_rect.x, update_rect.y,
+ update_rect.width, update_rect.height );
+ }
+ else
+ {
+ // Draw a circle
+ gdk_draw_arc( pixmap,
+ gfx_con,
+ TRUE,
+ update_rect.x, update_rect.y,
+ update_rect.width, update_rect.height,
+ 0, FULL_CIRCLE_DEGREES );
+ }
+
+ gtk_widget_queue_draw_area( widget,
+ update_rect.x, update_rect.y,
+ update_rect.width, update_rect.height );
+
+ gdk_gc_unref( gfx_con );
+}
+
+// ------------------------------------------------------------------------------------------------------
+// Uses Bresenham's algorithm (as provided by Wikipedia)
+void gaim_gtkwhiteboard_draw_brush_line( GtkWidget *widget, GaimGtkWhiteboard *gtkwb,
+ int x0, int y0, int x1, int y1, int color, int size )
+{
+ int temp;
+
+ int xstep;
+ int ystep;
+
+ gboolean steep = abs( y1 - y0 ) > abs( x1 - x0 );
+
+ if( steep )
+ {
+ temp = x0; x0 = y0; y0 = temp;
+ temp = x1; x1 = y1; y1 = temp;
+ }
+
+ int dx = abs( x1 - x0 );
+ int dy = abs( y1 - y0 );
+
+ int error = 0;
+ int derror = dy;
+
+ int x = x0;
+ int y = y0;
+
+ if( x0 < x1 )
+ xstep = 1;
+ else
+ xstep = -1;
+
+ if( y0 < y1 )
+ ystep = 1;
+ else
+ ystep = -1;
+
+ if( steep )
+ gaim_gtkwhiteboard_draw_brush_point( widget, gtkwb, y, x, color, size );
+ else
+ gaim_gtkwhiteboard_draw_brush_point( widget, gtkwb, x, y, color, size );
+
+ while( x != x1 )
+ {
+ x = x + xstep;
+ error = error + derror;
+
+ if( ( error * 2 ) >= dx )
+ {
+ y = y + ystep;
+ error = error - dx;
+ }
+
+ if( steep )
+ gaim_gtkwhiteboard_draw_brush_point( widget, gtkwb, y, x, color, size );
+ else
+ gaim_gtkwhiteboard_draw_brush_point( widget, gtkwb, x, y, color, size );
+ }
+}
+
+// ------------------------------------------------------------------------------------------------------
+
+void gaim_gtkwhiteboard_clear_canvas( GaimGtkWhiteboard *gtkwb )
+{
+ GdkPixmap *pixmap = gtkwb->pixmap;
+ GtkWidget *drawing_area = gtkwb->drawing_area;
+
+ gdk_draw_rectangle( pixmap,
+ drawing_area->style->white_gc,
+ TRUE,
+ 0, 0,
+ drawing_area->allocation.width, drawing_area->allocation.height );
+
+ gtk_widget_queue_draw_area( drawing_area,
+ 0, 0,
+ drawing_area->allocation.width, drawing_area->allocation.height );
+}
+
+// ------------------------------------------------------------------------------------------------------
+
+void gaim_gtkwhiteboard_button_clear_press( GtkWidget *widget, gpointer data )
+{
+ GaimGtkWhiteboard *gtkwb = ( GaimGtkWhiteboard* )( data );
+
+ // Proto specific? UI Ops?
+ //goodle_send_command_clear( ds->gc, ds->who );
+
+ gaim_gtkwhiteboard_clear_canvas( gtkwb );
+
+ gaim_gtkwhiteboard_set_canvas_as_icon( gtkwb );
+}
+
+// ------------------------------------------------------------------------------------------------------
+
+void gaim_gtkwhiteboard_set_canvas_as_icon( GaimGtkWhiteboard *gtkwb )
+{
+ GdkPixbuf *pixbuf;
+
+ // Makes an icon from the whiteboard's canvas 'image'
+ pixbuf = gdk_pixbuf_get_from_drawable( NULL,
+ ( GdkDrawable* )( gtkwb->pixmap ),
+ gdk_drawable_get_colormap( gtkwb->pixmap ),
+ 0, 0,
+ 0, 0,
+ 320, 240 ); //Constants for protocol specific UI_Ops?
+
+ gtk_window_set_icon( ( GtkWindow* )( gtkwb->window ), pixbuf );
+}
+
+// ------------------------------------------------------------------------------------------------------
+
+void gaim_gtkwhiteboard_rgb24_to_rgb48( int color_rgb, GdkColor *color )
+{
+ color->red = ( color_rgb >> 8 ) | 0xFF;
+ color->green = ( color_rgb & 0xFF00 ) | 0xFF;
+ color->blue = ( ( color_rgb & 0xFF ) << 8 ) | 0xFF;
+}
+
+// ------------------------------------------------------------------------------------------------------
+
--- a/src/gtkwhiteboard.h Wed Jul 13 22:02:56 2005 -0400
+++ b/src/gtkwhiteboard.h Tue Jul 19 23:14:35 2005 -0400
@@ -22,3 +22,59 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+#ifndef _GAIM_GTKWHITEBOARD_H_
+#define _GAIM_GTKWHITEBOARD_H_
+
+// INCLUDES ============================================================================================
+#include "gtkgaim.h"
+
+#include "whiteboard.h"
+
+// DEFINES =============================================================================================
+
+#define FULL_CIRCLE_DEGREES 23040
+
+#define BRUSH_STATE_UP 0
+#define BRUSH_STATE_DOWN 1
+#define BRUSH_STATE_MOTION 2
+
+// DATATYPES ===========================================================================================
+typedef struct _GaimGtkWhiteboard
+{
+ GaimWhiteboard *wb; // backend data for this whiteboard
+
+ GtkWidget *window; // Window for the Doodle session
+ GtkWidget *drawing_area; // Drawing area
+
+ GdkPixmap *pixmap; // Memory for drawing area
+} GaimGtkWhiteboard;
+
+// PROTOTYPES ==========================================================================================
+
+GaimGtkWhiteboard *gaim_gtkwhiteboard_create( GaimWhiteboard *wb );
+void gaim_gtkwhiteboard_destroy( GaimGtkWhiteboard *gtkwb );
+void gaim_gtkwhiteboard_exit( GtkWidget *widget, gpointer data );
+
+//void gaim_gtkwhiteboard_button_start_press( GtkButton *button, gpointer data );
+
+gboolean gaim_gtkwhiteboard_configure_event( GtkWidget *widget, GdkEventConfigure *event, gpointer data );
+gboolean gaim_gtkwhiteboard_expose_event( GtkWidget *widget, GdkEventExpose *event, gpointer data );
+
+gboolean gaim_gtkwhiteboard_brush_down( GtkWidget *widget, GdkEventButton *event, gpointer data );
+gboolean gaim_gtkwhiteboard_brush_motion( GtkWidget *widget, GdkEventMotion *event, gpointer data );
+gboolean gaim_gtkwhiteboard_brush_up( GtkWidget *widget, GdkEventButton *event, gpointer data );
+
+void gaim_gtkwhiteboard_draw_brush_point( GtkWidget *widget, GaimGtkWhiteboard *gtkwb,
+ int x, int y, int color, int size );
+void gaim_gtkwhiteboard_draw_brush_line( GtkWidget *widget, GaimGtkWhiteboard *gtkwb,
+ int x0, int y0, int x1, int y1, int color, int size );
+
+void gaim_gtkwhiteboard_clear_canvas( GaimGtkWhiteboard *gtkwb );
+
+void gaim_gtkwhiteboard_button_clear_press( GtkWidget *widget, gpointer data );
+
+void gaim_gtkwhiteboard_set_canvas_as_icon( GaimGtkWhiteboard *gtkwb );
+
+void gaim_gtkwhiteboard_rgb24_to_rgb48( int color_rgb, GdkColor *color );
+
+#endif // _GAIM_GTKWHITEBOARD_H_
Binary file src/gtkwhiteboard.o has changed
--- a/src/protocols/yahoo/yahoo_doodle.c Wed Jul 13 22:02:56 2005 -0400
+++ b/src/protocols/yahoo/yahoo_doodle.c Tue Jul 19 23:14:35 2005 -0400
@@ -49,23 +49,12 @@
#include "yahoo_filexfer.h"
#include "yahoo_picture.h"
+#include "whiteboard.h"
#include "yahoo_doodle.h"
-
// GLOBALS =============================================================================================
-gboolean auto_accept = TRUE;
-
-GList *buttonList = NULL;
-
-GList *dsList = NULL;
-
GList *drawList = NULL;
-int LastX; // Tracks last position of the mouse when drawing
-int LastY;
-int MotionCount; // Tracks how many brush motions made
-int BrushState = BRUSH_STATE_UP;
-
const int DefaultColorRGB24[] =
{
DOODLE_COLOR_RED,
@@ -202,8 +191,6 @@
if( ( gtkconv = GAIM_GTK_CONVERSATION( conv ) ) == NULL )
return;
- //type = gaim_conversation_get_type( conv );
-
// Create this button (via Gaim API)
button = gaim_gtkconv_button_new( NULL,
"Goodle", "Start a Doodle session with this user",
@@ -248,122 +235,6 @@
}
}
}
-// ------------------------------------------------------------------------------------------------------
-
-void goodle_button_press( GtkButton *button, gpointer data )
-{
- GaimConversation *conv = data;
- GaimAccount *account = gaim_conversation_get_account( conv );
- GaimConnection *gc = gaim_account_get_connection( account );
- char *to = ( char* )( gaim_conversation_get_name( conv ) );
-
- // Get the doodle session
- doodle_session *ds = yahoo_doodle_session_get( dsList,
- ( char* )( gaim_account_get_username( gc->account ) ),
- to );
-
- // Write a local message to this conversation showing that
- // a request for a Doodle session has been made
- gaim_conv_im_write( GAIM_CONV_IM( conv ), "", _("Sent Doodle request."),
- GAIM_MESSAGE_NICK | GAIM_MESSAGE_RECV, time( NULL ) );
-
- goodle_send_command_request( gc, to );
- yahoo_doodle_command_send_ready( gc, to );
-
- // Insert this 'session' in the list. At this point, it's only a requested session.
- if( ds == NULL )
- {
- ds = g_new0( doodle_session, 1 );
- strcpy( ds->who, to );
- ds->gc = gc;
- ds->state = DOODLE_STATE_REQUESTING;
- dsList = g_list_append( dsList, ( gpointer )( ds ) );
- }
-}
-// ------------------------------------------------------------------------------------------------------
-
-// Configuration dialog for plugin (uses GTK)
-GtkWidget *get_config_frame( GaimPlugin *plugin )
-{
- GtkWidget *vbox, *frame;
-
- vbox = gtk_vbox_new( FALSE, 6 );
- gtk_container_set_border_width( GTK_CONTAINER( vbox ), 12 );
-
- frame = gaim_gtk_make_frame( vbox, "Settings" );
-
- gaim_gtk_prefs_checkbox( "Automatically accept Doodle requests",
- "/plugins/gtk/goodle/auto_accept",
- frame );
-
- gtk_widget_show_all( vbox );
-
- return( vbox );
-}
-// ------------------------------------------------------------------------------------------------------
-
-void goodle_set_goodle_functions( gboolean useGoodle )
-{
- GList *accountList = NULL;
- GList *l = NULL;
- GList *l_next = NULL;
-
- GaimAccount *account;
- GaimConnection *gc;
-
- struct yahoo_data *yd;
-
- // Obtain all the Gaim accounts (no other way to get to the GaimConnections?)
- accountList = gaim_accounts_get_all();
-
- // Traverse through the accounts to determine which ones are Yahoo
- for( l = accountList; l != NULL; l = l_next )
- {
- l_next = l->next;
-
- account = ( GaimAccount* )( l->data );
-
- // Check if this particular account is Yahoo
- if( !strcmp( gaim_account_get_protocol_id( account ), "prpl-yahoo" ) )
- {
- // See if this Yahoo account is active
- if( gaim_account_is_connected( account ) )
- {
- gc = gaim_account_get_connection( account );
-
- yd = gc->proto_data;
-
- GaimPlugin *gp = gaim_find_prpl( "prpl-yahoo" );
- GaimPluginInfo *gpi = gp->info;
- GaimPluginProtocolInfo *gppi = gpi->extra_info;
-
- if( useGoodle )
- {
- // Replace the packet handler function with a modified one
- // to check for packets concerning 'Doodle'
- gaim_input_remove( gc->inpa );
- gc->inpa = gaim_input_add( yd->fd, GAIM_INPUT_READ, goodle_pending, gc );
-
- // Replace the 'send_im' function with a modified one
- // to check to see if we are chatting with a person we are doodling with
- gppi->send_im = goodle_send_im;
- }
- else
- {
- // Replace the modified packet handler function with original
- gaim_input_remove( gc->inpa );
- gc->inpa = gaim_input_add( yd->fd, GAIM_INPUT_READ, yahoo_pending, gc );
-
- // Replace the modified 'send_im' with the original
- gppi->send_im = yahoo_send_im;
- }
- }
- }
- }
-
- // Clear our list of accounts?
- accountList = NULL;
-}
// ------------------------------------------------------------------------------------------------------
*/
@@ -413,16 +284,16 @@
void yahoo_doodle_command_got_request( GaimConnection *gc, char *from )
{
- char *me = ( char* )( gaim_account_get_username( gc->account ) );
+ GaimAccount *account = gaim_connection_get_account( gc );
// Only handle this if local client requested Doodle session (else local client would have sent one)
- doodle_session *ds = yahoo_doodle_session_get( dsList, me, from );
+ GaimWhiteboard *wb = gaim_whiteboard_get( account, from );
g_print( "-----------------------------------------------\n" );
g_print( "Got REQUEST (%s)\n", from );
// If a session with the remote user doesn't exist
- if( ds == NULL )
+ if( wb == NULL )
{
// Ask user if he/she wishes to accept the request for a doodle session
// TODO Ask local user to start Doodle session with remote user
@@ -435,14 +306,7 @@
dialog_message, NULL, NULL, NULL );
*/
- if( !auto_accept )
- {};
-
- ds = g_new0( doodle_session, 1 );
- strcpy( ds->who, from );
- ds->gc = gc;
- ds->state = DOODLE_STATE_REQUESTED;
- dsList = g_list_append( dsList, ( gpointer )( ds ) );
+ wb = gaim_whiteboard_create( account, from, DOODLE_STATE_REQUESTED );
yahoo_doodle_command_send_request( gc, from );
}
@@ -454,28 +318,28 @@
void yahoo_doodle_command_got_ready( GaimConnection *gc, char *from )
{
+ GaimAccount *account = gaim_connection_get_account( gc );
+
// Only handle this if local client requested Doodle session (else local client would have sent one)
- doodle_session *ds = yahoo_doodle_session_get( dsList,
- ( char* )( gaim_account_get_username( gc->account ) ),
- from );
+ GaimWhiteboard *wb = gaim_whiteboard_get( account, from );
g_print( "-----------------------------------------------\n" );
g_print( "Got READY (%s)\n", from );
- if( ds == NULL )
+ if( wb == NULL )
return;
- if( ds->state == DOODLE_STATE_REQUESTING )
+ if( wb->state == DOODLE_STATE_REQUESTING )
{
// TODO Check for active pixmap?
//goodle_doodle_session_start( ds );
- ds->state = DOODLE_STATE_ESTABLISHED;
+ wb->state = DOODLE_STATE_ESTABLISHED;
yahoo_doodle_command_send_confirm( gc, from );
}
- if( ds->state == DOODLE_STATE_ESTABLISHED )
+ if( wb->state == DOODLE_STATE_ESTABLISHED )
{
// TODO Call clear function (requires function to clear canvas (but not send clear command packet)
// Ask whether to save picture too
@@ -490,12 +354,12 @@
void yahoo_doodle_command_got_draw( GaimConnection *gc, char *from, char *message )
{
+ GaimAccount *account = gaim_connection_get_account( gc );
+
// Only handle this if local client requested Doodle session (else local client would have sent one)
- doodle_session *ds = yahoo_doodle_session_get( dsList,
- ( char* )( gaim_account_get_username( gc->account ) ),
- from );
+ GaimWhiteboard *wb = gaim_whiteboard_get( account, from );
- if( ds == NULL )
+ if( wb == NULL )
return;
g_print( "-----------------------------------------------\n" );
@@ -558,18 +422,18 @@
void yahoo_doodle_command_got_clear( GaimConnection *gc, char *from )
{
+ GaimAccount *account = gaim_connection_get_account( gc );
+
// Only handle this if local client requested Doodle session (else local client would have sent one)
- doodle_session *ds = yahoo_doodle_session_get( dsList,
- ( char* )( gaim_account_get_username( gc->account ) ),
- from );
+ GaimWhiteboard *wb = gaim_whiteboard_get( account, from );
g_print( "-----------------------------------------------\n" );
g_print( "Got CLEAR (%s)\n", from );
- if( ds == NULL )
+ if( wb == NULL )
return;
- if( ds->state == DOODLE_STATE_ESTABLISHED )
+ if( wb->state == DOODLE_STATE_ESTABLISHED )
{
// TODO Ask user whether to save the image before clearing it
@@ -597,22 +461,23 @@
void yahoo_doodle_command_got_confirm( GaimConnection *gc, char *from )
{
// Get the doodle session
- doodle_session *ds = yahoo_doodle_session_get( dsList,
- ( char* )( gaim_account_get_username( gc->account ) ),
- from );
+ GaimAccount *account = gaim_connection_get_account( gc );
+
+ // Only handle this if local client requested Doodle session (else local client would have sent one)
+ GaimWhiteboard *wb = gaim_whiteboard_get( account, from );
g_print( "-----------------------------------------------\n" );
g_print( "Got CONFIRM (%s)\n", from );
- if( ds == NULL )
+ if( wb == NULL )
return;
// TODO Combine the following IF's?
// Check if we requested a doodle session
- if( ds->state == DOODLE_STATE_REQUESTING )
+ if( wb->state == DOODLE_STATE_REQUESTING )
{
- ds->state = DOODLE_STATE_ESTABLISHED;
+ wb->state = DOODLE_STATE_ESTABLISHED;
// Check if this session wasn't already started before we start it (again?)
//if( ds->pixmap == NULL )
@@ -622,9 +487,9 @@
}
// Check if we accepted a request for a doodle session
- if( ds->state == DOODLE_STATE_REQUESTED )
+ if( wb->state == DOODLE_STATE_REQUESTED )
{
- ds->state = DOODLE_STATE_ESTABLISHED;
+ wb->state = DOODLE_STATE_ESTABLISHED;
// Check if this session wasn't already started before we start it (again?)
//if( ds->pixmap == NULL )
@@ -636,10 +501,10 @@
void yahoo_doodle_command_got_shutdown( GaimConnection *gc, char *from )
{
- // Get the doodle session
- doodle_session *ds = yahoo_doodle_session_get( dsList,
- ( char* )( gaim_account_get_username( gc->account ) ),
- from );
+ GaimAccount *account = gaim_connection_get_account( gc );
+
+ // Only handle this if local client requested Doodle session (else local client would have sent one)
+ GaimWhiteboard *wb = gaim_whiteboard_get( account, from );
g_print( "-----------------------------------------------\n" );
g_print( "Got SHUTDOWN (%s)\n", from );
@@ -647,7 +512,7 @@
// TODO Ask if user wants to save picture before the session is closed
// If this session doesn't exist, don't try and kill it
- if( ds == NULL )
+ if( wb == NULL )
return;
else
;//gtk_widget_destroy( ds->window );
@@ -667,17 +532,16 @@
// Make and send an acknowledge (ready) Doodle packet
pkt = yahoo_packet_new( YAHOO_SERVICE_P2PFILEXFER, YAHOO_STATUS_AVAILABLE, 0 );
- yahoo_packet_hash( pkt, 49, "IMVIRONMENT" );
- yahoo_packet_hash( pkt, 1, gaim_account_get_username( gc->account ) );
- yahoo_packet_hash( pkt, 14, "1" );
- yahoo_packet_hash( pkt, 13, "1" );
- yahoo_packet_hash( pkt, 5, to );
- yahoo_packet_hash( pkt, 63, "doodle;11" );
- yahoo_packet_hash( pkt, 64, "1" );
- yahoo_packet_hash( pkt, 1002, "1" );
- yahoo_packet_send( yd, pkt );
+ yahoo_packet_hash_str( pkt, 49, "IMVIRONMENT" );
+ yahoo_packet_hash_str( pkt, 1, gaim_account_get_username( gc->account ) );
+ yahoo_packet_hash_str( pkt, 14, "1" );
+ yahoo_packet_hash_str( pkt, 13, "1" );
+ yahoo_packet_hash_str( pkt, 5, to );
+ yahoo_packet_hash_str( pkt, 63, "doodle;11" );
+ yahoo_packet_hash_str( pkt, 64, "1" );
+ yahoo_packet_hash_str( pkt, 1002, "1" );
- yahoo_packet_free( pkt );
+ yahoo_packet_send_and_free( pkt, yd );
return( 0 );
}
@@ -696,17 +560,16 @@
// Make and send a request to start a Doodle session
pkt = yahoo_packet_new( YAHOO_SERVICE_P2PFILEXFER, YAHOO_STATUS_AVAILABLE, 0 );
- yahoo_packet_hash( pkt, 49, "IMVIRONMENT" );
- yahoo_packet_hash( pkt, 1, gaim_account_get_username( gc->account ) );
- yahoo_packet_hash( pkt, 14, "" );
- yahoo_packet_hash( pkt, 13, "0" );
- yahoo_packet_hash( pkt, 5, to );
- yahoo_packet_hash( pkt, 63, "doodle;11" );
- yahoo_packet_hash( pkt, 64, "0" );
- yahoo_packet_hash( pkt, 1002, "1" );
- yahoo_packet_send( yd, pkt );
+ yahoo_packet_hash_str( pkt, 49, "IMVIRONMENT" );
+ yahoo_packet_hash_str( pkt, 1, gaim_account_get_username( gc->account ) );
+ yahoo_packet_hash_str( pkt, 14, "" );
+ yahoo_packet_hash_str( pkt, 13, "0" );
+ yahoo_packet_hash_str( pkt, 5, to );
+ yahoo_packet_hash_str( pkt, 63, "doodle;11" );
+ yahoo_packet_hash_str( pkt, 64, "0" );
+ yahoo_packet_hash_str( pkt, 1002, "1" );
- yahoo_packet_free( pkt );
+ yahoo_packet_send_and_free( pkt, yd );
return( 0 );
}
@@ -725,17 +588,16 @@
// Make and send a drawing packet
pkt = yahoo_packet_new( YAHOO_SERVICE_P2PFILEXFER, YAHOO_STATUS_AVAILABLE, 0 );
- yahoo_packet_hash( pkt, 49, "IMVIRONMENT" );
- yahoo_packet_hash( pkt, 1, gaim_account_get_username( gc->account ) );
- yahoo_packet_hash( pkt, 14, message );
- yahoo_packet_hash( pkt, 13, "3" );
- yahoo_packet_hash( pkt, 5, to );
- yahoo_packet_hash( pkt, 63, "doodle;11" );
- yahoo_packet_hash( pkt, 64, "1" );
- yahoo_packet_hash( pkt, 1002, "1" );
- yahoo_packet_send( yd, pkt );
+ yahoo_packet_hash_str( pkt, 49, "IMVIRONMENT" );
+ yahoo_packet_hash_str( pkt, 1, gaim_account_get_username( gc->account ) );
+ yahoo_packet_hash_str( pkt, 14, message );
+ yahoo_packet_hash_str( pkt, 13, "3" );
+ yahoo_packet_hash_str( pkt, 5, to );
+ yahoo_packet_hash_str( pkt, 63, "doodle;11" );
+ yahoo_packet_hash_str( pkt, 64, "1" );
+ yahoo_packet_hash_str( pkt, 1002, "1" );
- yahoo_packet_free( pkt );
+ yahoo_packet_send_and_free( pkt, yd );
}
// ------------------------------------------------------------------------------------------------------
@@ -752,17 +614,16 @@
// Make and send a request to clear packet
pkt = yahoo_packet_new( YAHOO_SERVICE_P2PFILEXFER, YAHOO_STATUS_AVAILABLE, 0 );
- yahoo_packet_hash( pkt, 49, "IMVIRONMENT" );
- yahoo_packet_hash( pkt, 1, gaim_account_get_username( gc->account ) );
- yahoo_packet_hash( pkt, 14, " " );
- yahoo_packet_hash( pkt, 13, "2" );
- yahoo_packet_hash( pkt, 5, to );
- yahoo_packet_hash( pkt, 63, "doodle;11" );
- yahoo_packet_hash( pkt, 64, "1" );
- yahoo_packet_hash( pkt, 1002, "1" );
- yahoo_packet_send( yd, pkt );
+ yahoo_packet_hash_str( pkt, 49, "IMVIRONMENT" );
+ yahoo_packet_hash_str( pkt, 1, gaim_account_get_username( gc->account ) );
+ yahoo_packet_hash_str( pkt, 14, " " );
+ yahoo_packet_hash_str( pkt, 13, "2" );
+ yahoo_packet_hash_str( pkt, 5, to );
+ yahoo_packet_hash_str( pkt, 63, "doodle;11" );
+ yahoo_packet_hash_str( pkt, 64, "1" );
+ yahoo_packet_hash_str( pkt, 1002, "1" );
- yahoo_packet_free( pkt );
+ yahoo_packet_send_and_free( pkt, yd );
}
// ------------------------------------------------------------------------------------------------------
@@ -779,17 +640,16 @@
// Send out a request to use a specified 'extra' feature (message)
pkt = yahoo_packet_new( YAHOO_SERVICE_P2PFILEXFER, YAHOO_STATUS_AVAILABLE, 0 );
- yahoo_packet_hash( pkt, 49, "IMVIRONMENT" );
- yahoo_packet_hash( pkt, 1, gaim_account_get_username( gc->account ) );
- yahoo_packet_hash( pkt, 14, message );
- yahoo_packet_hash( pkt, 13, "4" );
- yahoo_packet_hash( pkt, 5, to );
- yahoo_packet_hash( pkt, 63, "doodle;11" );
- yahoo_packet_hash( pkt, 64, "1" );
- yahoo_packet_hash( pkt, 1002, "1" );
- yahoo_packet_send( yd, pkt );
-
- yahoo_packet_free( pkt );
+ yahoo_packet_hash_str( pkt, 49, "IMVIRONMENT" );
+ yahoo_packet_hash_str( pkt, 1, gaim_account_get_username( gc->account ) );
+ yahoo_packet_hash_str( pkt, 14, message );
+ yahoo_packet_hash_str( pkt, 13, "4" );
+ yahoo_packet_hash_str( pkt, 5, to );
+ yahoo_packet_hash_str( pkt, 63, "doodle;11" );
+ yahoo_packet_hash_str( pkt, 64, "1" );
+ yahoo_packet_hash_str( pkt, 1002, "1" );
+
+ yahoo_packet_send_and_free( pkt, yd );
}
// ------------------------------------------------------------------------------------------------------
@@ -806,17 +666,16 @@
// Send ready packet (that local client accepted and is ready)
pkt = yahoo_packet_new( YAHOO_SERVICE_P2PFILEXFER, YAHOO_STATUS_AVAILABLE, 0 );
- yahoo_packet_hash( pkt, 49, "IMVIRONMENT" );
- yahoo_packet_hash( pkt, 1, ( char* )( gaim_account_get_username( gc->account ) ) );
- yahoo_packet_hash( pkt, 14, "1" );
- yahoo_packet_hash( pkt, 13, "5" );
- yahoo_packet_hash( pkt, 5, to );
- yahoo_packet_hash( pkt, 63, "doodle;11" );
- yahoo_packet_hash( pkt, 64, "1" );
- yahoo_packet_hash( pkt, 1002, "1" );
- yahoo_packet_send( yd, pkt );
+ yahoo_packet_hash_str( pkt, 49, "IMVIRONMENT" );
+ yahoo_packet_hash_str( pkt, 1, ( char* )( gaim_account_get_username( gc->account ) ) );
+ yahoo_packet_hash_str( pkt, 14, "1" );
+ yahoo_packet_hash_str( pkt, 13, "5" );
+ yahoo_packet_hash_str( pkt, 5, to );
+ yahoo_packet_hash_str( pkt, 63, "doodle;11" );
+ yahoo_packet_hash_str( pkt, 64, "1" );
+ yahoo_packet_hash_str( pkt, 1002, "1" );
- yahoo_packet_free( pkt );
+ yahoo_packet_send_and_free( pkt, yd );
}
// ------------------------------------------------------------------------------------------------------
@@ -833,41 +692,16 @@
// Declare that you are ending the Doodle session
pkt = yahoo_packet_new( YAHOO_SERVICE_P2PFILEXFER, YAHOO_STATUS_AVAILABLE, 0 );
- yahoo_packet_hash( pkt, 49, "IMVIRONMENT" );
- yahoo_packet_hash( pkt, 1, gaim_account_get_username( gc->account ) );
- yahoo_packet_hash( pkt, 14, "" );
- yahoo_packet_hash( pkt, 13, "0" );
- yahoo_packet_hash( pkt, 5, to );
- yahoo_packet_hash( pkt, 63, ";0" );
- yahoo_packet_hash( pkt, 64, "0" );
- yahoo_packet_hash( pkt, 1002, "1" );
- yahoo_packet_send( yd, pkt );
+ yahoo_packet_hash_str( pkt, 49, "IMVIRONMENT" );
+ yahoo_packet_hash_str( pkt, 1, gaim_account_get_username( gc->account ) );
+ yahoo_packet_hash_str( pkt, 14, "" );
+ yahoo_packet_hash_str( pkt, 13, "0" );
+ yahoo_packet_hash_str( pkt, 5, to );
+ yahoo_packet_hash_str( pkt, 63, ";0" );
+ yahoo_packet_hash_str( pkt, 64, "0" );
+ yahoo_packet_hash_str( pkt, 1002, "1" );
- yahoo_packet_free( pkt );
-}
-
-// ------------------------------------------------------------------------------------------------------
-
-// Looks through a specified list of Doodle sessions for one that is between usernames 'me' and 'who'
-// Returns a pointer to a matching doodle_session; if none match, it returns NULL
-doodle_session *yahoo_doodle_session_get( GList *ds_list, char *me, char *who )
-{
- doodle_session *ds = NULL;
-
- GList *l = ds_list;
-
- // Look for a Doodle session between the local user and the remote user
- while( l )
- {
- ds = l->data;
-
- if( !strcmp( gaim_account_get_username( ds->gc->account ), me ) && !strcmp( ds->who, who ) )
- return( ds );
-
- l = l->next;
- }
-
- return( NULL );
+ yahoo_packet_send_and_free( pkt, yd );
}
// ------------------------------------------------------------------------------------------------------
@@ -924,12 +758,12 @@
gtk_widget_show( hbox_canvas_and_controls );
for( i = 0; i < PALETTE_NUM_OF_COLORS; i++ )
- {
+{
color_box[i] = gtk_label_new( NULL );
gtk_widget_set_size_request( color_box[i], DOODLE_CANVAS_WIDTH / PALETTE_NUM_OF_COLORS ,32 );
gtk_container_add( GTK_CONTAINER( hbox_palette ), color_box[i] );
gtk_widget_show( color_box[i] );
- }
+}
// Create the drawing area
drawing_area = gtk_drawing_area_new();
@@ -992,407 +826,6 @@
ds->brush_size = DOODLE_BRUSH_MEDIUM;
ds->brush_color = 0; // black
}
-*/
-// ------------------------------------------------------------------------------------------------------
-/*
-void goodle_doodle_session_end( GtkWidget *widget, gpointer data )
-{
- doodle_session *ds = ( doodle_session* )( data );
- GaimConnection *gc = ds->gc;
- GdkPixmap *pixmap = ds->pixmap;
-
- //g_print( "goodle_doodle_session_end | %s\n", ds->who );
-
- // TODO Ask if user wants to save picture before the session is closed
-
- if( ds == NULL ) // Fixes sessions with yourself?
- return;
-
- yahoo_doodle_command_send_shutdown( gc, ds->who );
-
- // Clear pixmap memory before we remove this session from the Doodle session list
- if( pixmap )
- g_object_unref( pixmap );
-
- dsList = g_list_remove( dsList, ds );
- ds = NULL;
-}
-
-// ------------------------------------------------------------------------------------------------------
-
-gboolean goodle_doodle_session_configure_event( GtkWidget *widget, GdkEventConfigure *event, gpointer data )
-{
- doodle_session *ds = ( doodle_session* )( data );
-
- GdkPixmap *pixmap = ds->pixmap;
-
- //g_print( "goodle_doodle_session_configure_event | %s\n", ds->who );
-
- if( pixmap )
- g_object_unref( pixmap );
-
- pixmap = gdk_pixmap_new( widget->window,
- widget->allocation.width,
- widget->allocation.height,
- -1 );
-
- ds->pixmap = pixmap;
-
- gdk_draw_rectangle( pixmap,
- widget->style->white_gc,
- TRUE,
- 0, 0,
- widget->allocation.width,
- widget->allocation.height );
-
- return( TRUE );
-}
-
-// ------------------------------------------------------------------------------------------------------
-
-gboolean goodle_doodle_session_expose_event( GtkWidget *widget, GdkEventExpose *event, gpointer data )
-{
- doodle_session *ds = ( doodle_session* )( data );
- GdkPixmap *pixmap = ds->pixmap;
-
- //g_print( "goodle_doodle_session_expose_event | %s\n", ds->who );
-
- gdk_draw_drawable( widget->window,
- widget->style->fg_gc[GTK_WIDGET_STATE( widget )],
- pixmap,
- event->area.x, event->area.y,
- event->area.x, event->area.y,
- event->area.width, event->area.height );
-
- return( FALSE );
-}
-
-// ------------------------------------------------------------------------------------------------------
-
-gboolean goodle_doodle_session_brush_down( GtkWidget *widget, GdkEventButton *event, gpointer data )
-{
- doodle_session *ds = ( doodle_session* )( data );
- GdkPixmap *pixmap = ds->pixmap;
-
- int *brush_color = NULL;
- int *brush_size = NULL;
- int *x0 = NULL;
- int *y0 = NULL;
-
- if( BrushState != BRUSH_STATE_UP )
- {
- // Potential double-click DOWN to DOWN?
-
- g_print( "***Bad brush state transition %d to DOWN\n", BrushState );
-
- BrushState = BRUSH_STATE_DOWN;
-
- //return( FALSE );
- }
-
- BrushState = BRUSH_STATE_DOWN;
-
- //g_print( "BRUSH_DOWN | %s\n", ds->who );
-
- if( event->button == 1 && pixmap != NULL )
- {
- // Check if drawList has contents; if so, clear it
- if( drawList )
- goodle_doodle_session_destroy_draw_list( drawList );
-
- brush_color = g_new0( int, 1 );
- brush_size = g_new0( int, 1 );
- x0 = g_new0( int, 1 );
- y0 = g_new0( int, 1 );
-
- *brush_color = ds->brush_color;
- *brush_size = ds->brush_size;
- *x0 = event->x;
- *y0 = event->y;
-
- // Set tracking variables
- LastX = *x0;
- LastY = *y0;
- MotionCount = 0;
-
- drawList = g_list_append( drawList, ( gpointer )( brush_color ) );
- drawList = g_list_append( drawList, ( gpointer )( brush_size ) );
- drawList = g_list_append( drawList, ( gpointer )( x0 ) );
- drawList = g_list_append( drawList, ( gpointer )( y0 ) );
-
- goodle_doodle_session_draw_brush_point( widget, ds,
- event->x, event->y,
- ds->brush_color, ds->brush_size );
- }
-
- return( TRUE );
-}
-
-// ------------------------------------------------------------------------------------------------------
-
-gboolean goodle_doodle_session_brush_motion( GtkWidget *widget, GdkEventMotion *event, gpointer data )
-{
- int x;
- int y;
- int *dx;
- int *dy;
- GdkModifierType state;
-
- doodle_session *ds = ( doodle_session* )( data );
- GdkPixmap *pixmap = ds->pixmap;
-
- //g_print( "BRUSH_MOTION | %s\n", ds->who );
-
- if( event->is_hint )
- gdk_window_get_pointer( event->window, &x, &y, &state );
- else
- {
- x = event->x;
- y = event->y;
- state = event->state;
- }
-
- if( state & GDK_BUTTON1_MASK && pixmap != NULL )
- {
- if( ( BrushState != BRUSH_STATE_DOWN ) && ( BrushState != BRUSH_STATE_MOTION ) )
- {
- g_print( "***Bad brush state transition %d to MOTION\n", BrushState );
-
- BrushState = BRUSH_STATE_MOTION;
-
- return( FALSE );
- }
- BrushState = BRUSH_STATE_MOTION;
-
- dx = g_new0( int, 1 );
- dy = g_new0( int, 1 );
-
- *dx = x - LastX;
- *dy = y - LastY;
-
- MotionCount++;
-
- if( MotionCount == DOODLE_MAX_BRUSH_MOTIONS )
- {
- drawList = g_list_append( drawList, ( gpointer )( dx ) );
- drawList = g_list_append( drawList, ( gpointer )( dy ) );
-
- char* message = goodle_doodle_session_build_draw_string( drawList );
-
- yahoo_doodle_command_send_draw( ds->gc, ds->who, message );
-
- // The brush stroke is finished, clear the list for another one
- goodle_doodle_session_destroy_draw_list( drawList );
-
- int *brush_color = g_new0( int, 1 );
- int *brush_size = g_new0( int, 1 );
- int *x0 = g_new0( int, 1 );
- int *y0 = g_new0( int, 1 );
-
- *brush_color = ds->brush_color;
- *brush_size = ds->brush_size;
- *x0 = LastX;
- *y0 = LastY;
-
- // Reset motion tracking
- MotionCount = 0;
-
- drawList = g_list_append( drawList, ( gpointer )( brush_color ) );
- drawList = g_list_append( drawList, ( gpointer )( brush_size ) );
- drawList = g_list_append( drawList, ( gpointer )( x0 ) );
- drawList = g_list_append( drawList, ( gpointer )( y0 ) );
- }
- //else
- {
- dx = g_new0( int, 1 );
- dy = g_new0( int, 1 );
-
- *dx = x - LastX;
- *dy = y - LastY;
-
- drawList = g_list_append( drawList, ( gpointer )( dx ) );
- drawList = g_list_append( drawList, ( gpointer )( dy ) );
- }
-
- goodle_doodle_session_draw_brush_line( ds->drawing_area, ds,
- LastX, LastY,
- x, y,
- ds->brush_color, ds->brush_size );
-
- // Set tracking variables
- LastX = x;
- LastY = y;
- }
-
- return( TRUE );
-}
-
-// ------------------------------------------------------------------------------------------------------
-
-gboolean goodle_doodle_session_brush_up( GtkWidget *widget, GdkEventButton *event, gpointer data )
-{
- doodle_session *ds = ( doodle_session* )( data );
- GdkPixmap *pixmap = ds->pixmap;
-
- //g_print( "BRUSH_UP | %s\n", ds->who );
-
- if( ( BrushState != BRUSH_STATE_DOWN ) && ( BrushState != BRUSH_STATE_MOTION ) )
- {
- g_print( "***Bad brush state transition %d to UP\n", BrushState );
-
- BrushState = BRUSH_STATE_UP;
-
- return( FALSE );
- }
- BrushState = BRUSH_STATE_UP;
-
- if( event->button == 1 && pixmap != NULL )
- {
- // If the brush was never moved, express two sets of two deltas
- // That's a 'point,' but not for Yahoo!
- //if( ( event->x == LastX ) && ( event->y == LastY ) )
- if( MotionCount == 0 )
- {
- int index;
-
- for( index = 0; index < 2; index++ )
- {
- int *x0 = NULL;
- int *y0 = NULL;
-
- x0 = g_new0( int, 1 );
- y0 = g_new0( int, 1 );
-
- drawList = g_list_append( drawList, ( gpointer )( x0 ) );
- drawList = g_list_append( drawList, ( gpointer )( y0 ) );
- }
- }
- //else
- // MotionCount = 0;
-
- char* message = goodle_doodle_session_build_draw_string( drawList );
-
- yahoo_doodle_command_send_draw( ds->gc, ds->who, message );
- goodle_doodle_session_set_canvas_as_icon( ds );
-
- // The brush stroke is finished, clear the list for another one
- goodle_doodle_session_destroy_draw_list( drawList );
- }
-
- return( TRUE );
-}
-
-// ------------------------------------------------------------------------------------------------------
-
-void goodle_doodle_session_draw_brush_point( GtkWidget *widget, doodle_session *ds,
- int x, int y, int color, int size )
-{
- GdkPixmap *pixmap = ds->pixmap;
-
- //g_print( "goodle_doodle_session_draw_brush | %s\n", ds->who );
-
- GdkRectangle update_rect;
-
- update_rect.x = x - size / 2;
- update_rect.y = y - size / 2;
- update_rect.width = size;
- update_rect.height = size;
-
- // Interpret and convert color
- GdkGC *gfx_con = gdk_gc_new( pixmap );
- GdkColor col;
-
- goodle_rgb24_to_rgb48( color, &col );
-
- gdk_gc_set_rgb_fg_color( gfx_con, &col );
- //gdk_gc_set_rgb_bg_color( gfx_con, &col );
-
- if( size < DOODLE_BRUSH_MEDIUM )
- {
- // Draw a rectangle/square
- gdk_draw_rectangle( pixmap,
- gfx_con, // color element?
- TRUE,
- update_rect.x, update_rect.y,
- update_rect.width, update_rect.height );
- }
- else
- {
- // Draw a circle
- gdk_draw_arc( pixmap,
- gfx_con,
- TRUE,
- update_rect.x, update_rect.y,
- update_rect.width, update_rect.height,
- 0, FULL_CIRCLE_DEGREES );
- }
-
- gtk_widget_queue_draw_area( widget,
- update_rect.x, update_rect.y,
- update_rect.width, update_rect.height );
-
- gdk_gc_unref( gfx_con );
-}
-
-// ------------------------------------------------------------------------------------------------------
-
-void goodle_doodle_session_draw_brush_line( GtkWidget *widget, doodle_session *ds,
- int x0, int y0, int x1, int y1, int color, int size )
-{
- int temp;
-
- int xstep;
- int ystep;
-
- gboolean steep = abs( y1 - y0 ) > abs( x1 - x0 );
-
- if( steep )
- {
- temp = x0; x0 = y0; y0 = temp;
- temp = x1; x1 = y1; y1 = temp;
- }
-
- int dx = abs( x1 - x0 );
- int dy = abs( y1 - y0 );
-
- int error = 0;
- int derror = dy;
-
- int x = x0;
- int y = y0;
-
- if( x0 < x1 )
- xstep = 1;
- else
- xstep = -1;
-
- if( y0 < y1 )
- ystep = 1;
- else
- ystep = -1;
-
- if( steep )
- goodle_doodle_session_draw_brush_point( widget, ds, y, x, color, size );
- else
- goodle_doodle_session_draw_brush_point( widget, ds, x, y, color, size );
-
- while( x != x1 )
- {
- x = x + xstep;
- error = error + derror;
-
- if( ( error * 2 ) >= dx )
- {
- y = y + ystep;
- error = error - dx;
- }
-
- if( steep )
- goodle_doodle_session_draw_brush_point( widget, ds, y, x, color, size );
- else
- goodle_doodle_session_draw_brush_point( widget, ds, x, y, color, size );
- }
-}
// ------------------------------------------------------------------------------------------------------
@@ -1441,26 +874,6 @@
// ------------------------------------------------------------------------------------------------------
-void goodle_doodle_session_destroy_draw_list( GList *d_list )
-{
- // Destroy the contents of this list
- int *n = NULL;
- GList *l = drawList;
- while( l )
- {
- n = l->data;
-
- g_free( n );
-
- l = l->next;
- }
-
- g_list_free( drawList );
- drawList = NULL;
-}
-
-// ------------------------------------------------------------------------------------------------------
-
char *goodle_doodle_session_build_draw_string( GList *d_list )
{
GList *l = d_list;
@@ -1499,24 +912,6 @@
// ------------------------------------------------------------------------------------------------------
-void goodle_doodle_session_clear_canvas( doodle_session *ds )
-{
- GdkPixmap *pixmap = ds->pixmap;
- GtkWidget *drawing_area = ds->drawing_area;
-
- gdk_draw_rectangle( pixmap,
- drawing_area->style->white_gc,
- TRUE,
- 0, 0,
- drawing_area->allocation.width, drawing_area->allocation.height );
-
- gtk_widget_queue_draw_area( drawing_area,
- 0, 0,
- drawing_area->allocation.width, drawing_area->allocation.height );
-}
-
-// ------------------------------------------------------------------------------------------------------
-
void goodle_doodle_session_button_clear_press( GtkWidget *widget, gpointer data )
{
doodle_session *ds = ( doodle_session* )( data );
@@ -1530,29 +925,5 @@
// ------------------------------------------------------------------------------------------------------
-void goodle_doodle_session_set_canvas_as_icon( doodle_session *ds )
-{
- GdkPixbuf *pixbuf;
-
- // Makes an icon from the doodle image
- pixbuf = gdk_pixbuf_get_from_drawable( NULL,
- ( GdkDrawable* )( ds->pixmap ),
- gdk_drawable_get_colormap( ds->pixmap ),
- 0, 0,
- 0, 0,
- DOODLE_CANVAS_WIDTH, DOODLE_CANVAS_HEIGHT );
-
- gtk_window_set_icon( ( GtkWindow* )( ds->window ), pixbuf );
-}
-// ------------------------------------------------------------------------------------------------------
-
-void goodle_rgb24_to_rgb48( int color_rgb, GdkColor *color )
-{
- color->red = ( color_rgb >> 8 ) | 0xFF;
- color->green = ( color_rgb & 0xFF00 ) | 0xFF;
- color->blue = ( ( color_rgb & 0xFF ) << 8 ) | 0xFF;
-}
-
-// ------------------------------------------------------------------------------------------------------
*/
--- a/src/protocols/yahoo/yahoo_doodle.h Wed Jul 13 22:02:56 2005 -0400
+++ b/src/protocols/yahoo/yahoo_doodle.h Tue Jul 19 23:14:35 2005 -0400
@@ -22,10 +22,10 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-// DEFINES =============================================================================================
+#ifndef _YAHOO_DOODLE_H_
+#define _YAHOO_DOODLE_H_
-#ifndef YAHOO_DOODLE_H
-#define YAHOO_DOODLE_H
+// DEFINES =============================================================================================
// Doodle communication commands
#define DOODLE_CMD_REQUEST 0
@@ -75,45 +75,27 @@
#define DOODLE_MAX_BRUSH_MOTIONS 100
-#define FULL_CIRCLE_DEGREES 23040
-
-#define BRUSH_STATE_UP 0
-#define BRUSH_STATE_DOWN 1
-#define BRUSH_STATE_MOTION 2
-
// DATATYPES ===========================================================================================
typedef struct _doodle_session
{
- int state; // State of Doodle session
-
- GaimConnection *gc; // Connection associated with this session
-
- char who[32]; // Name of the remote user
-
int brush_size; // Size of drawing brush
int brush_color; // Color of drawing brush
-
- //GtkWidget *window; // Window for the Doodle session
- //GtkWidget *drawing_area; // Drawing area
-
- //GdkPixmap *pixmap; // Memory for drawing area
} doodle_session;
// PROTOTYPES ==========================================================================================
+
/*
void init_plugin( GaimPlugin *plugin );
gboolean goodle_load( GaimPlugin *plugin );
gboolean goodle_unload( GaimPlugin *plugin );
void goodle_destroy( GaimPlugin *plugin ); // void or gboolean?
-GtkWidget *get_config_frame( GaimPlugin *plugin );
void goodle_con_signed_on( GaimConnection *gc, gpointer data );
void goodle_con_signed_off( GaimConnection *gc, gpointer data );
void goodle_conv_created( GaimConversation *conv, gpointer data );
void goodle_conv_destroyed( GaimConversation *conv, gpointer data );
-void goodle_button_press( GtkButton *button, gpointer data );
+*/
-*/
void yahoo_doodle_process( GaimConnection *gc, char *me, char *from, char *command, char *message );
void yahoo_doodle_command_got_request( GaimConnection *gc, char *from );
@@ -132,31 +114,11 @@
void yahoo_doodle_command_send_confirm( GaimConnection *gc, char *to );
void yahoo_doodle_command_send_shutdown( GaimConnection *gc, char *to );
-doodle_session *yahoo_doodle_session_get( GList *ds_list, char *me, char *who );
-//void goodle_doodle_session_start( doodle_session *ds );
-//void goodle_doodle_session_end( GtkWidget *widget, gpointer data );
-
/*
-gboolean goodle_doodle_session_configure_event( GtkWidget *widget, GdkEventConfigure *event, gpointer data );
-gboolean goodle_doodle_session_expose_event( GtkWidget *widget, GdkEventExpose *event, gpointer data );
-gboolean goodle_doodle_session_brush_down( GtkWidget *widget, GdkEventButton *event, gpointer data );
-gboolean goodle_doodle_session_brush_motion( GtkWidget *widget, GdkEventMotion *event, gpointer data );
-gboolean goodle_doodle_session_brush_up( GtkWidget *widget, GdkEventButton *event, gpointer data );
+void goodle_doodle_session_start( doodle_session *ds );
-void goodle_doodle_session_draw_brush_point( GtkWidget *widget, doodle_session *ds,
- int x, int y, int color, int size );
-void goodle_doodle_session_draw_brush_line( GtkWidget *widget, doodle_session *ds,
- int x0, int y0, int x1, int y1, int color, int size );
void goodle_doodle_draw_stroke( doodle_session *ds, GList *d_list );
-void goodle_doodle_session_destroy_draw_list( GList *d_list );
char *goodle_doodle_session_build_draw_string( GList *d_list );
-void goodle_doodle_session_clear_canvas( doodle_session *ds );
-
-void goodle_doodle_session_button_clear_press( GtkWidget *widget, gpointer data );
-
-void goodle_doodle_session_set_canvas_as_icon( doodle_session *ds );
-
-void goodle_rgb24_to_rgb48( int color_rgb, GdkColor *color );
*/
-#endif // YAHOO_DOODLE_H
+#endif // _YAHOO_DOODLE_H_
--- a/src/whiteboard.c Wed Jul 13 22:02:56 2005 -0400
+++ b/src/whiteboard.c Tue Jul 19 23:14:35 2005 -0400
@@ -24,13 +24,98 @@
// INCLUDES =============================================================================================
#include "whiteboard.h"
-/*
+
// DATATYPES ============================================================================================
//static GaimWhiteboardOps *ui_ops = NULL;
+// GLOBALS ==============================================================================================
+
+static GList *wbList = NULL;
+
+gboolean auto_accept = TRUE;
+
// FUNCTIONS ============================================================================================
+GaimWhiteboard *gaim_whiteboard_create( GaimAccount *account, char *who, int state )
+{
+ GaimWhiteboard *wb = g_new0( GaimWhiteboard, 1 );
+
+ wb->account = account;
+
+ wb->who = g_new0( char, strlen( who ) + 1 );
+ strcpy( wb->who, who );
+
+ wb->state = state;
+
+ wbList = g_list_append( wbList, ( gpointer )( wb ) );
+
+ return( wb );
+}
+
+// ------------------------------------------------------------------------------------------------------
+
+void gaim_whiteboard_destroy( GaimWhiteboard *wb )
+{
+ wbList = g_list_remove( wbList, wb );
+
+ wb->account = NULL;
+
+ g_free( wb->who );
+
+ wb->state = 0;
+
+ g_free( wb );
+}
+
+// ------------------------------------------------------------------------------------------------------
+
+// Looks through the list of whiteboard sessions for one that is between usernames 'me' and 'who'
+// Returns a pointer to a matching whiteboard session; if none match, it returns NULL
+GaimWhiteboard *gaim_whiteboard_get( GaimAccount *account, char *who )
+{
+ GaimWhiteboard *wb = NULL;
+
+ GList *l = wbList;
+
+ // Look for a whiteboard session between the local user and the remote user
+ while( l )
+ {
+ wb = l->data;
+
+ if( !strcmp( gaim_account_get_username( wb->account ), gaim_account_get_username( account ) ) &&
+ !strcmp( wb->who, who ) )
+ return( wb );
+
+ l = l->next;
+ }
+
+ return( NULL );
+}
+
+// ------------------------------------------------------------------------------------------------------
+
+void gaim_whiteboard_draw_list_destroy( GList *d_list )
+{
+ // Destroy the contents of this list
+ int *n = NULL;
+ GList *l = d_list;
+ while( l )
+ {
+ n = l->data;
+
+ g_free( n );
+
+ l = l->next;
+ }
+
+ g_list_free( d_list );
+ d_list = NULL;
+}
+
+// ------------------------------------------------------------------------------------------------------
+
+/*
void gaim_whiteboard_draw_line( GaimWhiteBoard *board, int x1, int y1, int x2, int y2 )
{
if( ui_ops && ui_ops->draw_line )
@@ -45,4 +130,4 @@
}
// ------------------------------------------------------------------------------------------------------
-*/
\ No newline at end of file
+*/
--- a/src/whiteboard.h Wed Jul 13 22:02:56 2005 -0400
+++ b/src/whiteboard.h Tue Jul 19 23:14:35 2005 -0400
@@ -22,30 +22,46 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-// DEFINES =============================================================================================
-
#ifndef _GAIM_WHITEBOARD_H_
#define _GAIM_WHITEBOARD_H_
+// DEFINES =============================================================================================
+#include "internal.h"
+
+#include "account.h"
+
// INCLUDES ============================================================================================
-/*
-#include <glib.h>
// DATATYPES ===========================================================================================
-
typedef struct _GaimWhiteboard
{
- int dummy; // remove this when more apporiate stuff is added
+ int state; // State of whiteboard session
+
+ GaimAccount *account; // Account associated with this session
+
+ char *who; // Name of the remote user
+
+ void *proto_data; // Protocol specific data
+ //void *gui_data; // Graphical user-interface data
+
+ GList *draw_list; // List of drawing elements/deltas to send
} GaimWhiteboard;
+/*
typedef struct _GaimWhiteBoardOps
{
- void ( *draw_line )( GaimWhiteboard *board, int x1, int y1, int x2, int y2 );
+ void ( *draw_line )( GaimWhiteboard *wb, int x1, int y1, int x2, int y2 );
} GaimWhiteBoardOps;
-
+*/
// PROTOTYPES ==========================================================================================
-void gaim_whiteboard_draw_line( GaimWhiteboard *board, int x1, int y1, int x2, int y2 );
-void gaim_whiteboard_set_ops( GaimWhiteboardOps *ops );
-*/
+GaimWhiteboard *gaim_whiteboard_create( GaimAccount *account, char *who, int state );
+void gaim_whiteboard_destroy( GaimWhiteboard *wb );
+GaimWhiteboard *gaim_whiteboard_get( GaimAccount *account, char *who );
+
+void gaim_whiteboard_draw_list_destroy( GList *d_list );
+
+//void gaim_whiteboard_draw_line( GaimWhiteboard *wb, int x1, int y1, int x2, int y2 );
+//void gaim_whiteboard_set_ops( GaimWhiteboardOps *ops );
+
#endif // _GAIM_WHITEBOARD_H_
Binary file src/whiteboard.o has changed