char *auifav(AWINDOWP parent, char *path) { //-- Mute Parent CANVAS *tmpc = aw_muteparent(parent); aw_set_on_dialog(2); ag_rectopa(agc(), 0, 0, agw(), agh(), 0x0000, 180); ag_sync(); //-- Initializing Canvas CANVAS favbg; ag_canvas(&favbg, agw(), agh()); ag_draw(&favbg, agc(), 0, 0); //-- Init Sizes int winY = agh() - round(agh() / 1.618); int winH = agh() - winY; int titH = agdp() * 24; // (agdp()*6) + ag_fontheight(1); int boxY = winY + titH; int boxH = winH - titH; //-- Draw Title ag_roundgrad_ex(&favbg, 0, winY, agw(), titH, acfg()->navbg, acfg()->navbg_g, 0, 0, 0, 0, 0); //-- Draw Main Window ag_roundgrad_ex(&favbg, 0, boxY, agw(), boxH, acfg()->navbg, acfg()->navbg_g, 0, 0, 0, 0, 0); byte first = 1; char *out_char = NULL; while (auifav_win (&favbg, path, &out_char, winY, titH, boxY, boxH, first)) { first = 0; } //-- Cleanup Canvas ag_ccanvas(&favbg); //-- Unmute Parent aw_set_on_dialog(0); aw_unmuteparent(parent, tmpc); return out_char; }
//* //* 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); } }
/* * Descriptions: * ------------- * AROMA File Manager : Permission File * */ byte auido_setperm(AWINDOWP parent,char * path, char * fn) { struct stat fst; byte buf[12]; memset(buf,0,12); if (!stat(path, &fst)) { buf[11] = (fst.st_mode & S_IXOTH) ? 1 : 0; buf[10] = (fst.st_mode & S_IWOTH) ? 1 : 0; buf[9] = (fst.st_mode & S_IROTH) ? 1 : 0; buf[8] = (fst.st_mode & S_IXGRP) ? 1 : 0; buf[7] = (fst.st_mode & S_IWGRP) ? 1 : 0; buf[6] = (fst.st_mode & S_IRGRP) ? 1 : 0; buf[5] = (fst.st_mode & S_IXUSR) ? 1 : 0; buf[4] = (fst.st_mode & S_IWUSR) ? 1 : 0; buf[3] = (fst.st_mode & S_IRUSR) ? 1 : 0; buf[2] = (fst.st_mode & S_ISVTX) ? 1 : 0; buf[1] = (fst.st_mode & S_ISGID) ? 1 : 0; buf[0] = (fst.st_mode & S_ISUID) ? 1 : 0; } //-- Init Dialog Window CANVAS *tmpc = aw_muteparent(parent); aw_set_on_dialog(2); ag_rectopa(agc(), 0, 0, agw(), agh(), 0x0000, 180); ag_sync(); //-- Initializing Canvas CANVAS bg; ag_canvas(&bg, agw(), agh()); ag_draw(&bg, agc(), 0, 0); //-- Size & Position /* MainTitle SubTitle [PAD] user group others [x] r [x] w [x] x [x] r [x] w [x] x [x] r [x] w [x] x [x] s [x] g [x] t [PAD] [ BUTTONS ] */ int pad = agdp() * 4; int padB = pad; int padT = pad; int padL = pad; int padR = pad; PNGCANVASP winp = atheme("img.dialog"); APNG9 winv; if (winp != NULL) { if (apng9_calc(winp, &winv, 1)) { padL = winv.l; padR = winv.r; padB = winv.b; padT = winv.t; } } int hpad = agdp() * 2; int winW = agw() - (pad * 2); //-- Window int winX = pad; int cliW = winW - (padL + padR + (hpad*2)); //-- Window Client int cliX = pad + padL + hpad; int titH = ag_fontheight(1) + (agdp() * 2); //-- Title Height int chkH = agdp()*20; int txtH = ag_fontheight(0) + agdp(); //-- Text Interface Height int btnH = agdp() * 24; int cliH = titH + txtH + (chkH * 4) + btnH + (pad); int winH = cliH + padT + padB; int winY = (agh() / 2) - (winH / 2); int cliY = winY + padT; int _Y = cliY; //-- Draw Canvas if (!atheme_draw("img.dialog", &bg, winX, winY, winW, winH)) { ag_roundgrad(&bg, winX - 1, winY - 1, winW + 2, winH + 2, acfg()->border, acfg()->border_g, (acfg()->roundsz * agdp()) + 1); ag_roundgrad(&bg, winX, winY, winW, winH, acfg()->dialogbg, acfg()->dialogbg_g, acfg()->roundsz * agdp()); } //-- Init Window & Controls AWINDOWP hWin = aw(&bg); ACONTROLP txtTitle = aclabel(hWin, cliX, _Y, cliW, titH, alang_get("tools.chmod"), 1, 1, 2, acfg()->winfg); _Y+=titH; ACONTROLP txtFilename = aclabel(hWin, cliX, _Y, cliW, txtH, fn, 0, 1, 2, acfg()->winfg); _Y+=txtH+pad; int colW = cliW / 4; int col1 = cliX; int col2 = col1 + colW; int col3 = col2 + colW; int col4 = col3 + colW; aclabel(hWin, col1, _Y, colW, chkH, alang_get("tools.chmod.user"), 0, 1, 1, acfg()->winfg); ACONTROLP cbR1 = accb(hWin,col2,_Y,colW,chkH,alang_get("tools.chmod.read"),buf[3]); ACONTROLP cbW1 = accb(hWin,col3,_Y,colW,chkH,alang_get("tools.chmod.write"),buf[4]); ACONTROLP cbX1 = accb(hWin,col4,_Y,colW,chkH,alang_get("tools.chmod.exec"),buf[5]); _Y+=chkH; aclabel(hWin, col1, _Y, colW, chkH, alang_get("tools.chmod.group"), 0, 1, 1, acfg()->winfg); ACONTROLP cbR2 = accb(hWin,col2,_Y,colW,chkH,alang_get("tools.chmod.read"),buf[6]); ACONTROLP cbW2 = accb(hWin,col3,_Y,colW,chkH,alang_get("tools.chmod.write"),buf[7]); ACONTROLP cbX2 = accb(hWin,col4,_Y,colW,chkH,alang_get("tools.chmod.exec"),buf[8]); _Y+=chkH; aclabel(hWin, col1, _Y, colW, chkH, alang_get("tools.chmod.others"), 0, 1, 1, acfg()->winfg); ACONTROLP cbR3 = accb(hWin,col2,_Y,colW,chkH,alang_get("tools.chmod.read"),buf[9]); ACONTROLP cbW3 = accb(hWin,col3,_Y,colW,chkH,alang_get("tools.chmod.write"),buf[10]); ACONTROLP cbX3 = accb(hWin,col4,_Y,colW,chkH,alang_get("tools.chmod.exec"),buf[11]); _Y+=chkH; ACONTROLP cbZ1 = accb(hWin,col2,_Y,colW,chkH,alang_get("tools.chmod.setuid"),buf[0]); ACONTROLP cbZ2 = accb(hWin,col3,_Y,colW,chkH,alang_get("tools.chmod.setgid"),buf[1]); ACONTROLP cbZ3 = accb(hWin,col4,_Y,colW,chkH,alang_get("tools.chmod.sticky"),buf[2]); _Y+=chkH; int btnW = cliW / 2; int btn1 = cliX; int btn2 = btn1 + btnW; ACONTROLP okBtn = imgbtn(hWin, btn1, _Y, btnW-(pad/2), btnH, aui_icons(33), alang_get("ok"), 3, 6); ACONTROLP cancelBtn = imgbtn(hWin, btn2+(pad/2), _Y, btnW-(pad/2), btnH, aui_icons(0), alang_get("cancel"), 3, 5); //-- Show Window aw_show_ex(hWin, 0, 0, okBtn); byte ondispatch = 1; byte retval = 1; //-- Dispatch do { dword msg = aw_dispatch(hWin); switch (aw_gm(msg)) { case 5: { ondispatch = 0; } break; case 6: { // ondispatch = 0; buf[0]=accb_ischecked(cbZ1); buf[1]=accb_ischecked(cbZ2); buf[2]=accb_ischecked(cbZ3); buf[3]=accb_ischecked(cbR1); buf[4]=accb_ischecked(cbW1); buf[5]=accb_ischecked(cbX1); buf[6]=accb_ischecked(cbR2); buf[7]=accb_ischecked(cbW2); buf[8]=accb_ischecked(cbX2); buf[9]=accb_ischecked(cbR3); buf[10]=accb_ischecked(cbW3); buf[11]=accb_ischecked(cbX3); mode_t newmod = 0; if (buf[0]) newmod |= S_ISUID; if (buf[1]) newmod |= S_ISGID; if (buf[2]) newmod |= S_ISVTX; if (buf[3]) newmod |= S_IRUSR; if (buf[4]) newmod |= S_IWUSR; if (buf[5]) newmod |= S_IXUSR; if (buf[6]) newmod |= S_IRGRP; if (buf[7]) newmod |= S_IWGRP; if (buf[8]) newmod |= S_IXGRP; if (buf[9]) newmod |= S_IROTH; if (buf[10]) newmod |= S_IWOTH; if (buf[11]) newmod |= S_IXOTH; printf("CHMOD %o - %s\n",newmod,path); chmod(path,newmod); ondispatch = 0; retval = 0; } break; } } while (ondispatch); //-- Release Resources aw_destroy(hWin); ag_ccanvas(&bg); aw_set_on_dialog(0); aw_unmuteparent(parent, tmpc); return retval; }
void auido_show_del(byte * copy_status, char **source_path, int number_files) { //-- Init Dialog Window CANVAS *tmpc = aw_muteparent(NULL); aw_set_on_dialog(2); //ag_rectopa(agc(), 0, 0, agw(), agh(), 0x0000, 180); CANVAS * maskc = aw_maskparent(); ag_sync(); //-- Initializing Canvas CANVAS bg; ag_canvas(&bg, agw(), agh()); ag_draw(&bg, agc(), 0, 0); //-- Size & Position /* [PAD] mainInfo extraInfo [*************perProg*************] perInfo [PAD] [ CANCEL BUTTON ] [PAD] */ int pad = agdp() * 4; int padB = pad; int padT = pad; int padL = pad; int padR = pad; PNGCANVASP winp = atheme("img.dialog"); APNG9 winv; if (winp != NULL) { if (apng9_calc(winp, &winv, 1)) { padL = winv.l; padR = winv.r; padB = winv.b; padT = winv.t; } } int hpad = agdp() * 2; int winW = agw() - (pad * 2); //-- Window int winX = pad; int cliW = winW - (padL + padR); //-- Window Client int cliX = pad + padL; int titH = ag_fontheight(1) + (agdp() * 2); //-- Title Height int txtH = ag_fontheight(0) + agdp(); //-- Text Interface Height int prgH = agdp() * 12; //-- Progress Height int btnH = agdp() * 24; int btnW = winW / 2; int btnX = agw() / 2 - btnW / 2; int winH = (pad * 2) + titH + (txtH * 2) + (prgH) + btnH + padB + padT; int winY = (agh() / 2) - (winH / 2); int titY = winY + padT; int curY = titY + titH + pad; int defW = cliW - pad; int txtW1 = (int)(defW * 0.8); int txtW2 = defW - txtW1; int txtX1 = cliX + hpad; int txtX2 = txtX1 + txtW1; //-- Draw Canvas if (!atheme_draw("img.dialog", &bg, winX, winY, winW, winH)) { ag_roundgrad(&bg, winX - 1, winY - 1, winW + 2, winH + 2, acfg()->border, acfg()->border_g, (acfg()->roundsz * agdp()) + 1); ag_roundgrad(&bg, winX, winY, winW, winH, acfg()->dialogbg, acfg()->dialogbg_g, acfg()->roundsz * agdp()); } //-- Init Window & Controls AWINDOWP hWin = aw(&bg); ACONTROLP mainInfo = aclabel(hWin, cliX, titY, cliW, titH, alang_get("delete.prepare"), 1, 1, 2, acfg()->winfg); ACONTROLP extraInfo = aclabel(hWin, cliX, curY, cliW, txtH, alang_get("calculating"), 0, 1, 2, acfg()->winfg); curY += txtH; ACONTROLP perProg = acprog(hWin, cliX, curY + agdp(), cliW, prgH - (agdp() * 2), 0); curY += prgH; ACONTROLP perInfo = aclabel(hWin, cliX, curY, cliW, txtH, "", 0, 1, 2, acfg()->textfg_gray); curY += txtH + pad; imgbtn(hWin, btnX, curY, btnW, btnH, aui_icons(0), alang_get("cancel"), 3, 55); //-- Show Window //aw_show(hWin); aw_show_ex2(hWin, 5, winX - 1, winY - 1, winW + 2, winH + 2, NULL); byte ondispatch = 1; acprog_setonwait(perProg, 1); //-- Start Delete Proc AFSDT dt; memset(&dt, 0, sizeof(AFSDT)); int curr_id = 0; byte proc_state = 0; long kbps_tick = 0; if (auido_next_del_size (&dt, &curr_id, copy_status, source_path, number_files)) { //-- Dispatch do { dword msg = aw_dispatch(hWin); switch (aw_gm(msg)) { //-- CALCULATING case 10: { //-- Discovery Tick if (proc_state == 0) { char info[256]; char strfl[64]; char format[256]; snprintf(strfl, 64, "%i", dt.n); snprintf(format, 256, "%s ( %s )", alang_get("deleting"), "\%0.1f"); snprintf(info, 256, format, strfl, ((float)dt.k) / 1024); aclabel_settext(perInfo, dt.curr, 0); aclabel_settext(extraInfo, info, 1); } } break; case 11: { //-- Discovery Finish if (proc_state == 0) { curr_id++; if (!auido_next_del_size (&dt, &curr_id, copy_status, source_path, number_files)) { ondispatch = 0; aclabel_settext (mainInfo, alang_get ("finishing"), 1); } } else if (proc_state == 2) { ondispatch = 0; aclabel_settext(mainInfo, alang_get ("finishing"), 1); } } break; case 55: { if (proc_state == 0) { aclabel_settext(mainInfo, alang_get ("canceling"), 1); proc_state = 2; dt.status = 0; } } break; } } while (ondispatch); } //-- Release Resources aw_destroy(hWin); ag_ccanvas(&bg); aw_set_on_dialog(0); //aw_unmuteparent(NULL, tmpc); aw_unmaskparent(NULL, tmpc, maskc, winX - 1, winY - 1, winW + 2, winH + 2); }