Recognizes if input is ogg or not.
[xiph/unicode.git] / planarity / gameboard_draw_selection.c
blob4464817f2e737a9d2f22bd9309ff3713321ed166
1 /*
3 * gPlanarity:
4 * The geeky little puzzle game with a big noodly crunch!
5 *
6 * gPlanarity copyright (C) 2005 Monty <monty@xiph.org>
7 * Original Flash game by John Tantalo <john.tantalo@case.edu>
8 * Original game concept by Mary Radcliffe
10 * gPlanarity is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2, or (at your option)
13 * any later version.
15 * gPlanarity is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with Postfish; see the file COPYING. If not, write to the
22 * Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
27 #define _GNU_SOURCE
28 #include <gtk/gtk.h>
29 #include <gtk/gtkmain.h>
30 #include <gdk/gdk.h>
31 #include <gdk/gdkx.h>
32 #include <stdlib.h>
33 #include <math.h>
34 #include <string.h>
36 #include "graph.h"
37 #include "gameboard.h"
40 // draw selection box
41 void draw_selection_rectangle(Gameboard *g,cairo_t *c){
42 cairo_set_source_rgba(c,SELECTBOX_COLOR);
43 cairo_rectangle(c,g->selectionx,
44 g->selectiony,
45 g->selectionw,
46 g->selectionh);
47 cairo_fill(c);
50 // invalidate the selection box plus enough area to catch any verticies
51 void invalidate_selection(GtkWidget *widget){
52 Gameboard *g = GAMEBOARD (widget);
53 GdkRectangle r;
54 r.x = g->selectionx - (V_RADIUS + V_LINE)*2;
55 r.y = g->selectiony - (V_RADIUS + V_LINE)*2;
56 r.width = g->selectionw + (V_RADIUS + V_LINE)*4;
57 r.height = g->selectionh + (V_RADIUS + V_LINE)*4;
59 gdk_window_invalidate_rect (widget->window, &r, FALSE);
62 // invalidate the selection box plus enough area to catch any verticies
63 void invalidate_verticies_selection(GtkWidget *widget){
64 Gameboard *g = GAMEBOARD (widget);
65 vertex *v=g->g.verticies;
66 while(v){
67 if(v->selected){
68 invalidate_vertex_off(widget,v,g->dragx,g->dragy);
69 invalidate_edges(widget,v,g->dragx,g->dragy);
71 v=v->next;