summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOle Loots <ole@monochrom.net>2012-11-21 02:14:22 +0100
committerOle Loots <ole@monochrom.net>2012-11-21 02:14:22 +0100
commit0672d5e2c9e66fc12311ad41a566e56cee30f7e3 (patch)
treea353a52c8a246f632d2f4e432b0c53a8d2d9e8fd
parent7e94f32e4c99ced99ab4efaef1e56ad96430fb40 (diff)
downloadnetsurf-0672d5e2c9e66fc12311ad41a566e56cee30f7e3.tar.gz
netsurf-0672d5e2c9e66fc12311ad41a566e56cee30f7e3.tar.bz2
Implemented scroll handling in gemtk.
-rw-r--r--atari/gemtk/gemtk.h72
-rw-r--r--atari/gemtk/guiwin.c258
-rw-r--r--atari/gemtk/guiwin.h3
-rwxr-xr-xatari/res/netsurf.rscbin35768 -> 35740 bytes
-rwxr-xr-xatari/res/netsurf.rsh4
-rwxr-xr-xatari/res/netsurf.rsm9
-rwxr-xr-xatari/treeview.c873
7 files changed, 669 insertions, 550 deletions
diff --git a/atari/gemtk/gemtk.h b/atari/gemtk/gemtk.h
index 412871598..51844519f 100644
--- a/atari/gemtk/gemtk.h
+++ b/atari/gemtk/gemtk.h
@@ -1,22 +1,23 @@
-#ifndef GEMTK_H_INCLUDED
-#define GEMTK_H_INCLUDED
+#ifndef GEMTK_H_INCLUDED
+#define GEMTK_H_INCLUDED
#include <gem.h>
#include <mint/osbind.h>
#include <mint/cookie.h>
-#include <stdint.h>
-
-/* System type detection added by [GS] */
+#include <stdint.h>
+#include <stdbool.h>
+
+/* System type detection added by [GS] */
/* detect the system type, AES + kernel */
-#define SYS_TOS 0x0001
-#define SYS_MAGIC 0x0002
-#define SYS_MINT 0x0004
-#define SYS_GENEVA 0x0010
-#define SYS_NAES 0x0020
-#define SYS_XAAES 0x0040
-#define sys_type() (_systype_v ? _systype_v : _systype())
-#define sys_MAGIC() ((sys_type() & SYS_MAGIC) != 0)
-#define sys_NAES() ((sys_type() & SYS_NAES) != 0)
+#define SYS_TOS 0x0001
+#define SYS_MAGIC 0x0002
+#define SYS_MINT 0x0004
+#define SYS_GENEVA 0x0010
+#define SYS_NAES 0x0020
+#define SYS_XAAES 0x0040
+#define sys_type() (_systype_v ? _systype_v : _systype())
+#define sys_MAGIC() ((sys_type() & SYS_MAGIC) != 0)
+#define sys_NAES() ((sys_type() & SYS_NAES) != 0)
#define sys_XAAES() ((sys_type() & SYS_XAAES) != 0)
#define TOS4VER 0x03300 /* this is assumed to be the last single tasking OS */
@@ -29,20 +30,20 @@ extern unsigned short _systype_v;
unsigned short _systype (void);
OBJECT *get_tree( int idx );
-/*
-* MultiTOS Drag&Drop
-*/
-short ddcreate(short *pipe);
-short ddmessage(short apid, short fd, short winid, short mx, short my, short kstate, short pipename);
-short ddrexts(short fd, char *exts);
-short ddstry(short fd, char *ext, char *text, char *name, long size);
-void ddclose(short fd);
-void ddgetsig(long *oldsig);
-void ddsetsig(long oldsig);
-short ddopen(short ddnam, char ddmsg);
-short ddsexts(short fd, char *exts);
-short ddrtry(short fd, char *name, char *file, char *whichext, long *size);
-short ddreply(short fd, char ack);
+/*
+* MultiTOS Drag&Drop
+*/
+short ddcreate(short *pipe);
+short ddmessage(short apid, short fd, short winid, short mx, short my, short kstate, short pipename);
+short ddrexts(short fd, char *exts);
+short ddstry(short fd, char *ext, char *text, char *name, long size);
+void ddclose(short fd);
+void ddgetsig(long *oldsig);
+void ddsetsig(long oldsig);
+short ddopen(short ddnam, char ddmsg);
+short ddsexts(short fd, char *exts);
+short ddrtry(short fd, char *name, char *file, char *whichext, long *size);
+short ddreply(short fd, char ack);
/*
Message box
@@ -61,8 +62,12 @@ short msg_box_show(short type, const char * msg);
#define GW_FLAG_CUSTOM_TOOLBAR 0x08 // no internal toolbar handling
#define GW_FLAG_CUSTOM_SCROLLING 0x10 // no internal scroller handling
-#define GW_STATUS_ICONIFIED 0x01
-#define GW_STATUS_SHADED 0x02
+#define GW_STATUS_ICONIFIED 0x01
+#define GW_STATUS_SHADED 0x02
+
+#define GUIWIN_VSLIDER 0x01
+#define GUIWIN_HSLIDER 0x02
+#define GUIWIN_VH_SLIDER 0x03
struct gui_window_s;
typedef struct gui_window_s GUIWIN;
@@ -101,9 +106,10 @@ void guiwin_set_event_handler(GUIWIN *win,guiwin_event_handler_f cb);
void guiwin_set_user_data(GUIWIN *win, void *data);
void *guiwin_get_user_data(GUIWIN *win);
struct guiwin_scroll_info_s * guiwin_get_scroll_info(GUIWIN *win);
-void guiwin_update_slider(GUIWIN *win, short mode);
+bool guiwin_update_slider(GUIWIN *win, short mode);
void guiwin_send_redraw(GUIWIN *win, GRECT *area);
VdiHdl guiwin_get_vdi_handle(GUIWIN *win);
+bool guiwin_has_intersection(GUIWIN *win, GRECT *work);
@@ -123,5 +129,5 @@ VdiHdl guiwin_get_vdi_handle(GUIWIN *win);
#ifndef MIN
#define MIN(_a,_b) ((_a<_b) ? _a : _b)
#endif
-
-#endif // GEMTK_H_INCLUDED
+
+#endif // GEMTK_H_INCLUDED
diff --git a/atari/gemtk/guiwin.c b/atari/gemtk/guiwin.c
index e055abae9..026b18c8a 100644
--- a/atari/gemtk/guiwin.c
+++ b/atari/gemtk/guiwin.c
@@ -8,7 +8,7 @@
#include <mt_gem.h>
#include "gemtk.h"
-//#define DEBUG_PRINT(x) printf x
+//#define DEBUG_PRINT(x) printf x
#define DEBUG_PRINT(x)
struct gui_window_s {
@@ -27,30 +27,37 @@ static GUIWIN * winlist;
static VdiHdl v_vdi_h = -1;
static short work_out[57];
-static void move_screen( int vhandle, GRECT *screen, int dx, int dy) {
- INT16 xy[ 8];
- long dum = 0L;
- GRECT g;
-
- /* get intersection with screen area */
- wind_get_grect(0, WF_CURRXYWH, &g);
- rc_intersect(&g, screen);
- xy[ 0] = screen -> g_x;
- xy[ 1] = screen -> g_y;
- xy[ 2] = xy[ 0] + screen -> g_w - 1;
- xy[ 3] = xy[ 1] + screen -> g_h - 1;
- xy[ 4] = xy[ 0] + dx;
- xy[ 5] = xy[ 1] + dy;
- xy[ 6] = xy[ 2] + dx;
- xy[ 7] = xy[ 3] + dy;
- vro_cpyfm( vhandle, S_ONLY, xy, (MFDB *)&dum, (MFDB *)&dum);
+static void move_rect(GRECT *rect, int dx, int dy)
+{
+ INT16 xy[ 8];
+ long dum = 0L;
+ GRECT g;
+
+ while( !wind_update(BEG_UPDATE));
+ graf_mouse(M_OFF, 0L);
+
+ /* get intersection with screen area */
+ wind_get_grect(0, WF_CURRXYWH, &g);
+ rc_intersect(&g, rect);
+ xy[0] = rect->g_x;
+ xy[1] = rect->g_y;
+ xy[2] = xy[0] + rect->g_w-1;
+ xy[3] = xy[1] + rect->g_h-1;
+ xy[4] = xy[0] + dx;
+ xy[5] = xy[1] + dy;
+ xy[6] = xy[2] + dx;
+ xy[7] = xy[3] + dy;
+ vro_cpyfm(v_vdi_h, S_ONLY, xy, (MFDB *)&dum, (MFDB *)&dum);
+
+ graf_mouse(M_ON, 0L);
+ wind_update(END_UPDATE);
}
static short preproc_wm(GUIWIN * gw, EVMULT_OUT *ev_out, short msg[8])
{
GRECT g, g_ro, tb_area, tb_area_ro;
short retval = 1;
- int val;
+ int val = 1;
struct guiwin_scroll_info_s *slid;
switch(msg[0]) {
@@ -63,49 +70,104 @@ static short preproc_wm(GUIWIN * gw, EVMULT_OUT *ev_out, short msg[8])
g_ro = g;
switch(msg[4]) {
- case WA_DNPAGE:
- val = g.g_h;
- // complete redraw
- // increase scroll val by page size...
- break;
+ case WA_UPPAGE:
+ val = g.g_h/slid->y_unit_px;
+ slid->y_pos = MAX(0, slid->y_pos-val);
+ guiwin_update_slider(gw, GUIWIN_VSLIDER);
+ guiwin_send_redraw(gw, &g_ro);
+ break;
case WA_UPLINE:
slid->y_pos = MAX(0, slid->y_pos-1);
- // partial redraw
+ guiwin_update_slider(gw, GUIWIN_VSLIDER);
+ if(!guiwin_has_intersection(gw, NULL)){
+ // blit screen area:
+ g.g_h -= slid->y_unit_px;
+ move_rect(&g, 0, +slid->y_unit_px);
+ g.g_y = g_ro.g_y;
+ g.g_h = slid->y_unit_px;
+ // redraw new content:
+ guiwin_send_redraw(gw, &g);
+ } else {
+ // let the draw implementation handle intersections:
+ guiwin_send_redraw(gw, &g_ro);
+ }
break;
- case WA_DNLINE:
- slid->y_pos = MIN(slid->y_pos_max, slid->y_pos+1);
- g.g_y += slid->y_unit_px;
- g.g_h -= slid->y_unit_px;
- move_screen(v_vdi_h, &g, 0, -slid->y_unit_px);
- g.g_y = g_ro.g_y + g_ro.g_h - slid->y_unit_px;
- g.g_h = slid->y_unit_px;
- guiwin_send_redraw(gw, &g);
- // move content up by unit size and sched redraw for the
- // bottom 16 px
- // partial redraw
+ case WA_DNPAGE:
+ val = g.g_h/slid->y_unit_px;
+ slid->y_pos = MIN(slid->y_pos_max, slid->y_pos+val);
+ guiwin_update_slider(gw, GUIWIN_VSLIDER);
+ guiwin_send_redraw(gw, &g_ro);
break;
- case WA_LFPAGE:
- // complete redraw
- // increase scroll val by page size...
+ case WA_DNLINE:
+ slid->y_pos = MIN(slid->y_pos_max, slid->y_pos+1);
+ guiwin_update_slider(gw, GUIWIN_VSLIDER);
+ if(!guiwin_has_intersection(gw, NULL)){
+ // blit screen area:
+ g.g_y += slid->y_unit_px;
+ g.g_h -= slid->y_unit_px;
+ move_rect(&g, 0, -slid->y_unit_px);
+ g.g_y = g_ro.g_y + g_ro.g_h - slid->y_unit_px;
+ g.g_h = slid->y_unit_px;
+ // redraw new content:
+ guiwin_send_redraw(gw, &g);
+ } else {
+ // let the draw implementation handle intersections:
+ guiwin_send_redraw(gw, &g_ro);
+ }
break;
- case WA_RTPAGE:
- // complete redraw
- // increase scroll val by page size...
+ case WA_LFPAGE:
+ val = g.g_w/slid->x_unit_px;
+ slid->x_pos = MAX(0, slid->x_pos-val);
+ guiwin_update_slider(gw, GUIWIN_HSLIDER);
+ guiwin_send_redraw(gw, &g_ro);
break;
case WA_LFLINE:
slid->x_pos = MAX(0, slid->x_pos-1);
+ guiwin_update_slider(gw, GUIWIN_HSLIDER);
+ if(!guiwin_has_intersection(gw, NULL)){
+ // blit screen area:
+ g.g_x -= slid->x_unit_px;
+ move_rect(&g, 0, +slid->x_unit_px);
+ // redraw new content:
+ g.g_x = g_ro.g_x;
+ g.g_w = slid->x_unit_px;
+ guiwin_send_redraw(gw, &g);
+ } else {
+ // let the draw implementation handle intersections:
+ guiwin_send_redraw(gw, &g_ro);
+ }
// partial redraw
break;
+ case WA_RTPAGE:
+ val = g.g_w/slid->x_unit_px;
+ slid->x_pos = MIN(slid->x_pos_max, slid->x_pos+val);
+ guiwin_update_slider(gw, GUIWIN_HSLIDER);
+ guiwin_send_redraw(gw, &g_ro);
+ break;
+
case WA_RTLINE:
slid->x_pos = MIN(slid->x_pos_max, slid->x_pos+1);
- // partial redraw
+ guiwin_update_slider(gw, GUIWIN_HSLIDER);
+ if(!guiwin_has_intersection(gw, NULL)){
+ // blit remaining area:
+ g.g_x += slid->x_unit_px;
+ g.g_w -= slid->y_unit_px;
+ move_rect(&g, 0, -slid->x_unit_px);
+ // redraw new content:
+ g.g_x = g_ro.g_x + g_ro.g_w - slid->x_unit_px;
+ g.g_h = slid->x_unit_px;
+ guiwin_send_redraw(gw, &g);
+ } else {
+ // let the draw implementation handle intersections:
+ guiwin_send_redraw(gw, &g_ro);
+ }
break;
default:
@@ -127,11 +189,21 @@ static short preproc_wm(GUIWIN * gw, EVMULT_OUT *ev_out, short msg[8])
case WM_REPOSED:
wind_get_grect(gw->handle, WF_CURRXYWH, &g);
wind_set(gw->handle, WF_CURRXYWH, g.g_x, g.g_y, msg[6], msg[7]);
+ if((gw->flags & GW_FLAG_CUSTOM_SCROLLING) == 0) {
+ if(guiwin_update_slider(gw, GUIWIN_VH_SLIDER)){
+ guiwin_send_redraw(gw, NULL);
+ }
+ }
break;
case WM_FULLED:
wind_get_grect(gw->handle, WF_FULLXYWH, &g);
wind_set_grect(gw->handle, WF_CURRXYWH, &g);
+ if((gw->flags & GW_FLAG_CUSTOM_SCROLLING) == 0) {
+ if(guiwin_update_slider(gw, GUIWIN_VH_SLIDER)){
+ guiwin_send_redraw(gw, NULL);
+ }
+ }
break;
case WM_ICONIFY:
@@ -157,16 +229,22 @@ static short preproc_wm(GUIWIN * gw, EVMULT_OUT *ev_out, short msg[8])
guiwin_get_grect(gw, GUIWIN_AREA_TOOLBAR, &tb_area_ro);
tb_area = tb_area_ro;
if(rc_intersect((GRECT*)&msg[4], &tb_area)) {
+
+ gw->toolbar[gw->toolbar_idx].ob_x = tb_area_ro.g_x;
+ gw->toolbar[gw->toolbar_idx].ob_width = tb_area_ro.g_w;
+ gw->toolbar[gw->toolbar_idx].ob_y = tb_area_ro.g_y;
+ gw->toolbar[gw->toolbar_idx].ob_height = tb_area_ro.g_h;
+
wind_get_grect(gw->handle, WF_FIRSTXYWH, &g);
while (g.g_h > 0 || g.g_w > 0) {
- gw->toolbar[gw->toolbar_idx].ob_x = tb_area_ro.g_x;
- gw->toolbar[gw->toolbar_idx].ob_width = tb_area_ro.g_w;
- gw->toolbar[gw->toolbar_idx].ob_y = tb_area_ro.g_y;
- gw->toolbar[gw->toolbar_idx].ob_height = tb_area_ro.g_h;
- objc_draw(gw->toolbar, gw->toolbar_idx, 8, g.g_x, g.g_y,
- g.g_w, g.g_h);
+ if(rc_intersect(&tb_area_ro, &g)) {
+ objc_draw(gw->toolbar, gw->toolbar_idx, 8, g.g_x, g.g_y,
+ g.g_w, g.g_h);
+
+ }
wind_get_grect(gw->handle, WF_NEXTXYWH, &g);
}
+
}
}
break;
@@ -174,7 +252,9 @@ static short preproc_wm(GUIWIN * gw, EVMULT_OUT *ev_out, short msg[8])
default:
retval = 0;
break;
+
}
+
return(retval);
}
@@ -391,46 +471,59 @@ void guiwin_get_grect(GUIWIN *win, enum guwin_area_e mode, GRECT *dest)
}
}
-void guiwin_update_slider(GUIWIN *win, short mode)
+bool guiwin_update_slider(GUIWIN *win, short mode)
{
GRECT viewport;
struct guiwin_scroll_info_s * slid;
unsigned long size, pos;
+ int old_x, old_y;
short handle = guiwin_get_handle(win);
guiwin_get_grect(win, GUIWIN_AREA_CONTENT, &viewport);
slid = guiwin_get_scroll_info(win);
- if((mode & 1) && (slid->y_unit_px > 0)) {
+ old_x = slid->x_pos;
+ old_y = slid->y_pos;
+
+ if((mode & GUIWIN_VSLIDER) && (slid->y_unit_px > 0)) {
if ( slid->y_pos_max < (long)viewport.g_h/slid->y_unit_px)
size = 1000L;
else
- size = MAX( 50L, (unsigned long)viewport.g_h*1000L/(unsigned long)(slid->y_unit_px*slid->y_pos_max));
+ size = MAX( 50L, (unsigned long)viewport.g_h*1000L/
+ (unsigned long)(slid->y_unit_px*slid->y_pos_max));
wind_set(handle, WF_VSLSIZE, (int)size, 0, 0, 0);
if (slid->y_pos_max > (long)viewport.g_h/slid->y_unit_px) {
- pos = (unsigned long)slid->y_pos *1000L/(unsigned long)(slid->y_pos_max-viewport.g_h/slid->y_unit_px);
+ pos = (unsigned long)slid->y_pos *1000L/
+ (unsigned long)(slid->y_pos_max-viewport.g_h/slid->y_unit_px);
wind_set(handle, WF_VSLIDE, (int)pos, 0, 0, 0);
} else if (slid->y_pos) {
slid->y_pos = 0;
wind_set(handle, WF_VSLIDE, 0, 0, 0, 0);
}
}
- if((mode & 2) && (slid->x_unit_px > 0)) {
+ if((mode & GUIWIN_HSLIDER) && (slid->x_unit_px > 0)) {
if ( slid->x_pos_max < (long)viewport.g_w/slid->x_unit_px)
size = 1000L;
else
- size = MAX( 50L, (unsigned long)viewport.g_w*1000L/(unsigned long)(slid->x_unit_px*slid->x_pos_max));
+ size = MAX( 50L, (unsigned long)viewport.g_w*1000L/
+ (unsigned long)(slid->x_unit_px*slid->x_pos_max));
wind_set(handle, WF_HSLSIZE, (int)size, 0, 0, 0);
if( slid->x_pos_max > (long)viewport.g_w/slid->x_unit_px) {
- pos = (unsigned long)slid->x_pos*1000L/(unsigned long)(slid->x_pos_max-viewport.g_w/slid->x_unit_px);
+ pos = (unsigned long)slid->x_pos*1000L/
+ (unsigned long)(slid->x_pos_max-viewport.g_w/slid->x_unit_px);
wind_set(handle, WF_HSLIDE, (int)pos, 0, 0, 0);
} else if (slid->x_pos) {
slid->x_pos = 0;
wind_set(handle, WF_HSLIDE, 0, 0, 0, 0);
}
}
+
+ if(old_x != slid->x_pos || old_y != slid->y_pos){
+ return(true);
+ }
+ return(false);
}
short guiwin_get_handle(GUIWIN *win)
@@ -467,31 +560,50 @@ void *guiwin_get_user_data(GUIWIN *win)
return(win->user_data);
}
-struct guiwin_scroll_info_s *guiwin_get_scroll_info(GUIWIN *win)
-{
+struct guiwin_scroll_info_s *guiwin_get_scroll_info(GUIWIN *win) {
return(&win->scroll_info);
}
void guiwin_send_redraw(GUIWIN *win, GRECT *area)
{
- short msg[8];
- GRECT work;
+ short msg[8];
+ GRECT work;
- if(area == NULL){
- guiwin_get_grect(win, GUIWIN_AREA_WORK, &work);
- area = &work;
- }
+ if(area == NULL) {
+ guiwin_get_grect(win, GUIWIN_AREA_WORK, &work);
+ area = &work;
+ }
+
+ msg[0] = WM_REDRAW;
+ msg[1] = gl_apid;
+ msg[2] = 0;
+ msg[3] = win->handle;
+ msg[4] = area->g_x;
+ msg[5] = area->g_y;
+ msg[6] = area->g_w;
+ msg[7] = area->g_h;
- msg[0] = WM_REDRAW;
- msg[1] = gl_apid;
- msg[2] = 0;
- msg[3] = win->handle;
- msg[4] = area->g_x;
- msg[5] = area->g_y;
- msg[6] = area->g_w;
- msg[7] = area->g_h;
+ appl_write(gl_apid, 16, &msg);
+}
- appl_write(gl_apid, 16, &msg);
+bool guiwin_has_intersection(GUIWIN *win, GRECT *work)
+{
+ GRECT area, mywork;
+ bool retval = false;
+
+ if (work == NULL) {
+ guiwin_get_grect(win, GUIWIN_AREA_CONTENT, &mywork);
+ work = &mywork;
+ }
+
+ wind_get_grect(win->handle, WF_FIRSTXYWH, &area);
+ while (area.g_w && area.g_w) {
+ if (rc_intersect(work, &area)) {
+ retval = true;
+ }
+ wind_get_grect(win->handle, WF_NEXTXYWH, &area);
+ }
+ return(retval);
}
/*
void guiwin_exec_redraw(){
diff --git a/atari/gemtk/guiwin.h b/atari/gemtk/guiwin.h
index dba112cd6..6daf16ca9 100644
--- a/atari/gemtk/guiwin.h
+++ b/atari/gemtk/guiwin.h
@@ -1,5 +1,4 @@
#ifndef OPKG_GUI_GUIWIN_H
-#define OPKG_GUI_GUIWIN_H
-
+#define OPKG_GUI_GUIWIN_
#endif /* OPKG_GUIWIN_H */
diff --git a/atari/res/netsurf.rsc b/atari/res/netsurf.rsc
index a8a8b8085..5a9327ffb 100755
--- a/atari/res/netsurf.rsc
+++ b/atari/res/netsurf.rsc
Binary files differ
diff --git a/atari/res/netsurf.rsh b/atari/res/netsurf.rsh
index 7b422efc8..b0c800dfb 100755
--- a/atari/res/netsurf.rsh
+++ b/atari/res/netsurf.rsh
@@ -198,9 +198,7 @@
#define CHOICES_ABORT 108 /* BUTTON in tree CHOICES */
#define CHOICES_OK 109 /* BUTTON in tree CHOICES */
-#define ALERT 14 /* form/dial */
-
-#define VSCROLLER 15 /* form/dial */
+#define VSCROLLER 14 /* form/dial */
#define VSCROLLER_AREA 1 /* BOX in tree VSCROLLER */
#define VSCROLLER_SLIDER_AREA 2 /* BUTTON in tree VSCROLLER */
#define VSCROLLER_SLIDER 3 /* BUTTON in tree VSCROLLER */
diff --git a/atari/res/netsurf.rsm b/atari/res/netsurf.rsm
index 6996aeab8..ade2b1c80 100755
--- a/atari/res/netsurf.rsm
+++ b/atari/res/netsurf.rsm
@@ -1,9 +1,9 @@
ResourceMaster v3.65
-#C 16@0@0@0@
+#C 15@0@0@0@
#N 99@32@AZAaza___ _@AZAaza090___ _@@_@
#FoC-Header@rsm2out@C-Header@rsh@@@[C-Header@0@
#R 0@0@1@1@1@1@
-#M 20010100@0@7728@606@
+#M 20010100@0@7728@610@
#T 0@1@MAINMENU@@62@@
#O 4@32@T_FILE@@
#O 5@32@T_EDIT@@
@@ -187,8 +187,7 @@ ResourceMaster v3.65
#O 107@26@CB_BG_IMAGES@@
#O 108@26@ABORT@@
#O 109@26@OK@@
-#T 14@2@ALERT@@1@@
-#T 15@2@VSCROLLER@@8@@
+#T 14@2@VSCROLLER@@8@@
#O 1@20@AREA@@
#O 2@26@SLIDER_AREA@@
#O 3@26@SLIDER@@
@@ -196,4 +195,4 @@ ResourceMaster v3.65
#O 5@33@BT_DOWN_PIC@@
#O 6@25@BT_UP@@
#O 4@33@BT_UP_PIC@@
-#c 9608@
+#c 2361@
diff --git a/atari/treeview.c b/atari/treeview.c
index 4cddea417..44a863096 100755
--- a/atari/treeview.c
+++ b/atari/treeview.c
@@ -1,68 +1,68 @@
-/*
- * Copyright 2010 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 <stdbool.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-
-#include "content/urldb.h"
-#include "desktop/browser.h"
-#include "desktop/plotters.h"
-#include "desktop/textinput.h"
-#include "desktop/tree.h"
-#include "desktop/tree_url_node.h"
-#include "desktop/textinput.h"
-#include "utils/log.h"
-#include "utils/messages.h"
-#include "utils/utils.h"
-#include "atari/gui.h"
-#include "atari/treeview.h"
-#include "atari/plot/plot.h"
+/*
+ * Copyright 2010 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 <stdbool.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+#include "content/urldb.h"
+#include "desktop/browser.h"
+#include "desktop/plotters.h"
+#include "desktop/textinput.h"
+#include "desktop/tree.h"
+#include "desktop/tree_url_node.h"
+#include "desktop/textinput.h"
+#include "utils/log.h"
+#include "utils/messages.h"
+#include "utils/utils.h"
+#include "atari/gui.h"
+#include "atari/treeview.h"
+#include "atari/plot/plot.h"
#include "atari/misc.h"
-#include "atari/gemtk/gemtk.h"
+#include "atari/gemtk/gemtk.h"
#include "cflib.h"
enum treeview_area_e {
TREEVIEW_AREA_WORK = 0,
TREEVIEW_AREA_TOOLBAR,
TREEVIEW_AREA_CONTENT
-};
-
-extern int mouse_hold_start[3];
-extern browser_mouse_state bmstate;
-extern short last_drag_x;
-extern short last_drag_y;
+};
+
+extern int mouse_hold_start[3];
+extern browser_mouse_state bmstate;
+extern short last_drag_x;
+extern short last_drag_y;
extern long atari_plot_flags;
extern int atari_plot_vdi_handle;
-
-static void atari_treeview_resized(struct tree *tree,int w,int h, void *pw);
-static void atari_treeview_scroll_visible(int y, int h, void *pw);
+
+static void atari_treeview_resized(struct tree *tree,int w,int h, void *pw);
+static void atari_treeview_scroll_visible(int y, int h, void *pw);
static void atari_treeview_get_dimensions(int *width, int *height, void *pw);
static void atari_treeview_get_grect(NSTREEVIEW tree,
- enum treeview_area_e mode, GRECT *dest);
-
-static const struct treeview_table atari_tree_callbacks = {
- atari_treeview_request_redraw,
- atari_treeview_resized,
- atari_treeview_scroll_visible,
- atari_treeview_get_dimensions
+ enum treeview_area_e mode, GRECT *dest);
+
+static const struct treeview_table atari_tree_callbacks = {
+ atari_treeview_request_redraw,
+ atari_treeview_resized,
+ atari_treeview_scroll_visible,
+ atari_treeview_get_dimensions
};
static void __CDECL on_mbutton_event(NSTREEVIEW tv, EVMULT_OUT *ev_out,
@@ -79,7 +79,6 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
if( (ev_out->emo_events & MU_MESAG) != 0 ) {
// handle message
- printf("treeview msg: %d\n", msg[0]);
switch (msg[0]) {
case WM_REDRAW:
@@ -88,7 +87,7 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
case WM_SIZED:
case WM_FULLED:
- guiwin_update_slider(win, 3);
+ //atari_treeview_resized(tv->tree, tv->extent.x, tv->extent.y, tv);
break;
default:
@@ -116,384 +115,390 @@ static short handle_event(GUIWIN *win, EVMULT_OUT *ev_out, short msg[8])
}
return(0);
-}
-
+}
+
static void __CDECL on_keybd_event(NSTREEVIEW tv, EVMULT_OUT *ev_out,
- short msg[8])
-{
- bool r=false;
- long kstate = 0;
- long kcode = 0;
- long ucs4;
- long ik;
- unsigned short nkc = 0;
- unsigned short nks = 0;
- unsigned char ascii;
-
- kstate = ev_out->emo_kmeta;
- kcode = ev_out->emo_kreturn;
- nkc= gem_to_norm( (short)kstate, (short)kcode );
- ascii = (nkc & 0xFF);
- ik = nkc_to_input_key( nkc, &ucs4 );
-
- if( ik == 0 ){
- if (ascii >= 9 ) {
- r = tree_keypress( tv->tree, ucs4 );
- }
- } else {
- r = tree_keypress( tv->tree, ik );
- }
-}
-
-
+ short msg[8])
+{
+ bool r=false;
+ long kstate = 0;
+ long kcode = 0;
+ long ucs4;
+ long ik;
+ unsigned short nkc = 0;
+ unsigned short nks = 0;
+ unsigned char ascii;
+
+ kstate = ev_out->emo_kmeta;
+ kcode = ev_out->emo_kreturn;
+ nkc= gem_to_norm( (short)kstate, (short)kcode );
+ ascii = (nkc & 0xFF);
+ ik = nkc_to_input_key( nkc, &ucs4 );
+
+ if( ik == 0 ){
+ if (ascii >= 9 ) {
+ r = tree_keypress( tv->tree, ucs4 );
+ }
+ } else {
+ r = tree_keypress( tv->tree, ik );
+ }
+}
+
+
static void __CDECL on_redraw_event(NSTREEVIEW tv, EVMULT_OUT *ev_out,
- short msg[8])
-{
- GRECT work, clip;
+ short msg[8])
+{
+ GRECT work, clip;
+ struct guiwin_scroll_info_s *slid;
- if( tv == NULL )
- return;
+ if( tv == NULL )
+ return;
guiwin_get_grect(tv->window, GUIWIN_AREA_CONTENT, &work);
-
- clip = work;
- if ( !rc_intersect( (GRECT*)&msg[4], &clip ) ) return;
- clip.g_x -= work.g_x;
- clip.g_y -= work.g_y;
- if( clip.g_x < 0 ) {
- clip.g_w = work.g_w + clip.g_x;
- clip.g_x = 0;
- }
- if( clip.g_y < 0 ) {
- clip.g_h = work.g_h + clip.g_y;
- clip.g_y = 0;
- }
+ slid = guiwin_get_scroll_info(tv->window);
+
+ clip = work;
+ if ( !rc_intersect( (GRECT*)&msg[4], &clip ) ) return;
+ clip.g_x -= work.g_x;
+ clip.g_y -= work.g_y;
+ if( clip.g_x < 0 ) {
+ clip.g_w = work.g_w + clip.g_x;
+ clip.g_x = 0;
+ }
+ if( clip.g_y < 0 ) {
+ clip.g_h = work.g_h + clip.g_y;
+ clip.g_y = 0;
+ }
if( clip.g_h > 0 && clip.g_w > 0 ) {
- // TODO: get slider values
- atari_treeview_request_redraw(
- /*win->xpos*win->w_u +*/ clip.g_x,
- /*win->ypos*win->h_u +*/ clip.g_y,
- clip.g_w, clip.g_h, tv
- );
- }
-}
-
+ // TODO: get slider values
+ atari_treeview_request_redraw((slid->x_pos*slid->x_unit_px) + clip.g_x,
+ (slid->y_pos*slid->y_unit_px) + clip.g_y,
+ clip.g_w, clip.g_h, tv
+ );
+ }
+}
+
static void __CDECL on_mbutton_event(NSTREEVIEW tv, EVMULT_OUT *ev_out,
- short msg[8])
-{
- GRECT work;
- if(tv == NULL)
- return;
- if( evnt.mbut & 2 ) {
- /* do not handle right click */
- return;
+ short msg[8])
+{
+ struct guiwin_scroll_info_s *slid;
+ GRECT work;
+
+ if(tv == NULL)
+ return;
+ if( evnt.mbut & 2 ) {
+ /* do not handle right click */
+ return;
}
- guiwin_get_grect(tv->window, GUIWIN_AREA_CONTENT, &work);
-
+ guiwin_get_grect(tv->window, GUIWIN_AREA_CONTENT, &work);
+ slid = guiwin_get_scroll_info(tv->window);
+
/* mouse click relative origin: */
-
- // TODO: get scroll position
- //short origin_rel_x = (evnt.mx-work.g_x)+(win->xpos*win->w_u);
- //short origin_rel_y = (evnt.my-work.g_y)+(win->ypos*win->h_u);
-
- short origin_rel_x = (ev_out->emo_mouse.p_x-work.g_x);
- short origin_rel_y = (ev_out->emo_mouse.p_y-work.g_y);
-
- if( origin_rel_x >= 0 && origin_rel_y >= 0
- && evnt.mx < work.g_x + work.g_w
- && evnt.my < work.g_y + work.g_h )
- {
- int bms;
- bool ignore=false;
- short cur_rel_x, cur_rel_y, dummy, mbut;
-
- if( evnt.nb_click == 2 ){
- tree_mouse_action(tv->tree,
- BROWSER_MOUSE_CLICK_1 | BROWSER_MOUSE_DOUBLE_CLICK,
- origin_rel_x, origin_rel_y );
- return;
- }
-
- graf_mkstate(&cur_rel_x, &cur_rel_x, &mbut, &dummy);
- if( (mbut&1) == 0 ){
- bms = BROWSER_MOUSE_CLICK_1 | BROWSER_MOUSE_PRESS_1;
- if( evnt.nb_click == 2 ) {
- bms = BROWSER_MOUSE_DOUBLE_CLICK;
- }
- tree_mouse_action(tv->tree, bms, origin_rel_x, origin_rel_y );
- } else {
- /* button still pressed */
-
- short prev_x = origin_rel_x;
- short prev_y = origin_rel_y;
-
- cur_rel_x = origin_rel_x;
- cur_rel_y = origin_rel_y;
-
- if( tree_is_edited(tv->tree) ){
- gem_set_cursor(&gem_cursors.ibeam);
- } else {
- gem_set_cursor(&gem_cursors.hand);
- }
-
- tv->startdrag.x = origin_rel_x;
- tv->startdrag.y = origin_rel_y;
-
- tree_mouse_action( tv->tree,
- BROWSER_MOUSE_DRAG_1 | BROWSER_MOUSE_DRAG_ON ,
- cur_rel_x, cur_rel_y );
- do{
- if( abs(prev_x-cur_rel_x) > 5 || abs(prev_y-cur_rel_y) > 5 ){
- tree_mouse_action( tv->tree,
- BROWSER_MOUSE_HOLDING_1 | BROWSER_MOUSE_DRAG_ON,
- cur_rel_x, cur_rel_y);
- prev_x = cur_rel_x;
- prev_y = cur_rel_y;
- }
-
- if( tv->redraw )
- atari_treeview_redraw( tv );
- /* sample mouse button state: */
+
+ short origin_rel_x = (ev_out->emo_mouse.p_x-work.g_x) +
+ (slid->x_pos*slid->x_unit_px);
+ short origin_rel_y = (ev_out->emo_mouse.p_y-work.g_y) +
+ (slid->y_pos*slid->y_unit_px);
+
+ if( origin_rel_x >= 0 && origin_rel_y >= 0
+ && evnt.mx < work.g_x + work.g_w
+ && evnt.my < work.g_y + work.g_h )
+ {
+ int bms;
+ bool ignore=false;
+ short cur_rel_x, cur_rel_y, dummy, mbut;
+
+ if( evnt.nb_click == 2 ){
+ tree_mouse_action(tv->tree,
+ BROWSER_MOUSE_CLICK_1 | BROWSER_MOUSE_DOUBLE_CLICK,
+ origin_rel_x, origin_rel_y );
+ return;
+ }
+
+ graf_mkstate(&cur_rel_x, &cur_rel_x, &mbut, &dummy);
+ if( (mbut&1) == 0 ){
+ bms = BROWSER_MOUSE_CLICK_1 | BROWSER_MOUSE_PRESS_1;
+ if( evnt.nb_click == 2 ) {
+ bms = BROWSER_MOUSE_DOUBLE_CLICK;
+ }
+ tree_mouse_action(tv->tree, bms, origin_rel_x, origin_rel_y );
+ } else {
+ /* button still pressed */
+
+ short prev_x = origin_rel_x;
+ short prev_y = origin_rel_y;
+
+ cur_rel_x = origin_rel_x;
+ cur_rel_y = origin_rel_y;
+
+ if( tree_is_edited(tv->tree) ){
+ gem_set_cursor(&gem_cursors.ibeam);
+ } else {
+ gem_set_cursor(&gem_cursors.hand);
+ }
+
+ tv->startdrag.x = origin_rel_x;
+ tv->startdrag.y = origin_rel_y;
+
+ tree_mouse_action( tv->tree,
+ BROWSER_MOUSE_DRAG_1 | BROWSER_MOUSE_DRAG_ON ,
+ cur_rel_x, cur_rel_y );
+ do{
+ if( abs(prev_x-cur_rel_x) > 5 || abs(prev_y-cur_rel_y) > 5 ){
+ tree_mouse_action( tv->tree,
+ BROWSER_MOUSE_HOLDING_1 | BROWSER_MOUSE_DRAG_ON,
+ cur_rel_x, cur_rel_y);
+ prev_x = cur_rel_x;
+ prev_y = cur_rel_y;
+ }
+
+ if( tv->redraw )
+ atari_treeview_redraw( tv );
+ /* sample mouse button state: */
graf_mkstate(&cur_rel_x, &cur_rel_y, &mbut, &dummy);
- // TODO : get guwin slider values;
- cur_rel_x = (cur_rel_x-work.g_x)/*+(win->xpos*win->w_u);*/;
- cur_rel_y = (cur_rel_y-work.g_y)/*+(win->ypos*win->h_u);*/;
- } while( mbut & 1 );
-
- tree_drag_end(tv->tree, 0, tv->startdrag.x, tv->startdrag.y,
- cur_rel_x, cur_rel_y );
- gem_set_cursor(&gem_cursors.arrow);
- }
- }
-}
-
+ cur_rel_x = (cur_rel_x-work.g_x)+(slid->x_pos*slid->x_unit_px);
+ cur_rel_y = (cur_rel_y-work.g_y)+(slid->y_pos*slid->y_unit_px);
+ } while( mbut & 1 );
+
+ tree_drag_end(tv->tree, 0, tv->startdrag.x, tv->startdrag.y,
+ cur_rel_x, cur_rel_y );
+ gem_set_cursor(&gem_cursors.arrow);
+ }
+ }
+}
+
NSTREEVIEW atari_treeview_create(uint32_t flags, GUIWIN *win,
- guiwin_event_handler_f user_func)
+ guiwin_event_handler_f user_func)
{
struct guiwin_scroll_info_s *slid;
-
- if( win == NULL )
- return( NULL );
- NSTREEVIEW new = malloc(sizeof(struct atari_treeview));
- if (new == NULL)
- return NULL;
- memset( new, 0, sizeof(struct atari_treeview));
- new->tree = tree_create(flags, &atari_tree_callbacks, new);
- if (new->tree == NULL) {
- free(new);
- return NULL;
- }
+
+ if( win == NULL )
+ return( NULL );
+ NSTREEVIEW new = malloc(sizeof(struct atari_treeview));
+ if (new == NULL)
+ return NULL;
+ memset( new, 0, sizeof(struct atari_treeview));
+ new->tree = tree_create(flags, &atari_tree_callbacks, new);
+ if (new->tree == NULL) {
+ free(new);
+ return NULL;
+ }
new->window = win;
new->user_func = user_func;
guiwin_set_event_handler(win, handle_event);
guiwin_set_user_data(win, (void*)new);
-
+
slid = guiwin_get_scroll_info(new->window);
slid->y_unit_px = 16;
- slid->x_unit_px = 16;
-
- return(new);
-}
-
-void atari_treeview_open( NSTREEVIEW tv )
-{
- if( tv->window != NULL ) {
- tree_set_redraw(tv->tree, true);
- }
-}
-
-void atari_treeview_close( NSTREEVIEW tv )
-{
- if( tv->window != NULL ) {
- tree_set_redraw(tv->tree, false);
- }
-}
-
-void atari_treeview_destroy( NSTREEVIEW tv )
-{
- if( tv != NULL ){
- tv->disposing = true;
- LOG(("tree: %p", tv));
- if( tv->tree != NULL ) {
- tree_delete(tv->tree);
- tv->tree = NULL;
- }
- free( tv );
- }
-}
-
-bool atari_treeview_mevent( NSTREEVIEW tv, browser_mouse_state bms, int x, int y)
-{
+ slid->x_unit_px = 16;
+
+ return(new);
+}
+
+void atari_treeview_open( NSTREEVIEW tv )
+{
+ if( tv->window != NULL ) {
+ tree_set_redraw(tv->tree, true);
+ }
+}
+
+void atari_treeview_close( NSTREEVIEW tv )
+{
+ if( tv->window != NULL ) {
+ tree_set_redraw(tv->tree, false);
+ }
+}
+
+void atari_treeview_destroy( NSTREEVIEW tv )
+{
+ if( tv != NULL ){
+ tv->disposing = true;
+ LOG(("tree: %p", tv));
+ if( tv->tree != NULL ) {
+ tree_delete(tv->tree);
+ tv->tree = NULL;
+ }
+ free( tv );
+ }
+}
+
+bool atari_treeview_mevent( NSTREEVIEW tv, browser_mouse_state bms, int x, int y)
+{
GRECT work;
struct guiwin_scroll_info_s *slid;
- if( tv == NULL )
- return ( false );
-
+ if( tv == NULL )
+ return ( false );
+
guiwin_get_grect(tv->window, GUIWIN_AREA_CONTENT, &work);
slid = guiwin_get_scroll_info(tv->window);
-
- int rx = (x-work.g_x)+(slid->x_pos*slid->x_unit_px);
+
+ int rx = (x-work.g_x)+(slid->x_pos*slid->x_unit_px);
int ry = (y-work.g_y)+(slid->y_pos*slid->y_unit_px);
tree_mouse_action(tv->tree, bms, rx, ry);
-
- tv->click.x = rx;
- tv->click.y = ry;
-
- return( true );
-}
-
-
-
-void atari_treeview_redraw( NSTREEVIEW tv)
+
+ tv->click.x = rx;
+ tv->click.y = ry;
+
+ return( true );
+}
+
+
+
+void atari_treeview_redraw( NSTREEVIEW tv)
{
-
- if (tv != NULL) {
- if( tv->redraw && ((atari_plot_flags & PLOT_FLAG_OFFSCREEN) == 0) ) {
+ if (tv != NULL) {
+ if( tv->redraw && ((atari_plot_flags & PLOT_FLAG_OFFSCREEN) == 0) ) {
- short todo[4];
+ short todo[4];
GRECT work;
short handle = guiwin_get_handle(tv->window);
- struct guiwin_scroll_info_s *slid;
+ struct guiwin_scroll_info_s *slid;
- guiwin_get_grect(tv->window, GUIWIN_AREA_CONTENT, &work);
+ guiwin_get_grect(tv->window, GUIWIN_AREA_CONTENT, &work);
slid = guiwin_get_scroll_info(tv->window);
-
- struct redraw_context ctx = {
- .interactive = true,
- .background_images = true,
- .plot = &atari_plotters
- };
- plot_set_dimensions(work.g_x, work.g_y, work.g_w, work.g_h);
- if (plot_lock() == false)
- return;
-
- todo[0] = work.g_x;
- todo[1] = work.g_y;
- todo[2] = todo[0] + work.g_w-1;
- todo[3] = todo[1] + work.g_h-1;
- vs_clip(atari_plot_vdi_handle, 1, (short*)&todo );
-
- if( wind_get(handle, WF_FIRSTXYWH,
- &todo[0], &todo[1], &todo[2], &todo[3] )!=0 ) {
- while (todo[2] && todo[3]) {
-
+
+ struct redraw_context ctx = {
+ .interactive = true,
+ .background_images = true,
+ .plot = &atari_plotters
+ };
+ plot_set_dimensions(work.g_x, work.g_y, work.g_w, work.g_h);
+ if (plot_lock() == false)
+ return;
+
+ if( wind_get(handle, WF_FIRSTXYWH,
+ &todo[0], &todo[1], &todo[2], &todo[3] )!=0 ) {
+ while (todo[2] && todo[3]) {
+
+ short pxy[4];
+ pxy[0] = todo[0];
+ pxy[1] = todo[1];
+ pxy[2] = todo[0] + todo[2]-1;
+ pxy[3] = todo[1] + todo[3]-1;
+ vs_clip(atari_plot_vdi_handle, 1, (short*)&pxy);
+
/* convert screen to treeview coords: */
- // TODO: get slider values:
- todo[0] = todo[0] - work.g_x + slid->x_pos*slid->x_unit_px;
- todo[1] = todo[1] - work.g_y + slid->y_pos*slid->y_unit_px;
- if( todo[0] < 0 ){
- todo[2] = todo[2] + todo[0];
- todo[0] = 0;
- }
- if( todo[1] < 0 ){
- todo[3] = todo[3] + todo[1];
- todo[1] = 0;
- }
+ todo[0] = todo[0] - work.g_x + slid->x_pos*slid->x_unit_px;
+ todo[1] = todo[1] - work.g_y + slid->y_pos*slid->y_unit_px;
+ if( todo[0] < 0 ){
+ todo[2] = todo[2] + todo[0];
+ todo[0] = 0;
+ }
+ if( todo[1] < 0 ){
+ todo[3] = todo[3] + todo[1];
+ todo[1] = 0;
+ }
// TODO: get slider values
- if (rc_intersect((GRECT *)&tv->rdw_area,(GRECT *)&todo)) {
+ if (rc_intersect((GRECT *)&tv->rdw_area,(GRECT *)&todo)) {
tree_draw(tv->tree, -(slid->x_pos*slid->x_unit_px),
- -(slid->y_pos*slid->y_unit_px),
- todo[0], todo[1], todo[2], todo[3], &ctx
- );
- }
- if (wind_get(handle, WF_NEXTXYWH,
- &todo[0], &todo[1], &todo[2], &todo[3])==0) {
- break;
- }
- }
- } else {
- plot_unlock();
- return;
- }
- plot_unlock();
- vs_clip(atari_plot_vdi_handle, 0, (short*)&todo);
- tv->redraw = false;
- tv->rdw_area.g_x = 65000;
- tv->rdw_area.g_y = 65000;
- tv->rdw_area.g_w = -1;
- tv->rdw_area.g_h = -1;
- } else {
- /* just copy stuff from the offscreen buffer */
- }
- }
-}
-
-
-/**
- * Callback to force a redraw of part of the treeview window.
- *
- * \param x Min X Coordinate of area to be redrawn.
- * \param y Min Y Coordinate of area to be redrawn.
- * \param width Width of area to be redrawn.
- * \param height Height of area to be redrawn.
- * \param pw The treeview object to be redrawn.
- */
-void atari_treeview_request_redraw(int x, int y, int w, int h, void *pw)
-{
- if ( pw != NULL ) {
- NSTREEVIEW tv = (NSTREEVIEW) pw;
- if( tv->redraw == false ){
- tv->redraw = true;
- tv->rdw_area.g_x = x;
- tv->rdw_area.g_y = y;
- tv->rdw_area.g_w = w;
- tv->rdw_area.g_h = h;
- } else {
- /* merge the redraw area to the new area.: */
- int newx1 = x+w;
- int newy1 = y+h;
- int oldx1 = tv->rdw_area.g_x + tv->rdw_area.g_w;
- int oldy1 = tv->rdw_area.g_y + tv->rdw_area.g_h;
- tv->rdw_area.g_x = MIN(tv->rdw_area.g_x, x);
- tv->rdw_area.g_y = MIN(tv->rdw_area.g_y, y);
- tv->rdw_area.g_w = ( oldx1 > newx1 ) ? oldx1 - tv->rdw_area.g_x : newx1 - tv->rdw_area.g_x;
- tv->rdw_area.g_h = ( oldy1 > newy1 ) ? oldy1 - tv->rdw_area.g_y : newy1 - tv->rdw_area.g_y;
- }
- }
-}
-
-
-/**
- * Callback to notify us of a new overall tree size.
- *
- * \param tree The tree being resized.
- * \param width The new width of the window.
- * \param height The new height of the window.
- * \param *pw The treeview object to be resized.
- */
-
-void atari_treeview_resized(struct tree *tree, int width, int height, void *pw)
-{
- if (pw != NULL) {
- NSTREEVIEW tv = (NSTREEVIEW) pw;
- if( tv->disposing )
- return;
- // TODO: update slider size
+ -(slid->y_pos*slid->y_unit_px),
+ todo[0], todo[1], todo[2], todo[3], &ctx
+ );
+ }
+ vs_clip(atari_plot_vdi_handle, 0, (short*)&pxy);
+ if (wind_get(handle, WF_NEXTXYWH,
+ &todo[0], &todo[1], &todo[2], &todo[3])==0) {
+ break;
+ }
+ }
+ } else {
+ plot_unlock();
+ return;
+ }
+ plot_unlock();
+ tv->redraw = false;
+ tv->rdw_area.g_x = 65000;
+ tv->rdw_area.g_y = 65000;
+ tv->rdw_area.g_w = -1;
+ tv->rdw_area.g_h = -1;
+ } else {
+ /* just copy stuff from the offscreen buffer */
+ }
+ }
+}
+
+
+/**
+ * Callback to force a redraw of part of the treeview window.
+ *
+ * \param x Min X Coordinate of area to be redrawn.
+ * \param y Min Y Coordinate of area to be redrawn.
+ * \param width Width of area to be redrawn.
+ * \param height Height of area to be redrawn.
+ * \param pw The treeview object to be redrawn.
+ */
+void atari_treeview_request_redraw(int x, int y, int w, int h, void *pw)
+{
+ if ( pw != NULL ) {
+ NSTREEVIEW tv = (NSTREEVIEW) pw;
+ if( tv->redraw == false ){
+ tv->redraw = true;
+ tv->rdw_area.g_x = x;
+ tv->rdw_area.g_y = y;
+ tv->rdw_area.g_w = w;
+ tv->rdw_area.g_h = h;
+ } else {
+ /* merge the redraw area to the new area.: */
+ int newx1 = x+w;
+ int newy1 = y+h;
+ int oldx1 = tv->rdw_area.g_x + tv->rdw_area.g_w;
+ int oldy1 = tv->rdw_area.g_y + tv->rdw_area.g_h;
+ tv->rdw_area.g_x = MIN(tv->rdw_area.g_x, x);
+ tv->rdw_area.g_y = MIN(tv->rdw_area.g_y, y);
+ tv->rdw_area.g_w = ( oldx1 > newx1 ) ? oldx1 - tv->rdw_area.g_x : newx1 - tv->rdw_area.g_x;
+ tv->rdw_area.g_h = ( oldy1 > newy1 ) ? oldy1 - tv->rdw_area.g_y : newy1 - tv->rdw_area.g_y;
+ }
+ dbg_grect("atari_treeview_request_redraw", &tv->rdw_area);
+ }
+}
+
+
+/**
+ * Callback to notify us of a new overall tree size.
+ *
+ * \param tree The tree being resized.
+ * \param width The new width of the window.
+ * \param height The new height of the window.
+ * \param *pw The treeview object to be resized.
+ */
+
+void atari_treeview_resized(struct tree *tree, int width, int height, void *pw)
+{
+ GRECT area;
+ if (pw != NULL) {
+ NSTREEVIEW tv = (NSTREEVIEW) pw;
+ if( tv->disposing )
+ return;
+ tv->extent.x = width;
+ tv->extent.y = height;
struct guiwin_scroll_info_s *slid = guiwin_get_scroll_info(tv->window);
- slid->x_pos_max = (width / slid->x_unit_px);
- slid->y_pos_max = (height / slid->y_unit_px);
- guiwin_update_slider(tv->window, 3);
- }
-}
-
-
-/**
- * Callback to request that a section of the tree is scrolled into view.
- *
- * \param y The Y coordinate of top of the area in NS units.
- * \param height The height of the area in NS units.
- * \param *pw The treeview object affected.
- */
-
-void atari_treeview_scroll_visible(int y, int height, void *pw)
-{
- /* we don't support dragging outside the treeview */
- /* so we don't need to implement this? */
+ guiwin_get_grect(tv->window, GUIWIN_AREA_CONTENT, &area);
+ slid->x_pos_max = (width/slid->x_unit_px);//-(area.g_w/slid->x_unit_px)+1;
+ slid->y_pos_max = (height/slid->y_unit_px);//-(area.g_h/slid->y_unit_px)+1;
+ printf("units content: %d, units viewport: %d\n", (height/slid->y_unit_px),
+ (area.g_h/slid->y_unit_px));
+ guiwin_update_slider(tv->window, GUIWIN_VH_SLIDER);
+ }
+}
+
+
+/**
+ * Callback to request that a section of the tree is scrolled into view.
+ *
+ * \param y The Y coordinate of top of the area in NS units.
+ * \param height The height of the area in NS units.
+ * \param *pw The treeview object affected.
+ */
+
+void atari_treeview_scroll_visible(int y, int height, void *pw)
+{
+ /* we don't support dragging outside the treeview */
+ /* so we don't need to implement this? */
}
static void atari_treeview_get_grect(NSTREEVIEW tv, enum treeview_area_e mode,
@@ -506,44 +511,44 @@ static void atari_treeview_get_grect(NSTREEVIEW tv, enum treeview_area_e mode,
else if (mode == TREEVIEW_AREA_TOOLBAR) {
guiwin_get_grect(tv->window, GUIWIN_AREA_TOOLBAR, dest);
}
-}
-
-/**
- * Callback to return the tree window dimensions to the treeview system.
- *
- * \param *width Return the window width.
- * \param *height Return the window height.
- * \param *pw The treeview object to use.
- */
-
-void atari_treeview_get_dimensions(int *width, int *height,
- void *pw)
-{
- if (pw != NULL && (width != NULL || height != NULL)) {
- NSTREEVIEW tv = (NSTREEVIEW) pw;
+}
+
+/**
+ * Callback to return the tree window dimensions to the treeview system.
+ *
+ * \param *width Return the window width.
+ * \param *height Return the window height.
+ * \param *pw The treeview object to use.
+ */
+
+void atari_treeview_get_dimensions(int *width, int *height,
+ void *pw)
+{
+ if (pw != NULL && (width != NULL || height != NULL)) {
+ NSTREEVIEW tv = (NSTREEVIEW) pw;
GRECT work;
- atari_treeview_get_grect(tv, TREEVIEW_AREA_CONTENT, &work);
- *width = work.g_w;
- *height = work.g_h;
- }
-}
-
-
-/**
- * Translates a content_type to the name of a respective icon
- *
- * \param content_type content type
- * \param buffer buffer for the icon name
- */
-void tree_icon_name_from_content_type(char *buffer, content_type type)
-{
- switch (type) {
- case CONTENT_HTML:
- case CONTENT_TEXTPLAIN:
- case CONTENT_CSS:
- case CONTENT_IMAGE:
- default:
- strcpy( buffer, "content.png" );
- break;
- }
-}
+ atari_treeview_get_grect(tv, TREEVIEW_AREA_CONTENT, &work);
+ *width = work.g_w;
+ *height = work.g_h;
+ }
+}
+
+
+/**
+ * Translates a content_type to the name of a respective icon
+ *
+ * \param content_type content type
+ * \param buffer buffer for the icon name
+ */
+void tree_icon_name_from_content_type(char *buffer, content_type type)
+{
+ switch (type) {
+ case CONTENT_HTML:
+ case CONTENT_TEXTPLAIN:
+ case CONTENT_CSS:
+ case CONTENT_IMAGE:
+ default:
+ strcpy( buffer, "content.png" );
+ break;
+ }
+}