void acopt_redraw(ACONTROLP ctl) {
  ACOPTDP d = (ACOPTDP) ctl->d;
  
  if (d->acheck_signature != 136) {
    return;  //-- Not Valid Signature
  }
  
  if ((d->itemn > 0) && (d->draweditemn < d->itemn)) {
    ag_ccanvas(&d->client);
    ag_canvas(&d->client, d->clientWidth, d->nextY);
    ag_rect(&d->client, 0, 0, d->clientWidth, agdp()*max(acfg()->roundsz, 4), acfg()->textbg);
    //-- Set Values
    d->scrollY     = 0;
    d->maxScrollY  = d->nextY - (ctl->h - (agdp() * max(acfg()->roundsz, 4)));
    
    if (d->maxScrollY < 0) {
      d->maxScrollY = 0;
    }
    
    //-- Draw Items
    int i;
    
    for (i = 0; i < d->itemn; i++) {
      acopt_redrawitem(ctl, i);
    }
    
    d->draweditemn = d->itemn;
  }
}
ACONTROLP accb(
  AWINDOWP win,
  int x,
  int y,
  int w,
  int h,
  char * textv,
  byte checked
){
  //-- Validate Minimum Size
  if (h<agdp()*16) h=agdp()*16;
  if (w<agdp()*16) w=agdp()*16;
  
  //-- Limit Title Length  
  char title[128];
  snprintf(title,128,"%s",textv);
  
  //-- Initializing Button Data
  ACCBDP d = (ACCBDP) malloc(sizeof(ACCBD));
  memset(d,0,sizeof(ACCBD));
  
  //-- Save Touch Message & Set Stats
  d->checked   = checked;
  d->focused   = 0;
  d->pushed    = 0;
  
  //-- Initializing Canvas
  ag_canvas(&d->control,w,h);
  
  //-- Draw Control Background
  ag_draw_ex(&d->control,&win->c,0,0,x,y,w,h);
  
  //-- Calculate Position & Size
  int minpad    = 5*agdp();
  d->chkS       = (agdp()*10);
  int txtW      = w - ((d->chkS+6)+(agdp()*4));
  int txtX      = (d->chkS+(agdp()*4));
  int txtH      = ag_txtheight(txtW,title,0);
  int txtY      = ((h-txtH) / 2);
  if (txtY<1) txtY = 1;
  ag_textf(&d->control,txtW,minpad+txtX,txtY,title,acfg()->textbg,0);
  ag_text(&d->control,txtW,minpad+txtX-1,txtY-1,title,acfg()->textfg,0);
  
  //-- Initializing Control
  ACONTROLP ctl  = malloc(sizeof(ACONTROL));
  ctl->ondestroy= &accb_ondestroy;
  ctl->oninput  = &accb_oninput;
  ctl->ondraw   = &accb_ondraw;
  ctl->onblur   = &accb_onblur;
  ctl->onfocus  = &accb_onfocus;
  ctl->win      = win;
  ctl->x        = x;
  ctl->y        = y;
  ctl->w        = w;
  ctl->h        = h;
  ctl->forceNS  = 0;
  ctl->d        = (void *) d;
  aw_add(win,ctl);
  return ctl;
}
예제 #3
0
CANVAS * aw_muteparent(AWINDOWP win){
  if (win==NULL){
    //-- Set Temporary
    CANVAS * tmpbg = (CANVAS *) malloc(sizeof(CANVAS));
    ag_canvas(tmpbg,agw(),agh());
    ag_draw(tmpbg,agc(),0,0);
    return tmpbg;
  }
  else{
    win->isActived = 0;
    return NULL;
  }
}
ACONTROLP aclabel(
  AWINDOWP win,
  int x,
  int y,
  int w,
  int h,
  char * text,
  byte isbig,
  byte vpos,
  byte sigleAligment,
  color cl
){
  //-- Validate Minimum Size
  if (h<agdp()*2) h=agdp()*2;
  if (w<agdp()*10) w=agdp()*10;
  
  //-- Initializing Button Data
  ACLABELDP d = (ACLABELDP) malloc(sizeof(ACLABELD));
  memset(d,0,sizeof(ACLABELD));
  
  //-- Save Touch Message & Set Stats
  d->text      = strdup(text);
  d->isbig     = isbig;
  d->vpos      = vpos;
  d->drawed    = 0;
  d->cl        = cl;
  d->sigleAligment = sigleAligment;
  
  //-- Initializing Canvas
  ag_canvas(&d->control,w,h);
  
  //-- Initializing Control
  ACONTROLP ctl  = malloc(sizeof(ACONTROL));
  ctl->ondestroy= &aclabel_ondestroy;
  ctl->oninput  = &aclabel_oninput;
  ctl->ondraw   = &aclabel_ondraw;
  ctl->onblur   = &aclabel_onblur;
  ctl->onfocus  = NULL;
  ctl->win      = win;
  ctl->x        = x;
  ctl->y        = y;
  ctl->w        = w;
  ctl->h        = h;
  ctl->forceNS  = 0;
  ctl->d        = (void *) d;
  aw_add(win,ctl);
  return ctl;
}
예제 #5
0
void aw_textdialog(AWINDOWP parent,char * title,char * text,char * ok_text){
  CANVAS * tmpc = aw_muteparent(parent);
  on_dialog_window = 1;
  ag_rectopa(agc(),0,0,agw(),agh(),0x0000,180);
  ag_sync();
  int elmP  = agdp()*4;
  int winP  = agdp()*4;
  int winW  = agw() - (winP*2);
  int winH  = (agh() / 2) + (winP*4);
  int winX  = winP;
  int winY  = (agh() / 2) - (winH/2);
  int titW  = ag_txtwidth(title,1);
  int capH  = ag_fontheight(1) + (elmP*2);
  int btnH  = agdp()*20;
  int txtH  = winH - (btnH + capH + (elmP*3));
  int txtY  = winY + capH + elmP;
  int btnY  = txtY + txtH + elmP;
  int btnW  = (winW/2) - elmP;
  int btnX  = winX + ((winW/2) - (btnW/2));
  int txtX  = winX + elmP;
  int txtW  = winW - (elmP*2);
  CANVAS alertbg;
  ag_canvas(&alertbg,agw(),agh());
  ag_draw(&alertbg,agc(),0,0);
  ag_roundgrad(&alertbg,winX,winY,winW,winH,acfg_var.border,acfg_var.border_g,acfg_var.roundsz*agdp());
  ag_roundgrad(&alertbg,winX+1,winY+1,winW-2,winH-2,acfg_var.winbg,acfg_var.winbg_g,(acfg_var.roundsz*agdp())-1);
  ag_roundgrad_ex(&alertbg,winX+1,winY+1,winW-2,capH-1,acfg_var.titlebg,acfg_var.titlebg_g,(acfg_var.roundsz*agdp())-1,1,1,0,0);
  ag_textf(&alertbg,titW,((agw()/2)-(titW/2))+1,winY+elmP+1,title,acfg_var.titlebg_g,1);
  ag_text(&alertbg,titW,(agw()/2)-(titW/2),winY+elmP,title,acfg_var.titlefg,1);
  AWINDOWP hWin   = aw(&alertbg);
  actext(hWin,txtX,txtY,txtW,txtH,text,0);
  acbutton(hWin,btnX,btnY,btnW,btnH,(ok_text==NULL?acfg_var.text_ok:ok_text),0,5);
  aw_show(hWin);
  byte ondispatch = 1;
  while(ondispatch){
    dword msg=aw_dispatch(hWin);
    switch (aw_gm(msg)){
      case 5: ondispatch = 0; break;
    }
  }
  aw_destroy(hWin);
  ag_ccanvas(&alertbg);
  on_dialog_window = 0;
  aw_unmuteparent(parent,tmpc);
}
예제 #6
0
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;
}
void afbox_redraw(ACONTROLP ctl){
  AFBOXDP d = (AFBOXDP) ctl->d;
  if (d->acheck_signature != 177) return; //-- Not Valid Signature
  if ((d->itemn>0)&&(d->draweditemn<d->itemn)) {
    ag_ccanvas(&d->client);
    ag_canvas(&d->client,d->clientWidth,d->nextY);
    ag_rect(&d->client,0,0,d->clientWidth,agdp()*2,acfg()->textbg);
    
    //-- Set Values
    d->scrollY     = 0;
    d->maxScrollY  = d->nextY-(ctl->h-(agdp()*2));
    if (d->maxScrollY<0) d->maxScrollY=0;
    
    //-- Draw Items
    int i;
    for (i=0;i<d->itemn;i++){
      ag_rect(&d->client,0,d->items[i]->y,d->clientWidth,d->items[i]->h,acfg()->textbg);
      afbox_redrawitem(ctl,i);
    }
    d->draweditemn=d->itemn;
  }
}
예제 #8
0
//-- 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;
}
예제 #9
0
파일: wipe_ui.c 프로젝트: Jiangyi/12055
struct _menuUnit* wipe_ui_init()
{
    ag_canvas(&canvas_wipemenu,agw(),agh());
	
    struct _menuUnit* p = common_ui_init();
    return_null_if_fail(p != NULL);
    return_null_if_fail(menuUnit_set_name(p, "<~wipe.name>") == RET_OK);
    return_null_if_fail(menuUnit_set_title(p, "<~wipe.title>") == RET_OK);
    return_null_if_fail(menuUnit_set_icon(p, "@wipe") == RET_OK);
    return_null_if_fail(RET_OK == menuUnit_set_show(p, &wipe_menu_show));
    return_null_if_fail(menuNode_init(p) != NULL);
    //wipe_data/factory reset
    struct _menuUnit* temp = common_ui_init();
    assert_if_fail(menuNode_add(p, temp) == RET_OK);
    return_null_if_fail(menuUnit_set_name(temp, "<~wipe.factory.name>") == RET_OK);
    return_null_if_fail(menuUnit_set_result(temp, WIPE_FACTORY) == RET_OK);
    return_null_if_fail(menuUnit_set_desc(temp, "<~wipe.factory.desc>") == RET_OK);
    return_null_if_fail(menuUnit_set_icon(temp, "@wipe.all") == RET_OK);	
    return_null_if_fail(RET_OK == menuUnit_set_show(temp, &wipe_item_show));
    //wipe_data
    temp = common_ui_init();
    assert_if_fail(menuNode_add(p, temp) == RET_OK);
    return_null_if_fail(menuUnit_set_name(temp, "<~wipe.data.name>") == RET_OK);
    return_null_if_fail(menuUnit_set_result(temp, WIPE_DATA) == RET_OK);
    return_null_if_fail(menuUnit_set_desc(temp, "<~wipe.data.desc>") == RET_OK);
    return_null_if_fail(menuUnit_set_icon(temp, "@wipe.data") == RET_OK);		
    return_null_if_fail(RET_OK == menuUnit_set_show(temp, &wipe_item_show));
    //wipe_cache
    temp = common_ui_init();
    assert_if_fail(menuNode_add(p, temp) == RET_OK);
    return_null_if_fail(menuUnit_set_name(temp, "<~wipe.cache.name>") == RET_OK);
    return_null_if_fail(menuUnit_set_result(temp, WIPE_CACHE) == RET_OK);
    return_null_if_fail(menuUnit_set_desc(temp, "<~wipe.cache.desc>") == RET_OK);
    return_null_if_fail(menuUnit_set_icon(temp, "@wipe.cache") == RET_OK);		
    return_null_if_fail(RET_OK == menuUnit_set_show(temp, &wipe_item_show));
    return p;
}
예제 #10
0
byte aw_confirm(AWINDOWP parent, char * titlev,char * textv,char * img,char * yes_text,char * no_text){
  CANVAS * tmpc = aw_muteparent(parent);
  //-- Set Mask
  on_dialog_window = 1;
  ag_rectopa(agc(),0,0,agw(),agh(),0x0000,180);
  ag_sync();
  
  char title[64];
  char text[512];
  snprintf(title,64,"%s",titlev);
  snprintf(text,512,"%s",textv);
  
  int pad   = agdp()*4;
  int winW  = agw()-(pad*2);
  int txtW  = winW-(pad*2);
  int txtX  = pad*2;
  int btnH  = agdp()*20;
  int titW  = ag_txtwidth(title,1);
  int titH  = ag_fontheight(1) + (pad*2);
  
  PNGCANVASP winp = atheme("img.dialog");
  PNGCANVASP titp = atheme("img.dialog.titlebar");
  APNG9      winv;
  APNG9      titv;
  int vtitY = -1;
  int vpadB = -1;
  int vimgX = pad*2;
  if (titp!=NULL){
    if (apng9_calc(titp,&titv,1)){
      int tmptitH = titH - (pad*2);
      titH        = tmptitH + (titv.t+titv.b);
      vtitY       = titv.t;
    }
  }
  if (winp!=NULL){
    if (apng9_calc(winp,&winv,1)){
      txtW = winW - (winv.l+winv.r);
      txtX = pad  + (winv.l);
      vimgX= pad  + (winv.l);
      vpadB= winv.b;
    }
  }
  
  //-- Load Icon
  PNGCANVAS ap;
  byte imgE = 0; int imgW = 0; int imgH = 0;
  if (apng_load(&ap,img)){
    imgE      = 1;
    imgW      = min(ap.w,agdp()*30);
    imgH      = min(ap.h,agdp()*30);
    int imgA  = pad + imgW;
    txtX     += imgA;
    txtW     -= imgA;
  }
  
  int txtH    = ag_txtheight(txtW,text,0);
  int infH    = ((imgE)&&(txtH<imgH))?imgH:txtH;
    
  //-- Calculate Window Size & Position
  int winH    = titH + infH + btnH + (pad*3);
  if (vpadB!=-1){
    winH    = titH + infH + btnH + (pad*2) + vpadB;
  }
  int winX    = pad;
  int winY    = (agh()/2) - (winH/2);
  
  //-- Calculate Title Size & Position
  int titX    = (agw()/2) - (titW/2);
  int titY    = winY + pad;
  if (vtitY!=-1) titY = winY+vtitY;

  //-- Calculate Text Size & Position
  int infY    = winY + titH + pad;
  int txtY    = infY + ((infH - txtH) / 2);
  int imgY    = infY;
  
  //-- Calculate Button Size & Position
  int btnW    = (txtW / 2) - (pad/2);
  int btnY    = infY+infH+pad;
  int btnX    = txtX;
  int btnX2   = txtX+(txtW/2)+(pad/2);
  
  //-- Initializing Canvas
  CANVAS alertbg;
  ag_canvas(&alertbg,agw(),agh());
  ag_draw(&alertbg,agc(),0,0);
  
  //-- Draw Window
  if (!atheme_draw("img.dialog", &alertbg, winX-1,winY-1,winW+2,winH+2)){
    ag_roundgrad(&alertbg,winX-1,winY-1,winW+2,winH+2,acfg_var.border,acfg_var.border_g,(acfg_var.roundsz*agdp())+1);
    ag_roundgrad(&alertbg,winX,winY,winW,winH,acfg_var.dialogbg,acfg_var.dialogbg_g,acfg_var.roundsz*agdp());
  }
  
  //-- Draw Title
  if (!atheme_draw("img.dialog.titlebar", &alertbg, winX,winY,winW,titH)){
    ag_roundgrad_ex(&alertbg,winX,winY,winW,titH,acfg_var.dlgtitlebg,acfg_var.dlgtitlebg_g,acfg_var.roundsz*agdp(),1,1,0,0);
  }
  ag_textf(&alertbg,titW,titX+1,titY+1,title,acfg_var.dlgtitlebg_g,1);
  ag_text(&alertbg,titW,titX,titY,title,acfg_var.dlgtitlefg,1);
  
  //-- Draw Image
  if (imgE){
    apng_draw_ex(&alertbg,&ap,vimgX,imgY,0,0,imgW,imgH);
    apng_close(&ap);
  }
  
  //-- Draw Text
  ag_textf(&alertbg,txtW,txtX+1,txtY+1,text,acfg_var.dialogbg,0);
  ag_text(&alertbg,txtW,txtX,txtY,text,acfg_var.dialogfg,0);
  
  AWINDOWP hWin   = aw(&alertbg);
  
  acbutton(hWin,btnX,btnY,btnW,btnH,(yes_text==NULL?acfg_var.text_yes:yes_text),0,6);
  acbutton(hWin,btnX2,btnY,btnW,btnH,(no_text==NULL?acfg_var.text_no:no_text),0,5);
      
  aw_show(hWin);
  byte ondispatch = 1;
  byte res = 0;
  while(ondispatch){
    dword msg=aw_dispatch(hWin);
    switch (aw_gm(msg)){
      case 6: res=1; ondispatch = 0; break;
      case 5: ondispatch = 0; break;
    }
  }
  aw_destroy(hWin);
  ag_ccanvas(&alertbg);
  on_dialog_window = 0;
  aw_unmuteparent(parent,tmpc);
  return res;
}
예제 #11
0
파일: sd_file.c 프로젝트: Jiangyi/12055
static STATUS _file_scan(char *path, int path_len)
{
    return_val_if_fail(path != NULL, RET_FAIL);
    return_val_if_fail(strlen(path) <= path_len, RET_INVALID_ARG);
    DIR* d = NULL;
    struct dirent* de = NULL;
    int i = 0;
    int result = 0;
    d = opendir(path);
    return_val_if_fail(d != NULL, RET_FAIL);

    int d_size = 0;
    int d_alloc = 10;
    char** dirs = (char **)malloc(d_alloc * sizeof(char*));
    char** dirs_desc = (char **)malloc(d_alloc * sizeof(char*));
    return_val_if_fail(dirs != NULL, RET_FAIL);
    return_val_if_fail(dirs_desc != NULL, RET_FAIL);
    int z_size = 0;
    int z_alloc = 10;
    char** zips = (char **)malloc(z_alloc * sizeof(char*));
    char** zips_desc=(char **)malloc(z_alloc * sizeof(char*));
    return_val_if_fail(zips != NULL, RET_FAIL);
    return_val_if_fail(zips_desc != NULL, RET_FAIL);
//    zips[0] = strdup("../");
//    zips_desc[0]=strdup("../");

    while ((de = readdir(d)) != NULL) {
        int name_len = strlen(de->d_name);
        if (name_len <= 0) continue;
        char de_path[PATH_MAX];
        snprintf(de_path, PATH_MAX, "%s/%s", path, de->d_name);
        struct stat st ;
        assert_if_fail(stat(de_path, &st) == 0);
        if (de->d_type == DT_DIR) {
            //skip "." and ".." entries
            if (name_len == 1 && de->d_name[0] == '.') continue;
            if (name_len == 2 && de->d_name[0] == '.' && 
                    de->d_name[1] == '.') continue;
            if (d_size >= d_alloc) {
                d_alloc *= 2;
                dirs = (char **)realloc(dirs, d_alloc * sizeof(char*));
                assert_if_fail(dirs != NULL);
                dirs_desc = (char **)realloc(dirs_desc, d_alloc * sizeof(char*));
                assert_if_fail(dirs_desc != NULL);
            }
            dirs[d_size] = (char *)malloc(name_len + 2);
            assert_if_fail(dirs[d_size] != NULL);
            dirs_desc[d_size] = (char *)malloc(64);
            assert_if_fail(dirs_desc[d_size] != NULL);
            strncpy(dirs[d_size], de->d_name, name_len);
            dirs[d_size][name_len] = '/';
            dirs[d_size][name_len + 1] = '\0';
            snprintf(dirs_desc[d_size], 63, "%s" ,ctime(&st.st_mtime));
            dirs_desc[d_size][63] = '\0';
            ++d_size;
        } else if (de->d_type == DT_REG) {
            if (g_file_filter_fun == NULL || g_file_filter_fun(de->d_name, name_len) == 0)
            {
                if (z_size >= z_alloc) {
                    z_alloc *= 2;
                    zips = (char **) realloc(zips, z_alloc * sizeof(char*));
                    assert_if_fail(zips != NULL);
                    zips_desc = (char **) realloc(zips_desc, z_alloc * sizeof(char*));
                    assert_if_fail(zips_desc != NULL);
                }
                zips[z_size] = strdup(de->d_name);
                assert_if_fail(zips[z_size] != NULL);
                zips_desc[z_size] = (char*)malloc(64);
                assert_if_fail(zips_desc[z_size] != NULL);
                snprintf(zips_desc[z_size], 63, "%s   %lldbytes" ,ctime(&st.st_mtime), st.st_size);
                zips_desc[z_size][63] = '\0';
                z_size++;
            }
        }
    }
    closedir(d);


    // append dirs to the zips list
    if (d_size + z_size + 1 > z_alloc) {
        z_alloc = d_size + z_size + 1;
        zips = (char **)realloc(zips, z_alloc * sizeof(char*));
        assert_if_fail(zips != NULL);
        zips_desc = (char **)realloc(zips_desc, z_alloc * sizeof(char*));
        assert_if_fail(zips_desc != NULL);
    }
    for (i = 0; i < d_size; i++)
    {
        zips[z_size + i] = dirs[i];
        zips_desc[z_size + i] = dirs_desc[i];
    }
    free(dirs);
    z_size += d_size;
    zips[z_size] = NULL;
    zips_desc[z_size] = NULL;

	int chosen_item = 0;
	do {
      
		if (NULL == g_title_name) 
		{
			oppo_error("g_title_name is NULL \n");
			result = -1;
			goto finish_done;
		}
#if DEBUG
		sd_file_dump_array(zips, zips_desc, z_size);
#endif
		chosen_item = oppo_sdmenu(g_title_name, zips, zips_desc, z_size);

/* OPPO 2013-02-18 jizhengkang azx Add begin for reason */
		selectedItem[selectedCount] = chosen_item;

/* OPPO 2013-02-23 jizhengkang azx Modify begin for reason */
#if 0
		if (chosen_item == -1) {//huanggd for exit explorer when select "return" option
			result = 1;
			if (result_inter_sd || result_external_sd) {
				selectedCount = 1;
				memset(selectedItem + 2, 0, 1022);
			} else {
				selectedCount = 2;
				memset(selectedItem + 3, 0, 1021);
			}
			break;
		}
#endif
/* OPPO 2013-02-23 jizhengkang azx Modify end */

		if (chosen_item == -1) {
			result = -1;
			memset(selectedItem + selectedCount, 0, 1024 - selectedCount - 1);
			selectedCount--;
			break;
		}
		
		return_val_if_fail(chosen_item >= 0, RET_FAIL);
		char * item = zips[chosen_item];
		return_val_if_fail(item != NULL, RET_FAIL);
		int item_len = strlen(item);

//		((chosen_item > 0)&&(item[item_len - 1] == '/'))?selectedCount++:selectedCount--;
//		(chosen_item == 0)?selectedCount--:((item[item_len - 1] == '/')?selectedCount++:NULL);


/* OPPO 2013-02-18 jizhengkang azx Add end */




/* OPPO 2013-02-23 jizhengkang azx Delete begin for reason */
#if 0
		if ( chosen_item == 0) {
           //go up but continue browsing
			result = -1;
			break;
		} else 
#endif
/* OPPO 2013-02-23 jizhengkang azx Delete end */
		if (item[item_len - 1] == '/') {
			selectedCount++;
			char new_path[PATH_MAX];
			strlcpy(new_path, path, PATH_MAX);
			strlcat(new_path, "/", PATH_MAX);
			strlcat(new_path, item, PATH_MAX);
			new_path[strlen(new_path) - 1] = '\0';
			result = _file_scan(new_path, PATH_MAX);
			if (result > 0) break;
		} else {
           // select a zipfile
           // the status to the caller
			char new_path[PATH_MAX];
			strlcpy(new_path, path, PATH_MAX);
			strlcat(new_path, "/", PATH_MAX);
			strlcat(new_path, item, PATH_MAX);
			int wipe_cache = 0;
			//if third parameter is 1, echo sucess dialog
			if (NULL == g_fun) 
			{
				oppo_error("g_fun is NULL in fun\n");
				result = -1;
				goto finish_done;
			}

			if (oppo_get_battery_capacity() < 15) {
				if (!oppo_is_ac_usb_online()) {
					oppo_notice(3, "<~sd.install.notice>", "<~sd.install.caplow.desc>", "@sd");
					continue;			
				}
	    	}

		    if (canvas_sdfile_inited == 0) {
				canvas_sdfile_inited = 1;
				ag_canvas(&canvas_sdfile,agw(),agh());	
		    }
		    ag_draw(&canvas_sdfile,agc(),0,0);  

		    int ret = g_fun(new_path, PATH_MAX, (void *)g_data);
			if (0 == ret)//execute callback fun success
			{
				//back to up layer
				//result = -1;//huanggd for exit explorer when install successfully
				selectedCount = 1;
				memset(selectedItem + 2, 0, 1022);
				result = 1;
				feed_back("2");
			}
			else if(1 == ret){
				continue;//cacel install
			} else {
				oppo_error("g_fun execute fail\n");
				result = 0;
				feed_back("3");

				ag_draw(NULL,&canvas_sdfile,0,0);
				oppo_notice(3, "<~sd.install.failed.name>", "<~sd.install.failed.desc>", "@sd");
				continue;   
			}
			break;
		}
	} while(1);

finish_done:

	for (i = 0; i < z_size; ++i)
	{
		free(zips[i]);
		free(zips_desc[i]);
	}
	free(zips);
	return result;
}
ACONTROLP imgbtn_reinit(
  AWINDOWP win,
  ACONTROLP ctl,
  int x,
  int y,
  int w,
  int h,
  PNGCANVAS * img,
  char * text,
  byte isflat,
  byte touchmsg
) {
  if ((ctl != NULL) && (x == 0) && (y == 0) && (h == 0) && (w == 0)) {
    x = ctl->x;
    y = ctl->y;
    w = ctl->w;
    h = ctl->h;
  }
  
  int txtw = 0;
  int txth = 0;
  int txtx = 0;
  int txty = 0;
  
  if (w < agdp() * 20) {
    w = agdp() * 20;
  }
  
  if (h < agdp() * 20) {
    h = agdp() * 20;
  }
  
  if (text != NULL) {
    //-- Initializing Text Metrics
    if ((isflat == 3) || (isflat == 4)) {
      txtw = ag_txtwidth(text, 0);
      txth = ag_fontheight(0);
      
      if (w < ((agdp() * 22) + txtw)) {
        w = ((agdp() * 22) + txtw);
      }
      
      txtx = round(w / 2) - round(((agdp() * 20) + txtw) / 2);
      txty = round(h / 2) - round(txth / 2);
    }
    else {
      txtw = ag_txtwidth(text, 0);
      txth = ag_fontheight(0);
      
      if (h < ((agdp() * 20) + txth)) {
        h = ((agdp() * 20) + txth);
      }
      
      txtx = round(w / 2) - round(txtw / 2);
      txty = (agdp() * 16);
    }
  }
  
  int imgS = agdp() * 16;
  int imgX = round(w / 2) - round(imgS / 2);
  int imgY = 0; // agdp()*2;
  int contentH = (agdp() * 16) +  txth;
  int contentY = (h / 2) - (contentH / 2);
  
  if ((isflat == 3) || (isflat == 4)) {
    imgY = round(h / 2) - round(imgS / 2);
    imgX = txtx + (agdp() * 2);
    txtx += agdp() * 20;
  }
  else {
    imgY += contentY;
    txty += contentY;
  }
  
  if (isflat == 3) {
    isflat = 0;
  }
  
  //-- Initializing Button Data
  IMGBTNDP d = NULL;
  
  if (ctl != NULL) {
    d = ctl->d;
    win = ctl->win;
  }
  else {
    d = (IMGBTNDP) malloc(sizeof(IMGBTND));
    memset(d, 0, sizeof(IMGBTND));
    //-- Save Touch Message & Set Stats
    d->focused   = 0;
    d->pushed    = 0;
    //-- Initializing Canvas
    ag_canvas(&d->control, w, h);
    ag_canvas(&d->control_pushed, w, h);
    ag_canvas(&d->control_focused, w, h);
  }
  
  d->touchmsg  = touchmsg;
  //-- Draw Rest Control
  dword hl1 = ag_calchighlight(acfg()->controlbg, acfg()->controlbg_g);
  ag_draw_ex(&d->control, win->bg, 0, 0, x, y, w, h);
  
  if (!isflat) {
    if (!atheme_draw("img.button", &d->control, 0, 0, w, h)) {
      ag_roundgrad(&d->control, 0, 0, w, h, acfg()->border, acfg()->border_g, (agdp()*acfg()->btnroundsz));
      ag_roundgrad(&d->control, 1, 1, w - 2, h - 2,
                   ag_calculatealpha(acfg()->controlbg, acfg()->winbg, 180),
                   ag_calculatealpha(acfg()->controlbg_g, acfg()->winbg, 160),
                   (agdp()*acfg()->btnroundsz) - 1
                  );
      ag_roundgrad(&d->control, 2, 2, w - 4, h - 4, acfg()->controlbg, acfg()->controlbg_g, (agdp()*acfg()->btnroundsz) - 2);
      ag_roundgrad_ex(&d->control, 2, 2, w - 4, (h - 4) / 2, LOWORD(hl1), HIWORD(hl1), (agdp()*acfg()->btnroundsz) - 2, 1, 1, 0, 0);
    }
  }
  
  ag_textf(&d->control, txtw, txtx + 1, txty + 1, text, acfg()->controlbg, 0);
  ag_text(&d->control, txtw, txtx, txty, text, acfg()->controlfg, 0);
  color pshad = ag_calpushad(acfg()->selectbg_g);
  ag_draw_ex(&d->control_pushed, win->bg, 0, 0, x, y, w, h);
  int wadd = (isflat == 2) ? 2 : 0;
  int wdel = wadd * 2;
  
  //-- Draw Pushed Control
  if (!isflat) {
    hl1 = ag_calcpushlight(acfg()->selectbg, pshad);
    
    if (!atheme_draw("img.button.push", &d->control_pushed, 0, 0, w, h)) {
      ag_roundgrad(&d->control_pushed, 0, 0, w, h, acfg()->border, acfg()->border_g, (agdp()*acfg()->btnroundsz));
      //ag_roundgrad(&d->control_pushed,1,1,w-2,h-2,acfg()->controlbg,acfg()->controlbg_g,(agdp()*acfg()->btnroundsz)-1);
      ag_roundgrad(&d->control_pushed, 1, 1, w - 2, h - 2, acfg()->selectbg, pshad, (agdp()*acfg()->btnroundsz) - 1);
      ag_roundgrad_ex(&d->control_pushed, 1, 1, w - 2, (h - 2) / 2, LOWORD(hl1), HIWORD(hl1), (agdp()*acfg()->btnroundsz) - 1, 1, 1, 0, 0);
    }
    
    ag_textf(&d->control_pushed, txtw, txtx + 1, txty + 1, text, acfg()->selectbg_g, 0);
    ag_text(&d->control_pushed, txtw, txtx, txty, text, acfg()->selectfg, 0);
  }
  else {
    hl1 = ag_calchighlight(acfg()->controlbg, acfg()->controlbg_g);
    
    if (!atheme_draw("img.button", &d->control_pushed, 0, 0, w, h)) {
      ag_roundgrad(&d->control_pushed, wadd, wadd, w - wdel, h - wdel, acfg()->border, acfg()->border_g, (agdp()*acfg()->btnroundsz));
      /*ag_roundgrad(&d->control_pushed,wadd+1,wadd+1,w-(2+wdel),h-(2+wdel),
        ag_calculatealpha(acfg()->controlbg,acfg()->winbg,180),
        ag_calculatealpha(acfg()->controlbg_g,acfg()->winbg,160),
        (agdp()*acfg()->btnroundsz)-1
      );*/
      ag_roundgrad(&d->control_pushed, wadd + 1, wadd + 1, w - (2 + wdel), h - (2 + wdel), acfg()->controlbg, acfg()->controlbg_g, (agdp()*acfg()->btnroundsz) - 1);
      ag_roundgrad_ex(&d->control_pushed, wadd + 1, wadd + 1, w - (2 + wdel), (h - (1 + wdel)) / 2, LOWORD(hl1), HIWORD(hl1), (agdp()*acfg()->btnroundsz) - 1, 1, 1, 0, 0);
    }
    
    ag_textf(&d->control_pushed, txtw, txtx + 1, txty + 1, text, acfg()->controlbg, 0);
    ag_text(&d->control_pushed, txtw, txtx, txty, text, acfg()->controlfg, 0);
  }
  
  //-- Draw Focused Control
  hl1 = ag_calchighlight(acfg()->selectbg, acfg()->selectbg_g);
  ag_draw_ex(&d->control_focused, win->bg, 0, 0, x, y, w, h);
  
  if (!atheme_draw("img.button.focus", &d->control_focused, 0, 0, w, h)) {
    ag_roundgrad(&d->control_focused, wadd, wadd, w - wdel, h - wdel, acfg()->border, acfg()->border_g, (agdp()*acfg()->btnroundsz));
    //ag_roundgrad(&d->control_focused,wadd+1,wadd+1,w-(wdel+2),h-(wdel+2),acfg()->controlbg,acfg()->controlbg_g,(agdp()*acfg()->btnroundsz)-1);
    ag_roundgrad(&d->control_focused, wadd + 1, wadd + 1, w - (wdel + 2), h - (wdel + 2), acfg()->selectbg, acfg()->selectbg_g, (agdp()*acfg()->btnroundsz) - 1);
    ag_roundgrad_ex(&d->control_focused, wadd + 1, wadd + 1, w - (wdel + 2), (h - (wdel + 2)) / 2, LOWORD(hl1), HIWORD(hl1), (agdp()*acfg()->btnroundsz) - 1, 1, 1, 0, 0);
  }
  
  ag_textf(&d->control_focused, txtw, txtx + 1, txty + 1, text, acfg()->selectbg_g, 0);
  ag_text(&d->control_focused, txtw, txtx, txty, text, acfg()->selectfg, 0);
  
  if (img != NULL) {
    apng_stretch(&d->control, img, imgX, imgY, imgS, imgS, 0, 0, img->w, img->h);
    apng_stretch(&d->control_pushed, img, imgX, imgY, imgS, imgS, 0, 0, img->w, img->h);
    apng_stretch(&d->control_focused, img, imgX, imgY, imgS, imgS, 0, 0, img->w, img->h);
  }
  
  //-- Initializing Control
  if (ctl == NULL) {
    ctl  = malloc(sizeof(ACONTROL));
    ctl->ondestroy = &imgbtn_ondestroy;
    ctl->oninput  = &imgbtn_oninput;
    ctl->ondraw   = &imgbtn_ondraw;
    ctl->onblur   = &imgbtn_onblur;
    ctl->onfocus  = &imgbtn_onfocus;
    ctl->win      = win;
    ctl->forceNS  = 0;
    ctl->d        = (void *) d;
    ctl->x        = x;
    ctl->y        = y;
    ctl->w        = w;
    ctl->h        = h;
    aw_add(win, ctl);
  }
  else {
    ctl->x        = x;
    ctl->y        = y;
    ctl->w        = w;
    ctl->h        = h;
    imgbtn_ondraw(ctl);
  }
  
  return ctl;
}
예제 #13
0
void aw_textdialog(AWINDOWP parent,char * titlev,char * text,char * ok_text){
  
  // actext(hWin,txtX,txtY,txtW,txtH,text,0);
  CANVAS * tmpc = aw_muteparent(parent);
  //-- Set Mask
  on_dialog_window = 1;
  ag_rectopa(agc(),0,0,agw(),agh(),0x0000,180);
  ag_sync();
  
  char title[64];
  snprintf(title,64,"%s",titlev);
  
  int pad   = agdp()*4;
  int winW  = agw()-(pad*2);
  int txtW  = winW-(pad*2);
  int txtX  = pad*2;
  int btnH  = agdp()*20;
  int titW  = ag_txtwidth(title,1);
  int titH  = ag_fontheight(1) + (pad*2);
  
  PNGCANVASP winp = atheme("img.dialog");
  PNGCANVASP titp = atheme("img.dialog.titlebar");
  APNG9      winv;
  APNG9      titv;
  int vtitY = -1;
  int vpadB = pad;
  int vimgX = pad*2;
  if (titp!=NULL){
    if (apng9_calc(titp,&titv,1)){
      int tmptitH = titH - (pad*2);
      titH        = tmptitH + (titv.t+titv.b);
      vtitY       = titv.t;
    }
  }
  if (winp!=NULL){
    if (apng9_calc(winp,&winv,1)){
      txtW = winW - (winv.l+winv.r);
      txtX = pad  + (winv.l);
      vimgX= pad  + (winv.l);
      vpadB= winv.b;
    }
  }
  
  byte imgE = 0; int imgW = 0; int imgH = 0;
  int txtH    = agh()/2;
  int infH    = txtH;
  
  //-- Calculate Window Size & Position
  int winH    = titH + infH + btnH + (pad*2) + vpadB;
  
  int winX    = pad;
  int winY    = (agh()/2) - (winH/2);
  
  //-- Calculate Title Size & Position
  int titX    = (agw()/2) - (titW/2);
  int titY    = winY + pad;
  if (vtitY!=-1) titY = winY+vtitY;
  
  //-- Calculate Text Size & Position
  int infY    = winY + titH + pad;
  int txtY    = infY;
  
  //-- Calculate Button Size & Position
  int btnW    = winW / 2;
  int btnY    = infY+infH+pad;
  int btnX    = (agw()/2) - (btnW/2);
  
  //-- Initializing Canvas
  CANVAS alertbg;
  ag_canvas(&alertbg,agw(),agh());
  ag_draw(&alertbg,agc(),0,0);
  
  //-- Draw Window
  if (!atheme_draw("img.dialog", &alertbg, winX,winY,winW,winH)){
    ag_roundgrad(&alertbg,winX-1,winY-1,winW+2,winH+2,acfg_var.border,acfg_var.border_g,(acfg_var.roundsz*agdp())+1);
    ag_roundgrad(&alertbg,winX,winY,winW,winH,acfg_var.dialogbg,acfg_var.dialogbg_g,acfg_var.roundsz*agdp());
  }
  
  //-- Draw Title
  if (!atheme_draw("img.dialog.titlebar", &alertbg, winX,winY,winW,titH)){
    ag_roundgrad_ex(&alertbg,winX,winY,winW,titH,acfg_var.dlgtitlebg,acfg_var.dlgtitlebg_g,acfg_var.roundsz*agdp(),1,1,0,0);
  }
  
  ag_textf(&alertbg,titW,titX+1,titY+1,title,acfg_var.dlgtitlebg_g,1);
  ag_text(&alertbg,titW,titX,titY,title,acfg_var.dlgtitlefg,1);
  
  AWINDOWP hWin   = aw(&alertbg);
  actext(hWin,txtX,txtY,txtW,txtH,text,0);
  ACONTROLP okbtn=acbutton(hWin,btnX,btnY,btnW,btnH,(ok_text==NULL?acfg_var.text_ok:ok_text),0,5);
    
  aw_show(hWin);
  aw_setfocus(hWin,okbtn);
  byte ondispatch = 1;
  while(ondispatch){
    dword msg=aw_dispatch(hWin);
    switch (aw_gm(msg)){
      case 5: ondispatch = 0; break;
    }
  }
  aw_destroy(hWin);
  ag_ccanvas(&alertbg);
  on_dialog_window = 0;
  aw_unmuteparent(parent,tmpc);
}
예제 #14
0
ACONTROLP actext(
  AWINDOWP win,
  int x,
  int y,
  int w,
  int h,
  char * text,
  byte isbig
){
  //-- Validate Minimum Size
  if (h<agdp()*16) h=agdp()*16;
  if (w<agdp()*16) w=agdp()*16;
    
  //-- Initializing Client Area
  int minpadding = max(acfg()->roundsz,4);
  int cw            = w-(agdp()*(minpadding*2));
  int ch            = 0;
  if (text!=NULL)
    ch = ag_txtheight(cw,text,isbig)+(agdp()*(minpadding*2));
  else
    ch = h-(agdp()*2);
  
  //-- Initializing Text Data
  ACTEXTDP d        = (ACTEXTDP) malloc(sizeof(ACTEXTD));
  memset(d,0,sizeof(ACTEXTD));
  
  //-- Initializing Canvas
  ag_canvas(&d->control,w,h);
  ag_canvas(&d->control_focused,w,h);
  ag_canvas(&d->client,cw,ch);
  
  //-- Draw Control
  ag_draw_ex(&d->control,&win->c,0,0,x,y,w,h);
  ag_roundgrad(&d->control,0,0,w,h,acfg()->border,acfg()->border_g,(agdp()*acfg()->roundsz));
  ag_roundgrad(&d->control,1,1,w-2,h-2,acfg()->textbg,acfg()->textbg,(agdp()*acfg()->roundsz)-1);
  
  //-- Draw Focused Control
  ag_draw_ex(&d->control_focused,&win->c,0,0,x,y,w,h);
  ag_roundgrad(&d->control_focused,0,0,w,h,acfg()->selectbg,acfg()->selectbg_g,(agdp()*acfg()->roundsz));
  ag_roundgrad(&d->control_focused,agdp(),agdp(),w-(agdp()*2),h-(agdp()*2),acfg()->textbg,acfg()->textbg,(agdp()*(acfg()->roundsz-1)));
  
  
  //-- Draw Client
  ag_rect(&d->client,0,0,cw,ch,acfg()->textbg);
  if (text!=NULL)
    ag_text(&d->client,cw,0,agdp()*minpadding,text,acfg()->textfg,isbig);
  
  d->isbigtxt    = isbig;
  d->targetY     = 0;
  d->focused     = 0;
  d->scrollY     = 0;
  d->appendPos   = agdp()*minpadding;
  d->forceGlowTop= 0;
  d->isFixedText = 0;
  if (text!=NULL)
    d->maxScrollY  = ch-(h-(agdp()*minpadding));
  else{
    d->maxScrollY  = 0;
    d->isFixedText = 1;
  }
  if (d->maxScrollY<0) d->maxScrollY=0;
  
  ACONTROLP ctl  = malloc(sizeof(ACONTROL));
  ctl->ondestroy= &actext_ondestroy;
  ctl->oninput  = &actext_oninput;
  ctl->ondraw   = &actext_ondraw;
  ctl->onblur   = actext_onblur;
  ctl->onfocus  = actext_onfocus;
  ctl->win      = win;
  ctl->x        = x;
  ctl->y        = y;
  ctl->w        = w;
  ctl->h        = h;
  ctl->forceNS  = 0;
  ctl->d        = (void *) d;
  aw_add(win,ctl);
  return ctl;
}
ACONTROLP acprog(
  AWINDOWP win,
  int x,
  int y,
  int w,
  int h,
  float value
){
  //-- Validate Minimum Size
  if (h<agdp()*5)  h=agdp()*5;
  if (w<agdp()*10) w=agdp()*10;
  
  //-- Initializing Button Data
  APROGDP d = (APROGDP) malloc(sizeof(APROGD));
  memset(d,0,sizeof(APROGD));
  
  //-- Save Touch Message & Set Stats
  d->value        = value;
  d->drawed       = 0;
  d->width_current= ceil(value * w);
  d->hidden       = 0;
  d->onwait       = 0;
  d->waitpos      = 0.0;
  d->wait_thread  = 0;
  
  //-- Initializing Canvas
  ag_canvas(&d->control,w,h);
  ag_canvas(&d->bg,w,h);
  
  //-- Draw Background
  CANVAS * c = &d->bg;
  int hp2 = floor(h/2.0);
  ag_draw_ex(c,win->bg,0,0,x,y,w,h);
  if (!atheme_draw("img.progress",c,0,0,w,h)){
    dword hl1 = ag_calchighlight(acfg()->controlbg,acfg()->controlbg_g);
    ag_roundgrad(c,0,0,w,h,acfg()->border,acfg()->border_g,hp2);
    ag_roundgrad(c,1,1,w-2,h-2,
      ag_calculatealpha(acfg()->controlbg,  0xffff,180),
      ag_calculatealpha(acfg()->controlbg_g,0xffff,160),
      hp2-1);
    ag_roundgrad(c,2,2,w-4,h-4,acfg()->controlbg,acfg()->controlbg_g,hp2-2);
    ag_roundgrad_ex(c,2,2,w-4,ceil((h-4)/2.0),LOWORD(hl1),HIWORD(hl1),hp2-2,2,2,0,0);
  }
  
  //-- Initializing Control
  ACONTROLP ctl  = malloc(sizeof(ACONTROL));
  ctl->ondestroy= &acprog_ondestroy;
  ctl->oninput  = &acprog_oninput;
  ctl->ondraw   = &acprog_ondraw;
  ctl->onblur   = &acprog_onblur;
  ctl->onfocus  = NULL;
  ctl->win      = win;
  ctl->x        = x;
  ctl->y        = y;
  ctl->w        = w;
  ctl->h        = h;
  ctl->forceNS  = 0;
  ctl->d        = (void *) d;
  aw_add(win,ctl);
  return ctl;
}
예제 #16
0
byte aw_confirm(AWINDOWP parent, char * titlev,char * textv,char * img,char * yes_text,char * no_text){
  CANVAS * tmpc = aw_muteparent(parent);
  //-- Set Mask
  on_dialog_window = 1;
  ag_rectopa(agc(),0,0,agw(),agh(),0x0000,180);
  ag_sync();
  
  char title[32];
  char text[513];
  snprintf(title,31,"%s",titlev);
  snprintf(text,512,"%s",textv);
  
  int pad   = agdp()*4;
  int winW  = agw()-(pad*2);
  int txtW  = winW-(pad*2);
  int txtX  = pad*2;
  int btnH  = agdp()*20;
  int titW  = ag_txtwidth(title,1);
  int titH  = ag_fontheight(1) + (pad*2);
  
  //-- Load Icon
  PNGCANVAS ap;
  byte imgE = 0; int imgW = 0; int imgH = 0;
  if (apng_load(&ap,img)){
    imgE      = 1;
    imgW      = min(ap.w,agdp()*30);
    imgH      = min(ap.h,agdp()*30);
    int imgA  = pad + imgW;
    txtX     += imgA;
    txtW     -= imgA;
  }
  
  int txtH    = ag_txtheight(txtW,text,0);
  int infH    = ((imgE)&&(txtH<imgH))?imgH:txtH;
    
  //-- Calculate Window Size & Position
  int winH    = titH + infH + btnH + (pad*3);
  int winX    = pad;
  int winY    = (agh()/2) - (winH/2);
  
  //-- Calculate Title Size & Position
  int titX    = (agw()/2) - (titW/2);
  int titY    = winY + pad;
  
  //-- Calculate Text Size & Position
  int infY    = winY + titH + pad;
  int txtY    = infY + ((infH - txtH) / 2);
  int imgY    = infY;
  
  //-- Calculate Button Size & Position
  int btnW    = (txtW / 2) - (pad/2);
  int btnY    = infY+infH+pad;
  int btnX    = txtX;
  int btnX2   = txtX+(txtW/2)+(pad/2);
  
  //-- Initializing Canvas
  CANVAS alertbg;
  ag_canvas(&alertbg,agw(),agh());
  ag_draw(&alertbg,agc(),0,0);
  
  //-- Draw Window
  ag_roundgrad(&alertbg,winX-1,winY-1,winW+2,winH+2,acfg_var.border,acfg_var.border_g,(acfg_var.roundsz*agdp())+1);
  ag_roundgrad(&alertbg,winX,winY,winW,winH,acfg_var.winbg,acfg_var.winbg_g,acfg_var.roundsz*agdp());
  
  //-- Draw Title
  ag_roundgrad_ex(&alertbg,winX,winY,winW,titH,acfg_var.titlebg,acfg_var.titlebg_g,acfg_var.roundsz*agdp(),1,1,0,0);
  ag_textf(&alertbg,titW,titX+1,titY+1,title,acfg_var.titlebg_g,1);
  ag_text(&alertbg,titW,titX,titY,title,acfg_var.titlefg,1);
  
  //-- Draw Image
  if (imgE){
    apng_draw_ex(&alertbg,&ap,pad*2,imgY,0,0,imgW,imgH);
    apng_close(&ap);
  }
  
  //-- Draw Text
  ag_textf(&alertbg,txtW,txtX+1,txtY+1,text,acfg_var.textbg,0);
  ag_text(&alertbg,txtW,txtX,txtY,text,acfg_var.textfg,0);
  
  AWINDOWP hWin   = aw(&alertbg);
  
  acbutton(hWin,btnX,btnY,btnW,btnH,(yes_text==NULL?"Yes":yes_text),0,6);
  acbutton(hWin,btnX2,btnY,btnW,btnH,(no_text==NULL?"No":no_text),0,5);
      
  aw_show(hWin);
  byte ondispatch = 1;
  byte res = 0;
  while(ondispatch){
    dword msg=aw_dispatch(hWin);
    switch (aw_gm(msg)){
      case 6: res=1; ondispatch = 0; break;
      case 5: ondispatch = 0; break;
    }
  }
  aw_destroy(hWin);
  ag_ccanvas(&alertbg);
  on_dialog_window = 0;
  aw_unmuteparent(parent,tmpc);
  return res;
}
예제 #17
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();
  }
}
예제 #18
0
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();
  }
}
예제 #19
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;
}
ACONTROLP acime2(
  AWINDOWP win,
  int x, int y, int w, int h,
  byte inputMsg
) {
  //-- Initializing Button Data
  ACIMEDP d = (ACIMEDP) malloc(sizeof(ACIMED));
  memset(d, 0, sizeof(ACIMED));
  //-- Set Data
  d->inputMsg = inputMsg;
  d->onShift = 0;
  d->on123   = 0;
  d->onCTRL  = 0;
  d->pushedId = 255;
  //-- Init Canvas
  ag_canvas(&d->control, w, h);
  ag_canvas(&d->control_push, w, h);
  ag_canvas(&d->control_rest, w, h);
  //-- Drawings
  ag_roundgrad(&d->control_rest, 0, 0, w, h, acfg()->navbg, acfg()->navbg_g, 0);
  ag_rect(&d->control_rest, 0, 0, w, 1, acfg()->navbg);
  ag_draw(&d->control_push, &d->control_rest, 0, 0);
  //-- Calculate Size
  int btnW = floor(w / 10);
  d->btnH = floor(h / 5);
  //-- Draw Buttons
  int i     = 0;
  int bY    = 0;
  int w1p2  = (btnW / 2);
  int w3p2  = ((btnW * 3) / 2);
  
  for (i = 0; i < 10; i++) {
    acime2_drawbutton(d, i * btnW, bY, btnW, d->btnH, i);
  }
  
  bY += d->btnH;
  
  for (i = 0; i < 9; i++) {
    acime2_drawbutton(d, w1p2 + (i * btnW), bY, btnW, d->btnH, i + 10);
  }
  
  bY += d->btnH;
  acime2_drawbutton(d, 0, bY, w3p2, d->btnH, 19);            //-- SHIFT
  
  for (i = 0; i < 7; i++) {
    acime2_drawbutton(d, w3p2 + (i * btnW), bY, btnW, d->btnH, i + 20);
  }
  
  acime2_drawbutton(d, 8.5 * btnW, bY, w3p2, d->btnH, 27);   //-- BACKSPACE
  bY += d->btnH;
  acime2_drawbutton(d, 0,       bY, w3p2,    d->btnH, 28); //-- CHANGE 123-ABC
  acime2_drawbutton(d, w3p2,    bY, w3p2,    d->btnH, 29); //-- COMMA
  acime2_drawbutton(d, w3p2 * 2,  bY, btnW * 4,  d->btnH, 30); //-- SPACE
  acime2_drawbutton(d, 7 * btnW,  bY, w3p2,    d->btnH, 31); //-- DOT
  acime2_drawbutton(d, 8.5 * btnW, bY, w3p2,    d->btnH, 32); //-- ENTER
  bY += d->btnH;
  acime2_drawbutton(d, 0,         bY, btnW * 2,    d->btnH, 33); //-- TAB
  acime2_drawbutton(d, btnW * 2,      bY, btnW * 2,    d->btnH, 34); //-- CTRL
  acime2_drawbutton(d, 4 * btnW,    bY, w3p2,    d->btnH, 35); //-- LEFT
  acime2_drawbutton(d, 5.5 * btnW,  bY, w3p2,    d->btnH, 36); //-- UP
  acime2_drawbutton(d, 7 * btnW,    bY, w3p2,    d->btnH, 37); //-- DOWN
  acime2_drawbutton(d, 8.5 * btnW,  bY, w3p2,    d->btnH, 38); //-- RIGHT
  ag_draw(&d->control, &d->control_rest, 0, 0);
  //-- Initializing Control
  ACONTROLP ctl  = malloc(sizeof(ACONTROL));
  ctl->ondestroy = &acime2_ondestroy;
  ctl->oninput  = &acime2_oninput;
  ctl->ondraw   = &acime2_ondraw;
  ctl->onblur   = &acime2_onblur;
  ctl->onfocus  = NULL;
  ctl->win      = win;
  ctl->x        = x;
  ctl->y        = y;
  ctl->w        = w;
  ctl->h        = h;
  ctl->forceNS  = 0;
  ctl->d        = (void *) d;
  aw_add(win, ctl);
  return ctl;
}
예제 #21
0
byte aw_calibdraw(CANVAS * c,
  int id,int * xpos,int * ypos,int * xtch,int * ytch){
  ag_draw(agc(),c,0,0);
  
  usleep(500000);
  
  int sz = agdp()*10;
  if (id!=-1){
    int x  = xpos[id];
    int y  = ypos[id];
    int rx = x-(sz/2);
    int ry = y-(sz/2);
    ag_roundgrad(
      agc(),rx,ry,sz,sz,
      0xffff,
      ag_rgb(200,200,200),
      sz/2);
  }

  if (id!=-1){
    char txt[128];
    snprintf(txt,127,"Step %i: Tap The Circle To Calibrate",id+1);
    char * txt2 = "Press Back Key or Other Keys To Cancel";
    int tw = ag_txtwidth(txt,0);
    int tw2 = ag_txtwidth(txt2,0);
    int tx = (agw()/2) - (tw/2);
    int tx2= (agw()/2) - (tw2/2);
    int ty = (agh()/2) + (sz*2);
    int ty2= (ty +ag_fontheight(0)+agdp());
    ag_text(agc(),tw,tx+1,ty+1,txt,0x0000,0);
    ag_text(agc(),tw,tx,ty,txt,0xffff,0);
    ag_text(agc(),tw2,tx2+1,ty2+1,txt2,0x0000,0);
    ag_text(agc(),tw2,tx2,ty2,txt2,0xffff,0);
  }
  else{
    char * txt  = "Tap The Screen to Test Calibrated Data";
    char * txt2 = "Press Back or Other Keys To Continue";
    int tw = ag_txtwidth(txt,0);
    int tw2 = ag_txtwidth(txt2,0);
    int tx = (agw()/2) - (tw/2);
    int tx2= (agw()/2) - (tw2/2);
    int ty = (agh()/2) + (sz*2);
    int ty2= (ty +ag_fontheight(0)+agdp());
    ag_text(agc(),tw,tx+1,ty+1,txt,0x0000,0);
    ag_text(agc(),tw,tx,ty,txt,0xffff,0);
    ag_text(agc(),tw2,tx2+1,ty2+1,txt2,0x0000,0);
    ag_text(agc(),tw2,tx2,ty2,txt2,0xffff,0);
  }
  
  CANVAS bg;
  ag_canvas(&bg,agw(),agh());
  ag_draw(&bg,agc(),0,0);
  ag_sync();
  
  byte res=1;
  byte ond=1;
  byte onp=0;
  ui_clear_key_queue();
  while (ond){
    ATEV atev;
    ui_clear_key_queue();
    int action=atouch_wait_ex(&atev,1);
    switch (action){
      case ATEV_MOUSEDN:{
        onp=1;
        if (id==-1){
          ag_draw(agc(),&bg,0,0);
          int vz = agdp()*40;
          int vx = atev.x-(vz/2);
          int vy = atev.y-(vz/2);
          ag_roundgrad(agc(),vx,vy,vz,vz,0xffff,ag_rgb(180,180,180),(vz/2));
          ag_sync();
        }
      }
      break;
      case ATEV_MOUSEMV:{
        if (onp){
          if (id!=-1){
            xtch[id]=atev.x;
            ytch[id]=atev.y;
          }
          else{
            ag_draw(agc(),&bg,0,0);
            int vz = agdp()*40;
            int vx = atev.x-(vz/2);
            int vy = atev.y-(vz/2);
            ag_roundgrad(agc(),vx,vy,vz,vz,0xffff,ag_rgb(180,180,180),(vz/2));
            ag_sync();
          }
        }
      }
      break;
      case ATEV_MOUSEUP:{
        if (id!=-1){
          if (onp){
            if ((xtch[id]>0)&&(ytch[id]>0)){
              ond=0;
            }
            onp=0;
          }
        }
      }
      break;
      case ATEV_SELECT:
      case ATEV_BACK:
      case ATEV_MENU:{
        if (atev.d==0){
          ond=0;
          res=0;
        }
      }
      break;
    }
  }
  
  ag_ccanvas(&bg);
  return res;
}
예제 #22
0
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;
}
ACONTROLP afbox(
  AWINDOWP win,
  int x,
  int y,
  int w,
  int h,
  byte touchmsg,
  byte holdmsg,
  byte boxtype,
  byte changemsg
){
  //-- Validate Minimum Size
  if (h<agdp()*16) h=agdp()*16;
  if (w<agdp()*20) w=agdp()*20;

  //-- Initializing Text Data
  AFBOXDP d        = (AFBOXDP) malloc(sizeof(AFBOXD));
  memset(d,0,sizeof(AFBOXD));
  
  //-- Set Signature
  d->acheck_signature = 177;
  d->touchmsg         = touchmsg;
  d->holdmsg          = holdmsg;
  d->changemsg        = changemsg;
  d->boxtype          = boxtype;
  d->lasttouch        = 0;
  d->check_n          = 0;
  
  //-- Initializing Canvas
  ag_canvas(&d->control,w,h);
  ag_canvas(&d->control_focused,w,h);
  
  int minpadding = 2;
  
  //-- Initializing Client Size
  d->clientWidth  = w-(agdp()*minpadding);
  d->clientTextW  = d->clientWidth - (agdp()*44);
  d->clientTextX  = (agdp()*26);
  
  d->client.data=NULL;
  
  //-- Draw Control
  ag_draw_ex(&d->control,&win->c,0,0,x,y,w,h);
  ag_roundgrad(&d->control,0,0,w,h,acfg()->textbg,acfg()->textbg,0);
  
  //-- Draw Focused Control
  ag_draw_ex(&d->control_focused,&win->c,0,0,x,y,w,h);
  ag_roundgrad(&d->control_focused,0,0,w,h,acfg()->selectbg,acfg()->selectbg_g,0);
  ag_roundgrad(&d->control_focused,1,1,w-2,h-2,acfg()->textbg,acfg()->textbg,0);
  
  //-- Set Scroll Value
  d->selectedId  = -1;
  d->scrollY     = 0;
  d->maxScrollY  = 0;
  d->prevTouchY  =-50;
  d->invalidDrawItem = -1;
  
  //-- Set Data Values
  d->items       = NULL;
  d->itemn       = 0;
  d->touchedItem = -1;
  d->focusedItem = -1;
  d->nextY       = agdp();
  d->draweditemn = 0;
  
  d->groupCounts = 0;
  d->groupCurrId = -1;
  
  ACONTROLP ctl = malloc(sizeof(ACONTROL));
  ctl->ondestroy= &afbox_ondestroy;
  ctl->oninput  = &afbox_oninput;
  ctl->ondraw   = &afbox_ondraw;
  ctl->onblur   = &afbox_onblur;
  ctl->onfocus  = &afbox_onfocus;
  ctl->win      = win;
  ctl->x        = x;
  ctl->y        = y;
  ctl->w        = w;
  ctl->h        = h;
  ctl->forceNS  = 0;
  ctl->d        = (void *) d;
  aw_add(win,ctl);
  return ctl;
}
예제 #24
0
void actext_rebuild(
  ACONTROLP ctl,
  int x,
  int y,
  int w,
  int h,
  char * text,
  byte isbig,
  byte toBottom
){
  ACTEXTDP  d  = (ACTEXTDP) ctl->d;
  int minpadding = max(acfg()->roundsz,4);
  //-- Cleanup
  ag_ccanvas(&d->control);
  ag_ccanvas(&d->control_focused);
  ag_ccanvas(&d->client);
  memset(d,0,sizeof(ACTEXTD));
  
  //-- Rebuild
  //-- Validate Minimum Size
  if (h<agdp()*16) h=agdp()*16;
  if (w<agdp()*16) w=agdp()*16;
    
  //-- Initializing Client Area
  int cw            = w-(agdp()*(minpadding*2));
  int ch            = 0;
  if (text!=NULL)
    ch = ag_txtheight(cw,text,isbig)+(agdp()*(minpadding*2));
  else
    ch = h-(agdp()*2);

  //-- Initializing Canvas
  ag_canvas(&d->control,w,h);
  ag_canvas(&d->control_focused,w,h);
  ag_canvas(&d->client,cw,ch);
  
  //-- Draw Control
  ag_draw_ex(&d->control,ctl->win->bg,0,0,x,y,w,h);
  ag_roundgrad(&d->control,0,0,w,h,acfg()->border,acfg()->border_g,(agdp()*acfg()->roundsz));
  ag_roundgrad(&d->control,1,1,w-2,h-2,acfg()->textbg,acfg()->textbg,(agdp()*acfg()->roundsz)-1);
  
  //-- Draw Focused Control
  ag_draw_ex(&d->control_focused,ctl->win->bg,0,0,x,y,w,h);
  ag_roundgrad(&d->control_focused,0,0,w,h,acfg()->selectbg,acfg()->selectbg_g,(agdp()*acfg()->roundsz));
  ag_roundgrad(&d->control_focused,agdp(),agdp(),w-(agdp()*2),h-(agdp()*2),acfg()->textbg,acfg()->textbg,(agdp()*(acfg()->roundsz-1)));
  
  //-- Draw Client
  ag_rect(&d->client,0,0,cw,ch,acfg()->textbg);
  if (text!=NULL)
    ag_text(&d->client,cw,0,agdp()*minpadding,text,acfg()->textfg,isbig);
  
  d->isbigtxt    = isbig;
  d->targetY     = 0;
  d->focused     = 0;
  d->scrollY     = 0;
  d->appendPos   = agdp()*minpadding;
  d->forceGlowTop= 0;
  d->isFixedText = 0;
  if (text!=NULL)
    d->maxScrollY  = ch-(h-(agdp()*minpadding));
  else{
    d->maxScrollY  = 0;
    d->isFixedText = 1;
  }
  if (d->maxScrollY<0) d->maxScrollY=0;
  ctl->x        = x;
  ctl->y        = y;
  ctl->w        = w;
  ctl->h        = h;
  ctl->forceNS  = 0;
  
  if (toBottom){
    d->scrollY = d->maxScrollY;
  }
  
  ctl->ondraw(ctl);
  aw_draw(ctl->win);
}
ACONTROLP acopt(
  AWINDOWP win,
  int x,
  int y,
  int w,
  int h
) {
  //-- Validate Minimum Size
  if (h < agdp() * 16) {
    h = agdp() * 16;
  }
  
  if (w < agdp() * 20) {
    w = agdp() * 20;
  }
  
  //-- Initializing Text Data
  ACOPTDP d        = (ACOPTDP) malloc(sizeof(ACOPTD));
  memset(d, 0, sizeof(ACOPTD));
  //-- Set Signature
  d->acheck_signature = 136;
  //-- Initializing Canvas
  ag_canvas(&d->control, w, h);
  int minpadding = 2;
  //-- Initializing Client Size
  d->clientWidth  = w - (agdp() * minpadding);
  d->clientTextW  = d->clientWidth - (agdp() * 18); // d->clientWidth - (agdp()*18) - (agdp()*acfg()->btnroundsz*2);
  d->clientTextX  = (agdp() * 18); // + (agdp()*acfg()->btnroundsz*2);
  d->client.data = NULL;
  //-- Draw Control
  ag_draw_ex(&d->control, &win->c, 0, 0, x, y, w, h);
  ag_rect(&d->control, 0, 0, w, h, acfg()->textbg);
  //-- Set Scroll Value
  d->scrollY     = 0;
  d->maxScrollY  = 0;
  d->prevTouchY  = -50;
  d->invalidDrawItem = -1;
  //-- Set Data Values
  d->items       = NULL;
  d->itemn       = 0;
  d->touchedItem = -1;
  d->focusedItem = -1;
  d->nextY       = agdp() * minpadding;
  d->draweditemn = 0;
  int i;
  
  for (i = 0; i < ACOPT_MAX_GROUP; i++) {
    d->selectedIndexs[i] = -1;
  }
  
  d->groupCounts   = 0;
  d->groupCurrId   = -1;
  ACONTROLP ctl  = malloc(sizeof(ACONTROL));
  ctl->ondestroy = &acopt_ondestroy;
  ctl->oninput  = &acopt_oninput;
  ctl->ondraw   = &acopt_ondraw;
  ctl->onblur   = &acopt_onblur;
  ctl->onfocus  = &acopt_onfocus;
  ctl->win      = win;
  ctl->x        = x;
  ctl->y        = y;
  ctl->w        = w;
  ctl->h        = h;
  ctl->forceNS  = 0;
  ctl->d        = (void *) d;
  aw_add(win, ctl);
  return ctl;
}
예제 #26
0
//*
//* 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);
  }
}
ACONTROLP accheck(
  AWINDOWP win,
  int x,
  int y,
  int w,
  int h
){
  //-- Validate Minimum Size
  if (h<agdp()*16) h=agdp()*16;
  if (w<agdp()*20) w=agdp()*20;

  //-- Initializing Text Data
  ACCHECKDP d        = (ACCHECKDP) malloc(sizeof(ACCHECKD));
  memset(d,0,sizeof(ACCHECKD));
  
  //-- Set Signature
  d->acheck_signature = 133;
  
  //-- Initializing Canvas
  ag_canvas(&d->control,w,h);
  ag_canvas(&d->control_focused,w,h);
  
  int minpadding = max(acfg()->roundsz,4);
  
  //-- Initializing Client Size
  d->clientWidth  = w - (agdp()*minpadding*2);
  d->clientTextW  = d->clientWidth - (agdp()*18) - (agdp()*acfg()->btnroundsz*2);
  d->clientTextX  = (agdp()*18) + (agdp()*acfg()->btnroundsz*2);
  
  d->client.data=NULL;
  
  //-- Draw Control
  ag_draw_ex(&d->control,&win->c,0,0,x,y,w,h);
  ag_roundgrad(&d->control,0,0,w,h,acfg()->border,acfg()->border_g,(agdp()*acfg()->roundsz));
  ag_roundgrad(&d->control,1,1,w-2,h-2,acfg()->textbg,acfg()->textbg,(agdp()*acfg()->roundsz)-1);
  
  //-- Draw Focused Control
  ag_draw_ex(&d->control_focused,&win->c,0,0,x,y,w,h);
  ag_roundgrad(&d->control_focused,0,0,w,h,acfg()->selectbg,acfg()->selectbg_g,(agdp()*acfg()->roundsz));
  ag_roundgrad(&d->control_focused,agdp(),agdp(),w-(agdp()*2),h-(agdp()*2),acfg()->textbg,acfg()->textbg,(agdp()*(acfg()->roundsz-1)));
  
  //-- Set Scroll Value
  d->scrollY     = 0;
  d->maxScrollY  = 0;
  d->prevTouchY  =-50;
  d->invalidDrawItem = -1;
  //-- Set Data Values
  d->items       = NULL;
  d->itemn       = 0;
  d->touchedItem = -1;
  d->focusedItem = -1;
  d->nextY       = agdp()*minpadding;
  d->draweditemn = 0;
  
  d->groupCounts   = 0;
  d->groupCurrId   = -1;
  
  ACONTROLP ctl  = malloc(sizeof(ACONTROL));
  ctl->ondestroy= &accheck_ondestroy;
  ctl->oninput  = &accheck_oninput;
  ctl->ondraw   = &accheck_ondraw;
  ctl->onblur   = &accheck_onblur;
  ctl->onfocus  = &accheck_onfocus;
  ctl->win      = win;
  ctl->x        = x;
  ctl->y        = y;
  ctl->w        = w;
  ctl->h        = h;
  ctl->forceNS  = 0;
  ctl->d        = (void *) d;
  aw_add(win,ctl);
  return ctl;
}
예제 #28
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);
}