byte auifav_win(CANVAS * bg, char *path, char **out_char, int titY, int titH, int boxY, int boxH, byte first) { int btnS = agdp() * 20; int btnP = agdp() * 2; AWINDOWP hWin = aw(bg); ACONTROLP title = aclabel(hWin, btnS + btnP, titY, agw() - ((btnS + btnP) * 2), titH, alang_get("tools.favorite"), 1, 1, 2, acfg()->winfg); ACONTROLP addthis = imgbtn(hWin, btnP, titY + btnP, btnS, btnS, aui_icons(6), NULL, 1, 55); ACONTROLP cancel = imgbtn(hWin, agw() - (btnS + btnP), titY + btnP, btnS, btnS, aui_icons(0), NULL, 1, 5); ACONTROLP hFile = afbox(hWin, 0, boxY, agw(), boxH, 7, 8, 2, 6); auifav_fetch(hFile); aw_show_ex(hWin, first ? 1 : 100, titY, hFile); byte ondispatch = 1; byte reshow = 0; do { dword msg = aw_dispatch_ex(hWin, titY); switch (aw_gm(msg)) { case 5: { //-- DONE ondispatch = 0; } break; case 55: { //-- REFRESH ondispatch = 0; reshow = 1; } break; //-- ITEM CLICK case 7: { dword fl = afbox_ddata(hFile); char *fpath = auifav_getpath(fl); if (fpath != NULL) { aui_setpath(out_char, fpath, "", 0); free(fpath); ondispatch = 0; } } break; //-- ITEM TAP & HOLD case 8: { dword fl = afbox_ddata(hFile); char *fpath = auifav_getpath(fl); if (fpath != NULL) { int cp = 0; AWMENUITEM mi[2]; aw_menuset(mi, cp++, "select", 33); aw_menuset(mi, cp++, "tools.favorite.del", 8); byte ret = aw_menu(hWin, NULL, mi, cp); if (ret == 2) { auifav_del(fpath); reshow = 1; free(fpath); ondispatch = 0; } else if (ret == 1) { aui_setpath(out_char, fpath, "", 0); ondispatch = 0; } free(fpath); } } break; } } while (ondispatch); aw_destroy(hWin); return reshow; }
//* //* SHOW TIPS //* void aui_showtips(AUI_VARSP v) { if (aui_is_show_tips) { aui_is_show_tips = 0; CANVAS * tmpc = aw_muteparent(v->hWin); aw_set_on_dialog(2); ag_rectopa(agc(), 0, 0, agw(), agh(), 0x0000, 180); ag_sync(); CANVAS alertbg; ag_canvas(&alertbg, agw(), agh()); ag_draw(&alertbg, agc(), 0, 0); //-- Load Tips Font ag_loadbigfont("fonts/HTC Hand/HTCHand.otf", 18, AROMA_DIR "/"); PNGCANVAS ap; int imS = agdp() * 12; int bHH = v->btnH / 2; int w75 = round(agw() * 0.6); if (apng_load(&ap, "common/tips1")) { apng_stretch(&alertbg, &ap, v->pad + v->btnH, v->boxY - bHH, imS, imS, 0, 0, ap.w, ap.h); apng_close(&ap); } ag_text(&alertbg, w75, v->pad + v->btnH + imS, v->boxY - bHH, "Here is the path of the current working directory", 0xffff, 1); if (apng_load(&ap, "common/tips2")) { apng_stretch(&alertbg, &ap, agw() - (v->btnH + imS), v->boxY + (v->btnH * 4.5), imS, imS, 0, 0, ap.w, ap.h); apng_close(&ap); } ag_text(&alertbg, w75, agw() - (v->btnH + imS + w75), v->boxY + (v->btnH * 4.5), "<@right>Tap the checkbox to select multiple files</@>", 0xffff, 1); if (apng_load(&ap, "common/tips3")) { apng_stretch(&alertbg, &ap, agw() - (v->btnH + imS * 3), v->btnY - (v->pad + v->btnFH + imS), imS, imS, 0, 0, ap.w, ap.h); apng_close(&ap); } ag_text(&alertbg, w75, agw() - (v->btnH + imS * 3 + w75), v->btnY - (v->pad + v->btnFH + (imS * 2)), "<@right>All functions you need is on this toolbar</@>", 0xffff, 1); //-- Revert Font aui_cfg_reloadfonts(); //-- Create Window AWINDOWP hWin = aw(&alertbg); aw_show(hWin); byte ondispatch = 1; while (ondispatch) { dword msg = aw_dispatch_ex(hWin, agh()); byte msgm = aw_gm(msg); if (msgm == 5) { ondispatch = 0; } } aw_destroy(hWin); ag_ccanvas(&alertbg); aw_set_on_dialog(0); aw_unmuteparent(v->hWin, tmpc); } }