summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2008-08-27 22:19:25 +0000
committerChris Young <chris@unsatisfactorysoftware.co.uk>2008-08-27 22:19:25 +0000
commitb76b92809484acdc88de6d387a2b677218a7c7a0 (patch)
tree4c481f973a30b54217c39123e097b07f72aab5d0
parente86465e31f01a60a4a74590b766ce97e9854c26d (diff)
downloadnetsurf-b76b92809484acdc88de6d387a2b677218a7c7a0.tar.gz
netsurf-b76b92809484acdc88de6d387a2b677218a7c7a0.tar.bz2
Removed dependency on codesets.library
svn path=/trunk/netsurf/; revision=5214
-rwxr-xr-xamiga/gui.c21
-rwxr-xr-xamiga/utf8.c54
-rwxr-xr-xamiga/utf8.h4
3 files changed, 16 insertions, 63 deletions
diff --git a/amiga/gui.c b/amiga/gui.c
index 31263083e..989849dd3 100755
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -44,7 +44,6 @@
#include <proto/iffparse.h>
#include <datatypes/textclass.h>
#include "desktop/selection.h"
-#include <proto/codesets.h>
#include "utils/utf8.h"
#include "amiga/utf8.h"
#include "amiga/hotlist.h"
@@ -89,8 +88,6 @@ struct Device *TimerBase;
struct TimerIFace *ITimer;
struct Library *PopupMenuBase = NULL;
struct PopupMenuIFace *IPopupMenu = NULL;
-struct Library *CodesetsBase = NULL;
-struct CodesetsIFace *ICodesets = NULL;
struct Screen *scrn;
bool win_destroyed = false;
@@ -136,11 +133,6 @@ void gui_init(int argc, char** argv)
IPopupMenu = (struct PopupMenuIFace *)GetInterface(PopupMenuBase,"main",1,NULL);
}
- if(CodesetsBase = OpenLibrary("codesets.library",0))
- {
- ICodesets = (struct CodesetsIFace *)GetInterface(CodesetsBase,"main",1,NULL);
- }
-
filereq = (struct FileRequester *)AllocAslRequest(ASL_FileRequest,NULL);
if(iffh = AllocIFF())
@@ -681,9 +673,6 @@ void gui_quit(void)
FreeAslRequest(filereq);
- if(ICodesets) DropInterface((struct Interface *)ICodesets);
- if(CodesetsBase) CloseLibrary(CodesetsBase);
-
if(IPopupMenu) DropInterface((struct Interface *)IPopupMenu);
if(PopupMenuBase) CloseLibrary(PopupMenuBase);
@@ -760,7 +749,7 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw,
case BROWSER_WINDOW_FRAME:
gwin->objects[OID_MAIN] = WindowObject,
WA_ScreenTitle,nsscreentitle,
- WA_Title, messages_get("NetSurf"),
+// WA_Title, messages_get("NetSurf"),
WA_Activate, FALSE,
WA_DepthGadget, TRUE,
WA_DragBar, TRUE,
@@ -798,7 +787,7 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw,
case BROWSER_WINDOW_NORMAL:
gwin->objects[OID_MAIN] = WindowObject,
WA_ScreenTitle,nsscreentitle,
- WA_Title, messages_get("NetSurf"),
+// WA_Title, messages_get("NetSurf"),
WA_Activate, TRUE,
WA_DepthGadget, TRUE,
WA_DragBar, TRUE,
@@ -931,7 +920,8 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw,
/* below needs to be allocated as big as the screen */
gwin->bm = p96AllocBitMap(scrn->Width,scrn->Height,32,
BMF_CLEAR | BMF_DISPLAYABLE | BMF_INTERLEAVED,
- gwin->win->RPort->BitMap,RGBFB_A8R8G8B8);
+ gwin->win->RPort->BitMap,
+ RGBFB_A8R8G8B8);
InitRastPort(&gwin->rp);
gwin->rp.BitMap = gwin->bm;
@@ -985,7 +975,8 @@ void gui_window_destroy(struct gui_window *g)
void gui_window_set_title(struct gui_window *g, const char *title)
{
- SetWindowTitles(g->win,title,nsscreentitle);
+ if(g->win->Title) ami_utf8_free(g->win->Title);
+ SetWindowTitles(g->win,ami_utf8_easy(title),nsscreentitle);
}
void gui_window_redraw(struct gui_window *g, int x0, int y0, int x1, int y1)
diff --git a/amiga/utf8.c b/amiga/utf8.c
index 9ea649216..26b2fe2c7 100755
--- a/amiga/utf8.c
+++ b/amiga/utf8.c
@@ -18,62 +18,26 @@
#include <sys/types.h>
#include "utils/utf8.h"
-#include <proto/codesets.h>
#include <proto/exec.h>
#include <parserutils/charset/mibenum.h>
+#include <proto/diskfont.h>
+#include <diskfont/diskfonttag.h>
utf8_convert_ret utf8_to_local_encoding(const char *string, size_t len,
char **result)
{
-/*
- struct codeset *cs = CodesetsFind("ISO-8859-1",
- CSA_FallbackToDefault,FALSE,
- TAG_DONE);
-*/
-
-// if(!len) return UTF8_CONVERT_OK;
-
- *result = CodesetsUTF8ToStr(CSA_Source,string,
- CSA_SourceLen,len,
-// CSA_MapForeignChars,TRUE,
-// CSA_DestCodeset,cs,
- TAG_DONE);
-
- return UTF8_CONVERT_OK;
-}
-
-ULONG ami_utf8_to_any(const char *string, size_t len, char **result)
-{
- uint16 mibenum = 0;
-
- struct codeset *cs = CodesetsFindBest(CSA_Source,string,
- CSA_SourceLen,len,
- CSA_FallbackToDefault,TRUE,
- TAG_DONE);
+ ULONG *charset;
+ char *encname;
- *result = CodesetsUTF8ToStr(CSA_Source,string,
- CSA_SourceLen,len,
-// CSA_MapForeignChars,TRUE,
- CSA_DestCodeset,cs,
- TAG_DONE);
-
- mibenum = parserutils_charset_mibenum_from_name(cs->name,strlen(cs->name));
-
- printf("%ld\n",mibenum);
-
- return mibenum; // mibenum
-}
-
-/*
-char *ami_utf8_alloc(char *string)
-{
- return (AllocVec(CodesetsUTF8Len(string)+1,MEMF_CLEAR));
+ charset = GetDiskFontCtrl(DFCTRL_CHARSET);
+ encname = parserutils_charset_mibenum_to_name(charset);
+
+ return utf8_to_enc(string,encname,len,result);
}
-*/
void ami_utf8_free(char *ptr)
{
- if(ptr) CodesetsFreeA(ptr,NULL);
+ if(ptr) free(ptr);
}
char *ami_utf8_easy(char *string)
diff --git a/amiga/utf8.h b/amiga/utf8.h
index e4074c69f..fd863ca8a 100755
--- a/amiga/utf8.h
+++ b/amiga/utf8.h
@@ -18,8 +18,6 @@
#ifndef AMIGA_UTF8_H
#define AMIGA_UTF8_H
-//char *ami_utf8_alloc(char *string);
-ULONG ami_utf8_to_any(const char *string, size_t len, char **result);
-void ami_utf8_free(char *ptr);
char *ami_utf8_easy(char *string);
+void ami_utf8_free(char *ptr);
#endif