예제 #1
0
/* count_disks:
  *  Counts the number of valid drives.
  */
static int count_disks(void)
{
    int c, i;
    
    c = 0;
    
    for(i=0; i<26; i++)
        if(_al_drive_exists(i))
            c++;
            
    return c;
}
예제 #2
0
/* fs_dlist_proc:
  *  Dialog procedure for the file selector disk list.
  */
int fs_dlist_proc(int msg, DIALOG *d, int c)
{
	DIALOG *parent = (DIALOG *)d->dp3;
    char *s = (char *)parent[FS_EDIT].dp;
    int ret, i, temp;
    
    if(msg == MSG_START)
    {
        d->d1 = d->d2 = 0;
        temp = utoupper(ugetc(s));
        
        if(((temp >= 'A') && (temp <= 'Z')) && (ugetat(s, 1) == DEVICE_SEPARATOR))
        {
            temp -= 'A';
            
            for(i=0; i<temp; i++)
                if(_al_drive_exists(i))
                    d->d1++;
        }
    }
    
    ret = jwin_droplist_proc(msg, d, c);
    
    if(ret & D_CLOSE)
    {
        temp = 'A' + get_x_drive(d->d1+1);
        
        if((temp < 'A') || (temp > 'Z'))
            temp = 'C';
            
        s += usetc(s, temp);
        s += usetc(s, DEVICE_SEPARATOR);
        s += usetc(s, OTHER_PATH_SEPARATOR);
        usetc(s, 0);
        
        object_message(parent +FS_FILES, MSG_START, 0);
        object_message(parent +FS_FILES, MSG_DRAW, 0);
        object_message(parent +FS_EDIT, MSG_START, 0);
        object_message(parent +FS_EDIT, MSG_DRAW, 0);
        
        return ret - D_CLOSE + D_O_K;
    }
    
    return ret;
}
예제 #3
0
/* get_x_drive:
  *  Returns the drive letter matching the specified list index.
  */
static int get_x_drive(int index)
{
    int c, i;
    
    c = 0;
    
    for(i=0; i<26; i++)
    {
        if(_al_drive_exists(i))
        {
            c++;
            
            if(c==index)
                return i;
        }
    }
    
    return -1;
}