| 77 |
"F2", (char *)NULL |
"F2", (char *)NULL |
| 78 |
}; |
}; |
| 79 |
|
|
| 80 |
//SCREEN *ofm_term; |
/* SCREEN *ofm_term; */ |
| 81 |
|
|
| 82 |
/* console size */ |
/* console size */ |
| 83 |
|
|
| 170 |
|
|
| 171 |
tmp=(OPANEL*)xmalloc(sizeof(OPANEL)); |
tmp=(OPANEL*)xmalloc(sizeof(OPANEL)); |
| 172 |
if (tmp!=NULL) { |
if (tmp!=NULL) { |
| 173 |
//tmp->path="./"; |
/* tmp->path="./"; */ |
| 174 |
tmp->dir=(DirStruct*)NULL; |
tmp->dir=(DirStruct*)NULL; |
| 175 |
tmp->columns=2; |
tmp->columns=2; |
| 176 |
tmp->width=width; |
tmp->width=width; |
| 279 |
else opanel_nr=! opanelActive; |
else opanel_nr=! opanelActive; |
| 280 |
tmp=chdir(workdir[opanel_nr]); |
tmp=chdir(workdir[opanel_nr]); |
| 281 |
if (tmp) { |
if (tmp) { |
| 282 |
// fprintf(stderr,"Error changing to workdir[%d]: %s\n",opanel_nr,workdir[opanel_nr]); |
/* fprintf(stderr,"Error changing to workdir[%d]: %s\n",opanel_nr,workdir[opanel_nr]); */ |
| 283 |
tmp=chdir("/"); |
tmp=chdir("/"); |
| 284 |
p->reread=1; |
p->reread=1; |
| 285 |
} |
} |
| 292 |
/* if the directory isn't read yet, then we should do it */ |
/* if the directory isn't read yet, then we should do it */ |
| 293 |
|
|
| 294 |
if (p->dir==NULL) { |
if (p->dir==NULL) { |
| 295 |
//while ( ((p->dir=dirSuck("./"))==NULL) && (! chdir("..")) ); |
/* while ( ((p->dir=dirSuck("./"))==NULL) && (! chdir("..")) ); */ |
| 296 |
p->dir=dirSuck("./"); |
p->dir=dirSuck("./"); |
| 297 |
if (p->dir==NULL) return 1; |
if (p->dir==NULL) return 1; |
| 298 |
dirSort(p->dir,p->sort_mode); |
dirSort(p->dir,p->sort_mode); |
| 308 |
|
|
| 309 |
/* lazy check */ |
/* lazy check */ |
| 310 |
|
|
| 311 |
//while ( ((ds=dirSuck("./"))==NULL) && (! chdir("..")) ); |
/* while ( ((ds=dirSuck("./"))==NULL) && (! chdir("..")) ); */ |
| 312 |
ds=dirSuck("./"); |
ds=dirSuck("./"); |
| 313 |
if (ds!=NULL){ |
if (ds!=NULL){ |
| 314 |
dirSort(ds,p->sort_mode); |
dirSort(ds,p->sort_mode); |
| 336 |
dirFree(p->dir); |
dirFree(p->dir); |
| 337 |
p->dir=ds; |
p->dir=ds; |
| 338 |
getcwd(workdir[opanel_nr],PATH_MAX); |
getcwd(workdir[opanel_nr],PATH_MAX); |
| 339 |
// fprintf(stderr,"REREAD: %s refreshed\n",workdir[opanel_nr]); |
/* fprintf(stderr,"REREAD: %s refreshed\n",workdir[opanel_nr]); */ |
| 340 |
} else return 1; |
} else return 1; |
| 341 |
} |
} |
| 342 |
|
|
| 355 |
if (tstr==NULL) return 2; |
if (tstr==NULL) return 2; |
| 356 |
wmove(p->win,y,x); |
wmove(p->win,y,x); |
| 357 |
ds=p->first; |
ds=p->first; |
| 358 |
//selcount=selsize=0; |
/* selcount=selsize=0; */ |
| 359 |
|
|
| 360 |
tmp=0; |
tmp=0; |
| 361 |
|
|
| 408 |
|
|
| 409 |
/* write out the prefix and the filename */ |
/* write out the prefix and the filename */ |
| 410 |
|
|
| 411 |
t=colw-2; //maximum name length |
t=colw-2; /* maximum name length */ |
| 412 |
if ((tsize=strlen(ds->name))<=t) sprintf(tstr,"%-*.*s",t,t,ds->name); |
if ((tsize=strlen(ds->name))<=t) sprintf(tstr,"%-*.*s",t,t,ds->name); |
| 413 |
else { |
else { |
| 414 |
t/=2; |
t/=2; |
| 416 |
} |
} |
| 417 |
mvwprintw(p->win,y,x,"%c%.*s",prefix,colw-2,tstr); |
mvwprintw(p->win,y,x,"%c%.*s",prefix,colw-2,tstr); |
| 418 |
|
|
| 419 |
y++; //next row |
y++; /* next row */ |
| 420 |
if (y>p->height-2) { //if need to jump to next column |
if (y>p->height-2) { /* if need to jump to next column */ |
| 421 |
y=1; |
y=1; |
| 422 |
x+=colw; |
x+=colw; |
| 423 |
wmove(p->win,y,x); |
wmove(p->win,y,x); |
| 424 |
} |
} |
| 425 |
ds=ds->next; //next node |
ds=ds->next; /* next node */ |
| 426 |
} |
} |
| 427 |
ds=p->first->first; //get first node |
ds=p->first->first; /* get first node */ |
| 428 |
xfree(tstr); |
xfree(tstr); |
| 429 |
|
|
| 430 |
/* arrow */ |
/* arrow */ |
| 445 |
|
|
| 446 |
int cursesInit() |
int cursesInit() |
| 447 |
{ |
{ |
| 448 |
// ofm_term=newterm(NULL,stdout,stdin); |
/* ofm_term=newterm(NULL,stdout,stdin); |
| 449 |
// if (ofm_term==NULL) printf("Couldn't initialize!"); |
* if (ofm_term==NULL) printf("Couldn't initialize!"); |
| 450 |
// set_term(ofm_term); |
* set_term(ofm_term); |
| 451 |
|
*/ |
| 452 |
initscr(); |
initscr(); |
| 453 |
start_color(); |
start_color(); |
| 454 |
|
|
| 511 |
/* char/block file (non-active) */ |
/* char/block file (non-active) */ |
| 512 |
|
|
| 513 |
init_pair(14,COLOR_MAGENTA,COLOR_BLACK); |
init_pair(14,COLOR_MAGENTA,COLOR_BLACK); |
| 514 |
// init_pair(15,COLOR_BLACK,COLOR_BLUE); |
/* init_pair(15,COLOR_BLACK,COLOR_BLUE); */ |
| 515 |
init_pair(15,COLOR_YELLOW,COLOR_WHITE); |
init_pair(15,COLOR_YELLOW,COLOR_WHITE); |
| 516 |
|
|
| 517 |
|
|
| 527 |
clear(); |
clear(); |
| 528 |
refresh(); |
refresh(); |
| 529 |
endwin(); |
endwin(); |
| 530 |
// delscreen(ofm_term); |
/* delscreen(ofm_term); */ |
| 531 |
} |
} |
| 532 |
|
|
| 533 |
/* ***** ***** ***** */ |
/* ***** ***** ***** */ |
| 667 |
sprintf(buff,"%s/",workdir[! opanelActive]); |
sprintf(buff,"%s/",workdir[! opanelActive]); |
| 668 |
if (dlgMessageBox(B_OK|B_CANCEL,buff,"CopyTo","Destination:")==B_OK){ |
if (dlgMessageBox(B_OK|B_CANCEL,buff,"CopyTo","Destination:")==B_OK){ |
| 669 |
dlgCopy(tmp,buff); |
dlgCopy(tmp,buff); |
| 670 |
tmp->reread=1; //have to check it |
tmp->reread=1; /* have to check it */ |
| 671 |
opanels[! opanelActive]->reread=1; |
opanels[! opanelActive]->reread=1; |
| 672 |
} |
} |
| 673 |
result=1;; |
result=1;; |
| 685 |
|
|
| 686 |
if (tmp->sel_ds->index>1) { |
if (tmp->sel_ds->index>1) { |
| 687 |
result=1; |
result=1; |
| 688 |
if (strlen(workdir[opanelActive])==1) //if root dir |
if (strlen(workdir[opanelActive])==1) /* if root dir */ |
| 689 |
sprintf(buff,"/%s",tmp->sel_ds->name); |
sprintf(buff,"/%s",tmp->sel_ds->name); |
| 690 |
else |
else |
| 691 |
sprintf(buff,"%s/%s",workdir[opanelActive],tmp->sel_ds->name); |
sprintf(buff,"%s/%s",workdir[opanelActive],tmp->sel_ds->name); |
| 738 |
|
|
| 739 |
tmp=opanels[opanelActive]; |
tmp=opanels[opanelActive]; |
| 740 |
|
|
| 741 |
if (i==KEY_F(9)) { //MENU PULL DOWN |
if (i==KEY_F(9)) { /* MENU PULL DOWN */ |
| 742 |
menuPost(ofm_menu[activem]); |
menuPost(ofm_menu[activem]); |
| 743 |
box(ofm_menu[activem]->win,0,0); |
box(ofm_menu[activem]->win,0,0); |
| 744 |
menuBarRefresh(activem); |
menuBarRefresh(activem); |
| 748 |
if (i==KEY_RIGHT) { |
if (i==KEY_RIGHT) { |
| 749 |
menuUnpost(ofm_menu[activem]); |
menuUnpost(ofm_menu[activem]); |
| 750 |
viewportRefresh(); |
viewportRefresh(); |
| 751 |
activem=(activem+1)%2; //choose next menu |
activem=(activem+1)%2; /* choose next menu */ |
| 752 |
menuPost(ofm_menu[activem]); |
menuPost(ofm_menu[activem]); |
| 753 |
box(ofm_menu[activem]->win,0,0); |
box(ofm_menu[activem]->win,0,0); |
| 754 |
menuBarRefresh(activem); |
menuBarRefresh(activem); |
| 756 |
} else if (i==KEY_LEFT) { |
} else if (i==KEY_LEFT) { |
| 757 |
menuUnpost(ofm_menu[activem]); |
menuUnpost(ofm_menu[activem]); |
| 758 |
viewportRefresh(); |
viewportRefresh(); |
| 759 |
activem=(activem+2+1)%2; //choose previous menu |
activem=(activem+2+1)%2; /* choose previous menu */ |
| 760 |
menuPost(ofm_menu[activem]); |
menuPost(ofm_menu[activem]); |
| 761 |
box(ofm_menu[activem]->win,0,0); |
box(ofm_menu[activem]->win,0,0); |
| 762 |
menuBarRefresh(activem); |
menuBarRefresh(activem); |
| 806 |
} |
} |
| 807 |
|
|
| 808 |
else if (i=='\n') { |
else if (i=='\n') { |
| 809 |
if (cmd_size>0) { //if there is some command to execute |
if (cmd_size>0) { /* if there is some command to execute */ |
| 810 |
erase(); |
erase(); |
| 811 |
refresh(); |
refresh(); |
| 812 |
def_prog_mode(); |
def_prog_mode(); |
| 820 |
viewportRefresh(); |
viewportRefresh(); |
| 821 |
curs_set(0); |
curs_set(0); |
| 822 |
} else |
} else |
| 823 |
if (tmp->sel_ds->dir){ //if we want to change dir |
if (tmp->sel_ds->dir){ /* if we want to change dir */ |
| 824 |
if ( strcmp(workdir[opanelActive],"/") || strcmp(tmp->sel_ds->name,"..") ){ |
if ( strcmp(workdir[opanelActive],"/") || strcmp(tmp->sel_ds->name,"..") ){ |
| 825 |
itmp=chdir(tmp->sel_ds->name); |
itmp=chdir(tmp->sel_ds->name); |
| 826 |
if (itmp) { |
if (itmp) { |
| 827 |
dlgMessageBox(B_OK,NULL,"Error",strerror(errno)); |
dlgMessageBox(B_OK,NULL,"Error",strerror(errno)); |
| 828 |
opanelRefresh(opanels[! opanelActive]); |
opanelRefresh(opanels[! opanelActive]); |
| 829 |
} |
} |
| 830 |
else { //if we changed dir |
else { /* if we changed dir */ |
| 831 |
if (tmp->sel_name!=NULL) xfree(tmp->sel_name); |
if (tmp->sel_name!=NULL) xfree(tmp->sel_name); |
| 832 |
tmp->sel_name=NULL; |
tmp->sel_name=NULL; |
| 833 |
if (strcmp(tmp->sel_ds->name,"..")) //if we're going down in dir tree |
if (strcmp(tmp->sel_ds->name,"..")) /* if we're going down in dir tree */ |
| 834 |
stackPush(stack[opanelActive],tmp->sel_ds->name); |
stackPush(stack[opanelActive],tmp->sel_ds->name); |
| 835 |
else tmp->sel_name=stackPop(stack[opanelActive]); |
else tmp->sel_name=stackPop(stack[opanelActive]); |
| 836 |
|
|
| 1014 |
else if (isascii(i)) { |
else if (isascii(i)) { |
| 1015 |
if (cmd_size<sizeof(cmd_buffer)) { |
if (cmd_size<sizeof(cmd_buffer)) { |
| 1016 |
cmd_buffer[cmd_size++]=(char)i; |
cmd_buffer[cmd_size++]=(char)i; |
| 1017 |
writeinfo(2); //refresh bottom info |
writeinfo(2); /* refresh bottom info */ |
| 1018 |
} |
} |
| 1019 |
} |
} |
| 1020 |
else if (i==KEY_BACKSPACE && cmd_size>0) { |
else if (i==KEY_BACKSPACE && cmd_size>0) { |