From 4f45f807f241683480a56a99b558b4b1d0f59332 Mon Sep 17 00:00:00 2001 From: Ole Loots Date: Thu, 26 Sep 2013 01:24:49 +0200 Subject: [PATCH] Added about dialog, fixed scrolled treeview redraw. --- atari/Makefile.target | 1 + atari/about.c | 208 ++++++++++++++++++++++++++++++++++++++++++ atari/about.h | 25 +++++ atari/certview.c | 18 ++-- atari/cookies.c | 5 +- atari/deskmenu.c | 6 +- atari/gemtk/guiwin.c | 4 +- atari/history.c | 5 +- atari/hotlist.c | 24 +++-- atari/res/netsurf.rsc | Bin 34782 -> 38082 bytes atari/res/netsurf.rsh | 5 + atari/res/netsurf.rsm | 11 ++- atari/toolbar.h | 18 ++++ atari/treeview.c | 32 +++++-- atari/treeview.h | 59 +++++++++++- 15 files changed, 384 insertions(+), 37 deletions(-) create mode 100644 atari/about.c create mode 100644 atari/about.h diff --git a/atari/Makefile.target b/atari/Makefile.target index a8bc65ad8..b2530cfa7 100644 --- a/atari/Makefile.target +++ b/atari/Makefile.target @@ -75,6 +75,7 @@ LDFLAGS += -L$(GCCSDK_INSTALL_ENV)/lib # S_ATARI are sources purely for the Atari FreeMiNT build S_ATARI := \ + about.c \ bitmap.c \ clipboard.c \ ctxmenu.c \ diff --git a/atari/about.c b/atari/about.c new file mode 100644 index 000000000..f09dfb358 --- /dev/null +++ b/atari/about.c @@ -0,0 +1,208 @@ +/* + * Copyright 2013 Ole Loots + * + * This file is part of NetSurf, http://www.netsurf-browser.org/ + * + * NetSurf is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * NetSurf 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, see . + */ + +#include +#include +#include +#include +#include +#include + +#include "cflib.h" +#include "atari/misc.h" +#include "atari/plot/plot.h" +#include "atari/gemtk/gemtk.h" +#include "atari/res/netsurf.rsh" +#include "atari/about.h" + +#include "utils/testament.h" +#include "utils/useragent.h" +#include "desktop/netsurf.h" +#include "utils/nsurl.h" +#include "utils/messages.h" + + +#include "curl/curlver.h" + + +static OBJECT * about_form = NULL; +static char * infocontent; +static char version[32]; +VdiHdl vdihandle; + + +static short __CDECL about_userdraw(PARMBLK *parmblock) +{ + short pxy[8]; + short dummy; + int content_len; + char *content; + short cur_x, cur_y; + short cheight = 8, cwidth = gl_wchar; + char c[2] = {0,0}; + + /* Setup area to the full area...: */ + GRECT area = { + .g_x = parmblock->pb_x, + .g_y = parmblock->pb_y, + .g_w = parmblock->pb_w-8, + .g_h = parmblock->pb_h + }; + + /* Setup clip: */ + GRECT clip = { + .g_x = parmblock->pb_xc, + .g_y = parmblock->pb_yc, + .g_w = parmblock->pb_wc, + .g_h = parmblock->pb_hc + }; + + if(parmblock->pb_currstate == parmblock->pb_prevstate){ + + content = (char*)parmblock->pb_parm; + content_len = strlen(content); + cur_x = area.g_x; + cur_y = area.g_y; + + + if(!rc_intersect(&area, &clip)){ + return (0); + } + + pxy[0] = clip.g_x; + pxy[1] = clip.g_y; + pxy[2] = pxy[0] + clip.g_w-1; + pxy[3] = pxy[1] + clip.g_h-1; + vs_clip(vdihandle, 1, pxy); + vst_alignment(vdihandle, 0, 5, &dummy, &dummy); + vst_height(vdihandle, sys_sml_height, &dummy, &dummy, &dummy, &cheight); + vswr_mode(vdihandle, 2); + + for (int i=0; i= clip.g_x + && cur_x < (clip.g_x + clip.g_w) + && cur_y > clip.g_y + && cur_y < (clip.g_w + clip.g_h)) { + c[0] = content[i]; + v_gtext(vdihandle, cur_x, cur_y, c); + } + cur_x += cwidth; + } + } + + vs_clip(vdihandle, 0, pxy); + } + return(0); +} + +void atari_about_show(void) +{ + static USERBLK userblk; + short elem = 0; + const char * goto_url = NULL; + nserror nserr; + nsurl *url; + + vdihandle = plot_get_vdi_handle(); + + infocontent = malloc(8000); + memset(infocontent, 0, 8000); + + snprintf(infocontent, 8000, + "Netsurf : %s\n" + "Build ID : %s\n" + "Date : %s\n" + "MiNTLib : %d.%d-%d%s\n" + "GEMLib : %d.%d-%d%s\n" + "CFLib : %d.%d-%d%s\n" + "cURL : %s\n", + user_agent_string(), + WT_REVID, + WT_COMPILEDATE, + __MINTLIB_MAJOR__, __MINTLIB_MINOR__, __MINTLIB_REVISION__, + __MINTLIB_BETATAG__, + __GEMLIB_MAJOR__, __GEMLIB_MINOR__, __GEMLIB_REVISION__, + __GEMLIB_BETATAG__, + __CFLIB_MAJOR__, __CFLIB_MINOR__, __CFLIB_REVISION__, + __CFLIB_BETATAG__, + LIBCURL_VERSION); + + about_form = gemtk_obj_get_tree(ABOUT); + snprintf(version, 32, "%s%s", "NetSurf ", (char*)netsurf_version); + set_string(about_form, ABOUT_LBL_VERSION, version); + + userblk.ub_code = about_userdraw; + userblk.ub_parm = (long) infocontent; + about_form[ABOUT_CONTENT].ob_spec.userblk = &userblk; + + elem = simple_dial(about_form, 0); + switch (elem) { + case ABOUT_CREDITS: + goto_url = "about:credits"; + break; + + case ABOUT_LICENSE: + goto_url = "about:licence"; + break; + }; + + free(infocontent); + + if (goto_url != NULL) { + nserr = nsurl_create(goto_url, &url); + if (nserr == NSERROR_OK) { + nserr = browser_window_create(BROWSER_WINDOW_VERIFIABLE | + BROWSER_WINDOW_HISTORY, + url, + NULL, + NULL, + NULL); + nsurl_unref(url); + } + if (nserr != NSERROR_OK) { + warn_user(messages_get_errorcode(nserr), 0); + } + } +/* + dlg = open_mdial(about_form, 0); + do { + elem = do_mdial(dlg); + printf ("elem: %d\n", elem); + switch (elem) { + case ABOUT_OK: + close_dlg = true; + break; + + case ABOUT_CREDITS: + close_dlg = true; + break; + + case ABOUT_LICENSE: + close_dlg = true; + break; + } + } while (close_dlg == false); + + close_mdial(dlg); +*/ + +} diff --git a/atari/about.h b/atari/about.h new file mode 100644 index 000000000..db18250c5 --- /dev/null +++ b/atari/about.h @@ -0,0 +1,25 @@ +/* + * Copyright 2013 Ole Loots + * + * This file is part of NetSurf, http://www.netsurf-browser.org/ + * + * NetSurf is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * NetSurf 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, see . + */ + +#ifndef NS_ATARI_ABOUT_H_INCLUDED +#define NS_ATARI_ABOUT_H_INCLUDED + +void atari_about_show(void); + + +#endif // NS_ATARI_ABOUT_H_INCLUDED diff --git a/atari/certview.c b/atari/certview.c index bdc2a8247..6877529d8 100644 --- a/atari/certview.c +++ b/atari/certview.c @@ -59,12 +59,12 @@ static void atari_sslcert_viewer_draw(struct core_window *cw, int x, static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]); static struct atari_treeview_callbacks atari_sslcert_viewer_treeview_callbacks = { - .init_phase2 = atari_sslcert_viewer_init_phase2, - .finish = atari_sslcert_viewer_finish, - .draw = atari_sslcert_viewer_draw, - .keypress = atari_sslcert_viewer_keypress, - .mouse_action = atari_sslcert_viewer_mouse_action, - .gemtk_user_func = handle_event + .init_phase2 = atari_sslcert_viewer_init_phase2, + .finish = atari_sslcert_viewer_finish, + .draw = atari_sslcert_viewer_draw, + .keypress = atari_sslcert_viewer_keypress, + .mouse_action = atari_sslcert_viewer_mouse_action, + .gemtk_user_func = handle_event }; /* static functions */ @@ -158,6 +158,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) struct atari_sslcert_viewer_s *cvwin = NULL; char *cur_url = NULL; char *cur_title = NULL; + short retval = 0; OBJECT *toolbar; LOG(("")); @@ -191,7 +192,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) atari_treeview_get_grect(tv, TREEVIEW_AREA_TOOLBAR, &tb_area); evnt_timer(150); gemtk_wm_exec_redraw(gemtk_win, &tb_area); - + retval = 1; break; case WM_CLOSED: @@ -207,11 +208,14 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) sslcert_viewer_reject(cvwin->ssl_session_data); } atari_sslcert_viewer_destroy(cvwin); + retval = 1; break; default: break; } } + + return(retval); } static void atari_sslcert_viewer_init(struct atari_sslcert_viewer_s * cvwin, diff --git a/atari/cookies.c b/atari/cookies.c index 4530a2177..d05707559 100644 --- a/atari/cookies.c +++ b/atari/cookies.c @@ -121,6 +121,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) struct gui_window * gw; char *cur_url = NULL; char *cur_title = NULL; + short retval = 0; LOG(("")); @@ -150,14 +151,14 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) case WM_CLOSED: atari_cookie_manager_close(); + retval = 1; break; default: break; } } - // TODO: implement selectable objects in toolbar API: - // ObjcChange( OC_TOOLBAR, win, buff[4], ~SELECTED, OC_MSG ); + return(retval); } void atari_cookie_manager_init(void) diff --git a/atari/deskmenu.c b/atari/deskmenu.c index eb1192b03..183387e15 100644 --- a/atari/deskmenu.c +++ b/atari/deskmenu.c @@ -19,6 +19,7 @@ #include "atari/misc.h" #include "atari/gui.h" #include "atari/findfile.h" +#include "atari/about.h" #include "atari/rootwin.h" @@ -150,7 +151,8 @@ static void __CDECL evnt_menu(WINDOW * win, short buff[8]) */ static void __CDECL menu_about(short item, short title, void *data) -{ +{ + /* nsurl *url; nserror error; char buf[PATH_MAX]; @@ -173,6 +175,8 @@ static void __CDECL menu_about(short item, short title, void *data) if (error != NSERROR_OK) { warn_user(messages_get_errorcode(error), 0); } + */ + atari_about_show(); } static void __CDECL menu_new_win(short item, short title, void *data) diff --git a/atari/gemtk/guiwin.c b/atari/gemtk/guiwin.c index b4020e0d9..18d873c7d 100644 --- a/atari/gemtk/guiwin.c +++ b/atari/gemtk/guiwin.c @@ -597,7 +597,9 @@ short gemtk_wm_dispatch_event(EVMULT_IN *ev_in, EVMULT_OUT *ev_out, short msg[8] case AP_TFAIL: dest = gemtk_wm_find(msg[3]); if (dest) { - DEBUG_PRINT(("Found WM_ dest: %p (%d), flags: %d, cb: %p\n", dest, dest->handle, dest->flags, dest->handler_func)); + DEBUG_PRINT(("Found WM_ dest: %p (%d), flags: %d, cb: %p\n", + dest, dest->handle, dest->flags, + dest->handler_func)); if (dest->flags&GEMTK_WM_FLAG_PREPROC_WM) { retval = preproc_wm(dest, ev_out, msg); if(((retval == 0)||(dest->flags&GEMTK_WM_FLAG_RECV_PREPROC_WM))) { diff --git a/atari/history.c b/atari/history.c index 487030f65..90ed0b8ae 100644 --- a/atari/history.c +++ b/atari/history.c @@ -122,6 +122,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) struct gui_window * gw; char *cur_url = NULL; char *cur_title = NULL; + short retval = 0; LOG(("")); @@ -173,14 +174,14 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) case WM_CLOSED: atari_global_history_close(); + retval = 1; break; default: break; } } - // TODO: implement selectable objects in toolbar API: - // ObjcChange( OC_TOOLBAR, win, buff[4], ~SELECTED, OC_MSG ); + return(retval); } diff --git a/atari/hotlist.c b/atari/hotlist.c index 95b169390..1644935f5 100644 --- a/atari/hotlist.c +++ b/atari/hotlist.c @@ -94,8 +94,13 @@ static void atari_hotlist_draw(struct core_window *cw, int x, static void atari_hotlist_keypress(struct core_window *cw, uint32_t ucs4) { + GUIWIN *gemtk_win; + GRECT area; LOG(("ucs4: %lu\n", ucs4)); hotlist_keypress(ucs4); + gemtk_win = atari_treeview_get_gemtk_window(cw); + atari_treeview_get_grect(cw, TREEVIEW_AREA_CONTENT, &area); + //gemtk_wm_exec_redraw(gemtk_win, &area); } static void atari_hotlist_mouse_action(struct core_window *cw, @@ -115,14 +120,15 @@ static void atari_hotlist_mouse_action(struct core_window *cw, static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) { - struct atari_treeview_window *tv=NULL; - struct core_window *cw; - GRECT tb_area; - GUIWIN * gemtk_win; - struct gui_window * gw; char *cur_url = NULL; char *cur_title = NULL; + short retval = 0; + struct atari_treeview_window *tv = NULL; + struct core_window *cw; + struct gui_window * gw; OBJECT *toolbar; + GRECT tb_area; + GUIWIN * gemtk_win; LOG(("")); @@ -160,9 +166,6 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) case TOOLBAR_HOTLIST_DELETE: hotlist_keypress(KEY_DELETE_LEFT); - // TODO: check if redraw is really required, - // - implement treeview getter for the gemtk - // handle. break; case TOOLBAR_HOTLIST_EDIT: @@ -176,18 +179,19 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) atari_treeview_get_grect(cw, TREEVIEW_AREA_TOOLBAR, &tb_area); evnt_timer(150); gemtk_wm_exec_redraw(gemtk_win, &tb_area); + retval = 1; break; case WM_CLOSED: atari_hotlist_close(); + retval = 1; break; default: break; } } - // TODO: implement selectable objects in toolbar API: - // ObjcChange( OC_TOOLBAR, win, buff[4], ~SELECTED, OC_MSG ); + return(retval); } diff --git a/atari/res/netsurf.rsc b/atari/res/netsurf.rsc index b5ea38bbecb258d9f435b9fa0bd65cdbe5f7e00e..37cdcc267f9dfc6edcdeaa7b9c07261de98200e8 100755 GIT binary patch delta 8324 zcmd^^dw7#op2vTAlO~~*CWYQeLzA}jLfVE3av2mG6oFOLf`lq!TO8_Oacx9yR^)xr zs^~Z~g(D;Cj8k3Il3L2hVi_(?RMz!jUAN;y!Q0S?>!?L+9WB&e^6vMXH>t#NcJ$e2 zpZ#Os^6SYtpL6}4?|aU#;nc6BS9ePj$v|5(d``3TT!t^h=g!RV(WN>EjUyMCNIa8I zZJRiM!d@av2a&abX#4^q+Z#j~R#*Ydvu*2ADa*JmlxoXLqS0t&((A~m;vuKjNme?u z>VO?I9tH8h<`_JQc{sk9+`tLI(g-#aWqFuSH_w(eUv!pAI!YAS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xm1twmimKb~^`0aJN@1yO9@Wjw&kYFF?*GqO>I#jegFam zWqaMAQ+5fbRKqC-D_>STT{va($`S8e*^^oWr%Z-Zew=X1s)SR-_;Lcv5f{5r@pe?1 zt_82eGiTk|P_WaiykfKI9(&So-}f$M&z()`+^J^GrUmipE&q%^e7fxndvQg-^K0wV zwEp9#oF7@OSutz2=b;O&o;Bx;&&uX+XdORi@4WoT@H%&#T2y@)@*!v{=1a&wJ1*t; zasq1*7vKJzQu+^?t~E7AdjBT9;DFv-b%ExML2|6=HzEkxIkEFb#QKWTKHs%;`JQEL z^CwNI^}FiS`n7u2Yul;%wS)(bOl9Tgi#xYZ8t1qo;AouSI4y6dY(lW}4xNR(x;FGKOSke1c_tiOl?V@i*4FZOF`R ziOj4;W^P?AGxNv^WMihg^t!Z z;suz%)y6P$wV8JC+QV~S+W+?Y3;k^?tiJc!taJUxt-g;e>lE%yXV*X;vaC7RTK)5? ztV68@XWnkltg;$h$Ir%7jvq4>>sF$l?ZX{Mq~E{ucqF>OLePV?{7{{WOXk}d!M diff --git a/atari/res/netsurf.rsh b/atari/res/netsurf.rsh index 03968410a..54c88d66f 100755 --- a/atari/res/netsurf.rsh +++ b/atari/res/netsurf.rsh @@ -111,6 +111,11 @@ #define DOWNLOAD_CB_CLOSE_RDY 9 /* BOXCHAR in tree DOWNLOAD */ #define ABOUT 10 /* form/dial */ +#define ABOUT_LBL_VERSION 1 /* TEXT in tree ABOUT */ +#define ABOUT_OK 4 /* BUTTON in tree ABOUT */ +#define ABOUT_CONTENT 6 /* USERDEF in tree ABOUT */ +#define ABOUT_CREDITS 7 /* BUTTON in tree ABOUT */ +#define ABOUT_LICENSE 8 /* BUTTON in tree ABOUT */ #define POP_CTX 11 /* form/dial */ #define POP_CTX_CUT_SEL 1 /* TEXT in tree POP_CTX */ diff --git a/atari/res/netsurf.rsm b/atari/res/netsurf.rsm index e279d4a3b..75a7b4667 100755 --- a/atari/res/netsurf.rsm +++ b/atari/res/netsurf.rsm @@ -3,7 +3,7 @@ ResourceMaster v3.65 #N 99@32@AZAaza___ _@AZAaza090___ _@@_@ #FoC-Header@rsm2out@C-Header@rsh@@@[C-Header@0@ #R 0@0@1@1@2@1@ -#M 20010100@0@7728@646@ +#M 20010100@0@7728@652@ #T 0@1@MAINMENU@@64@@ #O 4@32@T_FILE@@ #O 5@32@T_EDIT@@ @@ -103,7 +103,12 @@ ResourceMaster v3.65 #O 7@21@LBL_PERCENT@@ #O 8@21@LBL_SPEED@@ #O 9@27@CB_CLOSE_RDY@@ -#T 10@2@ABOUT@@2@@ +#T 10@2@ABOUT@@9@@ +#O 1@21@LBL_VERSION@@ +#O 4@26@OK@@ +#O 6@24@CONTENT@@ +#O 7@26@CREDITS@@ +#O 8@26@LICENSE@@ #T 11@2@POP_CTX@@12@@ #O 1@21@CUT_SEL@@ #O 2@21@COPY_SEL@@ @@ -201,4 +206,4 @@ ResourceMaster v3.65 #T 17@2@TOOLBAR_HISTORY@@1@@ #T 18@2@TOOLBAR_SSL_CERT@@2@@ #O 1@26@TRUSTED@@ -#c 26341@ +#c 28820@ diff --git a/atari/toolbar.h b/atari/toolbar.h index 3116aa9d6..16c4eb220 100644 --- a/atari/toolbar.h +++ b/atari/toolbar.h @@ -1,3 +1,21 @@ +/* + * Copyright 2013 Ole Loots + * + * This file is part of NetSurf, http://www.netsurf-browser.org/ + * + * NetSurf is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * NetSurf 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, see . + */ + #ifndef NS_ATARI_TOOLBAR_H #define NS_ATARI_TOOLBAR_H diff --git a/atari/treeview.c b/atari/treeview.c index b4aafa9e8..fe92a02b3 100644 --- a/atari/treeview.c +++ b/atari/treeview.c @@ -158,6 +158,7 @@ static void atari_treeview_dump_info(struct atari_treeview_window *tv, void atari_treeview_redraw(struct core_window *cw) { struct atari_treeview_window *tv = (struct atari_treeview_window *)cw; + short pxy[4]; if (tv != NULL && tv->is_open) { if( tv->redraw && ((plot_get_flags() & PLOT_FLAG_OFFSCREEN) == 0) ) { @@ -170,6 +171,17 @@ void atari_treeview_redraw(struct core_window *cw) gemtk_wm_get_grect(tv->window, GEMTK_WM_AREA_CONTENT, &work); slid = gemtk_wm_get_scroll_info(tv->window); +// // Debug code: this 3 lines help to inspect the redraw +// // areas... +// pxy[0] = work.g_x; +// pxy[1] = work.g_y; +// pxy[2] = pxy[0] + work.g_w-1; +// pxy[3] = pxy[1] + work.g_h-1; +// +// vsf_color(plot_get_vdi_handle(), 0); +// v_bar(plot_get_vdi_handle(), (short*)&pxy); +// evnt_timer(500); + struct redraw_context ctx = { .interactive = true, .background_images = true, @@ -183,8 +195,6 @@ void atari_treeview_redraw(struct core_window *cw) &todo[0], &todo[1], &todo[2], &todo[3] )!=0 ) { while (todo[2] && todo[3]) { - short pxy[4]; - if(!rc_intersect(&work, (GRECT*)&todo)){ if (wind_get(handle, WF_NEXTXYWH, &todo[0], &todo[1], &todo[2], &todo[3])==0) { @@ -200,11 +210,11 @@ void atari_treeview_redraw(struct core_window *cw) // Debug code: this 3 lines help to inspect the redraw // areas... - /* - vsf_color(plot_get_vdi_handle(), 3); - v_bar(plot_get_vdi_handle(), (short*)&pxy); - evnt_timer(500); - */ + +// vsf_color(plot_get_vdi_handle(), 3); +// v_bar(plot_get_vdi_handle(), (short*)&pxy); +// evnt_timer(500); + /* convert screen to treeview coords: */ todo[0] = todo[0] - work.g_x ;//+ slid->x_pos*slid->x_unit_px; @@ -390,6 +400,7 @@ void atari_treeview_redraw(struct core_window *cw) */ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) { + short retval = 0; struct atari_treeview_window *tv = (struct atari_treeview_window *) gemtk_wm_get_user_data(win); struct core_window *cw = (struct core_window *)tv; @@ -419,7 +430,8 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8]) tv->io->gemtk_user_func(win, ev_out, msg); } - return(0); + // TODO: evaluate return values of event handler functions and pass them on: + return(retval); } @@ -746,13 +758,15 @@ void atari_treeview_redraw_request(struct core_window *cw, const struct rect *r) RECT_TO_GRECT(r, &area) + assert(tv); + slid = gemtk_wm_get_scroll_info(tv->window); //dbg_rect("redraw rect request", r); // treeview redraw is always full window width: area.g_x = 0; - area.g_w = area.g_w; + area.g_w = 8000; // but vertical redraw region is clipped: area.g_y = r->y0 - (slid->y_pos*slid->y_unit_px); area.g_h = r->y1 - r->y0; diff --git a/atari/treeview.h b/atari/treeview.h index fb4e659a0..4412b1dfc 100644 --- a/atari/treeview.h +++ b/atari/treeview.h @@ -23,6 +23,11 @@ #include "atari/gui.h" #include "atari/gemtk/gemtk.h" +/** + * Default AES Window widgets for a treeview window, can be passed to + * atari_treeview_create as the flags parameter to have an standardized treeview + * window. + */ #define ATARI_TREEVIEW_WIDGETS (CLOSER | MOVER | SIZER| NAME | FULLER | \ SMALLER | VSLIDE | HSLIDE | UPARROW | DNARROW \ | LFARROW | RTARROW) @@ -36,9 +41,14 @@ enum treeview_area_e { struct core_window; struct atari_treeview_window; -typedef struct atari_treeview_window *ATARI_TREEVIEW_PTR; +/** + * The atari treeview implementation wraps the core_window callbacks + * So that it can process parameters and then it passes the event further + * To the specific implementation window. + * These callbacks must be implemented by any atari treeview window. + */ -// TODO: add drag_status callback!! +// TODO: add drag_status callback typedef nserror (*atari_treeview_init2_callback)(struct core_window *cw, struct core_window_callback_table * default_callbacks); typedef void (*atari_treeview_finish_callback)(struct core_window *cw); @@ -60,20 +70,65 @@ struct atari_treeview_callbacks { gemtk_wm_event_handler_f gemtk_user_func; }; +/** + * Initalize an window to be an treeview window. + * +*/ struct core_window *atari_treeview_create(GUIWIN *win, struct atari_treeview_callbacks * callbacks, void * user_data, uint32_t flags); +/** + * Free the Treeview, but not the gemtk window used for the treeview. +*/ void atari_treeview_delete(struct core_window *cw); + +/** + * Open the treeview window. + */ void atari_treeview_open(struct core_window *cw, GRECT *pos); + +/** + * Returns the window "open" state. +*/ bool atari_treeview_is_open(struct core_window *cw); + +/** + * Closes (hides) the treeview window. +*/ void atari_treeview_close(struct core_window *cw); + +/** + * Get the window manager window handle + */ + GUIWIN * atari_treeview_get_gemtk_window(struct core_window *cw); + +/** + * Get an specific area inside the window. +*/ void atari_treeview_get_grect(struct core_window *cw, enum treeview_area_e mode, GRECT *dest); + +/** + * Process all pending redraw requests for a single treeview + */ void atari_treeview_redraw(struct core_window *cw); + +/** + * Attach arbitary user data to the treeview. +*/ void atari_treeview_set_user_data(struct core_window *cw, void *user_data_ptr); + +/** + * Return the arbitary user data set by atari_treeview_set_user_data() + */ void *atari_treeview_get_user_data(struct core_window *cw); + +/** + * Process all redraw request of all open Treeview windows +*/ void atari_treeview_flush_redraws(void); + #endif //NSATARI_TREEVIEW_H