navit  0.5.3-trunk
graphics_gtk_drawing_area.c File Reference
#include "config.h"
#include <stdlib.h>
#include <signal.h>
#include <sys/time.h>
#include <math.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include <cairo.h>
#include <locale.h>
#include <X11/XF86keysym.h>
#include <gdk/gdkx.h>
#include "event.h"
#include "debug.h"
#include "point.h"
#include "graphics.h"
#include "color.h"
#include "item.h"
#include "window.h"
#include "callback.h"
#include "keys.h"
#include "plugin.h"
#include "navit/font/freetype/font_freetype.h"
#include "navit.h"
#include <errno.h>

Data Structures

struct  graphics_priv
 
struct  graphics_gc_priv
 
struct  graphics_image_priv
 

Macros

#define GDK_ENABLE_BROKEN
 
#define GDK_KEY_Book   XF86XK_Book
 
#define GDK_KEY_Calendar   XF86XK_Calendar
 

Functions

static void set_drawing_color (cairo_t *cairo, struct color c)
 
static void graphics_destroy (struct graphics_priv *gr)
 
static void gc_destroy (struct graphics_gc_priv *gc)
 
static void gc_set_linewidth (struct graphics_gc_priv *gc, int w)
 
static void gc_set_dashes (struct graphics_gc_priv *gc, int w, int offset, unsigned char *dash_list, int n)
 
static void gc_set_foreground (struct graphics_gc_priv *gc, struct color *c)
 
static void gc_set_background (struct graphics_gc_priv *gc, struct color *c)
 
static void gc_set_texture (struct graphics_gc_priv *gc, struct graphics_image_priv *img)
 
static struct graphics_gc_privgc_new (struct graphics_priv *gr, struct graphics_gc_methods *meth)
 
static struct graphics_image_privimage_new (struct graphics_priv *gr, struct graphics_image_methods *meth, char *name, int *w, int *h, struct point *hot, int rotation)
 
static void image_free (struct graphics_priv *gr, struct graphics_image_priv *priv)
 
static void set_stroke_params_from_gc (cairo_t *cairo, struct graphics_gc_priv *gc)
 
static void draw_lines (struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count)
 
static void draw_polygon (struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count)
 
static void draw_polygon_with_holes (struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count, int hole_count, int *ccount, struct point **holes)
 
static void draw_rectangle (struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int w, int h)
 
static void draw_circle (struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int r)
 
static void draw_rgb_image_buffer (cairo_t *cairo, int buffer_width, int buffer_height, int draw_pos_x, int draw_pos_y, int stride, unsigned char *buffer)
 
static void display_text_draw (struct font_freetype_text *text, struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, struct point *p)
 
static void draw_text (struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, struct graphics_font_priv *font, char *text, struct point *p, int dx, int dy)
 
static void draw_image (struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, struct graphics_image_priv *img)
 
static void overlay_rect (struct graphics_priv *parent, struct graphics_priv *overlay, GdkRectangle *r)
 
static void overlay_draw (struct graphics_priv *parent, struct graphics_priv *overlay, GdkRectangle *re, cairo_t *cairo)
 
static void draw_drag (struct graphics_priv *gr, struct point *p)
 
static void background_gc (struct graphics_priv *gr, struct graphics_gc_priv *gc)
 
static void draw_mode (struct graphics_priv *gr, enum draw_mode_num mode)
 
static gint configure (GtkWidget *widget, GdkEventConfigure *event, gpointer user_data)
 
static gint expose (GtkWidget *widget, GdkEventExpose *event, gpointer user_data)
 
static int tv_delta (struct timeval *old, struct timeval *new)
 
static gint button_press (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
 
static gint button_release (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
 
static gint scroll (GtkWidget *widget, GdkEventScroll *event, gpointer user_data)
 
static gint motion_notify (GtkWidget *widget, GdkEventMotion *event, gpointer user_data)
 
static gint delete (GtkWidget *widget, GdkEventKey *event, gpointer user_data)
 
static gint keypress (GtkWidget *widget, GdkEventKey *event, gpointer user_data)
 
static struct graphics_privgraphics_gtk_drawing_area_new_helper (struct graphics_methods *meth)
 
static void overlay_disable (struct graphics_priv *gr, int disabled)
 
static void overlay_resize (struct graphics_priv *this, struct point *p, int w, int h, int wraparound)
 
static void get_data_window (struct graphics_priv *this, unsigned int xid)
 
static int set_attr (struct graphics_priv *gr, struct attr *attr)
 
static struct graphics_privoverlay_new (struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h, int wraparound)
 
static int graphics_gtk_drawing_area_fullscreen (struct window *w, int on)
 
static void graphics_gtk_drawing_area_disable_suspend (struct window *w)
 
static void * get_data (struct graphics_priv *this, char const *type)
 
static navit_float get_dpi (struct graphics_priv *gr)
 Return number of dots per inch. More...
 
static struct graphics_privgraphics_gtk_drawing_area_new (struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl)
 
void plugin_init (void)
 

Variables

static struct graphics_gc_methods gc_methods
 
static int gtk_argc
 
static char ** gtk_argv = {NULL}
 
static struct graphics_methods graphics_methods
 

Macro Definition Documentation

◆ GDK_ENABLE_BROKEN

#define GDK_ENABLE_BROKEN

Navit, a modular navigation system. Copyright (C) 2005-2008 Navit Team

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

◆ GDK_KEY_Book

#define GDK_KEY_Book   XF86XK_Book

◆ GDK_KEY_Calendar

#define GDK_KEY_Calendar   XF86XK_Calendar

Function Documentation

◆ background_gc()

static void background_gc ( struct graphics_priv gr,
struct graphics_gc_priv gc 
)
static

References graphics_priv::background_gc.

Referenced by expose().

◆ button_press()

static gint button_press ( GtkWidget *  widget,
GdkEventButton *  event,
gpointer  user_data 
)
static

◆ button_release()

static gint button_release ( GtkWidget *  widget,
GdkEventButton *  event,
gpointer  user_data 
)
static

◆ configure()

static gint configure ( GtkWidget *  widget,
GdkEventConfigure *  event,
gpointer  user_data 
)
static

◆ delete()

static gint delete ( GtkWidget *  widget,
GdkEventKey *  event,
gpointer  user_data 
)
static

◆ display_text_draw()

◆ draw_circle()

static void draw_circle ( struct graphics_priv gr,
struct graphics_gc_priv gc,
struct point p,
int  r 
)
static

◆ draw_drag()

static void draw_drag ( struct graphics_priv gr,
struct point p 
)
static

References graphics_priv::p, p, point::x, and point::y.

◆ draw_image()

static void draw_image ( struct graphics_priv gr,
struct graphics_gc_priv fg,
struct point p,
struct graphics_image_priv img 
)
static

◆ draw_lines()

static void draw_lines ( struct graphics_priv gr,
struct graphics_gc_priv gc,
struct point p,
int  count 
)
static

◆ draw_mode()

static void draw_mode ( struct graphics_priv gr,
enum draw_mode_num  mode 
)
static

◆ draw_polygon()

static void draw_polygon ( struct graphics_priv gr,
struct graphics_gc_priv gc,
struct point p,
int  count 
)
static

◆ draw_polygon_with_holes()

static void draw_polygon_with_holes ( struct graphics_priv gr,
struct graphics_gc_priv gc,
struct point p,
int  count,
int  hole_count,
int *  ccount,
struct point **  holes 
)
static

◆ draw_rectangle()

static void draw_rectangle ( struct graphics_priv gr,
struct graphics_gc_priv gc,
struct point p,
int  w,
int  h 
)
static

◆ draw_rgb_image_buffer()

static void draw_rgb_image_buffer ( cairo_t *  cairo,
int  buffer_width,
int  buffer_height,
int  draw_pos_x,
int  draw_pos_y,
int  stride,
unsigned char *  buffer 
)
static

Referenced by display_text_draw().

◆ draw_text()

static void draw_text ( struct graphics_priv gr,
struct graphics_gc_priv fg,
struct graphics_gc_priv bg,
struct graphics_font_priv font,
char *  text,
struct point p,
int  dx,
int  dy 
)
static

◆ expose()

◆ gc_destroy()

static void gc_destroy ( struct graphics_gc_priv gc)
static

◆ gc_new()

◆ gc_set_background()

static void gc_set_background ( struct graphics_gc_priv gc,
struct color c 
)
static

◆ gc_set_dashes()

static void gc_set_dashes ( struct graphics_gc_priv gc,
int  w,
int  offset,
unsigned char *  dash_list,
int  n 
)
static

◆ gc_set_foreground()

static void gc_set_foreground ( struct graphics_gc_priv gc,
struct color c 
)
static

References graphics_gc_priv::c, and c.

◆ gc_set_linewidth()

static void gc_set_linewidth ( struct graphics_gc_priv gc,
int  w 
)
static

◆ gc_set_texture()

static void gc_set_texture ( struct graphics_gc_priv gc,
struct graphics_image_priv img 
)
static

◆ get_data()

◆ get_data_window()

static void get_data_window ( struct graphics_priv this,
unsigned int  xid 
)
static

◆ get_dpi()

static navit_float get_dpi ( struct graphics_priv gr)
static

Return number of dots per inch.

Parameters
grself handle
Returns
dpi value

References graphics_priv::screen, and graphics_priv::widget.

◆ graphics_destroy()

◆ graphics_gtk_drawing_area_disable_suspend()

static void graphics_gtk_drawing_area_disable_suspend ( struct window w)
static

References dbg, lvl_warning, graphics_priv::pid, and graphics_priv::w.

Referenced by get_data().

◆ graphics_gtk_drawing_area_fullscreen()

static int graphics_gtk_drawing_area_fullscreen ( struct window w,
int  on 
)
static

References graphics_priv::w, and graphics_priv::win.

Referenced by get_data().

◆ graphics_gtk_drawing_area_new()

◆ graphics_gtk_drawing_area_new_helper()

◆ image_free()

static void image_free ( struct graphics_priv gr,
struct graphics_image_priv priv 
)
static

◆ image_new()

static struct graphics_image_priv* image_new ( struct graphics_priv gr,
struct graphics_image_methods meth,
char *  name,
int *  w,
int *  h,
struct point hot,
int  rotation 
)
static

◆ keypress()

◆ motion_notify()

static gint motion_notify ( GtkWidget *  widget,
GdkEventMotion *  event,
gpointer  user_data 
)
static

◆ overlay_disable()

static void overlay_disable ( struct graphics_priv gr,
int  disabled 
)
static

◆ overlay_draw()

static void overlay_draw ( struct graphics_priv parent,
struct graphics_priv overlay,
GdkRectangle *  re,
cairo_t *  cairo 
)
static

◆ overlay_new()

◆ overlay_rect()

static void overlay_rect ( struct graphics_priv parent,
struct graphics_priv overlay,
GdkRectangle *  r 
)
static

◆ overlay_resize()

static void overlay_resize ( struct graphics_priv this,
struct point p,
int  w,
int  h,
int  wraparound 
)
static

◆ plugin_init()

void plugin_init ( void  )

◆ scroll()

static gint scroll ( GtkWidget *  widget,
GdkEventScroll *  event,
gpointer  user_data 
)
static

◆ set_attr()

static int set_attr ( struct graphics_priv gr,
struct attr attr 
)
static

◆ set_drawing_color()

static void set_drawing_color ( cairo_t *  cairo,
struct color  c 
)
static

◆ set_stroke_params_from_gc()

static void set_stroke_params_from_gc ( cairo_t *  cairo,
struct graphics_gc_priv gc 
)
static

◆ tv_delta()

static int tv_delta ( struct timeval *  old,
struct timeval *  new 
)
static

Referenced by button_press(), and button_release().

Variable Documentation

◆ gc_methods

struct graphics_gc_methods gc_methods
static
Initial value:
= {
}
static void gc_destroy(struct graphics_gc_priv *gc)
Definition: graphics_gtk_drawing_area.c:134
static void gc_set_foreground(struct graphics_gc_priv *gc, struct color *c)
Definition: graphics_gtk_drawing_area.c:159
static void gc_set_background(struct graphics_gc_priv *gc, struct color *c)
Definition: graphics_gtk_drawing_area.c:163
static void gc_set_texture(struct graphics_gc_priv *gc, struct graphics_image_priv *img)
Definition: graphics_gtk_drawing_area.c:166
static void gc_set_dashes(struct graphics_gc_priv *gc, int w, int offset, unsigned char *dash_list, int n)
Definition: graphics_gtk_drawing_area.c:144
static void gc_set_linewidth(struct graphics_gc_priv *gc, int w)
Definition: graphics_gtk_drawing_area.c:140

Referenced by gc_new().

◆ graphics_methods

◆ gtk_argc

int gtk_argc
static

Referenced by plugin_init().

◆ gtk_argv

char** gtk_argv = {NULL}
static

Referenced by plugin_init().