Removed dependency on codesets.library

svn path=/trunk/netsurf/; revision=5214
This commit is contained in:
Chris Young 2008-08-27 22:19:25 +00:00
parent e86465e31f
commit b76b928094
3 changed files with 16 additions and 63 deletions

View File

@ -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)

View File

@ -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);
*/
ULONG *charset;
char *encname;
// 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;
charset = GetDiskFontCtrl(DFCTRL_CHARSET);
encname = parserutils_charset_mibenum_to_name(charset);
return utf8_to_enc(string,encname,len,result);
}
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);
*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));
}
*/
void ami_utf8_free(char *ptr)
{
if(ptr) CodesetsFreeA(ptr,NULL);
if(ptr) free(ptr);
}
char *ami_utf8_easy(char *string)

View File

@ -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