navit  0.5.1-trunk
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Groups
graphics_win32.c File Reference
#include <windows.h>
#include <windowsx.h>
#include <wingdi.h>
#include <glib.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include "config.h"
#include "debug.h"
#include "point.h"
#include "graphics.h"
#include "color.h"
#include "callback.h"
#include "plugin.h"
#include "item.h"
#include "window.h"
#include "graphics_win32.h"
#include "xpm2bmp.h"
#include "support/win32/ConvertUTF.h"
#include "profile.h"
#include "keys.h"
#include "png.h"

Data Structures

struct  graphics_priv
 
struct  window_priv
 
struct  graphics_image_priv
 
struct  graphics_gc_priv
 
struct  graphics_font_priv
 
struct  event_timeout
 

Macros

#define STRETCH_HALFTONE   4
 
#define GET_WHEEL_DELTA_WPARAM(wParam)   ((short)HIWORD(wParam))
 
#define EZ_ATTR_BOLD   1
 
#define EZ_ATTR_ITALIC   2
 
#define EZ_ATTR_UNDERLINE   4
 
#define EZ_ATTR_STRIKEOUT   8
 

Typedefs

typedef int nXOriginDest
 
typedef int int nYOriginDest
 
typedef int int int nWidthDest
 
typedef int int int int nHeightDest
 
typedef int int int int HDC hdcSrc
 
typedef int int int int HDC int nXOriginSrc
 
typedef int int int int HDC int int nYOriginSrc
 
typedef int int int int HDC
int int int 
nWidthSrc
 
typedef int int int int HDC
int int int int 
nHeightSrc
 
typedef int int int int HDC
int int int int BLENDFUNCTION 
blendFunction
 
typedef int mode
 

Functions

typedef BOOL (WINAPI *FP_AlphaBlend)(HDC hdcDest
 
typedef int (WINAPI *FP_SetStretchBltMode)(HDC dc
 
HFONT EzCreateFont (HDC hdc, TCHAR *szFaceName, int iDeciPtHeight, int iDeciPtWidth, int iAttributes, BOOL fLogRes)
 
static void ErrorExit (LPTSTR lpszFunction)
 
static void create_memory_dc (struct graphics_priv *gr)
 
static void HandleButtonClick (struct graphics_priv *gra_priv, int updown, int button, long lParam)
 
static void HandleKeyChar (struct graphics_priv *gra_priv, WPARAM wParam)
 
static void HandleKeyDown (struct graphics_priv *gra_priv, WPARAM wParam)
 
static LRESULT CALLBACK WndProc (HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
 
static int fullscreen (struct window *win, int on)
 
void WINAPI SystemIdleTimerReset (void)
 
static struct event_timeoutevent_win32_add_timeout (int timeout, int multi, struct callback *cb)
 
static void disable_suspend (struct window *win)
 
static HANDLE CreateGraphicsWindows (struct graphics_priv *gr, HMENU hMenu)
 
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 width, 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 struct graphics_gc_privgc_new (struct graphics_priv *gr, struct graphics_gc_methods *meth)
 
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_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_drag (struct graphics_priv *gr, struct point *p)
 
static void draw_mode (struct graphics_priv *gr, enum draw_mode_num mode)
 
static void * get_data (struct graphics_priv *this_, const char *type)
 
static void background_gc (struct graphics_priv *gr, struct graphics_gc_priv *gc)
 
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 font_destroy (struct graphics_font_priv *font)
 
static struct graphics_font_privfont_new (struct graphics_priv *gr, struct graphics_font_methods *meth, char *name, int size, int flags)
 
static int pngdecode (struct graphics_priv *gr, char *name, struct graphics_image_priv *img)
 
static void pngscale (struct graphics_image_priv *img, struct graphics_priv *gr, int width, int height)
 
static void pngrender (struct graphics_image_priv *img, struct graphics_priv *gr, int x0, int y0)
 
static int xpmdecode (char *name, struct graphics_image_priv *img)
 
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 draw_image (struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, struct graphics_image_priv *img)
 
static struct graphics_privgraphics_win32_new_helper (struct graphics_methods *meth)
 
static void overlay_resize (struct graphics_priv *gr, struct point *p, int w, int h, int wraparound)
 
static struct graphics_privoverlay_new (struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h, int wraparound)
 
static void overlay_disable (struct graphics_priv *gr, int disable)
 
static void get_text_bbox (struct graphics_priv *gr, struct graphics_font_priv *font, char *text, int dx, int dy, struct point *ret, int estimate)
 
static void bind_late (struct graphics_priv *gra_priv)
 
static struct graphics_privgraphics_win32_new (struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl)
 
static void event_win32_main_loop_run (void)
 
static void event_win32_main_loop_quit (void)
 
static struct event_watchevent_win32_add_watch (int h, enum event_watch_cond cond, struct callback *cb)
 
static void event_win32_remove_watch (struct event_watch *ev)
 
static void run_timer (UINT_PTR idEvent)
 
static VOID CALLBACK win32_timer_cb (HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
 
static void event_win32_remove_timeout (struct event_timeout *to)
 
static struct event_idleevent_win32_add_idle (int priority, struct callback *cb)
 
static void event_win32_remove_idle (struct event_idle *ev)
 
static void event_win32_call_callback (struct callback_list *cb)
 
static struct event_privevent_win32_new (struct event_methods *meth)
 
void plugin_init (void)
 

Variables

static HWND g_hwnd = NULL
 
static const TCHAR g_szClassName [] = {'N','A','V','G','R','A','\0'}
 
static struct graphics_gc_methods gc_methods
 
static struct graphics_font_methods font_methods
 
static struct graphics_methods graphics_methods
 
static GListtimers
 
static struct event_methods event_win32_methods
 

Macro Definition Documentation

#define EZ_ATTR_BOLD   1

Referenced by EzCreateFont().

#define EZ_ATTR_ITALIC   2

Referenced by EzCreateFont().

#define EZ_ATTR_STRIKEOUT   8

Referenced by EzCreateFont().

#define EZ_ATTR_UNDERLINE   4

Referenced by EzCreateFont().

#define GET_WHEEL_DELTA_WPARAM (   wParam)    ((short)HIWORD(wParam))
#define STRETCH_HALFTONE   4

Referenced by pngscale().

Typedef Documentation

typedef int int int int HDC int int int int BLENDFUNCTION blendFunction
typedef int int int int HDC hdcSrc
typedef int mode
typedef int int int nWidthDest
typedef int int int int HDC int int int nWidthSrc
typedef int nXOriginDest
typedef int int int int HDC int nXOriginSrc
typedef int int nYOriginDest
typedef int int int int HDC int int nYOriginSrc

Function Documentation

static void background_gc ( struct graphics_priv gr,
struct graphics_gc_priv gc 
)
static
typedef BOOL ( WINAPI *  FP_AlphaBlend)
static void disable_suspend ( struct window win)
static
static void draw_circle ( struct graphics_priv gr,
struct graphics_gc_priv gc,
struct point p,
int  r 
)
static
static void draw_drag ( struct graphics_priv gr,
struct point p 
)
static
static void draw_image ( struct graphics_priv gr,
struct graphics_gc_priv fg,
struct point p,
struct graphics_image_priv img 
)
static
static void draw_lines ( struct graphics_priv gr,
struct graphics_gc_priv gc,
struct point p,
int  count 
)
static
static void draw_polygon ( struct graphics_priv gr,
struct graphics_gc_priv gc,
struct point p,
int  count 
)
static
static void draw_rectangle ( struct graphics_priv gr,
struct graphics_gc_priv gc,
struct point p,
int  w,
int  h 
)
static
static void ErrorExit ( LPTSTR  lpszFunction)
static

References _tprintf, dbg, and lvl_error.

static struct event_idle* event_win32_add_idle ( int  priority,
struct callback cb 
)
static
static struct event_timeout * event_win32_add_timeout ( int  timeout,
int  multi,
struct callback cb 
)
static
static struct event_watch* event_win32_add_watch ( int  h,
enum event_watch_cond  cond,
struct callback cb 
)
static

References dbg, and lvl_debug.

static void event_win32_call_callback ( struct callback_list cb)
static

References g_hwnd.

static void event_win32_main_loop_quit ( void  )
static

References dbg, g_hwnd, L, and lvl_debug.

static void event_win32_main_loop_run ( void  )
static

References dbg, and lvl_debug.

static struct event_priv* event_win32_new ( struct event_methods meth)
static

References event_win32_methods.

Referenced by plugin_init().

static void event_win32_remove_idle ( struct event_idle ev)
static
static void event_win32_remove_timeout ( struct event_timeout to)
static
static void event_win32_remove_watch ( struct event_watch ev)
static

References dbg, and lvl_debug.

HFONT EzCreateFont ( HDC  hdc,
TCHAR *  szFaceName,
int  iDeciPtHeight,
int  iDeciPtWidth,
int  iAttributes,
BOOL  fLogRes 
)
static void font_destroy ( struct graphics_font_priv font)
static
static struct graphics_font_priv* font_new ( struct graphics_priv gr,
struct graphics_font_methods meth,
char *  name,
int  size,
int  flags 
)
static
static int fullscreen ( struct window win,
int  on 
)
static

References FALSE, g_hwnd, and L.

Referenced by get_data().

static void gc_destroy ( struct graphics_gc_priv gc)
static
static void gc_set_background ( struct graphics_gc_priv gc,
struct color c 
)
static
static void gc_set_dashes ( struct graphics_gc_priv gc,
int  width,
int  offset,
unsigned char  dash_list[],
int  n 
)
static
static void gc_set_linewidth ( struct graphics_gc_priv gc,
int  w 
)
static
static void get_text_bbox ( struct graphics_priv gr,
struct graphics_font_priv font,
char *  text,
int  dx,
int  dy,
struct point ret,
int  estimate 
)
static
static void graphics_destroy ( struct graphics_priv gr)
static
static struct graphics_priv * graphics_win32_new_helper ( struct graphics_methods meth)
static
static void HandleButtonClick ( struct graphics_priv gra_priv,
int  updown,
int  button,
long  lParam 
)
static

References callback_list_call_attr_3, and graphics_priv::cbl.

Referenced by WndProc().

static void HandleKeyChar ( struct graphics_priv gra_priv,
WPARAM  wParam 
)
static
static void HandleKeyDown ( struct graphics_priv gra_priv,
WPARAM  wParam 
)
static
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
static void overlay_disable ( struct graphics_priv gr,
int  disable 
)
static
static void overlay_resize ( struct graphics_priv gr,
struct point p,
int  w,
int  h,
int  wraparound 
)
static
void plugin_init ( void  )
static void run_timer ( UINT_PTR  idEvent)
static
void WINAPI SystemIdleTimerReset ( void  )

Referenced by disable_suspend(), and WndProc().

static VOID CALLBACK win32_timer_cb ( HWND  hwnd,
UINT  uMsg,
UINT_PTR  idEvent,
DWORD  dwTime 
)
static

References run_timer().

Referenced by event_win32_add_timeout().

Variable Documentation

struct event_methods event_win32_methods
static
Initial value:
=
{
}
static struct event_timeout * event_win32_add_timeout(int timeout, int multi, struct callback *cb)
Definition: graphics_win32.c:1766
static void event_win32_remove_timeout(struct event_timeout *to)
Definition: graphics_win32.c:1781
static void event_win32_main_loop_run(void)
Definition: graphics_win32.c:1677
static void event_win32_remove_idle(struct event_idle *ev)
Definition: graphics_win32.c:1814
static void event_win32_main_loop_quit(void)
Definition: graphics_win32.c:1690
static void event_win32_remove_watch(struct event_watch *ev)
Definition: graphics_win32.c:1718
static struct event_watch * event_win32_add_watch(int h, enum event_watch_cond cond, struct callback *cb)
Definition: graphics_win32.c:1711
static struct event_idle * event_win32_add_idle(int priority, struct callback *cb)
Definition: graphics_win32.c:1808
static void event_win32_call_callback(struct callback_list *cb)
Definition: graphics_win32.c:1820

Referenced by event_win32_new().

struct graphics_font_methods font_methods
static
Initial value:
=
{
}
static void font_destroy(struct graphics_font_priv *font)
Definition: graphics_win32.c:1095

Referenced by font_new().

const TCHAR g_szClassName[] = {'N','A','V','G','R','A','\0'}
static

Referenced by CreateGraphicsWindows().

struct graphics_gc_methods gc_methods
static
Initial value:
=
{
}
static void gc_set_background(struct graphics_gc_priv *gc, struct color *c)
Definition: graphics_win32.c:809
static void gc_set_linewidth(struct graphics_gc_priv *gc, int w)
Definition: graphics_win32.c:776
static void gc_set_foreground(struct graphics_gc_priv *gc, struct color *c)
Definition: graphics_win32.c:793
static void gc_destroy(struct graphics_gc_priv *gc)
Definition: graphics_win32.c:769
static void gc_set_dashes(struct graphics_gc_priv *gc, int width, int offset, unsigned char dash_list[], int n)
Definition: graphics_win32.c:783

Referenced by gc_new().

Initial value:
=
{
NULL,
NULL,
NULL,
NULL,
}
static void get_text_bbox(struct graphics_priv *gr, struct graphics_font_priv *font, char *text, int dx, int dy, struct point *ret, int estimate)
Definition: graphics_win32.c:1538
static struct graphics_priv * overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h, int wraparound)
Definition: graphics_win32.c:1497
static void * get_data(struct graphics_priv *this_, const char *type)
Definition: graphics_win32.c:980
static void draw_circle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int r)
Definition: graphics_win32.c:900
static void draw_image(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, struct graphics_image_priv *img)
Definition: graphics_win32.c:1469
static void background_gc(struct graphics_priv *gr, struct graphics_gc_priv *gc)
Definition: graphics_win32.c:1006
static struct graphics_font_priv * font_new(struct graphics_priv *gr, struct graphics_font_methods *meth, char *name, int size, int flags)
Definition: graphics_win32.c:1109
static void draw_mode(struct graphics_priv *gr, enum draw_mode_num mode)
Definition: graphics_win32.c:933
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)
Definition: graphics_win32.c:1025
static void draw_lines(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count)
Definition: graphics_win32.c:845
static void overlay_resize(struct graphics_priv *gr, struct point *p, int w, int h, int wraparound)
Definition: graphics_win32.c:1480
static void graphics_destroy(struct graphics_priv *gr)
Definition: graphics_win32.c:763
static struct graphics_gc_priv * gc_new(struct graphics_priv *gr, struct graphics_gc_methods *meth)
Definition: graphics_win32.c:827
static void draw_rectangle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int w, int h)
Definition: graphics_win32.c:889
static void draw_polygon(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count)
Definition: graphics_win32.c:869
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)
Definition: graphics_win32.c:1415
static void draw_drag(struct graphics_priv *gr, struct point *p)
Definition: graphics_win32.c:914
static void overlay_disable(struct graphics_priv *gr, int disable)
Definition: graphics_win32.c:1532

Referenced by graphics_win32_new_helper().