work on filecenter
This commit is contained in:
parent
69a3fdcdba
commit
94a273038a
@ -20,6 +20,9 @@ struct files {
|
|||||||
struct file_directory **file_directories;
|
struct file_directory **file_directories;
|
||||||
int file_directory_count = 0;
|
int file_directory_count = 0;
|
||||||
CDKSCREEN *cdkscreen = 0;
|
CDKSCREEN *cdkscreen = 0;
|
||||||
|
//CDKMENTRY *desc_entry = 0;
|
||||||
|
WINDOW *desc_win = 0;
|
||||||
|
|
||||||
char *bbspath;
|
char *bbspath;
|
||||||
char *configpath;
|
char *configpath;
|
||||||
|
|
||||||
@ -292,7 +295,7 @@ static int deleteFile(EObjectType cdktype, void *object, void *clientData, chtyp
|
|||||||
setCDKScrollItems(s, filenames, fcount, FALSE);
|
setCDKScrollItems(s, filenames, fcount, FALSE);
|
||||||
eraseCDKScroll(s);
|
eraseCDKScroll(s);
|
||||||
drawCDKScroll(s, TRUE);
|
drawCDKScroll(s, TRUE);
|
||||||
refreshCDKScreen(cdkscreen);
|
// refreshCDKScreen(cdkscreen);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -303,7 +306,7 @@ static int deleteFile(EObjectType cdktype, void *object, void *clientData, chtyp
|
|||||||
setCDKScrollItems(s, filenames, fcount, FALSE);
|
setCDKScrollItems(s, filenames, fcount, FALSE);
|
||||||
eraseCDKScroll(s);
|
eraseCDKScroll(s);
|
||||||
drawCDKScroll(s, TRUE);
|
drawCDKScroll(s, TRUE);
|
||||||
refreshCDKScreen(cdkscreen);
|
// refreshCDKScreen(cdkscreen);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -321,7 +324,7 @@ static int approveFile(EObjectType cdktype, void *object, void *clientData, chty
|
|||||||
doApprove(index);
|
doApprove(index);
|
||||||
}
|
}
|
||||||
setCDKScrollItems(s, filenames, fcount, FALSE);
|
setCDKScrollItems(s, filenames, fcount, FALSE);
|
||||||
refreshCDKScreen(cdkscreen);
|
// refreshCDKScreen(cdkscreen);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -335,7 +338,7 @@ static int approveAll(EObjectType cdktype, void *object, void *clientData, chtyp
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
setCDKScrollItems(s, filenames, fcount, FALSE);
|
setCDKScrollItems(s, filenames, fcount, FALSE);
|
||||||
refreshCDKScreen(cdkscreen);
|
// refreshCDKScreen(cdkscreen);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -350,7 +353,7 @@ static int disapproveAll(EObjectType cdktype, void *object, void *clientData, ch
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
setCDKScrollItems(s, filenames, fcount, FALSE);
|
setCDKScrollItems(s, filenames, fcount, FALSE);
|
||||||
refreshCDKScreen(cdkscreen);
|
// refreshCDKScreen(cdkscreen);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -473,7 +476,7 @@ static int moveFile(EObjectType cdktype, void *object, void *clientData, chtype
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
dirScrollList = newCDKScroll(cdkscreen, 9, 6, 1, 36, 36, "</48>File Directories<!48>", NULL, 0, FALSE, A_REVERSE, TRUE, TRUE);
|
dirScrollList = newCDKScroll(cdkscreen, 9, 1, 1, 12, 36, "</48>File Directories<!48>", NULL, 0, FALSE, A_REVERSE, TRUE, TRUE);
|
||||||
|
|
||||||
filedirs = (char **)malloc(sizeof(char *) * file_directory_count);
|
filedirs = (char **)malloc(sizeof(char *) * file_directory_count);
|
||||||
|
|
||||||
@ -490,7 +493,7 @@ static int moveFile(EObjectType cdktype, void *object, void *clientData, chtype
|
|||||||
} else if (dirScrollList->exitType == vNORMAL) {
|
} else if (dirScrollList->exitType == vNORMAL) {
|
||||||
snprintf(title, 42, "</48>%s<!48>", file_directories[dir_sel]->name);
|
snprintf(title, 42, "</48>%s<!48>", file_directories[dir_sel]->name);
|
||||||
|
|
||||||
subScrollList = newCDKScroll(cdkscreen, 12, 8, 1, 36, 36, title, NULL, 0, FALSE, A_REVERSE, TRUE, TRUE);
|
subScrollList = newCDKScroll(cdkscreen, 12, 1, 1, 12, 36, title, NULL, 0, FALSE, A_REVERSE, TRUE, TRUE);
|
||||||
|
|
||||||
filesubs = (char **)malloc(sizeof(char *) * file_directory_count);
|
filesubs = (char **)malloc(sizeof(char *) * file_directory_count);
|
||||||
|
|
||||||
@ -613,7 +616,7 @@ static int moveFile(EObjectType cdktype, void *object, void *clientData, chtype
|
|||||||
setCDKScrollItems(s, filenames, fcount, FALSE);
|
setCDKScrollItems(s, filenames, fcount, FALSE);
|
||||||
eraseCDKScroll(s);
|
eraseCDKScroll(s);
|
||||||
drawCDKScroll(s, TRUE);
|
drawCDKScroll(s, TRUE);
|
||||||
refreshCDKScreen(cdkscreen);
|
// refreshCDKScreen(cdkscreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int scanFiles(EObjectType cdktype, void *object, void *clientData, chtype input) {
|
static int scanFiles(EObjectType cdktype, void *object, void *clientData, chtype input) {
|
||||||
@ -775,7 +778,7 @@ static int scanFiles(EObjectType cdktype, void *object, void *clientData, chtype
|
|||||||
setCDKScrollItems(s, filenames, fcount, FALSE);
|
setCDKScrollItems(s, filenames, fcount, FALSE);
|
||||||
eraseCDKScroll(s);
|
eraseCDKScroll(s);
|
||||||
drawCDKScroll(s, TRUE);
|
drawCDKScroll(s, TRUE);
|
||||||
refreshCDKScreen(cdkscreen);
|
// refreshCDKScreen(cdkscreen);
|
||||||
closedir(ind);
|
closedir(ind);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -799,7 +802,7 @@ static int scanFiles(EObjectType cdktype, void *object, void *clientData, chtype
|
|||||||
setCDKScrollItems(s, filenames, fcount, FALSE);
|
setCDKScrollItems(s, filenames, fcount, FALSE);
|
||||||
eraseCDKScroll(s);
|
eraseCDKScroll(s);
|
||||||
drawCDKScroll(s, TRUE);
|
drawCDKScroll(s, TRUE);
|
||||||
refreshCDKScreen(cdkscreen);
|
// refreshCDKScreen(cdkscreen);
|
||||||
closedir(ind);
|
closedir(ind);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -821,11 +824,24 @@ static int scanFiles(EObjectType cdktype, void *object, void *clientData, chtype
|
|||||||
setCDKScrollItems(s, filenames, fcount, FALSE);
|
setCDKScrollItems(s, filenames, fcount, FALSE);
|
||||||
eraseCDKScroll(s);
|
eraseCDKScroll(s);
|
||||||
drawCDKScroll(s, TRUE);
|
drawCDKScroll(s, TRUE);
|
||||||
refreshCDKScreen(cdkscreen);
|
// refreshCDKScreen(cdkscreen);
|
||||||
closedir(ind);
|
closedir(ind);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int desc_function(EObjectType objtype, void *obj, void *clientData, chtype input) {
|
||||||
|
CDKSCROLL *s = (CDKSCROLL *)obj;
|
||||||
|
|
||||||
|
if (fcount == 0) return FALSE;
|
||||||
|
int index = getCDKScrollCurrent(s);
|
||||||
|
|
||||||
|
werase(desc_win);
|
||||||
|
waddstr(desc_win, f[index]->description);
|
||||||
|
wrefresh(desc_win);
|
||||||
|
// setCDKMentryValue(desc_entry, f[index]->description);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
void list_files(int dir, int sub) {
|
void list_files(int dir, int sub) {
|
||||||
CDKSCROLL *scrollList = 0;
|
CDKSCROLL *scrollList = 0;
|
||||||
int selection;
|
int selection;
|
||||||
@ -907,7 +923,7 @@ void list_files(int dir, int sub) {
|
|||||||
sqlite3_finalize(res);
|
sqlite3_finalize(res);
|
||||||
sqlite3_close(db);
|
sqlite3_close(db);
|
||||||
|
|
||||||
scrollList = newCDKScroll(cdkscreen, 6, 4, 1, 36, 36, title, NULL, 0, FALSE, A_REVERSE, TRUE, TRUE);
|
scrollList = newCDKScroll(cdkscreen, 6, 1, 1, 12, 36, title, NULL, 0, FALSE, A_REVERSE, TRUE, TRUE);
|
||||||
if (!scrollList) {
|
if (!scrollList) {
|
||||||
for (i=0;i<fcount;i++) {
|
for (i=0;i<fcount;i++) {
|
||||||
free(f[i]->name);
|
free(f[i]->name);
|
||||||
@ -921,7 +937,16 @@ void list_files(int dir, int sub) {
|
|||||||
fcount = 0;
|
fcount = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (fcount > 0) {
|
||||||
|
werase(desc_win);
|
||||||
|
waddstr(desc_win, f[0]->description);
|
||||||
|
// setCDKMentryValue(desc_entry, f[0]->description);
|
||||||
|
} else {
|
||||||
|
// setCDKMentryValue(desc_entry, "");
|
||||||
|
werase(desc_win);
|
||||||
|
}
|
||||||
|
wrefresh(desc_win);
|
||||||
|
setCDKScrollPostProcess(scrollList, desc_function, NULL);
|
||||||
setCDKScrollItems(scrollList, filenames, fcount, FALSE);
|
setCDKScrollItems(scrollList, filenames, fcount, FALSE);
|
||||||
|
|
||||||
bindCDKObject (vSCROLL, scrollList, 'm', moveFile, NULL);
|
bindCDKObject (vSCROLL, scrollList, 'm', moveFile, NULL);
|
||||||
@ -965,7 +990,7 @@ void list_subdirs(int selected) {
|
|||||||
filesubs[i] = strdup(file_directories[selected]->file_subs[i]->name);
|
filesubs[i] = strdup(file_directories[selected]->file_subs[i]->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
scrollList = newCDKScroll(cdkscreen, 4, 3, 1, 36, 36, title, NULL, 0, FALSE, A_REVERSE, TRUE, TRUE);
|
scrollList = newCDKScroll(cdkscreen, 4, 1, 1, 12, 36, title, NULL, 0, FALSE, A_REVERSE, TRUE, TRUE);
|
||||||
if (!scrollList) {
|
if (!scrollList) {
|
||||||
fprintf(stderr, "Unable to make scrolllist!");
|
fprintf(stderr, "Unable to make scrolllist!");
|
||||||
destroyCDKScreen(cdkscreen);
|
destroyCDKScreen(cdkscreen);
|
||||||
@ -995,6 +1020,7 @@ int main(int argc, char **argv) {
|
|||||||
CDK_PARAMS params;
|
CDK_PARAMS params;
|
||||||
WINDOW *cursesWin = 0;
|
WINDOW *cursesWin = 0;
|
||||||
CDKSCROLL *scrollList = 0;
|
CDKSCROLL *scrollList = 0;
|
||||||
|
WINDOW *instruction_win = 0;
|
||||||
int selection;
|
int selection;
|
||||||
char **filedirs;
|
char **filedirs;
|
||||||
char buffer[PATH_MAX];
|
char buffer[PATH_MAX];
|
||||||
@ -1022,7 +1048,14 @@ int main(int argc, char **argv) {
|
|||||||
cursesWin = initscr();
|
cursesWin = initscr();
|
||||||
cdkscreen = initCDKScreen(cursesWin);
|
cdkscreen = initCDKScreen(cursesWin);
|
||||||
|
|
||||||
scrollList = newCDKScroll(cdkscreen, 2, 1, 1, 36, 36, "</48>File Directories<!48>", NULL, 0, FALSE, A_REVERSE, TRUE, TRUE);
|
desc_win = newwin(10, 46, 14, 1);
|
||||||
|
instruction_win = newwin(10, 32, 14, 47);
|
||||||
|
|
||||||
|
waddstr(instruction_win, "t - toggle approval\na - approve all\nu - unapprove all\nd - delete file\nm - move file\ns - scan for files");
|
||||||
|
|
||||||
|
wrefresh(instruction_win);
|
||||||
|
|
||||||
|
scrollList = newCDKScroll(cdkscreen, 2, 1, 1, 12, 36, "</48>File Directories<!48>", NULL, 0, FALSE, A_REVERSE, TRUE, TRUE);
|
||||||
if (!scrollList) {
|
if (!scrollList) {
|
||||||
fprintf(stderr, "Unable to make scrolllist!");
|
fprintf(stderr, "Unable to make scrolllist!");
|
||||||
destroyCDKScreen(cdkscreen);
|
destroyCDKScreen(cdkscreen);
|
||||||
|
Reference in New Issue
Block a user