コード例 #1
0
//*
//* CHECKED FILE CHANGE
//*
void auia_chkcount(AUI_VARSP v) {
  if (*v->state != 3) {
    int ckn = afbox_checkcount(v->hFile);
    int itn = afbox_itemcount(v->hFile);
    
    if (ckn == 0) {
      aui_changetitle(v, AROMA_NAME);
    }
    else {
      char titlex[128];
      
      if (ckn == 1)
        snprintf(titlex, 128,
                 alang_get("selected.file"), ckn);
      else
        snprintf(titlex, 128,
                 alang_get("selected.files"), ckn);
                 
      aui_changetitle(v, titlex);
    }
    
    if (ckn == 0) {
      *v->state = aui_tbstate(v, 0, *v->state);
    }
    else if (ckn == itn) {
      *v->state = aui_tbstate(v, 2, *v->state);
    }
    else {
      *v->state = aui_tbstate(v, 1, *v->state);
    }
  }
}
コード例 #2
0
void afs_showDiskfull(AWINDOWP hWin, AFSDTP dt) {
  AWMENUITEM mi[2];
  aw_menuset(mi, 0, "cancel", 0);
  aw_menuset(mi, 1, "continue", 33);
  char info[300];
  snprintf(info, 300, "%s\n\n%s", alang_get("disk.full.info"), dt->curr);
  byte status =
    aw_multiconfirm(hWin, alang_get("disk.full"), info, aui_icons(37),
                    mi,
                    2);
  pthread_mutex_lock(&dt->ovrMutex);
  dt->status = status;
  pthread_cond_signal(&dt->ovrCond);
  pthread_mutex_unlock(&dt->ovrMutex);
}
コード例 #3
0
byte afs_showOverwrite(AWINDOWP hWin, AFSDTP dt) {
  AWMENUITEM mi[4];
  aw_menuset(mi, 0, "overwrite.skip", 0);
  aw_menuset(mi, 1, "overwrite.skipall", 19);
  aw_menuset(mi, 2, "overwrite", 33);
  aw_menuset(mi, 3, "overwrite.all", 16);
  char info[300];
  snprintf(info, 300, "%s\n\n%s", alang_get("file.exists.info"),
           dt->curr);
  byte ovr =
    aw_multiconfirm(hWin, alang_get("file.exists"), info, aui_icons(39),
                    mi, 4);
  afs_setOverwrite(dt, ovr);
  return ovr;
}
コード例 #4
0
byte auifav_fetch(ACONTROLP FB)
{
	char *o = aarray_get(aui_cfg_array, "favorites");
	if (o == NULL)
		return 0;
	int n = 0;
	char *buf = strdup(o);
	char *tok = strtok(buf, ";");
	while (tok) {
		char *dname = NULL;
		char *desc = NULL;
		if (strcmp(tok, "/") == 0) {
			dname = strdup(alang_get("dir.root"));
			desc = strdup("/");
		} else {
			dname = basename(tok);
			desc = aui_strip(tok, agw() - (agdp() * 46), 0);
		}
		afbox_add(FB, dname, desc, 0, &UI_ICONS[36], 0, "", n++, 0);
		free(desc);
		tok = strtok(NULL, ";");
	}
	free(buf);
	return 1;
}
コード例 #5
0
byte auia_do_delete(AUI_VARSP v) {
  AWMENUITEM mi[2];
  aw_menuset(mi, 0, "yes", 33);
  aw_menuset(mi, 1, "no", 0);
  char info[256];
  char numfl[64];
  snprintf(numfl, 64, "%i", auic_s);
  snprintf(info, 256, alang_get("delete.message"), numfl);
  byte ovr = aw_multiconfirm_ex(v->hWin, alang_get("delete.title"), info,
                                aui_icons(37),
                                mi, 2, 1);
  ag_setbusy();
  
  if (ovr == 0) {
    aui_changetitle(v, AROMA_NAME);
    v->reshow = 5;
    return 0;
  }
  
  auic_release();
  return 1;
}
コード例 #6
0
//* 
//* GET TOOL TITLE
//*
char *aui_tbtitle(int id)
{
	if (!auic()->tooltext)
		return NULL;

	char *titlekey[11] = {
		"tools.newfolder",	// 0
		"tools.favorite",	// 1
		"tools.selectall",	// 2
		"tools.unselect",	// 3
		"tools.copy",	// 4
		"tools.cut",	// 5
		"tools.paste",	// 6
		"tools.menu",	// 7
		"cancel",	// 8
		"done",		// 9
		"settings.reset"	// 10
	};
	return alang_get(titlekey[id]);
}
コード例 #7
0
void
afs_setoftitle(char * buf, char * format, int v1, int v2, char * sv1, char * sv2) {
  char st1[64];
  char st2[64];
  
  if (sv1 != NULL) {
    snprintf(st1, 64, "%s", sv1);
  }
  else {
    snprintf(st1, 64, "%i", v1);
  }
  
  if (sv2 != NULL) {
    snprintf(st2, 64, "%s", sv2);
  }
  else {
    snprintf(st2, 64, "%i", v2);
  }
  
  snprintf(buf, 256, alang_get(format), st1, st2);
}
コード例 #8
0
//*
//* COPY CUT
//*
void auia_setclipboard(AUI_VARSP v, byte type) {
  ag_setbusy();
  int ckn = afbox_checkcount(v->hFile);
  int itn = afbox_itemcount(v->hFile);
  auic_init(type, ckn, v->path);
  int i;
  
  for (i = 0; i < itn; i++) {
    char * fn = afbox_getcfile(v->hFile, i);
    
    if (fn != NULL) {
      auic_add(fn);
    }
  }
  
  if (type != 3) {
    *v->state = aui_tbstate(v, 3, *v->state);
    afbox_changeboxtype(v->hFile, 1);
    aui_changetitle(v, alang_get("paste.location"));
    afbox_setcheckall(v->hFile, 0);
  }
}
コード例 #9
0
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;
}
コード例 #10
0
//*
//* Parse AMS
//*
char * alang_ams(const char * str){
  char   c = 0;
  char  pc = 0;
  char * r = malloc(1); *r=0;
  int   rl = 0;
  byte  state=0;
  char key[256];
  int   kp = 0;
  byte tag_type = 0;
  
  while ((c=*str++)){
    if (state==0){
      if ((c=='<')&&(pc!='\\')&&((*str=='~')||(*str=='$'))){
        tag_type  = (*str=='~')?0:1;
        state     = 1;
        kp        = 0;
        key[0]    = 0;
      }
      else if ((c=='<')&&(pc=='\\')&&((*str=='~')||(*str=='$'))){
        r[rl-1] = c;
        r[rl]   = 0;
      }
      else{
        r = realloc(r, rl+2);
        r[rl++] = c;
        r[rl]   = 0;
      }
    }
    else if(state==1){
      if ((c!='>')&&(kp<255)){
        key[kp++] = c;
        key[kp]   = 0;
      }
      else if (tag_type==0){
        //-- Lang Tags
        state=0;
        char * lfound = alang_get(key+1);
        if (lfound!=NULL){
          int addsz = strlen(lfound);
          r = realloc(r, rl+addsz+1);
          char * rpos = r+rl;
          memcpy(rpos,lfound,addsz);
          rl+=addsz;
          r[rl] = 0;
        }
        else{
          int addsz = strlen(key+1);
          r = realloc(r, rl+addsz+1);
          char * rpos = r+rl;
          memcpy(rpos,key+1,addsz);
          rl+=addsz;
          r[rl] = 0;
        }
      }
      else{
        //-- Variable Tags
        state=0;
        char * lfound = miui_getvar(key+1);
        if (lfound!=NULL){
          int addsz = strlen(lfound);
          r = realloc(r, rl+addsz+1);
          char * rpos = r+rl;
          memcpy(rpos,lfound,addsz);
          rl+=addsz;
          r[rl] = 0;
          free(lfound);
        }
      }
    }
    pc = c;
  }
  return r;
}
コード例 #11
0
/*
 * 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;
}
コード例 #12
0
//* 
//* 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;
}
コード例 #13
0
//*
//* SHOW MAIN DIRECTORY LIST UI
//*
byte aui_show(char ** path, byte * state, char * selfile, byte back_ani) {
  //-- REDRAW BG
  aui_setbg(NULL);
  //-- Main Variable
  AUI_VARS v;
  //-- Return Value
  v.reshow = 0;
  //-- Init Drawing Data
  v.selfile = selfile;
  v.path = *path;
  v.state = state;
  v.pad = agdp() * 2;
  v.btnH = agdp() * 20;
  v.boxH = agh() - (aui_minY + (v.btnH * 2) + (v.pad * 4));
  v.boxY = aui_minY + v.btnH + (v.pad * 2);
  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 / 4);
  v.hFileType = (*v.state == 3) ? 1 : 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);
  //-- Check is ROOT Filesystem
  v.isRoot = (strcmp(v.path, "/") != 0) ? 0 : 1;
  
  //-- Justify Path UI Width
  if (!v.isRoot) {
    v.pthW -= v.btnH + v.pad;
  }
  
  //-- Draw Path UI
  aui_pathui(&aui_win_bg, v.pad, v.navY, v.pthW, v.btnH, v.path);
  //-- Create Main Window
  v.hWin = aw(&aui_win_bg);
  //****************************[ INIT WINDOW CONTROLS ]****************************/
  //-- REFRESH BUTTON
  imgbtn(v.hWin, v.pad, v.navY, v.btnH, v.btnH, &UI_ICONS[14], NULL, 2,
         10);
         
  //-- PARENT BUTTON
  if (!v.isRoot)
    imgbtn(v.hWin, agw() - (v.btnH + v.pad), v.navY, v.btnH, v.btnH,
           &UI_ICONS[12], NULL, 0, 11);
           
  //-- FILE LIST BOX
  v.hFile =
    afbox(v.hWin, 0, v.boxY, agw(), v.boxH - v.btnFH, 7, 8, v.hFileType,
          6);
  //-- TOOLS
  v.b1 = imgbtn(v.hWin, v.pad, v.btnY - v.btnFH, v.btnW, v.btnH + v.btnFH, &UI_ICONS[11], aui_tbtitle(0), 1, 20);	//-- NEW FOLDER
  v.b2 = imgbtn(v.hWin, v.pad + v.btnW, v.btnY - v.btnFH, v.btnW, v.btnH + v.btnFH, &UI_ICONS[6], aui_tbtitle(1), 1, 21);	//-- FAVORITE
  v.b3 = imgbtn(v.hWin, v.pad + v.btnW * 2, v.btnY - v.btnFH, v.btnW, v.btnH + v.btnFH, &UI_ICONS[16], aui_tbtitle(2), 1, 22);	//-- SELECT ALL
  v.b4 = imgbtn(v.hWin, v.pad + v.btnW * 3, v.btnY - v.btnFH, v.btnW, v.btnH + v.btnFH, &UI_ICONS[10], aui_tbtitle(7), 1, 3);	//-- MENU
  
  //-- SET TOOLBAR STATE
  if (*v.state != 3) {
    *v.state = 0;
  }
  
  *v.state = aui_tbstate(&v, *v.state, 0);
  //-- FETCH ITEMS FROM DIRECTORY
  aui_fetch(v.path, v.hFile, v.selfile);
  afbox_scrolltoitem(v.hFile);
  snprintf(v.selfile, 256, "");
  //-- Show Window
  aw_show_ex(v.hWin, back_ani ? 3 : 4, 0, v.hFile);
  // aw_setfocus(v.hWin,v.hFile);
  
  //-- Set Filebox Type
  if (*v.state == 3) {
    afbox_changeboxtype(v.hFile, 1);
    aui_changetitle(&v, alang_get("paste.location"));
  }
  else {
    aui_changetitle(&v, AROMA_NAME);
  }
  
  aui_showtips(&v);
  
  do {
  }
  while (aui_dispatch(&v));
  
  //-- Window
  aw_destroy(v.hWin);
  //-- Set New Path
  printf("RESHOW PATH [%s]\n", v.path);
  *path = v.path;
  return v.reshow;
}
コード例 #14
0
int aui_fetch(char *path, ACONTROLP FB, char *selfile)
{
	struct dirent **files;
	aui_dir_active_path = path;
	int n = scandir(path, &files, 0, *aui_fsort);

	if (n > 0) {
		while (n--) {
			char *dname = files[n]->d_name;
			if (!strcmp(dname, ".") || !strcmp(dname, "..")) {
				free(files[n]);
				continue;
			}

			if ((dname[0] == '.') && (auic()->showhidden == 0)) {
				free(files[n]);
				continue;
			}
			//-- GET TYPE
			byte dtype = aui_dtcheck(dname, files[n]->d_type, 20);

			char *full_path = NULL;
			aui_setpath(&full_path, aui_dir_active_path, dname, 0);

			if (full_path) {
				if (auic()->showhidden == 0) {
					if (aui_ishidden_file(full_path)) {
						free(full_path);
						free(files[n]);
						continue;
					}
				}

				byte selectedDefault =
				    strcmp(selfile, dname) ? 0 : 1;
				//-- DIR
				if (dtype == 4) {
					int cnt = aui_getdircount(full_path);
					char desc[256];
					char perm[10];
					aui_fileperm(perm, full_path);

					char formats[256];
					char formats2[256];
					snprintf(formats, 256,
						 "<#selectbg_g>%i</#>", cnt);
					snprintf(formats2, 256,
						 alang_get((cnt >
							    1) ?
							   "dir.filecounts" :
							   "dir.filecount"),
						 formats);
					snprintf(desc, 256, "<@right>%s</@>",
						 formats2);
					afbox_add(FB, dname, desc, 0,
						  &UI_ICONS[22], dtype, perm, 0,
						  selectedDefault);
				}
				//-- FILE
				else if (dtype == 8) {
					char desc[256];
					char dsz[256];
					char perm[10];
					aui_fileperm(perm, full_path);
					aui_filesize(dsz, full_path);
					snprintf(desc, 256, "<@right>%s</@>",
						 dsz);
					afbox_add(FB, dname, desc, 0,
						  &UI_ICONS[21], dtype, perm, 0,
						  selectedDefault);
				}
				//-- LINK FILE / DIR
				else if ((dtype == 28) || (dtype == 24)) {
					char *desc = NULL;
					char buf[4096];
					int len =
					    readlink(full_path, buf,
						     sizeof(buf));
					if (len >= 0) {
						buf[len] = 0;
						desc =
						    aui_strip(buf,
							      agw() -
							      (agdp() * 46), 0);
					}
					afbox_add(FB, dname,
						  ((desc ==
						    NULL) ?
						   alang_get("symlink.error") :
						   desc), 0,
						  &UI_ICONS[(dtype ==
							     24) ? 25 : 24],
						  dtype, "", 0,
						  selectedDefault);
					if (desc != NULL)
						free(desc);
				}
				//-- ERROR LINK
				else if (dtype == 10) {
					afbox_add(FB, dname,
						  alang_get("symlink.error"), 0,
						  &UI_ICONS[23], dtype, "", 0,
						  selectedDefault);
				}

				free(full_path);
			}
			free(files[n]);
		}
		free(files);
	}
	return 1;
}
コード例 #15
0
/*
 * Descriptions:
 * -------------
 * AROMA File Manager Main LIB
 *
 */ 
void aw_menuset(AWMENUITEMP mi, int id, char *title_id, int ico_id)
{
	
snprintf(mi[id].title, 128, alang_get(title_id));
	
コード例 #16
0
//*
//* 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();
  }
}
コード例 #17
0
byte auia_hold(AUI_VARSP v) {
  char * fl = afbox_getselectedfile(v->hFile);
  byte dtype = afbox_dtype(v->hFile);
  
  if (fl != NULL) {
    AWMENUITEM mi[6];
    int cp = 0;
    byte onfav = 0;
    byte isonfav = 0;
    
    if ((dtype == 4) || (dtype == 24)) {
      isonfav = auifav_isfav(fl);
      
      if (isonfav) {
        aw_menuset(mi, cp++, "tools.favorite.del", 8);
      }
      else {
        aw_menuset(mi, cp++, "tools.favorite.add", 7);
      }
      
      onfav = 1;
    }
    
    aw_menuset(mi, cp++, "tools.rename", 15);
    aw_menuset(mi, cp++, "tools.copy", 2);
    aw_menuset(mi, cp++, "tools.cut", 3);
    aw_menuset(mi, cp++, "tools.delete", 4);
    aw_menuset(mi, cp++, "tools.chmod", 1);
    byte ret = aw_menu(v->hWin, fl, mi, cp);
    
    if ((!onfav) && (ret > 0)) {
      ret++;
    }
    
    if (ret == 2) {
      //-- Rename
      return auia_hold_rename(v, fl);
    }
    else if (ret == 6) {
      //-- Rename
      return auia_hold_perm(v, fl);
    }
    else if ((ret == 3) || (ret == 4)) {
      //-- Copy / cut
      ag_setbusy();
      auic_init(ret - 2, 1, v->path);
      auic_add(fl);
      *v->state = aui_tbstate(v, 3, *v->state);
      afbox_changeboxtype(v->hFile, 1);
      aui_changetitle(v, alang_get("paste.location"));
      afbox_setcheckall(v->hFile, 0);
    }
    else if (ret == 5) {
      //-- Copy / cut
      ag_setbusy();
      auic_init(3, 1, v->path);
      auic_add(fl);
      return auia_do_delete(v);
    }
    else if (ret == 1) {
      //-- Add Remove Favorite
      char * full_fl = NULL;
      aui_setpath(&full_fl, v->path, fl, 1);
      
      if (full_fl != NULL) {
        if (isonfav) {
          auifav_del(full_fl);
        }
        else {
          auifav_add(full_fl);
        }
        
        LOGS("Add To Favorite: %s\n", full_fl);
        free(full_fl);
      }
    }
  }
  
  return 1;
}
コード例 #18
0
//*
//* 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;
}
コード例 #19
0
//*
//* SHOW MENU
//*
byte auia_menu(AUI_VARSP v) {
  byte common_cmd = 0;
  byte cstate = *v->state;
  
  if ((cstate == 1) || (cstate == 2)) {
    AWMENUITEM mi[5];
    int cp = 0;
    
    if (cstate == 1) {
      aw_menuset(mi, cp++, "tools.unselect", 19);
    }
    
    aw_menuset(mi, cp++, "tools.delete", 4);
    aw_menuset(mi, cp++, "settings", 17);
    aw_menuset(mi, cp++, "about", 9);
    aw_menuset(mi, cp++, "exit", 0);
    byte ret = aw_menu(v->hWin, NULL, mi, cp);
    
    if ((cstate == 2) && (ret > 0)) {
      ret++;
    }
    
    if (ret == 5) {
      common_cmd = 1;
    }
    else if (ret == 3) {
      common_cmd = 2;
    }
    else if (ret == 4) {
      common_cmd = 3;
    }
    else if (ret == 2) {
      //-- Delete
      auia_setclipboard(v, 3);
      return auia_do_delete(v);
    }
    else if (ret == 1) {
      afbox_setcheckall(v->hFile, 0);
    }
  }
  else {
    int cp = 0;
    AWMENUITEM mi[7];
    
    if (cstate == 3) {
      aw_menuset(mi, cp++, "tools.newfolder", 11);
    }
    
    byte isonfav = auifav_isfav(v->path);
    
    if (isonfav) {
      aw_menuset(mi, cp++, "tools.favorite.del", 8);
    }
    else {
      aw_menuset(mi, cp++, "tools.favorite.add", 7);
    }
    
    aw_menuset(mi, cp++,
               (auic()->showhidden ? "tools.hiddenfile" :
                "tools.hiddenfile.show"), 18);
    aw_menuset(mi, cp++, "tools.terminal", 40);
    aw_menuset(mi, cp++, "settings", 17);
    aw_menuset(mi, cp++, "about", 9);
    aw_menuset(mi, cp++, "exit", 0);
    byte ret = aw_menu(v->hWin, NULL, mi, cp);
    
    if ((cstate != 3) && (ret > 0)) {
      ret++;
    }
    
    if (ret == 7) { /* EXIT */
      common_cmd = 1;
    }
    else if (ret == 6) { /* ABOUT */
      common_cmd = 3;
    }
    else if (ret == 4) { /* TERMINAL */
      common_cmd = 4;
    }
    else if (ret == 5) { /* SETTING */
      common_cmd = 2;
    }
    else if (ret == 3) {
      auic()->showhidden = (auic()->showhidden ? 0 : 1);
      aui_cfg_save();
      v->reshow = 1;
      return 0;
    }
    else if (ret == 2) {
      //-- Add Remove Favorite
      if (isonfav) {
        auifav_del(v->path);
      }
      else {
        auifav_add(v->path);
      }
    }
    else if (ret == 1) {
      //-- Show New Folder
      return auia_newfolder(v);
    }
  }
  
  //-- Common command
  if (common_cmd == 1) {  //-- Exit
    AWMENUITEM mi[2];
    aw_menuset(mi, 0, "yes", 33);
    aw_menuset(mi, 1, "no", 0);
    byte ovr = aw_multiconfirm_ex(v->hWin, alang_get("exit"),
                                  alang_get("exit.message"),
                                  aui_icons(39), mi, 2,
                                  1);
                                  
    if (ovr == 0) {
      return 0;
    }
  }
  else if (common_cmd == 2) { //-- Settings
    v->reshow = 2;
    return 0;
  }
  else if (common_cmd == 3) { //-- About
    auido_about_dialog(v->hWin);
  }
  else if (common_cmd == 4) { //-- Terminal
    v->reshow = 6;
    return 0;
  }
  
  return 1;
}
コード例 #20
0
/*
 * Descriptions:
 * -------------
 * AROMA File Manager Main LIB
 *
 */
void aw_menuset(AWMENUITEMP mi, int id, char * title_id, int ico_id) {
  snprintf(mi[id].title, 128, "%s", alang_get(title_id));
  mi[id].icon = aui_icons(ico_id);
}
コード例 #21
0
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);
}