summaryrefslogtreecommitdiff
path: root/amiga
diff options
context:
space:
mode:
Diffstat (limited to 'amiga')
-rwxr-xr-xamiga/gui.c95
-rwxr-xr-xamiga/menu.c65
-rwxr-xr-xamiga/menu.h4
3 files changed, 96 insertions, 68 deletions
diff --git a/amiga/gui.c b/amiga/gui.c
index 9c402c13a..0e7d813ca 100755
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -77,6 +77,7 @@
#include <graphics/blitattr.h>
#include "amiga/gui_options.h"
#include "amiga/bitmap.h"
+#include "amiga/print.h"
#include "amiga/stringview/stringview.h"
#include "amiga/stringview/urlhistory.h"
@@ -189,6 +190,7 @@ void ami_init_mouse_pointers(void);
void ami_switch_tab(struct gui_window_2 *gwin,bool redraw);
static void *myrealloc(void *ptr, size_t len, void *pw);
void ami_get_hscroll_pos(struct gui_window_2 *gwin, ULONG *xs);
+void ami_get_vscroll_pos(struct gui_window_2 *gwin, ULONG *ys);
ULONG ami_set_border_gadget_balance(struct gui_window_2 *gwin);
ULONG ami_get_border_gadget_balance(struct gui_window_2 *gwin, ULONG *size1, ULONG *size2);
@@ -812,15 +814,18 @@ void ami_handle_msg(void)
case WMHI_MOUSEMOVE:
GetAttr(SPACE_AreaBox,gwin->gadgets[GID_BROWSER],(ULONG *)&bbox);
- ami_get_hscroll_pos(gwin, (ULONG *)&xs);
- x = gwin->win->MouseX - bbox->Left +xs; // mousex should be in intuimessage
-
- GetAttr(SCROLLER_Top,gwin->objects[OID_VSCROLL],(ULONG *)&ys);
- y = gwin->win->MouseY - bbox->Top + ys;
+ x = gwin->win->MouseX - bbox->Left; // mousex should be in intuimessage
+ y = gwin->win->MouseY - bbox->Top;
x /= gwin->bw->scale;
y /= gwin->bw->scale;
+ ami_get_hscroll_pos(gwin, (ULONG *)&xs);
+ ami_get_vscroll_pos(gwin, (ULONG *)&ys);
+
+ x += xs;
+ y += ys;
+
width=bbox->Width;
height=bbox->Height;
@@ -862,15 +867,20 @@ void ami_handle_msg(void)
break;
case WMHI_MOUSEBUTTONS:
- GetAttr(SPACE_AreaBox,gwin->gadgets[GID_BROWSER],(ULONG *)&bbox);
- ami_get_hscroll_pos(gwin, (ULONG *)&xs);
- x = gwin->win->MouseX - bbox->Left +xs;
- GetAttr(SCROLLER_Top,gwin->objects[OID_VSCROLL],(ULONG *)&ys);
- y = gwin->win->MouseY - bbox->Top + ys;
+ GetAttr(SPACE_AreaBox,gwin->gadgets[GID_BROWSER],(ULONG *)&bbox);
+
+ x = gwin->win->MouseX - bbox->Left;
+ y = gwin->win->MouseY - bbox->Top;
x /= gwin->bw->scale;
y /= gwin->bw->scale;
+ ami_get_hscroll_pos(gwin, (ULONG *)&xs);
+ ami_get_vscroll_pos(gwin, (ULONG *)&ys);
+
+ x += xs;
+ y += ys;
+
width=bbox->Width;
height=bbox->Height;
@@ -1298,7 +1308,7 @@ void ami_handle_appmsg(void)
ami_get_hscroll_pos(gwin, (ULONG *)&xs);
x = (appmsg->am_MouseX) - (bbox->Left) +xs;
- GetAttr(SCROLLER_Top,gwin->objects[OID_VSCROLL],(ULONG *)&ys);
+ ami_get_vscroll_pos(gwin, (ULONG *)&ys);
y = appmsg->am_MouseY - bbox->Top + ys;
width=bbox->Width;
@@ -2434,7 +2444,7 @@ void gui_window_redraw(struct gui_window *g, int x0, int y0, int x1, int y1)
c = g->shared->bw->current_content;
ami_get_hscroll_pos(g->shared, (ULONG *)&sx);
- GetAttr(SCROLLER_Top,g->shared->objects[OID_VSCROLL],(ULONG *)&sy);
+ ami_get_vscroll_pos(g->shared, (ULONG *)&sy);
ami_do_redraw_limits(g,c,x0,y0,x1,y1,sx,sy);
}
@@ -2459,7 +2469,7 @@ void gui_window_update_box(struct gui_window *g,
if(!g) return;
ami_get_hscroll_pos(g->shared, (ULONG *)&sx);
- GetAttr(SCROLLER_Top,g->shared->objects[OID_VSCROLL],(ULONG *)&sy);
+ ami_get_vscroll_pos(g->shared, (ULONG *)&sy);
ami_do_redraw_limits(g,g->shared->bw->current_content,
data->redraw.x,data->redraw.y,
@@ -2480,7 +2490,7 @@ void ami_do_redraw(struct gui_window_2 *g)
GetAttr(SPACE_AreaBox,g->gadgets[GID_BROWSER],(ULONG *)&bbox);
ami_get_hscroll_pos(g, (ULONG *)&hcurrent);
- GetAttr(SCROLLER_Top,g->objects[OID_VSCROLL],(ULONG *)&vcurrent);
+ ami_get_vscroll_pos(g, (ULONG *)&vcurrent);
c = g->bw->current_content;
@@ -2548,20 +2558,20 @@ void ami_do_redraw(struct gui_window_2 *g)
if(c->type == CONTENT_HTML)
{
- content_redraw(c, -hcurrent /* * g->bw->scale */,
- -vcurrent /* * g->bw->scale */,
- width-hcurrent /* * g->bw->scale */,
- height-vcurrent /* * g->bw->scale */,
- 0,0,width /* * g->bw->scale */,
- height /* * g->bw->scale */,
+ content_redraw(c, -hcurrent,
+ -vcurrent,
+ (width / g->bw->scale) - hcurrent,
+ (height / g->bw->scale) - vcurrent,
+ 0,0,width,
+ height,
g->bw->scale,0xFFFFFF);
}
else
{
content_redraw(c, -hcurrent /* * g->bw->scale */,
-vcurrent /* * g->bw->scale */,
- width-hcurrent /* * g->bw->scale */,
- height-vcurrent /* * g->bw->scale */,
+ (width / g->bw->scale) - hcurrent,
+ (height / g->bw->scale) - vcurrent,
0,0,c->width /* * g->bw->scale */,
c->height /* * g->bw->scale */,
g->bw->scale,0xFFFFFF);
@@ -2594,12 +2604,20 @@ void ami_get_hscroll_pos(struct gui_window_2 *gwin, ULONG *xs)
{
GetAttr(SCROLLER_Top, gwin->objects[OID_HSCROLL], xs);
}
+
+ *xs /= gwin->bw->scale;
+}
+
+void ami_get_vscroll_pos(struct gui_window_2 *gwin, ULONG *ys)
+{
+ GetAttr(SCROLLER_Top, gwin->objects[OID_VSCROLL], ys);
+ *ys /= gwin->bw->scale;
}
bool gui_window_get_scroll(struct gui_window *g, int *sx, int *sy)
{
ami_get_hscroll_pos(g->shared, (ULONG *)sx);
- GetAttr(SCROLLER_Top,g->shared->objects[OID_VSCROLL],(ULONG *)sy);
+ ami_get_vscroll_pos(g->shared, (ULONG *)sy);
}
void gui_window_set_scroll(struct gui_window *g, int sx, int sy)
@@ -2617,22 +2635,23 @@ void gui_window_set_scroll(struct gui_window *g, int sx, int sy)
if((cur_tab == g->tab) || (g->shared->tabs == 0))
{
- RefreshSetGadgetAttrs((APTR)g->shared->objects[OID_VSCROLL],g->shared->win,NULL,
- SCROLLER_Top,sy,
+ RefreshSetGadgetAttrs((APTR)g->shared->objects[OID_VSCROLL],
+ g->shared->win, NULL,
+ SCROLLER_Top, sy * g->shared->bw->scale,
TAG_DONE);
if(g->shared->gadgets[GID_HSCROLL])
{
RefreshSetGadgetAttrs((APTR)g->shared->gadgets[GID_HSCROLL],
g->shared->win, NULL,
- PGA_Top, sx,
+ PGA_Top, sx * g->shared->bw->scale,
TAG_DONE);
}
else if(g->shared->objects[OID_HSCROLL])
{
RefreshSetGadgetAttrs((APTR)g->shared->objects[OID_HSCROLL],
g->shared->win, NULL,
- SCROLLER_Top, sx,
+ SCROLLER_Top, sx * g->shared->bw->scale,
TAG_DONE);
}
g->shared->redraw_required = true;
@@ -2640,7 +2659,6 @@ void gui_window_set_scroll(struct gui_window *g, int sx, int sy)
if(option_faster_scroll) g->shared->redraw_scroll = true;
else g->shared->redraw_scroll = false;
-
g->scrollx = sx;
g->scrolly = sy;
@@ -2695,21 +2713,16 @@ void gui_window_update_extent(struct gui_window *g)
{
GetAttr(SPACE_AreaBox,g->shared->gadgets[GID_BROWSER],(ULONG *)&bbox);
-/*
- printf("upd ext %ld,%ld\n",g->bw->current_content->width, // * g->bw->scale,
- g->bw->current_content->height); // * g->bw->scale);
-*/
-
RefreshSetGadgetAttrs((APTR)g->shared->objects[OID_VSCROLL],g->shared->win,NULL,
- SCROLLER_Total,g->shared->bw->current_content->height,
- SCROLLER_Visible,bbox->Height,
+ SCROLLER_Total, (ULONG)(g->shared->bw->current_content->height * g->shared->bw->scale),
+ SCROLLER_Visible, bbox->Height,
TAG_DONE);
if(g->shared->gadgets[GID_HSCROLL])
{
RefreshSetGadgetAttrs((APTR)g->shared->gadgets[GID_HSCROLL],
g->shared->win, NULL,
- PGA_Total, g->shared->bw->current_content->width,
+ PGA_Total, (ULONG)(g->shared->bw->current_content->width * g->shared->bw->scale),
PGA_Visible, bbox->Width,
TAG_DONE);
}
@@ -2717,7 +2730,7 @@ void gui_window_update_extent(struct gui_window *g)
{
RefreshSetGadgetAttrs((APTR)g->shared->objects[OID_HSCROLL],
g->shared->win, NULL,
- SCROLLER_Total, g->shared->bw->current_content->width,
+ SCROLLER_Total, (ULONG)(g->shared->bw->current_content->width * g->shared->bw->scale),
SCROLLER_Visible, bbox->Width,
TAG_DONE);
}
@@ -3029,7 +3042,7 @@ void gui_window_place_caret(struct gui_window *g, int x, int y, int height)
GetAttr(SPACE_AreaBox,g->shared->gadgets[GID_BROWSER],(ULONG *)&bbox);
ami_get_hscroll_pos(g->shared, (ULONG *)&xs);
- GetAttr(SCROLLER_Top,g->shared->objects[OID_VSCROLL],&ys);
+ ami_get_vscroll_pos(g->shared, (ULONG *)&ys);
SetAPen(g->shared->win->RPort,3);
@@ -3057,7 +3070,7 @@ void gui_window_remove_caret(struct gui_window *g)
GetAttr(SPACE_AreaBox,g->shared->gadgets[GID_BROWSER],(ULONG *)&bbox);
ami_get_hscroll_pos(g->shared, (ULONG *)&xs);
- GetAttr(SCROLLER_Top,g->shared->objects[OID_VSCROLL],(ULONG *)&ys);
+ ami_get_vscroll_pos(g->shared, (ULONG *)&ys);
BltBitMapRastPort(browserglob.bm,g->c_x-xs,g->c_y-ys,g->shared->win->RPort,bbox->Left+g->c_x-xs,bbox->Top+g->c_y-ys,2+1,g->c_h+1,0x0C0);
@@ -3141,7 +3154,9 @@ bool gui_window_frame_resize_start(struct gui_window *g)
void gui_window_set_scale(struct gui_window *g, float scale)
{
- printf("set scale\n");
+ browserglob.scale = scale;
+ g->shared->new_content = true;
+ g->shared->redraw_required = true;
}
void gui_create_form_select_menu(struct browser_window *bw,
diff --git a/amiga/menu.c b/amiga/menu.c
index b82d1c151..fb6456c5d 100755
--- a/amiga/menu.c
+++ b/amiga/menu.c
@@ -100,17 +100,20 @@ void ami_init_menulabs(void)
menulab[24] = ami_utf8_easy((char *)messages_get("Browser"));
menulab[25] = ami_utf8_easy((char *)messages_get("FindTextNS"));
menulab[26] = NM_BARLABEL;
- menulab[27] = ami_utf8_easy((char *)messages_get("normal"));
- menulab[28] = ami_utf8_easy((char *)messages_get("HistLocalNS"));
- menulab[29] = ami_utf8_easy((char *)messages_get("HistGlobalNS"));
- menulab[30] = NM_BARLABEL;
- menulab[31] = ami_utf8_easy((char *)messages_get("ShowCookies"));
- menulab[32] = NM_BARLABEL;
- menulab[33] = ami_utf8_easy((char *)messages_get("Redraw"));
- menulab[34] = ami_utf8_easy((char *)messages_get("Hotlist"));
- menulab[35] = ami_utf8_easy((char *)messages_get("HotlistAdd"));
- menulab[36] = ami_utf8_easy((char *)messages_get("HotlistShowNS"));
- menulab[37] = NM_BARLABEL;
+ menulab[27] = ami_utf8_easy((char *)messages_get("HistLocalNS"));
+ menulab[28] = ami_utf8_easy((char *)messages_get("HistGlobalNS"));
+ menulab[29] = NM_BARLABEL;
+ menulab[30] = ami_utf8_easy((char *)messages_get("ShowCookies"));
+ menulab[31] = NM_BARLABEL;
+ menulab[32] = ami_utf8_easy((char *)messages_get("Scale"));
+ menulab[33] = ami_utf8_easy((char *)messages_get("ScaleDec"));
+ menulab[34] = ami_utf8_easy((char *)messages_get("ScaleNorm"));
+ menulab[35] = ami_utf8_easy((char *)messages_get("ScaleInc"));
+ menulab[36] = ami_utf8_easy((char *)messages_get("Redraw"));
+ menulab[37] = ami_utf8_easy((char *)messages_get("Hotlist"));
+ menulab[38] = ami_utf8_easy((char *)messages_get("HotlistAdd"));
+ menulab[39] = ami_utf8_easy((char *)messages_get("HotlistShowNS"));
+ menulab[40] = NM_BARLABEL;
menulab[AMI_MENU_HOTLIST_MAX] = ami_utf8_easy((char *)messages_get("Settings"));
menulab[AMI_MENU_HOTLIST_MAX+1] = ami_utf8_easy((char *)messages_get("SettingsEdit"));
@@ -154,12 +157,15 @@ struct NewMenu *ami_create_menu(ULONG type)
{NM_TITLE,0,0,0,0,0,}, // browser
{ NM_ITEM,0,"F",0,0,0,}, // find in page
{ NM_ITEM,NM_BARLABEL,0,0,0,0,},
- {NM_IGNORE,0,0,0,0,0,}, // was test option for scaling
{ NM_ITEM,0,0,0,0,0,}, // local history
{ NM_ITEM,0,0,0,0,0,}, // global history
{ NM_ITEM,NM_BARLABEL,0,0,0,0,},
{ NM_ITEM,0,0,0,0,0,}, // cookies
{ NM_ITEM,NM_BARLABEL,0,0,0,0,},
+ { NM_ITEM,0,0,0,0,0,}, // scale
+ { NM_SUB,0,"-",0,0,0,}, // decrease
+ { NM_SUB,0,"=",0,0,0,}, // normal
+ { NM_SUB,0,"+",0,0,0,}, // increase
{ NM_ITEM,0,0,0,0,0,}, // redraw
{NM_TITLE,0,0,0,0,0,}, // hotlist
{ NM_ITEM,0,0,0,0,0,}, // add to hotlist
@@ -647,19 +653,6 @@ void ami_menupick(ULONG code,struct gui_window_2 *gwin,struct MenuItem *item)
ami_search_open(gwin->bw->window);
break;
- case 1: // size
- switch(subnum)
- {
- case 0: // normal
- gwin->bw->scale = 1.0;
- break;
-
- case 1: // double
- gwin->bw->scale = 2.0;
- break;
- }
- break;
-
case 2: // local history
if(gwin->bw && gwin->bw->history)
ami_history_open(gwin->bw, gwin->bw->history);
@@ -673,7 +666,27 @@ void ami_menupick(ULONG code,struct gui_window_2 *gwin,struct MenuItem *item)
ami_open_tree(cookies_tree,AMI_TREE_COOKIES);
break;
- case 7: // redraw
+ case 7: // size
+ switch(subnum)
+ {
+ case 0: // decrease */
+ if(gwin->bw->scale > 0.1)
+ browser_window_set_scale(gwin->bw,
+ gwin->bw->scale - 0.1, false);
+ break;
+
+ case 1: // normal */
+ browser_window_set_scale(gwin->bw, 1.0, false);
+ break;
+
+ case 2: // increase */
+ browser_window_set_scale(gwin->bw,
+ gwin->bw->scale + 0.1, false);
+ break;
+ }
+ break;
+
+ case 8: // redraw
gwin->redraw_required = true;
gwin->new_content = true;
break;
diff --git a/amiga/menu.h b/amiga/menu.h
index 5ba50fc2a..1c4e7d7ed 100755
--- a/amiga/menu.h
+++ b/amiga/menu.h
@@ -28,10 +28,10 @@
/* Maximum number of menu items - first value is number of static items
* (ie. everything not intially defined as NM_IGNORE) */
-#define AMI_MENU_MAX 46 + AMI_HOTLIST_ITEMS
+#define AMI_MENU_MAX 49 + AMI_HOTLIST_ITEMS
/* Where the hotlist entries start */
-#define AMI_MENU_HOTLIST 38
+#define AMI_MENU_HOTLIST 41
/* Where the hotlist entries end */
#define AMI_MENU_HOTLIST_MAX AMI_MENU_HOTLIST+AMI_HOTLIST_ITEMS