From: afaber Date: Mon, 4 Feb 2008 00:46:04 +0000 (+0000) Subject: Fix:projs/CodeBlocks:update project files, more work on native win32 gui/graphics X-Git-Tag: navit-0.5.0.5194svn~4312 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=38577ada5c1d23dea6c4166e0952eaee2959a78b;p=profile%2Fivi%2Fnavit.git Fix:projs/CodeBlocks:update project files, more work on native win32 gui/graphics git-svn-id: https://navit.svn.sourceforge.net/svnroot/navit/trunk@839 ffa7fe5e-494d-0410-b361-a75ebd5db220 --- diff --git a/navit/projs/CodeBlocks/Navit.workspace b/navit/projs/CodeBlocks/Navit.workspace index fc79297..716ba31 100644 --- a/navit/projs/CodeBlocks/Navit.workspace +++ b/navit/projs/CodeBlocks/Navit.workspace @@ -1,6 +1,7 @@ + @@ -20,7 +21,27 @@ - + + + + + + + + + + + + + + + + + + + + + diff --git a/navit/projs/CodeBlocks/NavitCore.cbp b/navit/projs/CodeBlocks/NavitCore.cbp index 26da9b3..bc3c466 100644 --- a/navit/projs/CodeBlocks/NavitCore.cbp +++ b/navit/projs/CodeBlocks/NavitCore.cbp @@ -48,9 +48,6 @@ - - - - diff --git a/navit/projs/CodeBlocks/speech_speech_dispatcher.cbp b/navit/projs/CodeBlocks/speech_speech_dispatcher.cbp new file mode 100644 index 0000000..228c621 --- /dev/null +++ b/navit/projs/CodeBlocks/speech_speech_dispatcher.cbp @@ -0,0 +1,72 @@ + + + + + + diff --git a/navit/projs/CodeBlocks/win32_gui.cbp b/navit/projs/CodeBlocks/win32_gui.cbp new file mode 100644 index 0000000..91b2571 --- /dev/null +++ b/navit/projs/CodeBlocks/win32_gui.cbp @@ -0,0 +1,62 @@ + + + + + + diff --git a/navit/projs/CodeBlocks/win32gui/win32_graphics.c b/navit/projs/CodeBlocks/win32gui/win32_graphics.c index b7d24cd..6483b46 100644 --- a/navit/projs/CodeBlocks/win32gui/win32_graphics.c +++ b/navit/projs/CodeBlocks/win32gui/win32_graphics.c @@ -8,14 +8,92 @@ #include "graphics.h" #include "color.h" #include "plugin.h" +#include "win32_gui.h" -#define ID_CHILD_GFX 2000 #include "xpm2bmp.h"; #ifndef GET_WHEEL_DELTA_WPARAM #define GET_WHEEL_DELTA_WPARAM(wParam) ((short)HIWORD(wParam)) #endif +HFONT EzCreateFont (HDC hdc, TCHAR * szFaceName, int iDeciPtHeight, + int iDeciPtWidth, int iAttributes, BOOL fLogRes) ; + +#define EZ_ATTR_BOLD 1 +#define EZ_ATTR_ITALIC 2 +#define EZ_ATTR_UNDERLINE 4 +#define EZ_ATTR_STRIKEOUT 8 + +HFONT EzCreateFont (HDC hdc, TCHAR * szFaceName, int iDeciPtHeight, + int iDeciPtWidth, int iAttributes, BOOL fLogRes) +{ + FLOAT cxDpi, cyDpi ; + HFONT hFont ; + LOGFONT lf ; + POINT pt ; + TEXTMETRIC tm ; + + SaveDC (hdc) ; + + SetGraphicsMode (hdc, GM_ADVANCED) ; + ModifyWorldTransform (hdc, NULL, MWT_IDENTITY) ; + SetViewportOrgEx (hdc, 0, 0, NULL) ; + SetWindowOrgEx (hdc, 0, 0, NULL) ; + + if (fLogRes) + { + cxDpi = (FLOAT) GetDeviceCaps (hdc, LOGPIXELSX) ; + cyDpi = (FLOAT) GetDeviceCaps (hdc, LOGPIXELSY) ; + } + else + { + cxDpi = (FLOAT) (25.4 * GetDeviceCaps (hdc, HORZRES) / + GetDeviceCaps (hdc, HORZSIZE)) ; + + cyDpi = (FLOAT) (25.4 * GetDeviceCaps (hdc, VERTRES) / + GetDeviceCaps (hdc, VERTSIZE)) ; + } + + pt.x = (int) (iDeciPtWidth * cxDpi / 72) ; + pt.y = (int) (iDeciPtHeight * cyDpi / 72) ; + + DPtoLP (hdc, &pt, 1) ; + lf.lfHeight = - (int) (fabs (pt.y) / 10.0 + 0.5) ; + lf.lfWidth = 0 ; + lf.lfEscapement = 0 ; + lf.lfOrientation = 0 ; + lf.lfWeight = iAttributes & EZ_ATTR_BOLD ? 700 : 0 ; + lf.lfItalic = iAttributes & EZ_ATTR_ITALIC ? 1 : 0 ; + lf.lfUnderline = iAttributes & EZ_ATTR_UNDERLINE ? 1 : 0 ; + lf.lfStrikeOut = iAttributes & EZ_ATTR_STRIKEOUT ? 1 : 0 ; + lf.lfCharSet = DEFAULT_CHARSET ; + lf.lfOutPrecision = 0 ; + lf.lfClipPrecision = 0 ; + lf.lfQuality = 0 ; + lf.lfPitchAndFamily = 0 ; + + lstrcpy (lf.lfFaceName, szFaceName) ; + + hFont = CreateFontIndirect (&lf) ; + + if (iDeciPtWidth != 0) + { + hFont = (HFONT) SelectObject (hdc, hFont) ; + + GetTextMetrics (hdc, &tm) ; + + DeleteObject (SelectObject (hdc, hFont)) ; + + lf.lfWidth = (int) (tm.tmAveCharWidth * + fabs (pt.x) / fabs (pt.y) + 0.5) ; + + hFont = CreateFontIndirect (&lf) ; + } + + RestoreDC (hdc, -1) ; + return hFont ; +} + struct graphics_image_priv { PXPM2BMP pxpm; }; @@ -52,23 +130,6 @@ void ErrorExit(LPTSTR lpszFunction) } -struct graphics_priv { - struct point p; - int width; - int height; - int library_init; - int visible; - HANDLE wnd_parent_handle; - HANDLE wnd_handle; - - void (*resize_callback)(void *data, int w, int h); - void *resize_callback_data; - void (*motion_callback)(void *data, struct point *p); - void *motion_callback_data; - void (*button_callback)(void *data, int press, int button, struct point *p); - void *button_callback_data; - enum draw_mode_num mode; -}; struct graphics_gc_priv { HWND hwnd; @@ -118,11 +179,23 @@ static void MakeMemoryDC(HANDLE hWnd, HDC hdc ) } } +static void HandleButtonClick( int updown, int button, long lParam ) +{ + int xPos = LOWORD(lParam); + int yPos = HIWORD(lParam); + // printf( "WM_LBUTTONDOWN: %d %d \n", xPos, yPos ); + if (g_gra->button_callback ) + { + struct point pt = {xPos, yPos}; + (*g_gra->button_callback)(g_gra->button_callback_data, updown, button, &pt); + } +} + static LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam) { -if ( Message != 15 ) - printf( "CHILD %d %d %d \n", Message, wParam, lParam ); +//if ( Message != 15 ) + // printf( "CHILD %d %d %d \n", Message, wParam, lParam ); switch(Message) { case WM_CREATE: @@ -151,10 +224,6 @@ if ( Message != 15 ) case WM_CLOSE: DestroyWindow(hwnd); break; - case WM_LBUTTONDBLCLK: - if (g_gra->resize_callback) - (*g_gra->resize_callback)(g_gra->resize_callback_data, g_gra->width, g_gra->height); - break; case WM_SIZE: { //graphics = GetWindowLong( hwnd, DWL_USER, 0 ); @@ -193,39 +262,23 @@ if ( Message != 15 ) int yPos = HIWORD(lParam); struct point pt = {xPos, yPos}; - printf( "WM_MOUSEMOVE: %d %d \n", xPos, yPos ); + // printf( "WM_MOUSEMOVE: %d %d \n", xPos, yPos ); (*g_gra->motion_callback)(g_gra->motion_callback_data, &pt); } break; - case WM_LBUTTONUP: - { - int xPos = LOWORD(lParam); - int yPos = HIWORD(lParam); - - struct point pt = { xPos, yPos }; - - printf( "WM_LBUTTONUP: %d %d \n", xPos, yPos ); - if (g_gra->button_callback ) - { - struct point pt = {xPos, yPos}; - (*g_gra->button_callback)(g_gra->button_callback_data, 0, 1, &pt); - } - - } - break; case WM_LBUTTONDOWN: - { - int xPos = LOWORD(lParam); - int yPos = HIWORD(lParam); - printf( "WM_LBUTTONDOWN: %d %d \n", xPos, yPos ); - if (g_gra->button_callback ) - { - struct point pt = {xPos, yPos}; - (*g_gra->button_callback)(g_gra->button_callback_data, 1, 1, &pt); - } - } + HandleButtonClick( 1, 1,lParam ); + break; + case WM_LBUTTONUP: + HandleButtonClick( 0, 1,lParam ); + break; + case WM_RBUTTONDOWN: + HandleButtonClick( 1, 3,lParam ); + break; + case WM_RBUTTONUP: + HandleButtonClick( 0, 3,lParam ); break; case WM_HSCROLL: @@ -275,17 +328,16 @@ void CreateGraphicsWindows( struct graphics_priv* gr ) return NULL; } - g_gra->width = rcParent.right - rcParent.left; - g_gra->height = rcParent.bottom - rcParent.top; - + gr->width = rcParent.right - rcParent.left; + gr->height = rcParent.bottom - rcParent.top; hwnd = CreateWindow( g_szClassName, "", WS_CHILD , 0, 0, - g_gra->width, - g_gra->height, + gr->width, + gr->height, gr->wnd_parent_handle, (HMENU)ID_CHILD_GFX, NULL, @@ -404,6 +456,7 @@ static void draw_lines(struct graphics_priv *gr, struct graphics_gc_priv *gc, st static void draw_polygon(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count) { + //if (gr->mode == draw_mode_begin || gr->mode == draw_mode_end) { int i; @@ -459,15 +512,12 @@ static void draw_circle(struct graphics_priv *gr, struct graphics_gc_priv *gc, s static void draw_restore(struct graphics_priv *gr, struct point *p, int w, int h) { - // AF TODO - printf( "draw restore \n" ); - - InvalidateRect( gr->wnd_handle, NULL, FALSE ); + InvalidateRect( gr->wnd_handle, NULL, TRUE ); } static void draw_mode(struct graphics_priv *gr, enum draw_mode_num mode) { - printf( "set draw_mode to %d\n", (int)mode ); + // printf( "set draw_mode to %d\n", (int)mode ); if ( mode == draw_mode_begin ) { @@ -475,6 +525,17 @@ static void draw_mode(struct graphics_priv *gr, enum draw_mode_num mode) { CreateGraphicsWindows( gr ); } + if ( gr->mode != draw_mode_begin ) + { + if ( hMemDC ) + { + RECT rcClient; + HBRUSH bgBrush = CreateSolidBrush( gr->bg_color ); + GetClientRect( gr->wnd_handle, &rcClient ); + FillRect( hMemDC, &rcClient, bgBrush ); + DeleteObject( bgBrush ); + } + } } // force paint @@ -523,17 +584,102 @@ static void register_button_callback(struct graphics_priv *this_, void (*callbac static void background_gc(struct graphics_priv *gr, struct graphics_gc_priv *gc) { -// gr->background_gc=gc; + RECT rcClient; + HBRUSH bgBrush = CreateSolidBrush( gc->bg_color ); + GetClientRect( gr->wnd_handle, &rcClient ); + FillRect( hMemDC, &rcClient, bgBrush ); + DeleteObject( bgBrush ); + gr->bg_color = gc->bg_color; } +struct graphics_font_priv { + LOGFONT lf; + HFONT hfont; + int size; +}; + 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) { + RECT rcClient; + GetClientRect( gr->wnd_handle, &rcClient ); + + int prevBkMode = SetBkMode( hMemDC, TRANSPARENT ); + + if ( NULL == font->hfont ) + { + int size = font->size; + long lfHeight = -MulDiv(font->size, GetDeviceCaps(hMemDC, LOGPIXELSY), 72); + + font->hfont = EzCreateFont (hMemDC, TEXT ("Arial"), size/2, 0, 0, TRUE) ; + GetObject ( font->hfont, sizeof (LOGFONT), &font->lf) ; + +/* + font->hfont = CreateFont( lfHeight, + 0, + 0, + 0, + 0, + TRUE, + 0, + 0, + DEFAULT_CHARSET, + 0, + 0, + 0, + 0, + "Arial"); + */ + } + + +// RECT rc = { p->x, p->y, 800, 800 }; +// DrawText(hMemDC, text, -1, &rc, DT_NOCLIP | DT_CALCRECT| DT_SINGLELINE); + double angle = -atan2( dy, dx ) * 180 / 3.14159 ; +// printf( "dx %d , dy %d angle %6.3f %s\n", dx, dy, angle, text); + SetTextAlign (hMemDC, TA_BASELINE) ; + SetViewportOrgEx (hMemDC, p->x, p->y, NULL) ; + font->lf.lfEscapement = font->lf.lfOrientation = ( angle * 10 ) ; + DeleteObject (font->hfont) ; + + font->hfont = CreateFontIndirect (&font->lf); + HFONT hOldFont = SelectObject(hMemDC, font->hfont ); + + TextOut(hMemDC, 0,0, text, strlen( text ) ); + + SelectObject(hMemDC, hOldFont); + DeleteObject (font->hfont) ; + + SetBkMode( hMemDC, prevBkMode ); + + SetViewportOrgEx (hMemDC, 0, 0, NULL) ; + +} + + + +static void font_destroy(struct graphics_font_priv *font) +{ + if ( font->hfont ) + { + DeleteObject(font->hfont); + } + g_free(font); } +static struct graphics_font_methods font_methods = { + font_destroy +}; + static struct graphics_font_priv *font_new(struct graphics_priv *gr, struct graphics_font_methods *meth, int size) { - meth = NULL; - return NULL; + struct graphics_font_priv *font=g_new(struct graphics_font_priv, 1); + *meth = font_methods; + + font->hfont = NULL; + font->size = size; + // FontFamily fontFamily( "Liberation Mono"); +//font( &fontFamily, size, FontStyleRegular, UnitPoint ); + return font; } 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) @@ -583,6 +729,7 @@ static struct graphics_priv * graphics_win32_drawing_area_new_helper(struct grap struct graphics_priv *this_=g_new0(struct graphics_priv,1); *meth=graphics_methods; g_gra = this_; + this_->mode = -1; return this_; } diff --git a/navit/projs/CodeBlocks/win32gui/win32_gui.c b/navit/projs/CodeBlocks/win32gui/win32_gui.c index d8bef94..2e4456f 100644 --- a/navit/projs/CodeBlocks/win32gui/win32_gui.c +++ b/navit/projs/CodeBlocks/win32gui/win32_gui.c @@ -7,64 +7,33 @@ #include "gui.h" #include "win32_gui.h" #include "point.h" +#include "menu.h" -#define ID_DISPLAY_ZOOMIN 8000 -#define ID_DISPLAY_ZOOMOUT 8001 -#define ID_FILE_EXIT 9001 -#define ID_STUFF_GO 9002 +const char g_szClassName[] = "navit_gui_class"; -const char g_szClassName[] = "myWindowClass"; -#define ID_CHILD_GFX 2000 -#define ID_CHILD_1 2001 -#define ID_CHILD_2 ID_CHILD_1 + 1 -#define ID_CHILD_3 ID_CHILD_2 + 1 -#define ID_CHILD_4 ID_CHILD_4 + 1 - -#define _(text) gettext(text) +static menu_id = 0; +static POINT menu_pt; gboolean message_pump( gpointer data ) { - Sleep( 100 ); - printf( "pump\n" ); + MSG messages; - MSG messages; /* Here messages to the application are saved */ if (GetMessage (&messages, NULL, 0, 0)) { - /* Translate virtual-key messages into character messages */ TranslateMessage(&messages); - /* Send message to WindowProcedure */ DispatchMessage(&messages); } else{ exit( 0 ); } - return TRUE; + return TRUE; } -struct gui_priv *g_this_; - -struct graphics_priv { - struct point p; - int width; - int height; - int library_init; - int visible; - HANDLE wnd_parent_handle; - HANDLE wnd_handle; - - void (*resize_callback)(void *data, int w, int h); - void *resize_callback_data; - void (*motion_callback)(void *data, struct point *p); - void *motion_callback_data; - void (*button_callback)(void *data, int press, int button, struct point *p); - void *button_callback_data; -// enum draw_mode_num mode; -}; extern struct graphics_priv *g_gra; @@ -95,7 +64,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l { RECT rcClient; - printf( "PARENT %d %d %d \n", Message, wParam, lParam ); + //printf( "PARENT %d %d %d \n", Message, wParam, lParam ); switch(Message) { @@ -105,7 +74,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l HICON hIcon, hIconSm; hMenu = CreateMenu(); - g_this_->hwnd = hwnd; + // g_this_->hwnd = hwnd; hSubMenu = CreatePopupMenu(); @@ -151,18 +120,28 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l } break; case WM_COMMAND: + { + struct gui_priv* gui = (struct gui_priv*)GetWindowLongPtr( hwnd , DWLP_USER ); + switch(LOWORD(wParam)) { + case ID_DISPLAY_ZOOMIN: + navit_zoom_in(gui->nav, 2, NULL); + break; + case ID_DISPLAY_ZOOMOUT: + navit_zoom_out(gui->nav, 2, NULL); + break; case ID_FILE_EXIT: PostMessage(hwnd, WM_CLOSE, 0, 0); break; case ID_STUFF_GO: (*g_gra->resize_callback)(g_gra->resize_callback_data, g_gra->width, g_gra->height); -// navit_draw(g_this_->nav); +// navit_draw(gui->nav); // MessageBox(hwnd, "You clicked Go!", "Woo!", MB_OK); break; } + } break; case WM_USER+ 1: printf( "wm_user \n" ); @@ -182,17 +161,18 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l PostQuitMessage(0); break; + case WM_MOUSEWHEEL: { - struct gui_priv * priv = GetWindowLongPtr( hwnd, DWLP_USER ); + struct gui_priv* gui = (struct gui_priv*)GetWindowLongPtr( hwnd , DWLP_USER ); short delta = GET_WHEEL_DELTA_WPARAM( wParam ); if ( delta > 0 ) { - navit_zoom_in(g_this_->nav, 2, NULL); + navit_zoom_in(gui->nav, 2, NULL); } else{ - navit_zoom_out(g_this_->nav, 2, NULL); + navit_zoom_out(gui->nav, 2, NULL); } } break; @@ -203,7 +183,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM l return 0; } -HANDLE Win32Init( void ) +HANDLE CreateWin32Window( void ) { WNDCLASSEX wc; HWND hwnd; @@ -213,7 +193,7 @@ HANDLE Win32Init( void ) wc.style = 0; wc.lpfnWndProc = WndProc; wc.cbClsExtra = 0; - wc.cbWndExtra = 0; + wc.cbWndExtra = 32; wc.hInstance = NULL; wc.hIcon = NULL; wc.hCursor = LoadCursor(NULL, IDC_ARROW); @@ -224,8 +204,7 @@ HANDLE Win32Init( void ) if(!RegisterClassEx(&wc)) { - MessageBox(NULL, "Window Registration Failed!", "Error!", - MB_ICONEXCLAMATION | MB_OK); + MessageBox(NULL, "Window Registration Failed!", "Error!", MB_ICONEXCLAMATION | MB_OK); return 0; } @@ -239,8 +218,7 @@ HANDLE Win32Init( void ) if(hwnd == NULL) { - MessageBox(NULL, "Window Creation Failed!", "Error!", - MB_ICONEXCLAMATION | MB_OK); + MessageBox(NULL, "Window Creation Failed!", "Error!", MB_ICONEXCLAMATION | MB_OK); return 0; } @@ -256,9 +234,7 @@ HANDLE Win32Init( void ) static int win32_gui_set_graphics(struct gui_priv *this_, struct graphics *gra) { HANDLE* wndHandle_ptr = graphics_get_data(gra, "wnd_parent_handle_ptr"); - *wndHandle_ptr = this_->hwnd; - graphics_get_data(gra, "START_CLIENT"); return 0; } @@ -275,12 +251,97 @@ static int win32_gui_add_bookmark(struct gui_priv *gui, struct pcoord *c, char * return 1; } +struct menu_priv { + HWND wnd_handle; + HMENU hMenu; +}; + +static struct menu_methods menu_methods; + + +static struct menu_priv *add_menu( struct menu_priv *menu, + struct menu_methods *meth, + char *name, + enum menu_type type, + struct callback *cb) +{ + struct menu_priv* ret = NULL; + + ret = g_new0(struct menu_priv, 1); + + *ret = *menu; + *meth = menu_methods; + + if ( type == menu_type_submenu ) + { + HMENU hSubMenu = NULL; + hSubMenu = CreatePopupMenu(); + AppendMenu(menu->hMenu, MF_STRING | MF_POPUP, (UINT)hSubMenu, name ); + ret->hMenu = hSubMenu; + } + else + { + AppendMenu( menu->hMenu, MF_STRING, menu_id, name ); + } + menu_id++; + + return ret; + +} + +static void set_toggle(struct menu_priv *menu, int active) +{ + // gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(menu->action), active); +} + +static int get_toggle(struct menu_priv *menu) +{ + // return gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(menu->action)); + return 0; +} + +static struct menu_methods menu_methods = { + add_menu, + set_toggle, + get_toggle, +}; + +static void popup_activate(struct menu_priv *menu) +{ + POINT menu_pt = { 200,200 }; + POINT pnt = menu_pt; + + ClientToScreen(menu->wnd_handle, (LPPOINT) &pnt); + + if (menu->hMenu) + { + TrackPopupMenu (menu->hMenu, 0, pnt.x, pnt.y, 0, menu->wnd_handle, NULL); + } +} + +struct menu_priv* win32_gui_popup_new(struct gui_priv *this_, struct menu_methods *meth) +{ + struct menu_priv* ret = NULL; + + ret = g_new0(struct menu_priv, 1); + *meth = menu_methods; + + menu_id = 4000; + + ret->hMenu = CreatePopupMenu(); + ret->wnd_handle = this_->hwnd; + meth->popup=popup_activate; + +printf( "create popup menu %d \n", ret->hMenu ); + + return ret; +} struct gui_methods win32_gui_methods = { NULL, // win32_gui_menubar_new, NULL, // win32_gui_toolbar_new, NULL, // win32_gui_statusbar_new, - NULL, // win32_gui_popup_new, + win32_gui_popup_new, win32_gui_set_graphics, NULL, NULL, // win32_gui_datawindow_new, @@ -292,28 +353,18 @@ struct gui_methods win32_gui_methods = { static struct gui_priv *win32_gui_new( struct navit *nav, struct gui_methods *meth, struct attr **attrs) { struct gui_priv *this_; - int w=792, h=547; - unsigned xid = 0; *meth=win32_gui_methods; this_=g_new0(struct gui_priv, 1); this_->nav=nav; - g_this_ = this_; - - this_->hwnd = Win32Init(); + this_->hwnd = CreateWin32Window(); SetWindowLongPtr( this_->hwnd , DWLP_USER, this_ ); - -// navit_zoom_out(this_->nav, 2, NULL); - return this_; } -extern struct graphics_priv* win32_graphics_new( struct graphics_methods *meth, struct attr **attrs); - - void plugin_init(void) { plugin_register_gui_type("win32", win32_gui_new); diff --git a/navit/projs/CodeBlocks/win32gui/win32_gui.h b/navit/projs/CodeBlocks/win32gui/win32_gui.h index 269a73c..8c763b1 100644 --- a/navit/projs/CodeBlocks/win32gui/win32_gui.h +++ b/navit/projs/CodeBlocks/win32gui/win32_gui.h @@ -2,6 +2,22 @@ #define WIN32_GUI_INCLUDED #include "coord.h" +#include "point.h" +#include "graphics.h" + +#define ID_CHILD_GFX 2000 +#define ID_CHILD_1 2001 +#define ID_CHILD_2 ID_CHILD_1 + 1 +#define ID_CHILD_3 ID_CHILD_2 + 1 +#define ID_CHILD_4 ID_CHILD_4 + 1 +#define ID_DISPLAY_ZOOMIN 8000 +#define ID_DISPLAY_ZOOMOUT 8001 + +#define ID_FILE_EXIT 9001 +#define ID_STUFF_GO 9002 + +#define _(text) gettext(text) + struct statusbar_methods; struct menu_methods; @@ -14,10 +30,33 @@ struct gui_priv { HANDLE hwnd; }; + +struct graphics_priv { + struct point p; + int width; + int height; + int library_init; + int visible; + HANDLE wnd_parent_handle; + HANDLE wnd_handle; + COLORREF bg_color; + + + void (*resize_callback)(void *data, int w, int h); + void *resize_callback_data; + void (*motion_callback)(void *data, struct point *p); + void *motion_callback_data; + void (*button_callback)(void *data, int press, int button, struct point *p); + void *button_callback_data; + enum draw_mode_num mode; +}; + struct menu_priv *gui_gtk_menubar_new(struct gui_priv *gui, struct menu_methods *meth); struct menu_priv *gui_gtk_toolbar_new(struct gui_priv *gui, struct menu_methods *meth); struct statusbar_priv *gui_gtk_statusbar_new(struct gui_priv *gui, struct statusbar_methods *meth); struct menu_priv *gui_gtk_popup_new(struct gui_priv *gui, struct menu_methods *meth); struct datawindow_priv *gui_gtk_datawindow_new(struct gui_priv *gui, char *name, struct callback *click, struct callback *close, struct datawindow_methods *meth); +struct graphics_priv* win32_graphics_new( struct graphics_methods *meth, struct attr **attrs); + #endif