mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-22 20:16:54 +03:00
Added about dialog, fixed scrolled treeview redraw.
This commit is contained in:
parent
7f92060041
commit
4f45f807f2
@ -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 \
|
||||
|
208
atari/about.c
Normal file
208
atari/about.c
Normal file
@ -0,0 +1,208 @@
|
||||
/*
|
||||
* Copyright 2013 Ole Loots <ole@monochrom.net>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <limits.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#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<content_len; i++) {
|
||||
if (content[i] == '\n') {
|
||||
cur_y += cheight;
|
||||
cur_x = area.g_x;
|
||||
} else {
|
||||
if (cur_x >= 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);
|
||||
*/
|
||||
|
||||
}
|
25
atari/about.h
Normal file
25
atari/about.h
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright 2013 Ole Loots <ole@monochrom.net>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef NS_ATARI_ABOUT_H_INCLUDED
|
||||
#define NS_ATARI_ABOUT_H_INCLUDED
|
||||
|
||||
void atari_about_show(void);
|
||||
|
||||
|
||||
#endif // NS_ATARI_ABOUT_H_INCLUDED
|
@ -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,
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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))) {
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
Binary file not shown.
@ -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 */
|
||||
|
@ -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@
|
||||
|
@ -1,3 +1,21 @@
|
||||
/*
|
||||
* Copyright 2013 Ole Loots <ole@monochrom.net>
|
||||
*
|
||||
* 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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef NS_ATARI_TOOLBAR_H
|
||||
#define NS_ATARI_TOOLBAR_H
|
||||
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user