/pidgin/main: 310c7590b36f: Opdaterede igen
Nicky Thomassen
nicky at aptget.dk
Wed Feb 12 15:42:30 EST 2014
Changeset: 310c7590b36f95fd64ff0b3367a0a91bba46b073
Author: Nicky Thomassen <nicky at aptget.dk>
Date: 2014-02-12 21:36 +0100
Branch: default
URL: https://hg.pidgin.im/pidgin/main/rev/310c7590b36f
Description:
Opdaterede igen
diffstat:
pidgin/gtkwhiteboard.c | 107 +++++++++++++++++++++++++-----------------------
pidgin/gtkwhiteboard.h | 45 +--------------------
2 files changed, 57 insertions(+), 95 deletions(-)
diffs (243 lines):
diff --git a/pidgin/gtkwhiteboard.c b/pidgin/gtkwhiteboard.c
--- a/pidgin/gtkwhiteboard.c
+++ b/pidgin/gtkwhiteboard.c
@@ -25,16 +25,54 @@
#include "buddylist.h"
#include "debug.h"
#include "pidgin.h"
+#include "whiteboard.h"
#include "gtk3compat.h"
#include "gtkwhiteboard.h"
#include "gtkutils.h"
+typedef enum {
+ PIDGIN_WHITEBOARD_BRUSH_UP,
+ PIDGIN_WHITEBOARD_BRUSH_DOWN,
+ PIDGIN_WHITEBOARD_BRUSH_MOTION
+} PidginWhiteboardBrushState;
+
+typedef struct _PidginWhiteboard PidginWhiteboard;
+typedef struct _PidginWhiteboardPrivate PidginWhiteboardPrivate;
+
struct _PidginWhiteboardPrivate {
cairo_t *cr;
cairo_surface_t *surface;
};
+/**
+ * PidginWhiteboard:
+ * @priv: Internal data
+ * @wb: Backend data for this whiteboard
+ * @window: Window for the Doodle session
+ * @drawing_area: Drawing area
+ * @width: Canvas width
+ * @height: Canvas height
+ * @brush_color: Foreground color
+ * @brush_size: Brush size
+ *
+ * A PidginWhiteboard
+ */
+struct _PidginWhiteboard
+{
+ PidginWhiteboardPrivate *priv;
+
+ PurpleWhiteboard *wb;
+
+ GtkWidget *window;
+ GtkWidget *drawing_area;
+
+ int width;
+ int height;
+ int brush_color;
+ int brush_size;
+};
+
/******************************************************************************
* Prototypes
*****************************************************************************/
@@ -80,15 +118,11 @@ static void color_select_dialog(GtkWidge
/******************************************************************************
* Globals
*****************************************************************************/
-/*
-GList *buttonList = NULL;
-GdkColor DefaultColor[PIDGIN_PALETTE_NUM_COLORS];
-*/
static int LastX; /* Tracks last position of the mouse when drawing */
static int LastY;
static int MotionCount; /* Tracks how many brush motions made */
-static int BrushState = PIDGIN_BRUSH_STATE_UP;
+static PidginWhiteboardBrushState brush_state = PIDGIN_WHITEBOARD_BRUSH_UP;
static PurpleWhiteboardUiOps ui_ops =
{
@@ -169,40 +203,6 @@ static void pidgin_whiteboard_create(Pur
g_signal_connect(G_OBJECT(window), "delete_event",
G_CALLBACK(whiteboard_close_cb), gtkwb);
-#if 0
- int i;
-
- GtkWidget *hbox_palette;
- GtkWidget *vbox_palette_above_canvas_and_controls;
- GtkWidget *palette_color_box[PIDGIN_PALETTE_NUM_COLORS];
-
- /* Create vertical box to place palette above the canvas and controls */
- vbox_palette_above_canvas_and_controls = gtk_box_new(GTK_ORIENTATION_VERTICAL, 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_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_box_pack_start(GTK_BOX(vbox_palette_above_canvas_and_controls),
- hbox_palette, FALSE, FALSE, PIDGIN_HIG_BORDER);
- gtk_widget_show(hbox_palette);
-
- /* Create horizontal box to seperate the canvas from the controls */
- hbox_canvas_and_controls = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_box_pack_start(GTK_BOX(vbox_palette_above_canvas_and_controls),
- hbox_canvas_and_controls, FALSE, FALSE, PIDGIN_HIG_BORDER);
- gtk_widget_show(hbox_canvas_and_controls);
-
- for(i = 0; i < PIDGIN_PALETTE_NUM_COLORS; i++)
- {
- palette_color_box[i] = gtk_image_new_from_pixbuf(NULL);
- gtk_widget_set_size_request(palette_color_box[i], gtkwb->width / PIDGIN_PALETTE_NUM_COLORS ,32);
- gtk_container_add(GTK_CONTAINER(hbox_palette), palette_color_box[i]);
-
- gtk_widget_show(palette_color_box[i]);
- }
-#endif
-
hbox_canvas_and_controls = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_show(hbox_canvas_and_controls);
@@ -437,15 +437,14 @@ static gboolean pidgin_whiteboard_brush_
PurpleWhiteboard *wb = gtkwb->wb;
GList *draw_list = purple_whiteboard_get_draw_list(wb);
- if(BrushState != PIDGIN_BRUSH_STATE_UP)
- {
+ if (brush_state != PIDGIN_WHITEBOARD_BRUSH_UP) {
/* Potential double-click DOWN to DOWN? */
- BrushState = PIDGIN_BRUSH_STATE_DOWN;
+ brush_state = PIDGIN_WHITEBOARD_BRUSH_DOWN;
/* return FALSE; */
}
- BrushState = PIDGIN_BRUSH_STATE_DOWN;
+ brush_state = PIDGIN_WHITEBOARD_BRUSH_DOWN;
if(event->button == 1 && gtkwb->priv->cr != NULL)
{
@@ -505,15 +504,18 @@ static gboolean pidgin_whiteboard_brush_
if(state & GDK_BUTTON1_MASK && gtkwb->priv->cr != NULL)
{
- if((BrushState != PIDGIN_BRUSH_STATE_DOWN) && (BrushState != PIDGIN_BRUSH_STATE_MOTION))
+ if ((brush_state != PIDGIN_WHITEBOARD_BRUSH_DOWN) &&
+ (brush_state != PIDGIN_WHITEBOARD_BRUSH_MOTION))
{
- purple_debug_error("gtkwhiteboard", "***Bad brush state transition %d to MOTION\n", BrushState);
+ purple_debug_error("gtkwhiteboard",
+ "***Bad brush state transition %d to MOTION\n",
+ brush_state);
- BrushState = PIDGIN_BRUSH_STATE_MOTION;
+ brush_state = PIDGIN_WHITEBOARD_BRUSH_MOTION;
return FALSE;
}
- BrushState = PIDGIN_BRUSH_STATE_MOTION;
+ brush_state = PIDGIN_WHITEBOARD_BRUSH_MOTION;
dx = x - LastX;
dy = y - LastY;
@@ -573,15 +575,18 @@ static gboolean pidgin_whiteboard_brush_
PurpleWhiteboard *wb = gtkwb->wb;
GList *draw_list = purple_whiteboard_get_draw_list(wb);
- if((BrushState != PIDGIN_BRUSH_STATE_DOWN) && (BrushState != PIDGIN_BRUSH_STATE_MOTION))
+ if ((brush_state != PIDGIN_WHITEBOARD_BRUSH_DOWN) &&
+ (brush_state != PIDGIN_WHITEBOARD_BRUSH_MOTION))
{
- purple_debug_error("gtkwhiteboard", "***Bad brush state transition %d to UP\n", BrushState);
+ purple_debug_error("gtkwhiteboard",
+ "***Bad brush state transition %d to UP\n",
+ brush_state);
- BrushState = PIDGIN_BRUSH_STATE_UP;
+ brush_state = PIDGIN_WHITEBOARD_BRUSH_UP;
return FALSE;
}
- BrushState = PIDGIN_BRUSH_STATE_UP;
+ brush_state = PIDGIN_WHITEBOARD_BRUSH_UP;
if(event->button == 1 && gtkwb->priv->cr != NULL)
{
diff --git a/pidgin/gtkwhiteboard.h b/pidgin/gtkwhiteboard.h
--- a/pidgin/gtkwhiteboard.h
+++ b/pidgin/gtkwhiteboard.h
@@ -30,49 +30,6 @@
#include "pidgin.h"
-#include "whiteboard.h"
-
-#define PIDGIN_FULL_CIRCLE_DEGREES 23040
-
-/* TODO: Make into an enum. */
-#define PIDGIN_BRUSH_STATE_UP 0
-#define PIDGIN_BRUSH_STATE_DOWN 1
-#define PIDGIN_BRUSH_STATE_MOTION 2
-
-/* XXX: This seems duplicated with the Yahoo! Doodle protocol code.
- * XXX: How should they work together? */
-#define PIDGIN_PALETTE_NUM_COLORS 7
-
-typedef struct _PidginWhiteboardPrivate PidginWhiteboardPrivate;
-
-/**
- * PidginWhiteboard:
- * @priv: Internal data
- * @wb: Backend data for this whiteboard
- * @window: Window for the Doodle session
- * @drawing_area: Drawing area
- * @width: Canvas width
- * @height: Canvas height
- * @brush_color: Foreground color
- * @brush_size: Brush size
- *
- * A PidginWhiteboard
- */
-typedef struct _PidginWhiteboard
-{
- PidginWhiteboardPrivate *priv;
-
- PurpleWhiteboard *wb;
-
- GtkWidget *window;
- GtkWidget *drawing_area;
-
- int width;
- int height;
- int brush_color;
- int brush_size;
-} PidginWhiteboard;
-
G_BEGIN_DECLS
/*****************************************************************************/
@@ -86,7 +43,7 @@ G_BEGIN_DECLS
*
* Returns: The GtkWhiteboard UI Operations.
*/
-PurpleWhiteboardUiOps *pidgin_whiteboard_get_ui_ops( void );
+PurpleWhiteboardUiOps *pidgin_whiteboard_get_ui_ops(void);
G_END_DECLS
More information about the Commits
mailing list