//* //* MAKE NEW FOLDER //* byte auia_newfolder(AUI_VARSP v) { byte redoing = 0; char new_folder_name[256]; snprintf(new_folder_name, 256, "New Folder"); byte dispatch_ret = 1; do { redoing = 0; dispatch_ret = 1; char * ret = aw_ime(v->hWin, new_folder_name, alang_get("newfolder")); if (ret != NULL) { if (strlen(ret) == 0) { redoing = aw_confirm(v->hWin, alang_get("newfolder"), alang_get ("newfolder.insertname"), aui_icons(37), alang_get("tryagain"), alang_get("cancel")); } else { char * path_newfolder = NULL; aui_setpath(&path_newfolder, v->path, ret, 0); if (path_newfolder != NULL) { if (file_exists(path_newfolder)) { redoing = aw_confirm(v->hWin, alang_get ("newfolder"), alang_get ("newfolder.exist"), aui_icons (39), alang_get ("tryagain"), alang_get ("cancel")); } else { int retval = mkdir(path_newfolder, 0777); if (retval == 0) { dispatch_ret = 0; v->reshow = 1; snprintf(v->selfile, 256, "%s", ret); } else { redoing = aw_confirm(v->hWin, alang_get ("newfolder"), alang_get ("newfolder.error"), aui_icons (37), alang_get ("tryagain"), alang_get ("cancel")); } } free(path_newfolder); } } snprintf(new_folder_name, 256, "%s", ret); free(ret); } } while (redoing); return dispatch_ret; }
//* //* SHOW MAIN DIRECTORY LIST UI //* void aui_show_setting() { printf("SHOW SETTINGS\n"); //-- REDRAW BG aui_setbg(NULL); //-- Main Variable AUI_VARS v; //-- Return Value v.reshow = 0; //-- Init Drawing Data v.selfile = ""; v.path = ""; v.state = 0; v.pad = agdp() * 2; v.btnH = agdp() * 20; v.boxH = agh() - (aui_minY + (v.btnH) + (v.pad * 2)); v.boxY = aui_minY; v.btnY = v.boxY + v.boxH + v.pad; v.navW = agw() - (v.pad * 2); v.pthW = v.navW; v.navY = aui_minY + v.pad; v.btnW = floor(v.navW / 3); int btnHlv = v.navW - (v.pad / 2); v.hFileType = 0; v.btnFH = aui_cfg_btnFH(); //-- Draw Navigation Bar // aui_drawtopbar(&aui_win_bg, 0, aui_minY, agw(), v.btnH + (v.pad * 2)); aui_drawnav(&aui_win_bg, 0, v.btnY - (v.pad + v.btnFH), agw(), v.btnH + (v.pad * 2) + v.btnFH); //-- Create Main Window v.hWin = aw(&aui_win_bg); //****************************[ INIT WINDOW CONTROLS ]****************************/ // imgbtn(v.hWin, v.pad, v.navY, btnHlv, v.btnH, &UI_ICONS[20], alang_get("settings.mount"), 3, 22); /*imgbtn(v.hWin, v.pad, v.navY, btnHlv, v.btnH, &UI_ICONS[17], alang_get("settings.calib"), 3, 21); */ v.hFile = acopt(v.hWin, 0, v.boxY, agw(), (v.boxH - v.btnFH)); //-- Toolbar style : 1 acopt_addgroup(v.hFile, alang_get("settings.toolbar"), ""); acopt_add(v.hFile, alang_get("settings.toolbar.icontext"), "", auic()->tooltext ? 1 : 0); acopt_add(v.hFile, alang_get("settings.toolbar.icononly"), "", auic()->tooltext ? 0 : 1); //-- Font size : 2 acopt_addgroup(v.hFile, alang_get("settings.fontsize"), ""); acopt_add(v.hFile, alang_get("settings.fontsize.small"), "", (auic()->fontsize == 1) ? 1 : 0); acopt_add(v.hFile, alang_get("settings.fontsize.medium"), "", (auic()->fontsize == 2) ? 1 : 0); acopt_add(v.hFile, alang_get("settings.fontsize.big"), "", (auic()->fontsize == 3) ? 1 : 0); //-- Font Family : 3 acopt_addgroup(v.hFile, alang_get("settings.fontfamily"), ""); if (1) { AZREADDIRP rz_fonts = az_readdir(AROMA_DIR "/fonts/"); if (rz_fonts != NULL) { int i = 0; for (i = 0; i < rz_fonts->n; i++) { if (rz_fonts->t[i] == 1) { char desc[256]; auis_readinfo(desc, AROMA_DIR "/fonts/", rz_fonts->f[i]); acopt_add(v.hFile, rz_fonts->f[i], desc, (strcmp (auic()->fontfamily, rz_fonts->f[i]) == 0) ? 1 : 0); } } az_readdir_free(rz_fonts); } } //-- Icon set : 4 acopt_addgroup(v.hFile, alang_get("settings.iconset"), ""); if (1) { AZREADDIRP rz_icons = az_readdir(AROMA_DIR "/icons/"); if (rz_icons != NULL) { int i = 0; for (i = 0; i < rz_icons->n; i++) { if (rz_icons->t[i] == 1) { char desc[256]; auis_readinfo(desc, AROMA_DIR "/icons/", rz_icons->f[i]); acopt_add(v.hFile, rz_icons->f[i], desc, (strcmp (auic()->iconset, rz_icons->f[i]) == 0) ? 1 : 0); } } az_readdir_free(rz_icons); } } //-- Theme : 5 acopt_addgroup(v.hFile, alang_get("settings.themes"), ""); acopt_add(v.hFile, "Generic", "Unskinned AROMA File Manager", (strcmp(auic()->theme, "") == 0) ? 1 : 0); if (1) { AZREADDIRP rz_theme = az_readdir(AROMA_DIR "/themes/"); if (rz_theme != NULL) { int i = 0; for (i = 0; i < rz_theme->n; i++) { if (rz_theme->t[i] == 1) { char desc[256]; auis_readinfo(desc, AROMA_DIR "/themes/", rz_theme->f[i]); acopt_add(v.hFile, rz_theme->f[i], desc, (strcmp (auic()->theme, rz_theme->f[i]) == 0) ? 1 : 0); } } az_readdir_free(rz_theme); } } //-- Languages : 6 acopt_addgroup(v.hFile, alang_get("settings.lang"), ""); if (1) { AZREADDIRP rz_langs = az_readdir(AROMA_DIR "/langs/"); if (rz_langs != NULL) { int i = 0; for (i = 0; i < rz_langs->n; i++) { if (rz_langs->t[i] == 1) { char desc[256]; auis_readinfo(desc, AROMA_DIR "/langs/", rz_langs->f[i]); acopt_add(v.hFile, rz_langs->f[i], desc, (strcmp (auic()->language, rz_langs->f[i]) == 0) ? 1 : 0); } } az_readdir_free(rz_langs); } } //-- Font size : 7 acopt_addgroup(v.hFile, alang_get("settings.trans"), ""); acopt_add(v.hFile, alang_get("settings.trans.0"), "", (acfg()->fadeframes == 0) ? 1 : 0); acopt_add(v.hFile, alang_get("settings.trans.1"), "", (acfg()->fadeframes == 2) ? 1 : 0); acopt_add(v.hFile, alang_get("settings.trans.2"), "", (acfg()->fadeframes == 4) ? 1 : 0); acopt_add(v.hFile, alang_get("settings.trans.3"), "", (acfg()->fadeframes == 6) ? 1 : 0); acopt_add(v.hFile, alang_get("settings.trans.4"), "", (acfg()->fadeframes == 8) ? 1 : 0); //-- Automount : 8 acopt_addgroup(v.hFile, alang_get("settings.mount"), ""); acopt_add(v.hFile, alang_get("settings.mount.all"), "", auic()->automount ? 1 : 0); acopt_add(v.hFile, alang_get("settings.mount.none"), "", auic()->automount ? 0 : 1); //-- colorspace : 9 acopt_addgroup(v.hFile, alang_get("settings.colorspace"), ""); acopt_add(v.hFile, alang_get("settings.colorspace.rgba"), "", (auic()->colorspace == 1) ? 1 : 0); acopt_add(v.hFile, alang_get("settings.colorspace.abgr"), "", (auic()->colorspace == 2) ? 1 : 0); acopt_add(v.hFile, alang_get("settings.colorspace.argb"), "", (auic()->colorspace == 3) ? 1 : 0); acopt_add(v.hFile, alang_get("settings.colorspace.bgra"), "", (auic()->colorspace == 4) ? 1 : 0); //-- Font size : 8 /* acopt_addgroup(v.hFile,"Automount Partitions",""); acopt_add(v.hFile,"All partitions","",0); acopt_add(v.hFile,"None","",1); */ //-- TOOLS v.b1 = imgbtn(v.hWin, v.pad, v.btnY - v.btnFH, v.btnW, v.btnH + v.btnFH, &UI_ICONS[33], aui_tbtitle(9), 1, 12); //-- Done v.b2 = imgbtn(v.hWin, v.pad + v.btnW, v.btnY - v.btnFH, v.btnW, v.btnH + v.btnFH, &UI_ICONS[14], aui_tbtitle(10), 1, 22); //-- Reset v.b3 = imgbtn(v.hWin, v.pad + v.btnW * 2, v.btnY - v.btnFH, v.btnW, v.btnH + v.btnFH, &UI_ICONS[0], aui_tbtitle(8), 1, 20); //-- Cancel //-- Show Window aw_show_ex(v.hWin, 2, 0, v.hFile); // aw_setfocus(v.hWin,v.hFile); aui_changetitle(&v, alang_get("settings")); byte ondispatch = 1; byte saveconfig = 1; byte save_to_file = 0; do { dword msg = aw_dispatch(v.hWin); switch (aw_gm(msg)) { case 12: { //-- DONE ondispatch = 0; } break; case 20: { //-- CANCEL ondispatch = 0; saveconfig = 0; } break; case 22: { //-- RESET if (aw_confirm(v.hWin, alang_get("settings.reset"), alang_get("settings.reset.msg"), aui_icons(39), NULL, NULL)) { ondispatch = 0; saveconfig = 0; aui_cfg_init(); aui_load_icons(); aui_cfg_reloadfonts(); aui_langreload(); aui_themereload(); save_to_file = 1; } } break; case 21: { //-- CALIB if (aw_calibtools(NULL)) { aui_cfg_save(); } } break; } } while (ondispatch); if (saveconfig) { byte font_reloaded = 0; byte colorspace_refreshed = 0; //-- Text on toolbar auic()->tooltext = (acopt_getvalue(v.hFile, 1) == 1) ? 1 : 0; auic()->automount = (acopt_getvalue(v.hFile, 8) == 1) ? 1 : 0; //-- Font Size byte newfontsz = (byte) acopt_getvalue(v.hFile, 2); if (newfontsz != auic()->fontsize) { auic()->fontsize = newfontsz; font_reloaded = 1; } byte newcolorspace = (byte) acopt_getvalue(v.hFile, 9); if (newcolorspace != auic()->colorspace) { auic()->colorspace = newcolorspace; colorspace_refreshed = 1; } //-- Font Family char * fontsel = acopt_getseltitle(v.hFile, 3); if ((fontsel != NULL) && (strcmp(fontsel, auic()->fontfamily) != 0)) { snprintf(auic()->fontfamily, 256, "%s", fontsel); font_reloaded = 1; } //-- Iconset fontsel = acopt_getseltitle(v.hFile, 4); if ((fontsel != NULL) && (strcmp(fontsel, auic()->iconset) != 0)) { snprintf(auic()->iconset, 256, "%s", fontsel); aui_unload_icons(); aui_load_icons(); } //-- Theme fontsel = acopt_getseltitle(v.hFile, 5); if ((fontsel != NULL) && (strcmp(fontsel, auic()->theme) != 0)) { int newtheme = acopt_getvalue(v.hFile, 5); if (newtheme == 1) { if (strcmp(auic()->theme, "") != 0) { snprintf(auic()->theme, 256, ""); aui_themereload(); } } else { snprintf(auic()->theme, 256, "%s", fontsel); aui_themereload(); } } //-- Language fontsel = acopt_getseltitle(v.hFile, 6); if ((fontsel != NULL) && (strcmp(fontsel, auic()->language) != 0)) { snprintf(auic()->language, 256, "%s", fontsel); aui_langreload(); } //-- Transition int transition = acopt_getvalue(v.hFile, 7); acfg()->fadeframes = (transition - 1) * 2; //-- Reload Font if (font_reloaded) { aui_cfg_reloadfonts(); } // set new color space if (colorspace_refreshed) { aui_cfg_setcolorspace(); } save_to_file = 1; } //-- Window aw_destroy(v.hWin); //-- Save if (save_to_file) { aui_cfg_save(); } }
byte aw_showmenu(AWINDOWP parent){ CANVAS * tmpc = aw_muteparent(parent); //-- Set Mask on_dialog_window = 2; ag_rectopa(agc(),0,0,agw(),agh(),0x0000,180); ag_sync(); int btnH = agdp()*20; int pad = agdp()*4; int vpad = agdp()*2; int winH = ((btnH+vpad) * 3) + pad; int winW = agw()-(pad*2); int winX = pad; int winY = agh()-winH; int btnY = winY + pad; int btnX = winX + pad; int btnW = winW - (pad*2); //-- Initializing Canvas CANVAS alertbg; ag_canvas(&alertbg,agw(),agh()); ag_draw(&alertbg,agc(),0,0); //-- Draw Window Background ag_roundgrad_ex(&alertbg,winX-1,winY-1,winW+2,winH+2,acfg_var.border,acfg_var.border_g,(acfg_var.roundsz*agdp())+1,1,1,0,0); ag_roundgrad_ex(&alertbg,winX,winY,winW,winH,acfg_var.navbg,acfg_var.navbg_g,acfg_var.roundsz*agdp(),1,1,0,0); //-- Create Window AWINDOWP hWin = aw(&alertbg); acbutton(hWin,btnX,btnY,btnW,btnH,acfg_var.text_about,0,11); //acbutton(hWin,btnX,btnY+((btnH+vpad)*1),btnW,btnH,"Help",0,12); acbutton(hWin,btnX,btnY+((btnH+vpad)*1),btnW,btnH,acfg_var.text_calibrating,0,13); acbutton(hWin,btnX,btnY+((btnH+vpad)*2),btnW,btnH,acfg_var.text_quit,0,14); aw_show(hWin); byte ondispatch = 1; byte res = 0; while(ondispatch){ dword msg=aw_dispatch(hWin); switch (aw_gm(msg)){ case 5: ondispatch = 0; break; case 11: res=1; ondispatch = 0; break; case 12: res=2; ondispatch = 0; break; case 13: res=3; ondispatch = 0; break; case 14: res=4; ondispatch = 0; break; } } aw_destroy(hWin); ag_ccanvas(&alertbg); on_dialog_window = 0; aw_unmuteparent(parent,tmpc); if (res==1){ aw_about_dialog(parent); } else if (res==2){ aw_help_dialog(parent); } else if (res==3){ aw_calibtools(parent); } else if (res==4){ byte res = aw_confirm(parent, AROMA_NAME " " AROMA_VERSION, acfg_var.text_quit_msg,"@alert",NULL,NULL); if (res) return 2; } return 0; }
void aw_calibtools(AWINDOWP parent){ int USE_HACK = aw_confirm( parent, "Use alternative touch", "Do you want to use alternative touch?\n Only use if the default method does not work.\n\nPress the volume keys to select Yes or No.", "@alert", acfg_var.text_no, acfg_var.text_yes ); byte current_hack = atouch_gethack(); if (!USE_HACK){ atouch_sethack(1); } else{ atouch_sethack(0); } //-- Set Mask CANVAS * tmpc = aw_muteparent(parent); on_dialog_window = 1; ag_rectopa(agc(),0,0,agw(),agh(),0x0000,220); ag_sync(); byte isvalid = 0; //-- Initializing Canvas CANVAS ccv; ag_canvas(&ccv,agw(),agh()); ag_blur(&ccv,agc(),agdp()*2); int xpos[5] = { agdp()*10, agw()-(agdp()*10), agdp()*10, agw()-(agdp()*10), agw()/2 }; int ypos[5] = { agdp()*10, agdp()*10, agh() - (agdp()*10), agh()-(agdp()*10), agh()/2 }; int xtch[5] = { 0,0,0,0,0 }; int ytch[5] = { 0,0,0,0,0 }; atouch_plaincalibrate(); char datx[256]; if (!aw_calibdraw(&ccv,0,xpos,ypos,xtch,ytch)) goto doneit; if (!aw_calibdraw(&ccv,1,xpos,ypos,xtch,ytch)) goto doneit; if (!aw_calibdraw(&ccv,2,xpos,ypos,xtch,ytch)) goto doneit; if (!aw_calibdraw(&ccv,3,xpos,ypos,xtch,ytch)) goto doneit; if (!aw_calibdraw(&ccv,4,xpos,ypos,xtch,ytch)) goto doneit; float padsz = agdp()*5; float leftx = ((xtch[0]+xtch[2])/2); float rightx = ((xtch[1]+xtch[3])/2); float topy = ((ytch[0]+ytch[1])/2); float bottomy = ((ytch[2]+ytch[3])/2); float centerx = xtch[4]; float centery = ytch[4]; float halfx = (agw()/2)-padsz; float halfy = (agh()/2)-padsz; float fullx = agw()-padsz; float fully = agh()-padsz; byte data_is_valid = 0; float cal_x = 0; float cal_y = 0; int add_x = 0; int add_y = 0; if ((halfx>0)&&(fullx>0)&&(halfy>0)&&(fully>0)){ cal_x = ((((centerx-leftx)/halfx) + ((rightx-leftx)/fullx))/2); cal_y = ((((centery-topy)/halfy) + ((bottomy-topy)/fully))/2); if ((cal_x>0)&&(cal_y>0)){ add_x = round((leftx / cal_x) - padsz); add_y = round((topy / cal_y) - padsz); data_is_valid = 1; } } if (data_is_valid){ atouch_set_calibrate(cal_x,add_x,cal_y,add_y); if (!USE_HACK){ snprintf(datx,255, "Use/Replace this command in <#009>aroma-config</#>:\n\n" "<#060>calibrate(\n \"%01.4f\",\"%i\",\"%01.4f\",\"%i\",\"yes\"\n);</#>\n\n", cal_x,add_x,cal_y,add_y); } else{ snprintf(datx,255, "Use/Replace this command in <#009>aroma-config</#>:\n\n" "<#060>calibrate(\n \"%01.4f\",\"%i\",\"%01.4f\",\"%i\"\n);</#>\n\n", cal_x,add_x,cal_y,add_y); } aw_calibdraw(&ccv,-1,xpos,ypos,xtch,ytch); isvalid = 1; } else{ aw_alert(parent, "Calibrated Data", "Calibrated data not valid, please try again...", "@info", NULL); } doneit: ag_ccanvas(&ccv); on_dialog_window = 0; aw_unmuteparent(parent,tmpc); byte dont_restore_caldata = 0; if (isvalid){ aw_alert(parent, "Calibrated Data", datx, "@info", NULL); dont_restore_caldata = aw_confirm( parent, "Set Calibrated Data", "Do you want to use the current calibrated data in the current process?\n\n<#080>NOTE:</#> It will revert back when you restart the AROMA Installer...", "@alert", NULL, NULL ); } if (!dont_restore_caldata){ atouch_sethack(current_hack); atouch_restorecalibrate(); } }
void aw_calibtools(AWINDOWP parent){ //-- Set Mask CANVAS * tmpc = aw_muteparent(parent); on_dialog_window = 1; ag_rectopa(agc(),0,0,agw(),agh(),0x0000,220); ag_sync(); byte isvalid = 0; //-- Initializing Canvas CANVAS ccv; ag_canvas(&ccv,agw(),agh()); ag_blur(&ccv,agc(),agdp()*2); int xpos[5] = { agdp()*10, agw()-(agdp()*10), agdp()*10, agw()-(agdp()*10), agw()/2 }; int ypos[5] = { agdp()*10, agdp()*10, agh() - (agdp()*10), agh()-(agdp()*10), agh()/2 }; int xtch[5] = { 0,0,0,0,0 }; int ytch[5] = { 0,0,0,0,0 }; atouch_plaincalibrate(); char datx[256]; if (!aw_calibdraw(&ccv,0,xpos,ypos,xtch,ytch)) goto doneit; if (!aw_calibdraw(&ccv,1,xpos,ypos,xtch,ytch)) goto doneit; if (!aw_calibdraw(&ccv,2,xpos,ypos,xtch,ytch)) goto doneit; if (!aw_calibdraw(&ccv,3,xpos,ypos,xtch,ytch)) goto doneit; if (!aw_calibdraw(&ccv,4,xpos,ypos,xtch,ytch)) goto doneit; float padsz = agdp()*5; float leftx = ((xtch[0]+xtch[2])/2); float rightx = ((xtch[1]+xtch[3])/2); float topy = ((ytch[0]+ytch[1])/2); float bottomy = ((ytch[2]+ytch[3])/2); float centerx = xtch[4]; float centery = ytch[4]; float halfx = (agw()/2)-padsz; float halfy = (agh()/2)-padsz; float fullx = agw()-padsz; float fully = agh()-padsz; byte data_is_valid = 0; float cal_x = 0; float cal_y = 0; int add_x = 0; int add_y = 0; if ((halfx>0)&&(fullx>0)&&(halfy>0)&&(fully>0)){ cal_x = ((((centerx-leftx)/halfx) + ((rightx-leftx)/fullx))/2); cal_y = ((((centery-topy)/halfy) + ((bottomy-topy)/fully))/2); if ((cal_x>0)&&(cal_y>0)){ add_x = round((leftx / cal_x) - padsz); add_y = round((topy / cal_y) - padsz); data_is_valid = 1; } } if (data_is_valid){ atouch_set_calibrate(cal_x,add_x,cal_y,add_y); snprintf(datx,255, "Use/Replace this command in top of <#009>aroma-config</#>:\n\n" "<#060>calibrate(\"%01.4f\",\"%i\",\"%01.4f\",\"%i\");</#>\n\n", cal_x,add_x,cal_y,add_y); aw_calibdraw(&ccv,-1,xpos,ypos,xtch,ytch); isvalid = 1; } else{ aw_alert(parent, "Calibrated Data", "Calibrated Data not Valid, Please Try Again...", "icons/info", NULL); } doneit: ag_ccanvas(&ccv); on_dialog_window = 0; aw_unmuteparent(parent,tmpc); byte dont_restore_caldata = 0; if (isvalid){ aw_alert(parent, "Calibrated Data", datx, "icons/info", NULL); dont_restore_caldata = aw_confirm( parent, "Set Calibrated Data", "Do You Want to Use Current Calibrated Data in Current Process?\n\n<#080>NOTE:</#> It Will revert back when you restart the AROMA Installer...", "icons/alert", NULL, NULL ); } if (!dont_restore_caldata){ atouch_restorecalibrate(); } }
//* //* ONHOLD //* //* //* MAKE NEW FOLDER //* byte auia_hold_rename(AUI_VARSP v, char *oldname) { byte redoing = 0; char new_folder_name[256]; snprintf(new_folder_name, 256, oldname); byte dispatch_ret = 1; do { redoing = 0; dispatch_ret = 1; char *ret = aw_ime(v->hWin, new_folder_name, alang_get("rename")); if (ret != NULL) { if (strlen(ret) == 0) { redoing = aw_confirm(v->hWin, alang_get("rename"), alang_get ("rename.insertname"), aui_icons(37), alang_get("tryagain"), alang_get("cancel")); } else if (strcmp(ret, oldname) == 0) { redoing = 0; } else { char *path_newfolder = NULL; aui_setpath(&path_newfolder, v->path, ret, 0); if (path_newfolder != NULL) { if (file_exists(path_newfolder)) { redoing = aw_confirm(v->hWin, alang_get ("rename"), alang_get ("rename.exist"), aui_icons (39), alang_get ("tryagain"), alang_get ("cancel")); } else { char *path_oldfolder = NULL; aui_setpath(&path_oldfolder, v->path, oldname, 0); if (path_oldfolder) { int retval = rename (path_oldfolder, path_newfolder); if (retval != -1) { dispatch_ret = 0; v->reshow = 1; snprintf(v-> selfile, 256, "%s", ret); } else { redoing = aw_confirm (v->hWin, alang_get ("rename"), alang_get ("rename.error"), aui_icons (37), alang_get ("tryagain"), alang_get ("cancel")); } free(path_oldfolder); } } free(path_newfolder); } } snprintf(new_folder_name, 256, ret); free(ret); } } while (redoing); return dispatch_ret; }