summaryrefslogtreecommitdiff
path: root/amiga
diff options
context:
space:
mode:
Diffstat (limited to 'amiga')
-rw-r--r--amiga/font.c24
-rwxr-xr-xamiga/font.h4
-rwxr-xr-xamiga/gui.c36
-rwxr-xr-xamiga/gui.h3
-rwxr-xr-xamiga/plotters.c24
-rwxr-xr-xamiga/plotters.h4
6 files changed, 59 insertions, 36 deletions
diff --git a/amiga/font.c b/amiga/font.c
index 735ffe0f7..1bb0674c2 100644
--- a/amiga/font.c
+++ b/amiga/font.c
@@ -49,8 +49,10 @@ bool nsfont_width(const struct css_style *style,
const char *string, size_t length,
int *width)
{
- ami_open_font(style);
+ struct TextFont *tfont = ami_open_font(style);
*width = TextLength(currp,string,length);
+ ami_close_font(tfont);
+
return true;
}
@@ -72,12 +74,13 @@ bool nsfont_position_in_string(const struct css_style *style,
int x, size_t *char_offset, int *actual_x)
{
struct TextExtent extent;
-
- ami_open_font(style);
+ struct TextFont *tfont = ami_open_font(style);
*char_offset = TextFit(currp,string,length,
&extent,NULL,1,x,32767);
*actual_x = extent.te_Extent.MaxX;
+
+ ami_close_font(tfont);
return true;
}
@@ -106,8 +109,7 @@ bool nsfont_split(const struct css_style *style,
struct TextExtent extent;
ULONG co;
char *charp;
-
- ami_open_font(style);
+ struct TextFont *tfont = ami_open_font(style);
co = TextFit(currp,string,length,
&extent,NULL,1,x,32767);
@@ -121,10 +123,11 @@ bool nsfont_split(const struct css_style *style,
*char_offset = co;
*actual_x = TextLength(currp,string,co);
+ ami_close_font(tfont);
return true;
}
-void ami_open_font(struct css_style *style)
+struct TextFont *ami_open_font(struct css_style *style)
{
struct TextFont *tfont;
struct TTextAttr tattr;
@@ -216,5 +219,14 @@ void ami_open_font(struct css_style *style)
TAG_DONE);
}
+ return tfont;
+}
+
+void ami_close_font(struct TextFont *tfont)
+{
+ SetRPAttrs(currp,
+ RPTAG_Font,origrpfont,
+ TAG_DONE);
+
CloseFont(tfont);
}
diff --git a/amiga/font.h b/amiga/font.h
index 857bee429..4e7c6f197 100755
--- a/amiga/font.h
+++ b/amiga/font.h
@@ -20,7 +20,9 @@
#define AMIGA_FONT_H
#include "css/css.h"
+#include <graphics/text.h>
-void ami_open_font(struct css_style *);
+struct TextFont *ami_open_font(struct css_style *);
+void ami_close_font(struct TextFont *tfont);
#endif
diff --git a/amiga/gui.c b/amiga/gui.c
index de2e8b467..b79604a0a 100755
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -36,6 +36,8 @@
#include <proto/utility.h>
#include <proto/graphics.h>
#include <proto/Picasso96API.h>
+#include "render/form.h"
+#include <graphics/rpattr.h>
#ifdef WITH_HUBBUB
#include <hubbub/hubbub.h>
@@ -102,7 +104,7 @@ void gui_init(int argc, char** argv)
TimerBase = (struct Device *)tioreq->tr_node.io_Device;
ITimer = (struct TimerIFace *)GetInterface((struct Library *)TimerBase,"main",1,NULL);
- verbose_log = 1;
+ verbose_log = 0;
if(lock=Lock("Resources/LangNames",ACCESS_READ))
{
@@ -224,9 +226,6 @@ void ami_get_msg(void)
{
gwin = node->objstruct;
- if(gwin->redraw_required)
- ami_do_redraw(gwin);
-
while((result = RA_HandleInput(gwin->objects[OID_MAIN],&code)) != WMHI_LASTMSG)
{
@@ -377,19 +376,9 @@ void ami_get_msg(void)
return;
}
-/*
- while((result = RA_HandleInput(gwin->objects[OID_VSCROLL],&code)) != WMHI_LASTMSG)
- {
- switch(result & WMHI_CLASSMASK) // class
- {
- default:
- //case WMHI_GADGETUP:
- //switch(result & WMHI_GADGETMASK) //gadaddr->GadgetID) //result & WMHI_GADGETMASK)
- printf("vscroller %ld %ld\n",(result & WMHI_CLASSMASK),(result & WMHI_GADGETMASK));
- break;
- }
- }
-*/
+ if(gwin->redraw_required)
+ ami_do_redraw(gwin);
+
node = nnode;
}
}
@@ -670,6 +659,8 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw,
InitRastPort(&gwin->rp);
gwin->rp.BitMap = gwin->bm;
+ GetRPAttrs(&gwin->rp,RPTAG_Font,&origrpfont,TAG_DONE);
+
GetAttr(WINDOW_HorizObject,gwin->objects[OID_MAIN],(ULONG *)&gwin->objects[OID_HSCROLL]);
GetAttr(WINDOW_VertObject,gwin->objects[OID_MAIN],(ULONG *)&gwin->objects[OID_VSCROLL]);
@@ -834,7 +825,7 @@ void gui_window_scroll_visible(struct gui_window *g, int x0, int y0,
void gui_window_position_frame(struct gui_window *g, int x0, int y0,
int x1, int y1)
{
- printf("posn frame\n");
+ ChangeWindowBox(g->win,x0,y0,x1-x0,y1-y0);
}
void gui_window_get_dimensions(struct gui_window *g, int *width, int *height,
@@ -858,7 +849,9 @@ void gui_window_get_dimensions(struct gui_window *g, int *width, int *height,
void gui_window_update_extent(struct gui_window *g)
{
-// Object *hscroller,*vscroller;
+ struct IBox *bbox;
+
+ GetAttr(SPACE_AreaBox,g->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);
@@ -870,13 +863,13 @@ void gui_window_update_extent(struct gui_window *g)
RefreshSetGadgetAttrs((APTR)g->objects[OID_VSCROLL],g->win,NULL,
SCROLLER_Total,g->bw->current_content->height,
- SCROLLER_Visible,600,
+ SCROLLER_Visible,bbox->Height,
SCROLLER_Top,0,
TAG_DONE);
RefreshSetGadgetAttrs((APTR)g->objects[OID_HSCROLL],g->win,NULL,
SCROLLER_Total,g->bw->current_content->width,
- SCROLLER_Visible,800,
+ SCROLLER_Visible,bbox->Width,
SCROLLER_Top,0,
TAG_DONE);
}
@@ -1012,6 +1005,7 @@ bool gui_copy_to_clipboard(struct selection *s)
void gui_create_form_select_menu(struct browser_window *bw,
struct form_control *control)
{
+ printf("FORM TYPE: %ld\n",control->type);
}
void gui_launch_url(const char *url)
diff --git a/amiga/gui.h b/amiga/gui.h
index 7f4c81d25..35f8205a1 100755
--- a/amiga/gui.h
+++ b/amiga/gui.h
@@ -66,6 +66,7 @@ struct gui_window {
union content_msg_data *redraw_data;
};
-struct gui_window *curwin;
+//struct gui_window *curwin;
struct RastPort *currp;
+struct TextFont *origrpfont;
#endif
diff --git a/amiga/plotters.c b/amiga/plotters.c
index 0ac3f5852..e3f167d03 100755
--- a/amiga/plotters.c
+++ b/amiga/plotters.c
@@ -24,6 +24,7 @@
#include <proto/graphics.h>
#include <intuition/intuition.h>
#include <graphics/rpattr.h>
+#include <graphics/gfxmacros.h>
#include <proto/exec.h> // for debugprintf only
@@ -103,9 +104,7 @@ bool ami_line(int x0, int y0, int x1, int y1, int width,
SetRPAttrs(currp,RPTAG_APenColor,p96EncodeColor(RGBFB_A8B8G8R8,c),
TAG_DONE);
Move(currp,x0,y0);
- Draw(currp,x1,y1); // NB: does not support width,dotted,dashed
-
-/*There is the line pattern in the rastport, would that help? There are macros in graphics/gfxmacros.h that do it. */
+ Draw(currp,x1,y1);
return true;
}
@@ -156,21 +155,26 @@ bool ami_clip(int x0, int y0, int x1, int y1)
bool ami_text(int x, int y, const struct css_style *style,
const char *text, size_t length, colour bg, colour c)
{
- ami_open_font(style);
+ struct TextFont *tfont = ami_open_font(style);
SetRPAttrs(currp,RPTAG_APenColor,p96EncodeColor(RGBFB_A8B8G8R8,c),
RPTAG_BPenColor,p96EncodeColor(RGBFB_A8B8G8R8,bg),
- RPTAG_OPenColor,p96EncodeColor(RGBFB_A8B8G8R8,bg),
+// RPTAG_OPenColor,p96EncodeColor(RGBFB_A8B8G8R8,bg),
// RPTAG_Font,tfont,
TAG_DONE);
Move(currp,x,y);
Text(currp,text,length);
+ ami_close_font(tfont);
+
return true;
}
bool ami_disc(int x, int y, int radius, colour c, bool filled)
{
+ struct AreaInfo ai;
+ APTR buf[10];
+
DebugPrintF("disc\n");
currp->PenWidth = 1;
@@ -179,6 +183,16 @@ bool ami_disc(int x, int y, int radius, colour c, bool filled)
SetRPAttrs(currp,RPTAG_APenColor,p96EncodeColor(RGBFB_A8B8G8R8,c),
TAG_DONE);
+
+/* see rkrm
+ if(filled)
+ {
+// InitArea(&ai,&buf,2);
+ AreaCircle(currp,x,y,radius);
+// AreaEnd(currp);
+ }
+*/
+
DrawEllipse(currp,x,y,radius,radius); // NB: does not support fill, need to use AreaCircle for that
return true;
diff --git a/amiga/plotters.h b/amiga/plotters.h
index 3de1b497d..0ed18c5ee 100755
--- a/amiga/plotters.h
+++ b/amiga/plotters.h
@@ -36,10 +36,10 @@ bool ami_disc(int x, int y, int radius, colour c, bool filled);
bool ami_arc(int x, int y, int radius, int angle1, int angle2,
colour c);
bool ami_bitmap(int x, int y, int width, int height,
- struct bitmap *bitmap, colour bg);
+ struct bitmap *bitmap, colour bg,struct content *content);
bool ami_bitmap_tile(int x, int y, int width, int height,
struct bitmap *bitmap, colour bg,
- bool repeat_x, bool repeat_y);
+ bool repeat_x, bool repeat_y,struct content *content);
bool ami_group_start(const char *name);
bool ami_group_end(void);
bool ami_flush(void);