diff options
author | Alec Murphy <alec@checksum.fail> | 2017-07-15 14:30:38 -0400 |
---|---|---|
committer | Alec Murphy <alec@checksum.fail> | 2017-07-15 14:30:38 -0400 |
commit | 999cb55a5d7cfb14bd015cfecd659b95faed7fc6 (patch) | |
tree | a84c6d1574a519ea0f3f8ac453b97de7e8157a61 | |
parent | c629021a5df736a30e34dbbd99f64851c085982d (diff) |
Save screen settings to Registry, update Menus
-rwxr-xr-x | Bookmarks.HC | 78 | ||||
-rwxr-xr-x | Load.HC | 46 |
2 files changed, 105 insertions, 19 deletions
diff --git a/Bookmarks.HC b/Bookmarks.HC index b570013..32945c1 100755 --- a/Bookmarks.HC +++ b/Bookmarks.HC @@ -26,7 +26,7 @@ TTConnEntryForm *edit_form; I64 conn_len=0; I64 conn_idx=0; - + U8 *conn_list; U8 *conn_edlist; @@ -79,16 +79,74 @@ U0 ConnEntriesRecalc() }; } - StrPrint(conn_list+conn_len,"Add Entry"); - conn_len+=StrLen("Add Entry")+1; - conn_idx++; +} + +public I64 PopUpBookmarkLst(U8 *lst) +{//Prompt for lst entry in PopUp win task. + I64 res,i=0; + CDoc *doc=DocNew; + DocPrint(doc,"$$GREEN$$$$TX+CX,\"Connection List\"$$\n\n"); + DocPrint(doc,"$$LTBLUE$$"); + while (*lst) { + if (*lst=='@') {//Check for '@' alias lst entry + i--; + lst++; + } + DocPrint(doc,"$$MU,\"%s\",LE=%d$$\n",lst,i++); + lst+=StrLen(lst)+1; + } + DocPrint(doc,"\n$$MU,\"Add Entry\",LE=%d$$\n",i++); + DocPrint(doc,"$$RED$$"); + DocPrint(doc,"$$MU,\"Delete Entry\",LE=%d$$\n",i++); + DocPrint(doc,"$$LTBLUE$$"); + DocPrint(doc,"$$MU,\"Edit Entry\",LE=%d$$\n",i++); + DocPrint(doc,"\n$$MU,\"CANCEL\",LE=DOCM_CANCEL$$\n"); + + res=PopUpMenu(doc); + DocDel(doc); + return res; +} + +public I64 PopUpDelLst(U8 *lst) +{//Prompt for lst entry in PopUp win task. + I64 res,i=0; + CDoc *doc=DocNew; + DocPrint(doc,"$$RED$$$$TX+CX,\"Delete Entry\"$$\n\n"); + while (*lst) { + if (*lst=='@') {//Check for '@' alias lst entry + i--; + lst++; + } + DocPrint(doc,"$$MU,\"%s\",LE=%d$$\n",lst,i++); + lst+=StrLen(lst)+1; + } + DocPrint(doc,"\n$$LTBLUE$$"); + DocPrint(doc,"$$MU,\"CANCEL\",LE=DOCM_CANCEL$$\n"); + + res=PopUpMenu(doc); + DocDel(doc); + return res; +} - StrPrint(conn_list+conn_len,"Delete Entry"); - conn_len+=StrLen("Delete Entry")+1; - conn_idx++; - StrPrint(conn_list+conn_len,"Edit Entry"); - conn_len+=StrLen("Edit Entry")+1; - conn_idx++; +public I64 PopUpEditLst(U8 *lst) +{//Prompt for lst entry in PopUp win task. + I64 res,i=0; + CDoc *doc=DocNew; + DocPrint(doc,"$$BLUE$$$$TX+CX,\"Edit Entry\"$$\n\n"); + DocPrint(doc,"$$LTBLUE$$"); + while (*lst) { + if (*lst=='@') {//Check for '@' alias lst entry + i--; + lst++; + } + DocPrint(doc,"$$MU,\"%s\",LE=%d$$\n",lst,i++); + lst+=StrLen(lst)+1; + } + DocPrint(doc,"\n$$MU,\"CANCEL\",LE=DOCM_CANCEL$$\n"); + res=PopUpMenu(doc); + DocDel(doc); + return res; } + @@ -1,6 +1,6 @@ #include "::/Apps/TempleTerm/Bookmarks" #include "::/Apps/TempleTerm/ZModem" - + #define PROMPT_Q 0xFFFF #define REMOTE_Q 0xFFFE @@ -82,6 +82,8 @@ U0 TempleTermSession(I64 sock) rz_filename=CAlloc(1024); rz_shortfn=CAlloc(1024); + RegExe("WalnutLabs/TempleTerm"); + I64 DETECT_ZDLE=0; I64 IN_ZDLE=0; @@ -223,6 +225,11 @@ U0 TempleTermSession(I64 sock) if (in_rz==7) { + + progress2_max=0; + progress3_max=0; + progress4_max=0; + // ZDATA, cont...: if (rz_ibpos==0) @@ -285,6 +292,7 @@ U0 TempleTermSession(I64 sock) if (rz_ibpos==3) { progress1=rz_dpos; + StrPrint(progress1_desc, "ZMODEM RX: %s [%d/%d] (%d files remaining)", rz_shortfn, rz_dpos, rz_filesize, rz_remainfiles-1); }; // get length of subpacket @@ -335,6 +343,11 @@ U0 TempleTermSession(I64 sock) if (in_rz==6) { + + progress2_max=0; + progress3_max=0; + progress4_max=0; + // ZDATA, begin: // get length of subpacket @@ -417,7 +430,7 @@ U0 TempleTermSession(I64 sock) // allocate buffer, set pos to 0, and start receiving... rz_fbuf=CAlloc(rz_filesize); - StrPrint(progress1_desc, "ZMODEM Receive: %s (%d files remaining)", rz_shortfn, rz_remainfiles-1); + ProgressBarsRst; progress1=0; progress1_max=rz_filesize; progress2_max=0; @@ -428,6 +441,7 @@ U0 TempleTermSession(I64 sock) rz_pktctr=0; rz_dpos=0; rz_opos=0; + StrPrint(progress1_desc, "ZMODEM RX: %s [%d/%d] (%d files remaining)", rz_shortfn, rz_dpos, rz_filesize, rz_remainfiles-1); sendHexHeader(sock, ZRPOS, rz_dpos.u8[0], rz_dpos.u8[1], rz_dpos.u8[2], rz_dpos.u8[3]); in_rz=2; rzb_state=0; @@ -953,7 +967,7 @@ I64 TempleTermConnect(U8 *host, I64 port=23) if (in_rz==0 || abort_rz==1) { // Send username - if ((kbd.scan_code & 0xFFFF) == 2070) + if ((kbd.scan_code & 0xFFFF) == 2070) { sendString(sock, conn_entries[res].user, 0); key=0; @@ -1066,6 +1080,20 @@ I64 TempleTermConnect(U8 *host, I64 port=23) Free(rz_shortfn); Free(rz_filename); Free(rz_ibuf); + RegWrite("WalnutLabs/TempleTerm", "Fs->parent_task->display_flags=%d;\n", + Fs->display_flags); + RegAppend("WalnutLabs/TempleTerm", "Fs->parent_task->win_left=%d;\n", + Fs->win_left); + RegAppend("WalnutLabs/TempleTerm", "Fs->parent_task->win_right=%d;\n", + Fs->win_right); + RegAppend("WalnutLabs/TempleTerm", "Fs->parent_task->win_top=%d;\n", + Fs->win_top); + RegAppend("WalnutLabs/TempleTerm", "Fs->parent_task->win_bottom=%d;\n", + Fs->win_bottom); + RegAppend("WalnutLabs/TempleTerm", "Fs->parent_task->win_width=%d;\n", + Fs->win_width); + RegAppend("WalnutLabs/TempleTerm", "Fs->parent_task->win_height=%d;\n", + Fs->win_height); Kill(session); close(sock); Fs->draw_it=NULL; @@ -1112,13 +1140,13 @@ U0 Run() ConnEntriesRecalc; while (res!=-1) { - res = PopUpPickLst(conn_list); + res = PopUpBookmarkLst(conn_list); if (res!=-1 && res<(conn_idx-3)) { TempleTermConnect(conn_entries[res].host, conn_entries[res].port); }; - if (res==(conn_idx-3)) + if (res==(conn_idx)) { idx = res; StrPrint(add_form->name,""); @@ -1142,11 +1170,11 @@ U0 Run() }; }; - if (res==(conn_idx-2)) + if (res==(conn_idx+1)) { // delete entry idx = res; - dres = PopUpPickLst(conn_edlist); + dres = PopUpDelLst(conn_edlist); if (dres!=-1) { if(PopUpCancelOk("Ok to DELETE this entry?")) @@ -1161,11 +1189,11 @@ U0 Run() ConnEntriesRecalc; }; - if (res==(conn_idx-1)) + if (res==(conn_idx+2)) { // edit entry idx = res; - eres = PopUpPickLst(conn_edlist); + eres = PopUpEditLst(conn_edlist); if (eres!=-1) { StrPrint(edit_form->name,conn_entries[eres].name); |