void ami_theme_init(void) { char themefile[1024]; char searchico[1024]; BPTR lock = 0; strcpy(themefile,nsoption_charp(theme)); AddPart(themefile,"Theme",100); lock = Lock(themefile,ACCESS_READ); if(!lock) { warn_user("ThemeApplyErr",nsoption_charp(theme)); strcpy(themefile,"PROGDIR:Resources/Themes/Default/Theme"); nsoption_set_charp(theme, (char *)strdup("PROGDIR:Resources/Themes/Default")); } else { UnLock(lock); } lock = Lock(themefile,ACCESS_READ); if(lock) { UnLock(lock); messages_load(themefile); } ami_get_theme_filename(searchico, "theme_search", false); search_default_ico_location = (char *)strdup(searchico); }
void ami_theme_throbber_setup(void) { char throbberfile[1024]; Object *dto; struct bitmap *bm; ami_get_theme_filename(throbberfile,"theme_throbber",false); throbber_frames=atoi(messages_get("theme_throbber_frames")); throbber_update_interval = atoi(messages_get("theme_throbber_delay")); if(throbber_update_interval == 0) throbber_update_interval = 100; bm = ami_bitmap_from_datatype(throbberfile); throbber = ami_bitmap_get_native(bm, bm->width, bm->height, NULL); throbber_width = bm->width / throbber_frames; throbber_height = bm->height; throbber_nsbm = bm; }
void ami_init_mouse_pointers(void) { int i; struct RastPort mouseptr; struct DiskObject *dobj; uint32 format = IDFMT_BITMAPPED; int32 mousexpt=0,mouseypt=0; InitRastPort(&mouseptr); for(i=0;i<=AMI_LASTPOINTER;i++) { BPTR ptrfile = 0; mouseptrbm[i] = NULL; mouseptrobj[i] = NULL; char ptrfname[1024]; #ifdef __amigaos4__ if(nsoption_bool(truecolour_mouse_pointers)) { ami_get_theme_filename((char *)&ptrfname,ptrs32[i], false); if(dobj = GetIconTags(ptrfname,ICONGETA_UseFriendBitMap,TRUE,TAG_DONE)) { if(IconControl(dobj, ICONCTRLA_GetImageDataFormat, &format, TAG_DONE)) { if(IDFMT_DIRECTMAPPED == format) { int32 width = 0, height = 0; uint8* data = 0; IconControl(dobj, ICONCTRLA_GetWidth, &width, ICONCTRLA_GetHeight, &height, ICONCTRLA_GetImageData1, &data, TAG_DONE); if (width > 0 && width <= 64 && height > 0 && height <= 64 && data) { STRPTR tooltype; if(tooltype = FindToolType(dobj->do_ToolTypes, "XOFFSET")) mousexpt = atoi(tooltype); if(tooltype = FindToolType(dobj->do_ToolTypes, "YOFFSET")) mouseypt = atoi(tooltype); if (mousexpt < 0 || mousexpt >= width) mousexpt = 0; if (mouseypt < 0 || mouseypt >= height) mouseypt = 0; static uint8 dummyPlane[64 * 64 / 8]; static struct BitMap dummyBitMap = { 64 / 8, 64, 0, 2, 0, { dummyPlane, dummyPlane, 0, 0, 0, 0, 0, 0 }, }; mouseptrobj[i] = NewObject(NULL, "pointerclass", POINTERA_BitMap, &dummyBitMap, POINTERA_XOffset, -mousexpt, POINTERA_YOffset, -mouseypt, POINTERA_WordWidth, (width + 15) / 16, POINTERA_XResolution, POINTERXRESN_SCREENRES, POINTERA_YResolution, POINTERYRESN_SCREENRESASPECT, POINTERA_ImageData, data, POINTERA_Width, width, POINTERA_Height, height, TAG_DONE); } } } } } #endif if(!mouseptrobj[i]) { ami_get_theme_filename(ptrfname,ptrs[i], false); if(ptrfile = Open(ptrfname,MODE_OLDFILE)) { int mx,my; UBYTE *pprefsbuf = AllocVec(1061,MEMF_PRIVATE | MEMF_CLEAR); Read(ptrfile,pprefsbuf,1061); mouseptrbm[i]=AllocVec(sizeof(struct BitMap),MEMF_PRIVATE | MEMF_CLEAR); InitBitMap(mouseptrbm[i],2,32,32); mouseptrbm[i]->Planes[0] = AllocRaster(32,32); mouseptrbm[i]->Planes[1] = AllocRaster(32,32); mouseptr.BitMap = mouseptrbm[i]; for(my=0;my<32;my++) { for(mx=0;mx<32;mx++) { SetAPen(&mouseptr,pprefsbuf[(my*(33))+mx]-'0'); WritePixel(&mouseptr,mx,my); } } mousexpt = ((pprefsbuf[1056]-'0')*10)+(pprefsbuf[1057]-'0'); mouseypt = ((pprefsbuf[1059]-'0')*10)+(pprefsbuf[1060]-'0'); mouseptrobj[i] = NewObject(NULL,"pointerclass", POINTERA_BitMap,mouseptrbm[i], POINTERA_WordWidth,2, POINTERA_XOffset,-mousexpt, POINTERA_YOffset,-mouseypt, POINTERA_XResolution,POINTERXRESN_SCREENRES, POINTERA_YResolution,POINTERYRESN_SCREENRESASPECT, TAG_DONE); FreeVec(pprefsbuf); Close(ptrfile); } } } // for }
void ami_open_tree(struct tree *tree,int type) { struct treeview_window *twin; BOOL msel = TRUE,nothl = TRUE,launchdisable=FALSE; static WORD gen=0; char *wintitle; char folderclosed[100],folderopen[100],item[100]; if(tree->handle) { twin = (struct treeview_window *)tree->handle; WindowToFront(twin->win); ActivateWindow(twin->win); return; } twin = AllocVec(sizeof(struct treeview_window),MEMF_PRIVATE | MEMF_CLEAR); twin->listbrowser_list = AllocVec(sizeof(struct List),MEMF_PRIVATE | MEMF_CLEAR); static struct ColumnInfo columninfo[] = { { 80,"Name", CIF_DRAGGABLE | CIF_SORTABLE}, { 20,"URL", CIF_DRAGGABLE }, // { 5,"Visits", CIF_DRAGGABLE }, { -1, (STRPTR)~0, -1 } }; if(tree->single_selection) msel = FALSE; ami_get_theme_filename(&folderclosed,"theme_list_folder_closed"); ami_get_theme_filename(&folderopen,"theme_list_folder_open"); switch(type) { case AMI_TREE_HOTLIST: nothl = FALSE; wintitle = (char *)messages_get("Hotlist"); ami_get_theme_filename(&item,"theme_list_bookmark"); break; case AMI_TREE_COOKIES: nothl = TRUE; launchdisable=TRUE; wintitle = (char *)messages_get("Cookies"); ami_get_theme_filename(&item,"theme_list_cookie"); break; case AMI_TREE_HISTORY: nothl = TRUE; wintitle = (char *)messages_get("GlobalHistory"); ami_get_theme_filename(&item,"theme_list_history"); break; case AMI_TREE_SSLCERT: nothl = TRUE; wintitle = (char *)messages_get("SSLCerts"); ami_get_theme_filename(&item,"theme_list_sslcert"); break; } NewList(twin->listbrowser_list); tree->handle = (void *)twin; twin->tree = tree; ami_add_elements(twin,twin->tree->root,&gen); twin->objects[OID_MAIN] = WindowObject, WA_ScreenTitle,nsscreentitle, WA_Title,wintitle, WA_Activate, TRUE, WA_DepthGadget, TRUE, WA_DragBar, TRUE, WA_CloseGadget, TRUE, WA_SizeGadget, TRUE, WA_CustomScreen,scrn, WINDOW_SharedPort,sport, WINDOW_UserData,twin, WINDOW_IconifyGadget, TRUE, WINDOW_Position, WPOS_CENTERSCREEN, WINDOW_ParentGroup, twin->gadgets[GID_MAIN] = VGroupObject, LAYOUT_AddChild, twin->gadgets[GID_TREEBROWSER] = ListBrowserObject, GA_ID, GID_TREEBROWSER, GA_RelVerify, TRUE, GA_ReadOnly,FALSE, LISTBROWSER_ColumnInfo, &columninfo, // LISTBROWSER_ColumnTitles, TRUE, LISTBROWSER_Hierarchical,TRUE, LISTBROWSER_Editable,TRUE, // LISTBROWSER_TitleClickable,TRUE, LISTBROWSER_AutoFit, TRUE, LISTBROWSER_HorizontalProp, TRUE, LISTBROWSER_Labels, twin->listbrowser_list, // LISTBROWSER_MultiSelect,msel, LISTBROWSER_ShowSelected,TRUE, LISTBROWSER_ShowImage,BitMapObject, BITMAP_SourceFile,folderclosed, BITMAP_Screen,scrn, BITMAP_Masking,TRUE, BitMapEnd, LISTBROWSER_HideImage,BitMapObject, BITMAP_SourceFile,folderopen, BITMAP_Screen,scrn, BITMAP_Masking,TRUE, BitMapEnd, LISTBROWSER_LeafImage,BitMapObject, BITMAP_SourceFile,item, BITMAP_Screen,scrn, BITMAP_Masking,TRUE, BitMapEnd, ListBrowserEnd, CHILD_NominalSize,TRUE, LAYOUT_AddChild, HGroupObject, LAYOUT_AddChild, twin->gadgets[GID_OPEN] = ButtonObject, GA_ID,GID_OPEN, GA_Text,messages_get("TreeLaunch"), GA_RelVerify,TRUE, GA_Disabled,launchdisable, ButtonEnd, LAYOUT_AddChild, twin->gadgets[GID_NEWF] = ButtonObject, GA_ID,GID_NEWF, BUTTON_AutoButton,BAG_POPDRAWER, GA_RelVerify,TRUE, GA_Disabled,nothl, ButtonEnd, LAYOUT_AddChild, twin->gadgets[GID_NEWB] = ButtonObject, GA_ID,GID_NEWB, BUTTON_AutoButton,BAG_POPFILE, GA_RelVerify,TRUE, GA_Disabled,nothl, ButtonEnd, LAYOUT_AddChild, twin->gadgets[GID_LEFT] = ButtonObject, GA_ID,GID_LEFT, BUTTON_AutoButton,BAG_LFARROW, GA_RelVerify,TRUE, GA_Disabled,nothl, //(!tree->movable), ButtonEnd, LAYOUT_AddChild, twin->gadgets[GID_UP] = ButtonObject, GA_ID,GID_UP, BUTTON_AutoButton,BAG_UPARROW, GA_RelVerify,TRUE, GA_Disabled,nothl, //(!tree->movable), ButtonEnd, LAYOUT_AddChild, twin->gadgets[GID_DOWN] = ButtonObject, GA_ID,GID_DOWN, BUTTON_AutoButton,BAG_DNARROW, GA_RelVerify,TRUE, GA_Disabled,nothl, //(!tree->movable), ButtonEnd, LAYOUT_AddChild, twin->gadgets[GID_DEL] = ButtonObject, GA_ID,GID_DEL, GA_Text,messages_get("TreeDelete"), GA_RelVerify,TRUE, ButtonEnd, EndGroup, CHILD_WeightedHeight,0, EndGroup, EndWindow; twin->win = (struct Window *)RA_OpenWindow(twin->objects[OID_MAIN]); twin->node = AddObject(window_list,AMINS_TVWINDOW); twin->node->objstruct = twin; }