コード例 #1
0
ファイル: miui_controls.c プロジェクト: Canbeal/miui_recovery
//-- DESTROY WINDOW
void aw_destroy(AWINDOWP win){
  ag_setbusy();
  
  //-- Set To Unactive
  win->isActived = 0;
  
  //-- Wait Thread To Closed
  int threadwait_n=0;
  while (win->threadnum>0){
    usleep(500);
    if (threadwait_n++>1000) break;
  }
  
  //-- Cleanup Controls
  if (win->controln>0){
    int i;
    ACONTROLP * controls = (ACONTROLP *) win->controls;
    for (i=win->controln-1;i>=0;i--){
      controls[i]->ondestroy((void*) controls[i]);
      free(controls[i]);
    }
    free(win->controls);
  }
  
  //-- Cleanup Window
  ag_ccanvas(&win->c);
  free(win);
}
コード例 #2
0
//*
//* CANCEL CLIPBOARD
//*
void auia_unsetclipboard(AUI_VARSP v) {
  ag_setbusy();
  auic_release();
  *v->state = aui_tbstate(v, 0, *v->state);
  afbox_changeboxtype(v->hFile, 0);
  aui_changetitle(v, AROMA_NAME);
}
コード例 #3
0
void afbox_changeboxtype(ACONTROLP ctl, byte t){
  ag_setbusy();
  AFBOXDP d = (AFBOXDP) ctl->d;
  if (d->acheck_signature != 177) return; //-- Not Valid Signature
  d->boxtype      = t;
  int i;
  for (i=0;i<d->itemn;i++){
    afbox_redrawitem(ctl,i);
  }
  ctl->ondraw(ctl);
  aw_redraw(ctl->win);
  ag_sync();
}
コード例 #4
0
void auido_del(char *dest, byte * tool_state)
{
	ag_setbusy();

	if (auic_s > 0) {
		int valid_files = 0;
		int number_files = auic_s;
		byte *copy_status = malloc(number_files * sizeof(byte));
		char **source_path = malloc(number_files * sizeof(char *));
		memset(copy_status, 0, number_files * sizeof(byte));
		memset(source_path, 0, number_files * sizeof(char *));
		int i = 0;

		for (i = 0; i < number_files; i++) {
			source_path[i] = auic_getpath(i);
			if (source_path[i] != NULL) {
				//-- Check paste validity
				copy_status[i] = 0;
				char *real_source =
				    realpath(source_path[i], NULL);
				if (isnodelete(real_source)) {
					copy_status[i] = 1;
				}
				if (copy_status[i] != 1)
					valid_files++;
				free(real_source);
			} else {
				copy_status[i] = 3;
			}
		}

		if (valid_files > 0) {
			auido_show_del(copy_status, source_path, number_files);
		}
		//-- Releases
		for (i = 0; i < number_files; i++) {
			if (source_path[i] != NULL)
				free(source_path[i]);
		}
		free(source_path);
		free(copy_status);
	}

	auic_release();
	*tool_state = 0;
	return;
}
コード例 #5
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);
  }
}
コード例 #6
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;
}
コード例 #7
0
ファイル: miui_controls.c プロジェクト: Canbeal/miui_recovery
//-- CREATE WINDOW
AWINDOWP aw(CANVAS * bg){
  ag_setbusy();
  //sleep(4);
  //-- Create Window
  AWINDOWP win = (AWINDOWP) malloc(sizeof(AWINDOW));
  if (win==NULL) return NULL;
  
  //-- Create Canvas & Draw BG
  ag_canvas(&win->c,agw(),agh());
  ag_draw(&win->c,bg,0,0);
  
  //-- Initializing Variables
  win->bg           = bg;
  win->controls     = NULL;
  win->controln     = 0;
  win->threadnum    = 0;
  win->focusIndex   = -1;
  win->touchIndex   = -1;
  win->isActived    = 0;
  
  //-- RETURN
  return win;
}
コード例 #8
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;
}