summaryrefslogtreecommitdiff
path: root/atari
diff options
context:
space:
mode:
Diffstat (limited to 'atari')
-rw-r--r--atari/ctxmenu.c67
-rw-r--r--atari/gemtk/gemtk.h2
-rw-r--r--atari/gemtk/guiwin.c5
-rw-r--r--atari/gemtk/utils.c19
-rwxr-xr-xatari/res/netsurf.rscbin34814 -> 34858 bytes
-rwxr-xr-xatari/res/netsurf.rsh17
-rwxr-xr-xatari/res/netsurf.rsm23
-rwxr-xr-xatari/rootwin.c55
-rwxr-xr-xatari/rootwin.h3
-rw-r--r--atari/search.c29
-rw-r--r--atari/search.h2
11 files changed, 161 insertions, 61 deletions
diff --git a/atari/ctxmenu.c b/atari/ctxmenu.c
index bb52ef5a5..a82824eb3 100644
--- a/atari/ctxmenu.c
+++ b/atari/ctxmenu.c
@@ -48,7 +48,6 @@
#define CNT_INVALID 0
-#define CNT_URLINPUT 32
#define CNT_BROWSER 64
#define CNT_HREF 128
#define CNT_SELECTION 256
@@ -66,49 +65,51 @@ struct s_context_info ctxinfo;
static struct s_context_info * get_context_info( struct gui_window * gw, short mx, short my )
{
hlcache_handle *h;
- GRECT bwrect;
+ GRECT area;
struct contextual_content ccdata;
struct browser_window * bw = gw->browser->bw;
int sx, sy;
h = bw->current_content;
- ctxinfo.flags = 0;
-
- guiwin_get_grect(gw->root->win, GUIWIN_AREA_CONTENT, &bwrect);
- mx -= bwrect.g_x;
- my -= bwrect.g_y;
- if( (mx < 0 || mx > bwrect.g_w) || (my < 0 || my > bwrect.g_h) ){
- // TODO: check for urlinput location
- // and set CNT_URLINPUT
- return(&ctxinfo);
- }
-
- if (!bw->current_content || content_get_type(h) != CONTENT_HTML){
- return(&ctxinfo);
- }
+ ctxinfo.flags = 0;
+
+ window_get_grect(gw->root, BROWSER_AREA_CONTENT, &area);
+ if (POINT_WITHIN(mx, my, area)) {
+
+ mx -= area.g_x;
+ my -= area.g_y;
+
+ if (!bw->current_content || content_get_type(h) != CONTENT_HTML){
+ return(&ctxinfo);
+ }
- ctxinfo.flags |= CNT_BROWSER;
+ ctxinfo.flags |= CNT_BROWSER;
- memset( &ctxinfo.ccdata, sizeof(struct contextual_content), 0 );
+ memset( &ctxinfo.ccdata, sizeof(struct contextual_content), 0 );
- gui_window_get_scroll(gw, &sx, &sy);
+ gui_window_get_scroll(gw, &sx, &sy);
- browser_window_get_contextual_content( gw->browser->bw, mx+sx, my+sy,
- (struct contextual_content*)&ctxinfo.ccdata);
+ browser_window_get_contextual_content( gw->browser->bw, mx+sx, my+sy,
+ (struct contextual_content*)&ctxinfo.ccdata);
- if( ctxinfo.ccdata.link_url ){
- ctxinfo.flags |= CNT_HREF;
- }
- if( ctxinfo.ccdata.object) {
- if( content_get_type(ctxinfo.ccdata.object) == CONTENT_IMAGE ){
- ctxinfo.flags |= CNT_IMG;
+ if( ctxinfo.ccdata.link_url ){
+ ctxinfo.flags |= CNT_HREF;
}
- }
- if ( ctxinfo.ccdata.form_features == CTX_FORM_TEXT )
- ctxinfo.flags |= (CNT_INTERACTIVE | CNT_SELECTION);
- return( &ctxinfo );
-}
+ if( ctxinfo.ccdata.object) {
+ if( content_get_type(ctxinfo.ccdata.object) == CONTENT_IMAGE ){
+ ctxinfo.flags |= CNT_IMG;
+ }
+ }
+ if ( ctxinfo.ccdata.form_features == CTX_FORM_TEXT )
+ ctxinfo.flags |= (CNT_INTERACTIVE | CNT_SELECTION);
+ }
+
+ return(&ctxinfo);
+
+}
+
+//TODO: do not open popup for gui_window, but for a rootwin?
void context_popup(struct gui_window * gw, short x, short y)
{
@@ -147,7 +148,7 @@ void context_popup(struct gui_window * gw, short x, short y)
SET_BIT(pop[ POP_CTX_SELECT_ALL ].ob_state, OS_DISABLED, 0);
SET_BIT(pop[ POP_CTX_COPY_SEL ].ob_state, OS_DISABLED, 0);
SET_BIT(pop[ POP_CTX_VIEW_SOURCE ].ob_state, OS_DISABLED, 0);
- }
+ }
if( ctx->flags & CNT_HREF ){
SET_BIT(pop[ POP_CTX_COPY_LINK ].ob_state, OS_DISABLED, 0);
diff --git a/atari/gemtk/gemtk.h b/atari/gemtk/gemtk.h
index 2bd3553f5..e5d7c76a4 100644
--- a/atari/gemtk/gemtk.h
+++ b/atari/gemtk/gemtk.h
@@ -44,6 +44,8 @@ bool rc_intersect_ro(GRECT *a, GRECT *b);
*/
int keybd2ascii( int keybd, int shift);
+/** set VDI clip area by passing an GRECT */
+void gemtk_clip_grect(VdiHdl vh, GRECT *rect);
#ifndef POINT_WITHIN
# define POINT_WITHIN(_x,_y, r) ((_x >= r.g_x) && (_x <= r.g_x + r.g_w ) \
diff --git a/atari/gemtk/guiwin.c b/atari/gemtk/guiwin.c
index ad12499b1..17c577ec0 100644
--- a/atari/gemtk/guiwin.c
+++ b/atari/gemtk/guiwin.c
@@ -348,6 +348,7 @@ static short preproc_mu_button(GUIWIN * gw, EVMULT_OUT *ev_out, short msg[8])
slid = guiwin_get_scroll_info(gw);
+ // adjust form position (considering window and scroll position):
gw->form[gw->form_idx].ob_x = content_area.g_x -
(slid->x_pos * slid->x_unit_px);
gw->form[gw->form_idx].ob_y = content_area.g_y -
@@ -368,6 +369,10 @@ static short preproc_mu_button(GUIWIN * gw, EVMULT_OUT *ev_out, short msg[8])
if (type == G_FTEXT || type == G_FBOXTEXT) {
+ // edit field handling, this causes ugly redraws when the
+ // form is scrolled and larger than the window in which
+ // it is attached.
+
// report mouse click to the tree:
retval = form_button(gw->form, gw->form_focus_obj,
ev_out->emo_mclicks, &nextobj);
diff --git a/atari/gemtk/utils.c b/atari/gemtk/utils.c
index 3fc668a06..bd136dd99 100644
--- a/atari/gemtk/utils.c
+++ b/atari/gemtk/utils.c
@@ -54,13 +54,26 @@ typedef struct {
char *unshift;
char *shift;
char *capslock;
-} MY_KEYTAB;
+} KEYTAB;
int keybd2ascii( int keybd, int shift)
{
- MY_KEYTAB *key;
- key = (MY_KEYTAB *)Keytbl( (char*)-1, (char*)-1, (char*)-1);
+ KEYTAB *key;
+ key = (KEYTAB *)Keytbl( (char*)-1, (char*)-1, (char*)-1);
return (shift)?key->shift[keybd>>8]:key->unshift[keybd>>8];
}
+void gemtk_clip_grect(VdiHdl vh, GRECT *rect)
+{
+ short pxy[4];
+
+ pxy[0] = rect->g_x;
+ pxy[1] = rect->g_y;
+ pxy[2] = pxy[0] + rect->g_w-1;
+ pxy[3] = pxy[1] + rect->g_h-1;
+
+ vs_clip_pxy(vh, pxy);
+}
+
+
diff --git a/atari/res/netsurf.rsc b/atari/res/netsurf.rsc
index b57214a6f..d49199d8e 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 1b6ac16cc..092faa06a 100755
--- a/atari/res/netsurf.rsh
+++ b/atari/res/netsurf.rsh
@@ -79,14 +79,15 @@
#define TOOLBAR_HOTLIST_EDIT 4 /* CICON in tree TOOLBAR_HOTLIST */
#define SEARCH 8 /* form/dial */
-#define SEARCH_TB_SRCH 1 /* FTEXT in tree SEARCH */
-#define SEARCH_LBL_SHOWALL 2 /* STRING in tree SEARCH */
-#define SEARCH_LBL_CASESENSE 3 /* STRING in tree SEARCH */
-#define SEARCH_BT_SEARCH 4 /* BUTTON in tree SEARCH */
-#define SEARCH_LBL_FWD 5 /* STRING in tree SEARCH */
-#define SEARCH_CB_CASESENSE 6 /* BUTTON in tree SEARCH */
-#define SEARCH_CB_SHOWALL 7 /* BUTTON in tree SEARCH */
-#define SEARCH_CB_FWD 8 /* BUTTON in tree SEARCH */
+#define SEARCH_BT_SEARCH 1 /* BUTTON in tree SEARCH */
+#define SEARCH_LBL_FWD 2 /* STRING in tree SEARCH */
+#define SEARCH_CB_FWD 3 /* BUTTON in tree SEARCH */
+#define SEARCH_BT_SEARCH_BACK 4 /* BUTTON in tree SEARCH */
+#define SEARCH_CB_CASESENSE 6 /* BOXCHAR in tree SEARCH */
+#define SEARCH_CB_SHOWALL 7 /* BOXCHAR in tree SEARCH */
+#define SEARCH_LBL_SHOWALL 8 /* STRING in tree SEARCH */
+#define SEARCH_LBL_CASESENSE 9 /* TEXT in tree SEARCH */
+#define SEARCH_TB_SRCH 10 /* FTEXT in tree SEARCH */
#define DOWNLOAD 9 /* form/dial */
/* Width ist 400, code depends on that! If you change it, change it in download.c */
diff --git a/atari/res/netsurf.rsm b/atari/res/netsurf.rsm
index 32b6696dd..3993f4ae7 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@2@1@2@1@
-#M 20010100@0@7728@632@
+#M 20010100@0@7728@633@
#T 0@1@MAINMENU@@62@@
#O 4@32@T_FILE@@
#O 5@32@T_EDIT@@
@@ -74,15 +74,16 @@ ResourceMaster v3.65
#O 2@33@CREATE_FOLDER@@
#O 3@33@DELETE@@
#O 4@33@EDIT@@
-#T 8@2@SEARCH@@9@@
-#O 1@29@TB_SRCH@@
-#O 2@28@LBL_SHOWALL@@
-#O 3@28@LBL_CASESENSE@@
-#O 4@26@BT_SEARCH@@
-#O 5@28@LBL_FWD@@
-#O 6@26@CB_CASESENSE@@
-#O 7@26@CB_SHOWALL@@
-#O 8@26@CB_FWD@@
+#T 8@2@SEARCH@@11@@
+#O 1@26@BT_SEARCH@@
+#O 2@28@LBL_FWD@@
+#O 3@26@CB_FWD@@
+#O 4@26@BT_SEARCH_BACK@@
+#O 6@27@CB_CASESENSE@@
+#O 7@27@CB_SHOWALL@@
+#O 8@28@LBL_SHOWALL@@
+#O 9@21@LBL_CASESENSE@@
+#O 10@29@TB_SRCH@@
#T 9@2@DOWNLOAD@@10@@
#O 1@20@PROGRESS@Width ist 400, code depends on that! If you change it, change it in download.c@
#O 2@20@PROGRESS_DONE@@
@@ -197,4 +198,4 @@ ResourceMaster v3.65
#T 15@2@POP_FONT_RENDERER@@3@@
#O 1@28@INTERNAL@@
#O 2@28@FREETYPE@@
-#c 27079@
+#c 25055@
diff --git a/atari/rootwin.c b/atari/rootwin.c
index 06bb2ee65..81a470955 100755
--- a/atari/rootwin.c
+++ b/atari/rootwin.c
@@ -547,14 +547,55 @@ void window_get_scroll(ROOTWIN *rootwin, int *x, int *y)
void window_get_grect(ROOTWIN *rootwin, enum browser_area_e which, GRECT *d)
{
+
+ d->g_x = 0;
+ d->g_y = 0;
+ d->g_w = 0;
+ d->g_h = 0;
+
if (which == BROWSER_AREA_TOOLBAR) {
guiwin_get_grect(rootwin->win, GUIWIN_AREA_TOOLBAR, d);
} else if (which == BROWSER_AREA_CONTENT) {
- guiwin_get_grect(rootwin->win, GUIWIN_AREA_CONTENT, d);
+
+ GRECT search_area;
+
+ guiwin_get_grect(rootwin->win, GUIWIN_AREA_CONTENT, d);
+
+
+ window_get_grect(rootwin, BROWSER_AREA_SEARCH, &search_area);
+
+ d->g_y += search_area.g_h;
+ d->g_h -= search_area.g_h;
+
} else if (which == BROWSER_AREA_URL_INPUT) {
+
toolbar_get_grect(rootwin->toolbar, TOOLBAR_URL_AREA, d);
- } else {
+ } else if (which == BROWSER_AREA_SEARCH) {
+ // TODO: check if search is open
+ GRECT work;
+ OBJECT * tree;
+
+ guiwin_get_grect(rootwin->win, GUIWIN_AREA_WORK, &work);
+ guiwin_get_grect(rootwin->win, GUIWIN_AREA_TOOLBAR, d);
+ tree = get_tree(SEARCH);
+
+ d->g_x = work.g_x;
+ d->g_w = work.g_w;
+ d->g_y += d->g_h;
+ d->g_h = tree->ob_height;
+ }
+ else {
+
+ }
+
+
+ // sanitize the results
+ if (d->g_h < 0) {
+ d->g_h = 0;
+ }
+ if (d->g_w < 0) {
+ d->g_w = 0;
}
}
@@ -822,7 +863,7 @@ exit:
void window_process_redraws(ROOTWIN * rootwin)
{
- GRECT work, visible_ro, tb_area, content_area;
+ GRECT work, visible_ro, tb_area, search_area, content_area;
short i;
short scroll_x=0, scroll_y=0;
bool toolbar_rdrw_required;
@@ -834,6 +875,7 @@ void window_process_redraws(ROOTWIN * rootwin)
redraw_active = true;
window_get_grect(rootwin, BROWSER_AREA_TOOLBAR, &tb_area);
+ window_get_grect(rootwin, BROWSER_AREA_SEARCH, &search_area);
window_get_grect(rootwin, BROWSER_AREA_CONTENT, &content_area);
//dbg_grect("content area", &content_area);
@@ -877,6 +919,11 @@ void window_process_redraws(ROOTWIN * rootwin)
toolbar_redraw(rootwin->toolbar, &rdrw_area);
}
+ rdrw_area = rdrw_area_ro;
+ if (rc_intersect(&search_area, &rdrw_area)) {
+ search_redraw(NULL, &rdrw_area);
+ }
+
rdrw_area = rdrw_area_ro;
if (rc_intersect(&content_area, &rdrw_area)) {
@@ -901,7 +948,7 @@ void window_process_redraws(ROOTWIN * rootwin)
caret_pos.g_w = caret->dimensions.g_w;
caret_pos.g_h = caret->dimensions.g_h;
- if(rc_intersect_ro(&caret_pos, &content_area)) {
+ if (rc_intersect_ro(&caret_pos, &content_area)) {
caret_rdrw_required = true;
}
}
diff --git a/atari/rootwin.h b/atari/rootwin.h
index 2efbe0b06..3d06615c8 100755
--- a/atari/rootwin.h
+++ b/atari/rootwin.h
@@ -34,7 +34,8 @@ enum browser_area_e {
BROWSER_AREA_CONTENT = 1,
BROWSER_AREA_STATUSBAR,
BROWSER_AREA_TOOLBAR,
- BROWSER_AREA_URL_INPUT
+ BROWSER_AREA_URL_INPUT,
+ BROWSER_AREA_SEARCH
};
diff --git a/atari/search.c b/atari/search.c
index 0b2ed2b05..b58105638 100644
--- a/atari/search.c
+++ b/atari/search.c
@@ -36,7 +36,8 @@
#include "desktop/search.h"
#include "utils/log.h"
#include "utils/messages.h"
-#include "atari/gui.h"
+#include "atari/gui.h"
+#include "atari/rootwin.h"
#include "atari/misc.h"
#include "atari/search.h"
#include "atari/gemtk/gemtk.h"
@@ -134,6 +135,32 @@ void nsatari_search_set_back_state(bool active, void *p)
LOG(("%p: set back state: %d\n", p, active));
}
+void search_redraw(void *session, GRECT *clip)
+{
+ GRECT area, clipped_area;
+ struct gui_window *gw = input_window;
+ short pxy[4];
+ VdiHdl vh;
+
+ if(gw == NULL)
+ return;
+
+ window_get_grect(gw->root, BROWSER_AREA_SEARCH, &area);
+
+ clipped_area = area;
+
+ if (!rc_intersect(clip, &clipped_area)) {
+ return;
+ }
+
+ OBJECT * tree = get_tree(SEARCH);
+ tree->ob_x = area.g_x;
+ tree->ob_y = area.g_y;
+ tree->ob_width = area.g_w;
+ tree->ob_height = area.g_h;
+
+ objc_draw_grect(tree, 0, 8, &clipped_area);
+}
static SEARCH_FORM_SESSION get_search_session(GUIWIN * win)
{
diff --git a/atari/search.h b/atari/search.h
index 9228b9623..1fc64ded7 100644
--- a/atari/search.h
+++ b/atari/search.h
@@ -43,5 +43,7 @@ typedef struct s_search_form_session * SEARCH_FORM_SESSION;
SEARCH_FORM_SESSION open_browser_search(struct gui_window * gw);
void search_destroy(struct gui_window * gw);
+
+void search_redraw(void *session, GRECT *clip);
#endif