diff --git a/exec/cshell.js b/exec/cshell.js index 237c3d84ebf481a2ccfb8a5825947c729e340c5b..64e926997e4f23351c76cfa61c0097b21be05de7 100644 --- a/exec/cshell.js +++ b/exec/cshell.js @@ -14,6 +14,16 @@ * file: <menu_name>.<width>x<height>.bin * RIGHT WINDOW ICON: * file: icon.16x10.bin + * + * NOTE: for a standard 80 x 24 terminal, menu wallpaper has a maximum + * size of 34 x 22, and the main wallpaper has a maximum size of 60 x 22, + * though these numbers largely depend on the size of the side menu and + * right window. The max width can be determined by this formula: + * WALLPAPER WIDTH = + * SCREEN COLUMNS - RIGHT WINDOW WIDTH - (SIDE MENU WIDTH + 1) - 2 + * + * DEFAULT SIDE MENU WIDTH: 25 + * DEFAULT RIGHT WINDOW WIDTH: 18 ****************************************************************************** This shell relies on having commservice.js, commclient.js, and all other related @@ -50,29 +60,31 @@ console.ctrlkey_passthru="+KOPTU"; var cmdlist=new CommandList(); var settings=new Settings(); -var shortcuts=new Favorites(); -var bottom=new MainMenu(); +var favorites=new Favorites(); +var bottom=new BottomLine(); var right=new RightWindow(); var center=new MainWindow(); -var left=new SideMenu(); +var left=new LeftWindow(); /* SHELL FUNCTIONS */ function init() { loadSettings(); - loadFavorites(); bottom.init(); right.init(); center.init(); left.init(); + if(favorites.items.length > 0) { + loadMenu("favorites"); + showLeftWindow(); + } redraw(); } function shell() { - while(1) - { + while(1) { cycle(); var cmd=""; @@ -81,34 +93,54 @@ function shell() /* LEFT MENU COMMAND PROCESSING */ switch(cmd) { - case KEY_UP: - lightBarUp(m); - break; - case KEY_DOWN: - lightBarDown(m); - break; - case KEY_HOME: - lightBarHome(m); - break; - case KEY_END: - lightBarEnd(m); - break; - case KEY_LEFT: - previousMenu(); - break; - case KEY_RIGHT: - case "Q": - case "\x1b": - hideSideMenu(); - center.restore(); - bottom.restore(); - continue; - default: - if(left.menu.items[cmd]) { - var item_id=left.menu.items[cmd].id; - left.process(item_id); - } + case ctrl('R'): /* CTRL-R (Quick Redraw in SyncEdit) */ + case ctrl('O'): /* CTRL-O - Pause */ + case ctrl('U'): /* CTRL-U User List */ + case ctrl('T'): /* CTRL-T Time Info */ + case ctrl('K'): /* CTRL-K Control Key Menu */ + case ctrl('P'): /* Ctrl-P Messages */ + controlkeys.handle(key); + continue; + case KEY_UP: + lightBarUp(left.menu); + break; + case KEY_DOWN: + lightBarDown(left.menu); + break; + case KEY_HOME: + lightBarHome(left.menu); + break; + case KEY_END: + lightBarEnd(left.menu); + break; + case KEY_LEFT: + previousMenu(); + break; + case KEY_RIGHT: + case "Q": + case "\x1b": + hideLeftWindow(); + center.restore(); + bottom.restore(); + continue; + case "+": + if(left.currentmenu == "favorites" || + left.currentmenu == "addfavorite" || + left.currentmenu == "removefavorite") { break; + } + favorites.mi=left.currentmenu; + favorites.mt=left.menu.title; + favorites.ii=left.menu.current; + favorites.it=left.menu.items[favorites.ii].text.substr(3); + loadMenu("addfavorite"); + break; + default: + if(left.menu.items[cmd]) { + var item_id=left.menu.items[cmd].id; + left.process(item_id); + } + break; } } @@ -125,10 +157,16 @@ function shell() case ctrl('K'): /* CTRL-K Control Key Menu */ case ctrl('P'): /* Ctrl-P Messages */ controlkeys.handle(key); - break; + continue; case " ": redraw(); break; + case "-": + if(!favorites.items.length > 0) { + break; + } + loadMenu("delfavorite"); + break; case "\x1b": case "Q": return false; @@ -141,18 +179,11 @@ function shell() } if(!left.menu) continue; - var m=left.menu; - if(!left.menu_shown) showSideMenu(); + if(!left.menu_shown) showLeftWindow(); if(!left.title_shown) left.drawTitle(); - /* DISPLAY CURRENT SECTION INFO */ - switch(left.currentmenu) { - case "xtrnsec": - showXtrnProgInfo(m); - break; - case "xtrnsecs": - showXtrnSecInfo(m); - break; + if(menuinfo[left.currentmenu]) { + menuinfo[left.currentmenu](); } } } @@ -183,6 +214,10 @@ function redraw() left.redraw(); bottom.redraw(); + if(menuinfo[left.currentmenu]) { + menuinfo[left.currentmenu](); + } + full_redraw=false; } function drawTitle(x,y,str) @@ -233,6 +268,58 @@ function drawOutline() console.putmsg(outline,P_SAVEATR); } } +function displayInfo(text) +{ + console.putmsg(text); + console.popxy(); + console.down(); + console.pushxy(); +} +function setPosition(x,y) +{ + console.gotoxy(x,y); + console.pushxy(); +} +function logoff() +{ + if(bbs.batch_dnload_total) { + if(console.yesno(bbs.text(Menu_downloadBatchQ))) { + bbs.batch_download(); + bbs.logoff(); + } + } else bbs.hangup(); +} +function loadMenu() +{ + return left.loadMenu.apply(left,arguments); +} +function chatInput() +{ + showChat(); + while(center.in_chat) { + cycle(); + var key=console.inkey(K_NOCRLF|K_NOSPIN|K_NOECHO,5); + if(!key) continue; + + switch(key) { + case '\r': + if(!center.chat.input_line.buffer.length) { + center.in_chat=false; + } + break; + case '\x09': /* CTRL-I TAB */ + center.toggleChannel(); + continue; + case '\x1b': + center.in_chat=false; + break; + default: + break; + } + center.chat.processKey(key); + } + hideChat(); +} /* MAIN MENU */ function hideChat() @@ -265,7 +352,6 @@ function stretchCenter(height) } function expandCenter(width,side) { - log("expanding chat: " + width); var cols=center.chat.chatroom.columns; var x=center.chat.chatroom.x; if(side=="left"){ @@ -278,30 +364,9 @@ function expandCenter(width,side) center.chat.resize(cols,undefined,x,undefined); } -/* MENU ITEM INFORMATION */ -function showXtrnSecInfo(m) -{ - if(xtrn_area.sec_list[left.curr_xtrnsec]) { - center.loadWallPaper( - system.text_dir + "cshell/xtrn/" + - xtrn_area.sec_list[left.curr_xtrnsec].code + ".*.bin"); - center.redraw(); - } -} -function showXtrnProgInfo(m) -{ - if(xtrn_area.sec_list[left.curr_xtrnsec].prog_list[m.current]) { - center.loadWallPaper( - system.text_dir + "cshell/xtrn/" + - xtrn_area.sec_list[left.curr_xtrnsec].prog_list[m.current].code + ".*.bin"); - center.redraw(); - } -} - /* LEFT MENU */ -function hideSideMenu() +function hideLeftWindow() { - log("hiding side menu"); expandCenter(settings.menu_width+1,"left"); delete left.menu; left.currentmenu=""; @@ -309,9 +374,8 @@ function hideSideMenu() left.title_shown=false; left.previous=[]; } -function showSideMenu() +function showLeftWindow() { - log("showing side menu"); expandCenter(-(settings.menu_width+1),"left"); drawSeparator(settings.menu_width+2,2,settings.main_height); left.menu_shown=true; @@ -354,111 +418,123 @@ function previousMenu() { left.previousMenu(); } - -/* USER SETTINGS */ -function saveSettings() +function addcmd(text,id,disabled) { - if(file_exists(settings_file.name)) { - settings_file.open('w+',true); - if(!settings_file.is_open) { - log("error opening user settings",LOG_WARNING); - return; - } - settings_file.close(); - } + this.add(text,undefined,settings.menu_width,undefined,undefined,disabled); + this.items[this.items.length-1].id=id; } -function saveFavorites() +function fill_menu(lb) { - if(file_exists(settings_file.name)) { - settings_file.open('w+',true); - if(!settings_file.is_open) { - log("error opening user settings",LOG_WARNING); - return; - } - for each(var s in this.shortcuts) { - var values=[s.command]; - settings_file.iniSetValue("shortcuts",s.text,s.parameters.join(",")); - } - settings_file.close(); + if(left.previous.length) offset=5; + else offset=4; + + while(lb.items.length<settings.main_height-offset) + { + lb.add("","",settings.menu_width,undefined,undefined,true); } + + if(left.previous.length) lb.add(format_opt("Previous Menu",settings.menu_width,-1),KEY_LEFT,settings.menu_width); + lb.add(format_opt("Main Menu",settings.menu_width,0),KEY_RIGHT,settings.menu_width); } -function loadSettings() +function set_hotkeys(lb) { - if(file_exists(settings_file.name)) { - settings_file.open('r',true); - if(!settings_file.is_open) { - log("error opening user settings",LOG_WARNING); - return; - } - var data=settings_file.iniGetObject("settings"); - settings_file.close(); - settings=new Settings(data); + /* USE FIRST AVAILABLE HOTKEY AS TRIGGER */ + /* RETURN VALUE = ITEM INDEX FOR MENU COMMAND REFERENCE */ + var hotkeys="1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ"; + var index=0; + for(var i=0;i<lb.items.length;i++) { + if(lb.items[i].disabled) continue; + + while(bottom.menu.items[hotkeys[index]]) index++; + lb.items[i].text="|" + hotkeys[index++] + " " + lb.items[i].text; + lb.items[i].retval=i; } } -function loadFavorites() + +/* MENU FUNCTIONS */ +function format_opt(str, width, expand) { - if(file_exists(settings_file.name)) { - settings_file.open('r',true); - if(!settings_file.is_open) { - log("error opening user settings",LOG_WARNING); - return; - } - var data=settings_file.iniGetObject("shortcuts"); - settings_file.close(); - shortcuts=new Favorites(data); + var spaces80=" "; + if(expand == -1) { + opt='|< '; + var cleaned=str; + cleaned=cleaned.replace(/\|/g,''); + opt+=str+spaces80.substr(0,width-cleaned.length-2); + return opt; + } else if(expand == 0) { + opt=str; + var cleaned=opt; + cleaned=cleaned.replace(/\|/g,''); + opt+=spaces80.substr(0,width-cleaned.length-2); + opt+=' |>'; + return opt; + } else if(expand == 1) { + opt=str; + var cleaned=opt; + cleaned=cleaned.replace(/\|/g,''); + opt+=spaces80.substr(0,width-cleaned.length-2); + opt+=' |+'; + return opt; } + return(str); } -function add_favorite() +function todo_getfiles(lib, dir) { - // ToDo: create an interface for adding custom user commands + var path=format("%s%s.ixb", file_area.lib_list[lib].dir_list[dir].data_dir, file_area.lib_list[lib].dir_list[dir].code); + return(file_size(path)/22); /* F_IXBSIZE */ } - -/* COMMAND LIST FUNCTIONS */ -function loadXtrn() -{ -} -function loadMenu() +function clear_screen() { - return left.loadMenu.apply(left,arguments); + /* + * Called whenever a command needs to exit the menu for user interaction. + * + * If you'd like a header before non-menu stuff, this is the place to put + * it. + */ + + bbs.sys_status&=~SS_MOFF; + bbs.sys_status&=~SS_PAUSEOFF; + console.clear(ANSI_NORMAL); + full_redraw=true; + + /* We are going to a line-mode thing... re-enable CTRL keys. */ } -function chatInput() + +/* USER SETTINGS */ +function saveSettings() { - showChat(); - while(center.in_chat) { - cycle(); - var key=console.inkey(K_NOCRLF|K_NOSPIN|K_NOECHO,5); - if(!key) continue; - - switch(key) { - case '\r': - case '\n': - if(!center.chat.input_line.buffer.length) { - center.in_chat=false; - } - break; - case '\x09': /* CTRL-I TAB */ - center.toggleChannel(); - continue; - case '\x1b': - center.in_chat=false; - break; - default: - break; - } - center.chat.processKey(key); + settings_file.open('w+',false); + if(!settings_file.is_open) { + log("error opening user settings",LOG_WARNING); + return; } - hideChat(); + for(var f=0;f<favorites.items.length;f++) { + var fav=favorites.items[f]; + var value= + fav.menuID + "," + + fav.menuTitle + "," + + fav.itemID + "," + + fav.itemTitle + "," + + fav.xtrnsec; + settings_file.iniSetValue("favorites",f,value); + } + settings_file.close(); } -function logoff() +function loadSettings() { - if(bbs.batch_dnload_total) { - if(console.yesno(bbs.text(Menu_downloadBatchQ))) { - bbs.batch_download(); - bbs.logoff(); + if(file_exists(settings_file.name)) { + settings_file.open('r',true); + if(!settings_file.is_open) { + log("error opening user settings",LOG_WARNING); + return; } - } else bbs.hangup(); + var set=settings_file.iniGetObject("settings"); + var fav=settings_file.iniGetObject("favorites"); + settings=new Settings(set); + favorites=new Favorites(fav); + settings_file.close(); + } } - init(); shell(); \ No newline at end of file diff --git a/exec/load/cshell_menu.js b/exec/load/cshell_menu.js index 3f4189391c15dc9978b1dd1d597ab13a20f7a3f9..d6d10d8143bddd65012b1922c9af39472662ce23 100644 --- a/exec/load/cshell_menu.js +++ b/exec/load/cshell_menu.js @@ -1,83 +1,6 @@ -/* MAIN MENU OBJECT */ -function Menu_bottom(items,x,y) -{ - this.items=items; - this.x=x; - this.y=y; - - this.disable=function(item) - { - this.items[item].enabled=false; - } - this.enable=function(item) - { - this.items[item].enabled=true; - } - this.clear=function() - { - console.gotoxy(this); - console.cleartoeol(settings.shell_bg); - } - this.draw=function() - { - console.gotoxy(this); - console.pushxy(); - console.cleartoeol(settings.shell_bg); - console.popxy(); - for(var i in this.items) { - if(this.items[i].enabled==true) { - var hc=settings.main_hkey_color; - var tc=settings.main_text_color; - var bg=settings.shell_bg; - - var item=this.items[i]; - for(var c=0;c<item.text.length;c++) { - if(item.text[c]=="|") { - console.attributes=bg + hc; - c++; - } else { - console.attributes=bg + tc; - } - console.write(item.text[c]); - } - console.write(" "); - } - } - console.attributes=ANSI_NORMAL; - } -} - -/* SIDE MENU OBJECTS */ -function Menu_sidebar() -{ - this.lpadding=""; - this.rpadding=""; - this.fg=settings.menu_fg; - this.bg=settings.menu_bg; - this.hfg=settings.menu_hfg; - this.hbg=settings.menu_hbg; - this.width=settings.menu_width; - this.xpos=settings.menu_x; - this.ypos=settings.menu_y; - this.hotkeys= - KEY_LEFT - +KEY_RIGHT - +KEY_UP - +KEY_DOWN - +"\b\x7f\x1b<>Q" - +ctrl('O') - +ctrl('U') - +ctrl('T') - +ctrl('K') - +ctrl('P'); - for(var i in bottom.menu.items) { - this.hotkeys+=i; - } - this.addcmd=Item_addcmd; -} - -function Menu_main() -{ +/* MENU OBJECTS */ +menuobj=[]; +menuobj["main"]=function() { this.title="MAIN"; this.items=new Array(); this.addcmd("Files","F",user.compare_ars("REST T")); @@ -87,23 +10,55 @@ function Menu_main() this.addcmd("Settings","S"); this.addcmd("Externals","X",user.compare_ars("REST X")); this.addcmd("View","V"); + this.node_action=NODE_MAIN; set_hotkeys(this); fill_menu(this); } -function Menu_favorites() -{ +menuobj["favorites"]=function() { this.title="FAVORITES"; this.items=new Array(); - this.addcmd("Add Favorite","+",true); + this.addcmd(" type +/- from any menu",undefined,true); + this.addcmd(" to add/remove favorites",undefined,true); + this.addcmd("",undefined,true); + for (var f=0;f<favorites.items.length;f++) { + if(favorites.items[f].itemID >= 0) { + this.addcmd(favorites.items[f].itemTitle,f); + } + else this.addcmd(favorites.items[f].menuTitle,f); + } set_hotkeys(this); fill_menu(this); + this.node_action=NODE_MAIN; } -function Menu_file() -{ - this.title="FILES"; +menuobj["delfavorite"]=function() { + this.title="EDIT FAVORITES"; this.items=new Array(); - this.addcmd("[" + file_area.lib_list[bbs.curlib].dir_list[bbs.curdir].name.toUpperCase() + "]",undefined,true); + this.addcmd(" choose item to remove",undefined,true); + this.addcmd(" from your favorites",undefined,true); this.addcmd("",undefined,true); + for (var f=0;f<favorites.items.length;f++) { + if(favorites.items[f].itemID >= 0) { + this.addcmd(favorites.items[f].itemTitle,f); + } + else this.addcmd(favorites.items[f].menuTitle,f); + } + set_hotkeys(this); + fill_menu(this); +} +menuobj["addfavorite"]=function() { + this.title="ADD FAVORITE"; + this.items=new Array(); + this.addcmd("Add Menu","M"); + this.addcmd(favorites.mt,undefined,true); + this.addcmd("",undefined,true); + this.addcmd("Add Program","P"); + this.addcmd(favorites.it,undefined,true); + set_hotkeys(this); + fill_menu(this); +} +menuobj["file"]=function() { + this.title="FILES"; + this.items=new Array(); this.addcmd("Change Directory","C"); this.addcmd("List Files","L"); this.addcmd("Scan for New Files","N"); @@ -126,32 +81,29 @@ function Menu_file() this.addcmd("Settings","S"); set_hotkeys(this); fill_menu(this); + this.node_action=NODE_XFER; } -function Menu_filedir(changenewscan) -{ +menuobj["filedir"]=function() { this.title="FILES"; this.items=new Array(); - this.addcmd("[" + file_area.lib_list[bbs.curlib].dir_list[bbs.curdir].name.toUpperCase()+"]",undefined,true); - this.addcmd("",undefined,true); this.addcmd("All File Areas","A"); this.addcmd("Library","L"); this.addcmd("Directory","D"); - if(changenewscan) - this.addcmd("Chg New Scan Date","N"); + this.addcmd("Chg New Scan Date","N"); set_hotkeys(this); fill_menu(this); + this.node_action=NODE_XFER; } -function Menu_settings() -{ +menuobj["settings"]=function() { this.title="SETTINGS"; this.items=new Array(); this.addcmd("User Configuration","U"); this.addcmd("Minute Bank","B"); set_hotkeys(this); fill_menu(this); + this.node_action=NODE_DFLT; } -function Menu_email() -{ +menuobj["email"]=function() { this.title="E-MAIL"; this.items=new Array(); this.addcmd("Send Mail","S"); @@ -160,12 +112,9 @@ function Menu_email() set_hotkeys(this); fill_menu(this); } -function Menu_message() -{ +menuobj["message"]=function() { this.title="MESSAGES : " + msg_area.grp_list[bbs.curgrp].name.toUpperCase(); this.items=new Array(); - this.addcmd("[" + msg_area.grp_list[bbs.curgrp].sub_list[bbs.cursub].name.toUpperCase()+"]",undefined,true); - this.addcmd("",undefined,true); this.addcmd("Change Sub","C"); this.addcmd("Read Messages","R"); this.addcmd("Scan New Messages","N"); @@ -180,8 +129,7 @@ function Menu_message() set_hotkeys(this); fill_menu(this); } -function Menu_chat() -{ +menuobj["chat"]=function() { this.title="CHAT"; this.items=new Array(); this.addcmd("Multinode Chat","M"); @@ -194,27 +142,27 @@ function Menu_chat() this.addcmd("Settings","S"); set_hotkeys(this); fill_menu(this); + this.node_action=NODE_CHAT; } -function Menu_xtrnsecs() -{ - this.title="GAMES"; +menuobj["xtrnsecs"]=function() { + this.title="EXTERNAL PROGRAMS"; this.items=new Array(); for(j=0; j<xtrn_area.sec_list.length; j++) this.addcmd(xtrn_area.sec_list[j].name,j.toString()); set_hotkeys(this); fill_menu(this); + this.node_action=NODE_XTRN; } -function Menu_xtrnsec(sec) -{ - this.title="GAMES : " + xtrn_area.sec_list[sec].name; +menuobj["xtrnsec"]=function() { + this.title="XTRN : " + xtrn_area.sec_list[left.xtrnsec].name; this.items=new Array(); - for(j=0; j<xtrn_area.sec_list[sec].prog_list.length && j<console.screen_rows-3; j++) - this.addcmd(xtrn_area.sec_list[sec].prog_list[j].name,j.toString()); + for(j=0; j<xtrn_area.sec_list[left.xtrnsec].prog_list.length && j<console.screen_rows-3; j++) + this.addcmd(xtrn_area.sec_list[left.xtrnsec].prog_list[j].name,j.toString()); set_hotkeys(this); fill_menu(this); + this.node_action=NODE_XTRN; } -function Menu_info() -{ +menuobj["info"]=function() { this.title="INFO"; this.items=new Array(); this.addcmd("System Info","I"); @@ -226,8 +174,7 @@ function Menu_info() set_hotkeys(this); fill_menu(this); } -function Menu_userlist() -{ +menuobj["userlist"]=function() { this.title="USERS"; this.items=new Array(); this.addcmd("Logons Today","L"); @@ -236,9 +183,9 @@ function Menu_userlist() set_hotkeys(this); fill_menu(this); } -function Menu_emailtarget() -{ +menuobj["emailtarget"]=function() { this.title="E-MAIL"; + this.info=system.text_dir + "cshell/email.ini"; this.items=new Array(); this.addcmd('Sysop','S',user.compare_ars("REST S")); this.addcmd('Local User','L',user.compare_ars("REST E")); @@ -248,8 +195,7 @@ function Menu_emailtarget() set_hotkeys(this); fill_menu(this); } -function Menu_download() -{ +menuobj["download"]=function() { this.title="DOWNLOAD"; this.items=new Array(); this.addcmd('Batch','B',bbs.batch_dnload_total<=0); @@ -257,13 +203,11 @@ function Menu_download() this.addcmd('From User','U'); set_hotkeys(this); fill_menu(this); + this.node_action=NODE_XFER; } -function Menu_upload() -{ +menuobj["upload"]=function() { this.title="UPLOAD"; this.items=new Array(); - this.addcmd("[" + file_area.lib_list[bbs.curlib].dir_list[bbs.curdir].name.toUpperCase()+"]",undefined,true); - this.addcmd("",undefined,true); if(file_area.lib_list[bbs.curlib].dir_list[bbs.curdir].can_upload || file_area.upload_dir==undefined) { this.addcmd('To Current Dir','C',!file_area.lib_list[bbs.curlib].dir_list[bbs.curdir].can_upload); } @@ -274,9 +218,9 @@ function Menu_upload() this.addcmd('To User(s)','U',file_area.user_dir==undefined); set_hotkeys(this); fill_menu(this); + this.node_action=NODE_XFER; } -function Menu_fileinfo() -{ +menuobj["fileinfo"]=function() { this.title="FILES"; this.items=new Array(); this.addcmd('File Contents','C'); @@ -287,23 +231,20 @@ function Menu_fileinfo() this.addcmd('Your File Transfer Statistics','S'); set_hotkeys(this); fill_menu(this); + this.node_action=NODE_XFER; } -function Menu_filesettings(value) -{ - this.current=value; +menuobj["filesettings"]=function() { this.title="FILE SETTINGS"; this.items=new Array(); this.addcmd('Set Batch Flagging '+(user.settings&USER_BATCHFLAG?'Off':'On'),'B'); this.addcmd('Set Extended Descriptions '+(user.settings&USER_EXTDESC?'Off':'On'),'S'); set_hotkeys(this); fill_menu(this); + this.node_action=NODE_DFLT; } -function Menu_newmsgscan() -{ +menuobj["newmsgscan"]=function() { this.title="MESSAGE SCAN"; this.items=new Array(); - this.addcmd("[" + msg_area.grp_list[bbs.curgrp].sub_list[bbs.cursub].name.toUpperCase()+"]",undefined,true); - this.addcmd("",undefined,true); this.addcmd('All Message Areas','A'); this.addcmd("Current Group",'G'); this.addcmd('Current Sub','S'); @@ -313,12 +254,9 @@ function Menu_newmsgscan() set_hotkeys(this); fill_menu(this); } -function Menu_yourmsgscan() -{ +menuobj["yourmsgscan"]=function() { this.title="MESSAGE SCAN"; this.items=new Array(); - this.addcmd("[" + msg_area.grp_list[bbs.curgrp].sub_list[bbs.cursub].name.toUpperCase()+"]",undefined,true); - this.addcmd("",undefined,true); this.addcmd('All Message Areas','A'); this.addcmd("Current Group",'G'); this.addcmd('Current Sub','S'); @@ -326,20 +264,16 @@ function Menu_yourmsgscan() set_hotkeys(this); fill_menu(this); } -function Menu_searchmsgtxt() -{ +menuobj["searchmsgtxt"]=function() { this.title="MESSAGE SCAN"; this.items=new Array(); - this.addcmd("[" + msg_area.grp_list[bbs.curgrp].sub_list[bbs.cursub].name.toUpperCase()+"]",undefined,true); - this.addcmd("",undefined,true); this.addcmd('All Message Areas','A'); this.addcmd("Current Group",'G'); this.addcmd('Current Sub','S'); set_hotkeys(this); fill_menu(this); } -function Menu_chatsettings() -{ +menuobj["chatsettings"]=function() { this.title="CHAT SETTINGS"; this.items=new Array(); this.addcmd("Set Split Screen "+(user.chat_settings&CHAT_SPLITP?"Off":"On"),'S'); @@ -347,11 +281,12 @@ function Menu_chatsettings() this.addcmd("Set Alerts "+(user.chat_settings&CHAT_NOACT?"On":"Off"),'A'); set_hotkeys(this); fill_menu(this); + this.node_action=NODE_DFLT; } /* MENU COMMANDS */ -function do_mainmenu(key) -{ +var menucmd=[]; +menucmd["main"]=function(key) { switch(key) { case 'F': this.loadMenu("file"); @@ -376,16 +311,54 @@ function do_mainmenu(key) break; } } -function do_favorites(key) -{ - switch(key) { - case '+': - add_favorite(); - break; +menucmd["favorites"]=function(key) { + var fav=favorites.items[key]; + if(fav) { + this.xtrnsec=fav.xtrnsec; + this.loadMenu(fav.menuID); + if(fav.itemID >= 0) { + key=this.menu.items[fav.itemID].id; + this.process(key); + } } } -function do_infomenu(key) -{ +menucmd["addfavorite"]=function(key) { + if(favorites.mi == "favorites") { + /* dont allow favorites of favorites */ + return false; + } + var index=favorites.length; + + if(key == 'M') { + favorites.items.push(new Favorite( + favorites.mi, + favorites.mt, + undefined, + undefined, + this.xtrnsec + )); + } else if(key == 'P') { + favorites.items.push(new Favorite( + favorites.mi, + favorites.mt, + favorites.ii, + favorites.it, + this.xtrnsec + )); + } + + saveSettings(); + this.loadMenu("favorites"); +} +menucmd["delfavorite"]=function(key) { + var fav=favorites.items[key]; + if(fav) { + favorites.items.splice(key,1); + } + saveSettings(); + this.loadMenu("favorites"); +} +menucmd["info"]=function(key) { switch(key) { case 'I': @@ -422,8 +395,7 @@ function do_infomenu(key) break; } } -function do_userlistmenu(key) -{ +menucmd["userlist"]=function(key) { switch(key) { case 'L': @@ -446,21 +418,18 @@ function do_userlistmenu(key) break; } } -function do_xtrnsecs(key) -{ - this.curr_xtrnsec=Number(key); - this.loadMenu("xtrnsec",this.curr_xtrnsec); +menucmd["xtrnsecs"]=function(key) { + this.xtrnsec=Number(key); + this.loadMenu("xtrnsec"); } -function do_xtrnsec(key) -{ +menucmd["xtrnsec"]=function(key) { clear_screen(); var current_passthru=console.ctrlkey_passthru; - bbs.exec_xtrn(xtrn_area.sec_list[this.curr_xtrnsec].prog_list[Number(key)].number); + bbs.exec_xtrn(xtrn_area.sec_list[this.xtrnsec].prog_list[Number(key)].number); console.ctrlkey_passthru=current_passthru; full_redraw=true; } -function do_filemenu(key) -{ +menucmd["file"]=function(key) { var i; var j; switch(key) @@ -540,13 +509,16 @@ function do_filemenu(key) this.redraw(); break; case 'N': - this.loadMenu("newfiles",true); + this.loadMenu("filedir"); + this.process=menucmd["scannewfile"]; break; case 'F': - this.loadMenu("searchfilenames",true); + this.loadMenu("filedir"); + this.process=menucmd["scanfilenames"]; break; case 'T': - this.loadMenu("searchfiledesc",true); + this.loadMenu("filedir"); + this.process=menucmd["scanfiledesc"]; break; case 'D': this.loadMenu("download"); @@ -597,14 +569,13 @@ function do_filemenu(key) this.loadMenu("fileinfo"); break; case 'S': - this.loadMenu("filesettings",cur); + this.loadMenu("filesettings"); break; default: break; } } -function do_fileinfo(key) -{ +menucmd["fileinfo"]=function(key) { switch(key) { case 'C': @@ -691,8 +662,7 @@ function do_fileinfo(key) break; } } -function do_filedirmenu1(key) -{ +menucmd["scannewfile"]=function(key) { switch(key) { case 'A': @@ -730,8 +700,7 @@ function do_filedirmenu1(key) break; } } -function do_filedirmenu2(key) -{ +menucmd["scanfilenames"]=function(key) { switch(key) { case 'A': @@ -769,8 +738,7 @@ function do_filedirmenu2(key) break; } } -function do_filedirmenu3(key) -{ +menucmd["scanfiledesc"]=function(key) { switch(key) { case 'A': @@ -811,8 +779,7 @@ function do_filedirmenu3(key) break; } } -function do_uploadmenu(key) -{ +menucmd["upload"]=function(key) { switch(key) { case 'C': // Current dir clear_screen(); @@ -838,8 +805,7 @@ function do_uploadmenu(key) break; } } -function do_downloadmenu(key) -{ +menucmd["download"]=function(key) { switch(key) { case 'B': @@ -863,8 +829,7 @@ function do_downloadmenu(key) break } } -function do_filesettings(key) -{ +menucmd["filesettings"]=function(key) { switch(key) { case 'B': @@ -878,8 +843,7 @@ function do_filesettings(key) break; } } -function do_messagemenu(key) -{ +menucmd["message"]=function(key) { var i; var j; message: @@ -998,8 +962,7 @@ function do_messagemenu(key) break; } } -function do_searchmsgtxt(key) -{ +menucmd["searchmsgtxt"]=function(key) { switch(key) { case 'A': @@ -1034,8 +997,7 @@ function do_searchmsgtxt(key) break; } } -function do_scantoyou(key) -{ +menucmd["yourmsgscan"]=function(key) { switch(key) { case 'A': @@ -1070,8 +1032,7 @@ function do_scantoyou(key) break; } } -function do_newscan(key) -{ +menucmd["newmsgscan"]=function(key) { switch(key) { case 'A': @@ -1114,8 +1075,7 @@ function do_newscan(key) break; } } -function do_emailtargetmenu(key) -{ +menucmd["emailtarget"]=function(key) { switch(key) { case 'S': @@ -1173,8 +1133,7 @@ function do_emailtargetmenu(key) break; } } -function do_emailmenu(key) -{ +menucmd["email"]=function(key) { var cur=1; this.menu.current=cur; var i; @@ -1199,8 +1158,7 @@ function do_emailmenu(key) } cur=this.menu.current; } -function do_chatmenu(key) -{ +menucmd["chat"]=function(key) { var cur=1; this.menu.current=cur; var i; @@ -1255,8 +1213,7 @@ function do_chatmenu(key) } cur=this.menu.current; } -function do_chatsettings(key) -{ +menucmd["chatsettings"]=function(key) { switch(key) { case 'S': @@ -1274,8 +1231,7 @@ function do_chatsettings(key) break; } } -function do_settingsmenu(key) -{ +menucmd["settings"]=function(key) { switch(key) { case 'U': @@ -1295,84 +1251,93 @@ function do_settingsmenu(key) } } -/* MENU FUNCTIONS */ -function Item_addcmd(text,id,disabled) -{ - this.add(text,undefined,settings.menu_width,undefined,undefined,disabled); - this.items[this.items.length-1].id=id; +/* MENU INFO */ +var menuinfo=[]; +menuinfo["main"]=function() { + var wp=directory(system.text_dir + "cshell/mainmenu.*.bin")[0]; + if(wp) { + center.loadWallPaper(wp); + center.redraw(); + } } -function set_hotkeys(lb) -{ - /* USE FIRST AVAILABLE HOTKEY AS TRIGGER */ - /* RETURN VALUE = ITEM INDEX FOR MENU COMMAND REFERENCE */ - var hotkeys="1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ"; - var index=0; - for(var i=0;i<lb.items.length;i++) { - if(lb.items[i].disabled) continue; - - while(bottom.menu.items[hotkeys[index]]) index++; - lb.items[i].text="|" + hotkeys[index++] + " " + lb.items[i].text; - lb.items[i].retval=i; +menuinfo["xtrnsec"]=function() { + center.clear(); + if(!xtrn_area.sec_list[left.xtrnsec].prog_list[left.menu.current]) return false; + var wp=directory(system.text_dir + "cshell/xtrn/" + + xtrn_area.sec_list[left.xtrnsec].prog_list[left.menu.current].code + ".*.bin")[0]; + if(wp) { + center.loadWallPaper(wp); + center.redraw(); } } -function fill_menu(lb) -{ - if(left.previous.length) offset=5; - else offset=4; - - while(lb.items.length<settings.main_height-offset) - { - lb.add("","",settings.menu_width,undefined,undefined,true); +menuinfo["xtrnsecs"]=function() { + center.clear(); + if(!xtrn_area.sec_list[left.xtrnsec]) return false; + var wp=directory(system.text_dir + "cshell/xtrn/" + + xtrn_area.sec_list[left.xtrnsec].code + ".*.bin")[0]; + if(wp) { + center.loadWallPaper(wp); + center.redraw(); } - - if(left.previous.length) lb.add(format_opt("Previous Menu",settings.menu_width,-1),KEY_LEFT,settings.menu_width); - lb.add(format_opt("Main Menu",settings.menu_width,0),KEY_RIGHT,settings.menu_width); } -function format_opt(str, width, expand) -{ - var spaces80=" "; - if(expand == -1) { - opt='|< '; - var cleaned=str; - cleaned=cleaned.replace(/\|/g,''); - opt+=str+spaces80.substr(0,width-cleaned.length-2); - return opt; - } else if(expand == 0) { - opt=str; - var cleaned=opt; - cleaned=cleaned.replace(/\|/g,''); - opt+=spaces80.substr(0,width-cleaned.length-2); - opt+=' |>'; - return opt; - } else if(expand == 1) { - opt=str; - var cleaned=opt; - cleaned=cleaned.replace(/\|/g,''); - opt+=spaces80.substr(0,width-cleaned.length-2); - opt+=' |+'; - return opt; +menuinfo["message"]=function() { + var wp=directory(system.text_dir + "cshell/message.*.bin")[0]; + if(wp) { + center.loadWallPaper(wp); + center.redraw(); + return; } - return(str); + var posx=center.chat.chatroom.x+1; + var posy=center.chat.chatroom.y-2; + setPosition(posx,posy); + displayInfo("\1n\1gGROUP\1h:\1n " + msg_area.grp_list[bbs.curgrp].name); + displayInfo("\1n\1gSUB \1h:\1n " + msg_area.grp_list[bbs.curgrp].sub_list[bbs.cursub].name); } -function todo_getfiles(lib, dir) -{ - var path=format("%s%s.ixb", file_area.lib_list[lib].dir_list[dir].data_dir, file_area.lib_list[lib].dir_list[dir].code); - return(file_size(path)/22); /* F_IXBSIZE */ +menuinfo["chat"]=function() { + var wp=directory(system.text_dir + "cshell/chat.*.bin")[0]; + if(wp) { + center.loadWallPaper(wp); + center.redraw(); + return; + } + var posx=center.chat.chatroom.x+1; + var posy=center.chat.chatroom.y-2; + setPosition(posx,posy); + displayInfo("\1n\1gChat Handle\1h:\1n " + user.handle); } -function clear_screen() -{ - /* - * Called whenever a command needs to exit the menu for user interaction. - * - * If you'd like a header before non-menu stuff, this is the place to put - * it. - */ - - bbs.sys_status&=~SS_MOFF; - bbs.sys_status&=~SS_PAUSEOFF; - console.clear(ANSI_NORMAL); - - /* We are going to a line-mode thing... re-enable CTRL keys. */ +menuinfo["file"]=function() { + var wp=directory(system.text_dir + "cshell/file.*.bin")[0]; + if(wp) { + center.loadWallPaper(wp); + center.redraw(); + return; + } + var posx=center.chat.chatroom.x+1; + var posy=center.chat.chatroom.y-2; + setPosition(posx,posy); + displayInfo("\1n\1gLIB \1h:\1n " + file_area.lib_list[bbs.curlib].description); + displayInfo("\1n\1gDIR \1h:\1n " + file_area.lib_list[bbs.curlib].dir_list[bbs.curdir].description); +} +menuinfo["email"]=function() { + var wp=directory(system.text_dir + "cshell/email.*.bin")[0]; + if(wp) { + center.loadWallPaper(wp); + center.redraw(); + return; + } + var posx=center.chat.chatroom.x+1; + var posy=center.chat.chatroom.y-2; + setPosition(posx,posy); + displayInfo("\1n\1gMessages sent\1h:\1n " + user.stats.total_emails); + displayInfo("\1n\1gNew Messages\1h:\1n " + user.stats.mail_waiting); +} +menuinfo["userlist"]=function() { + var wp=directory(system.text_dir + "cshell/userlist.*.bin")[0]; + if(wp) { + center.loadWallPaper(wp); + center.redraw(); + return; + } } diff --git a/exec/load/cshell_obj.js b/exec/load/cshell_obj.js index 269f5580ba553942f4c1c52df52937005a7ad9cd..0a843c37d1d7b0c66075eea121021de7b81cd672 100644 --- a/exec/load/cshell_obj.js +++ b/exec/load/cshell_obj.js @@ -1,5 +1,5 @@ /* MAIN MENU */ -function MainMenu() +function BottomLine() { this.x=1; this.y=console.screen_rows; @@ -17,7 +17,7 @@ function MainMenu() menu_items["V"]=new Shortcut("Fa|vorites","menu","favorites"); menu_items["S"]=new Shortcut("|Settings","menu","settings"); menu_items["L"]=new Shortcut("|Logoff","logoff",""); - this.menu=new Menu_bottom(menu_items,9,console.screen_rows); + this.menu=new MainMenu(menu_items,9,console.screen_rows); } this.restore=function() { @@ -41,6 +41,59 @@ function MainMenu() } } +function MainMenu(items,x,y) +{ + this.items=items; + this.x=x; + this.y=y; + + this.disable=function(item) + { + this.items[item].enabled=false; + } + this.enable=function(item) + { + this.items[item].enabled=true; + } + this.clear=function() + { + console.gotoxy(this); + console.cleartoeol(settings.shell_bg); + } + this.draw=function() + { + console.gotoxy(this); + console.pushxy(); + console.cleartoeol(settings.shell_bg); + console.popxy(); + for(var i in this.items) { + if(this.items[i].enabled==true) { + var hc=settings.main_hkey_color; + var tc=settings.main_text_color; + var bg=settings.shell_bg; + + var item=this.items[i]; + for(var c=0;c<item.text.length;c++) { + if(item.text[c]=="|") { + console.attributes=bg + hc; + c++; + } else { + console.attributes=bg + tc; + } + console.write(item.text[c]); + } + console.write(" "); + } + } + console.attributes=ANSI_NORMAL; + } +} +function CommandList() +{ + this["menu"]=loadMenu; + this["chat"]=chatInput; + this["logoff"]=logoff; +} function Shortcut() { this.enabled=true; @@ -58,25 +111,36 @@ function Shortcut() function RightWindow() { this.clock=new DigitalClock(); - this.graphic; - this.x=console.screen_columns-18; + this.width=18; + this.logo=new Graphic(this.width-2,10); + this.alerts=[]; + this.update=true; + + this.x=console.screen_columns-this.width; this.y=2; this.init=function() { this.clock.init(this.x,this.y+10,LIGHTBLUE); - this.graphic=new Graphic(16,10); - this.graphic.load(system.text_dir + "cshell/logo.16x10.bin"); + this.logo.load(system.text_dir + "cshell/logo.16x10.bin"); } this.redraw=function() { - drawSeparator(console.screen_columns-18,2,console.screen_rows-2); + drawSeparator(console.screen_columns-this.width,2,console.screen_rows-2); this.clock.update(true); - this.graphic.draw(this.x+1,this.y); + this.logo.draw(this.x+1,this.y); + this.drawAlerts(); } this.cycle=function() { this.clock.update(); + if(this.update) { + this.drawAlerts(); + } + } + this.drawAlerts=function() + { + this.update=false; } } @@ -84,7 +148,8 @@ function RightWindow() function MainWindow() { this.in_chat=false; - this.wallpaper=false; + this.wp=false; + this.wp_shown=true; this.chat=new ChatEngine(root); this.init=function() @@ -92,7 +157,7 @@ function MainWindow() this.chat.init(settings.main_width,settings.main_height-3,2,5); this.chat.input_line.init(9,console.screen_rows,console.screen_columns-9,"\0017","\1k"); this.chat.joinChan("BBS MAIN",user.alias,user.name); - this.loadWallPaper(system.text_dir + "cshell/main.*.bin"); + this.loadWallPaper(directory(system.text_dir + "cshell/main.*.bin")[0]); this.chat.chatroom.active=false; } this.drawTitle=function() @@ -112,21 +177,31 @@ function MainWindow() this.chat.input_line.toggle(); this.drawTitle(); } + this.clear=function() + { + var posx=center.chat.chatroom.x; + var posy=center.chat.chatroom.y-3; + clearBlock(posx,posy,center.chat.chatroom.columns,center.chat.chatroom.rows+3); + this.wp=false; + this.wp_shown=false; + } this.cycle=function() { this.chat.cycle(); } this.restore=function() { - this.loadWallPaper(system.text_dir + "cshell/main.*.bin"); + this.loadWallPaper(directory(system.text_dir + "cshell/main.*.bin")[0]); this.redraw(); } this.redraw=function() { if(this.in_chat) { this.drawChat(); - } else { + } else if(this.wp) { this.drawWallPaper(); + } else { + this.clear(); } } @@ -137,23 +212,35 @@ function MainWindow() } this.loadWallPaper=function(file) { - file=directory(file); - var width=0; - var height=0; - if(file.length) { - var size=file_getname(file[0]).split(".")[1].split("x"); - width=Number(size[0]); - height=Number(size[1]); + var width=this.chat.chatroom.columns; + var height=this.chat.chatroom.rows+3; + if(file_exists(file)) { + var size=file_getname(file).split(".")[1].split("x"); + if(size[0]) width=Number(size[0]); + if(size[1]) height=Number(size[1]); } - this.wallpaper=new Graphic(width,height); - this.wallpaper.load(file); + this.wp=new Graphic(width,height); + this.wp.load(file); } this.drawWallPaper=function() { - this.wallpaper.draw(this.chat.chatroom.x,this.chat.chatroom.y-3); + var posx=this.chat.chatroom.x; + var posy=this.chat.chatroom.y-3; + var gapx=this.chat.chatroom.columns-this.wp.width; + var gapy=(this.chat.chatroom.rows+3)-this.wp.height; + if(gapx != 0 || gapy != 0) { + posx+=parseInt(gapx/2,10); + posy+=parseInt(gapy/2,10); + } + if(this.wp.width > this.chat.chatroom.columns || + this.wp.height > this.chat.chatroom.rows+3) return false; + this.wp.draw(posx,posy); + this.wp_shown=true; } } -function SideMenu() + +/* SIDE MENU */ +function LeftWindow() { var msg_rows=0; var msg_timeouts=new Array(); @@ -166,35 +253,38 @@ function SideMenu() this.title_shown=false; this.previous=[]; - this.curr_xtrnsec=0; + this.xtrnsec=0; this.currentmenu; this.menu; this.process; this.init=function() { - Menu_sidebar.prototype=new Lightbar; - Menu_main.prototype=new Menu_sidebar; - Menu_file.prototype=new Menu_sidebar; - Menu_filedir.prototype=new Menu_sidebar; - Menu_settings.prototype=new Menu_sidebar; - Menu_email.prototype=new Menu_sidebar; - Menu_message.prototype=new Menu_sidebar; - Menu_chat.prototype=new Menu_sidebar; - Menu_xtrnsecs.prototype=new Menu_sidebar; - Menu_xtrnsec.prototype=new Menu_sidebar; - Menu_info.prototype=new Menu_sidebar; - Menu_userlist.prototype=new Menu_sidebar; - Menu_emailtarget.prototype=new Menu_sidebar; - Menu_download.prototype=new Menu_sidebar; - Menu_upload.prototype=new Menu_sidebar; - Menu_fileinfo.prototype=new Menu_sidebar; - Menu_filesettings.prototype=new Menu_sidebar; - Menu_newmsgscan.prototype=new Menu_sidebar; - Menu_yourmsgscan.prototype=new Menu_sidebar; - Menu_searchmsgtxt.prototype=new Menu_sidebar; - Menu_chatsettings.prototype=new Menu_sidebar; - Menu_favorites.prototype=new Menu_sidebar; + SideBar.prototype=new Lightbar; + + menuobj["main"].prototype=new SideBar; + menuobj["file"].prototype=new SideBar; + menuobj["filedir"].prototype=new SideBar; + menuobj["settings"].prototype=new SideBar; + menuobj["email"].prototype=new SideBar; + menuobj["message"].prototype=new SideBar; + menuobj["chat"].prototype=new SideBar; + menuobj["xtrnsecs"].prototype=new SideBar; + menuobj["xtrnsec"].prototype=new SideBar; + menuobj["info"].prototype=new SideBar; + menuobj["userlist"].prototype=new SideBar; + menuobj["emailtarget"].prototype=new SideBar; + menuobj["download"].prototype=new SideBar; + menuobj["upload"].prototype=new SideBar; + menuobj["fileinfo"].prototype=new SideBar; + menuobj["filesettings"].prototype=new SideBar; + menuobj["newmsgscan"].prototype=new SideBar; + menuobj["yourmsgscan"].prototype=new SideBar; + menuobj["searchmsgtxt"].prototype=new SideBar; + menuobj["chatsettings"].prototype=new SideBar; + menuobj["favorites"].prototype=new SideBar; + menuobj["addfavorite"].prototype=new SideBar; + menuobj["delfavorite"].prototype=new SideBar; } this.cycle=function() { @@ -226,145 +316,49 @@ function SideMenu() this.loadMenu(this.previous.pop()); } } - this.loadMenu=function(name,value) + this.loadMenu=function() { if(this.currentmenu) { - if(this.currentmenu==name) return false; + if(this.currentmenu==arguments[0]) return false; this.previous.push(this.currentmenu); } - this.currentmenu=name; - switch(name) - { - case "main": - this.menu=new Menu_main; - this.process=do_mainmenu; - bbs.node_action=NODE_MAIN; - break; - case "favorites": - this.menu=new Menu_favorites; - this.process=do_favorites; - break; - case "xtrnsecs": - this.menu=new Menu_xtrnsecs; - this.process=do_xtrnsecs; - bbs.node_action=NODE_XTRN; - break; - case "xtrnsec": - this.menu=new Menu_xtrnsec(value); - this.process=do_xtrnsec; - bbs.node_action=NODE_XTRN; - break; - case "file": - this.menu=new Menu_file; - this.process=do_filemenu; - bbs.node_action=NODE_XFER; - center.loadWallPaper(system.text_dir + "cshell/file.*.bin"); - break; - case "message": - this.menu=new Menu_message; - this.process=do_messagemenu; - center.loadWallPaper(system.text_dir + "cshell/message.*.bin"); - break; - case "chat": - this.menu=new Menu_chat; - this.process=do_chatmenu; - bbs.node_action=NODE_CHAT; - center.loadWallPaper(system.text_dir + "cshell/chat.*.bin"); - break; - case "email": - this.menu=new Menu_email; - this.process=do_emailmenu; - center.loadWallPaper(system.text_dir + "cshell/email.*.bin"); - break; - case "emailtarget": - this.menu=new Menu_emailtarget; - this.process=do_emailtargetmenu; - center.loadWallPaper(system.text_dir + "cshell/email.*.bin"); - break; - case "fileinfo": - this.menu=new Menu_fileinfo; - this.process=do_fileinfo; - bbs.node_action=NODE_XFER; - center.loadWallPaper(system.text_dir + "cshell/file.*.bin"); - break; - case "settings": - this.menu=new Menu_settings; - this.process=do_settingsmenu; - bbs.node_action=NODE_DFLT; - center.loadWallPaper(system.text_dir + "cshell/settings.*.bin"); - break; - case "filedir": - this.menu=new Menu_filedir(value); - this.process=do_filedirmenu; - bbs.node_action=NODE_XFER; - center.loadWallPaper(system.text_dir + "cshell/file.*.bin"); - break; - case "info": - this.menu=new Menu_info; - this.process=do_infomenu; - center.loadWallPaper(system.text_dir + "cshell/info.*.bin"); - break; - case "userlist": - this.menu=new Menu_userlist; - this.process=do_userlistmenu; - center.loadWallPaper(system.text_dir + "cshell/userlist.*.bin"); - break; - case "fileinfo": - this.menu=new Menu_fileinfo; - this.process=do_fileinfo; - center.loadWallPaper(system.text_dir + "cshell/file.*.bin"); - break; - case "chatsettings": - this.menu=new Menu_chatsettings; - this.process=do_chatsettings; - center.loadWallPaper(system.text_dir + "cshell/chat.*.bin"); - break; - case "searchmsgtxt": - this.menu=new Menu_searchmsgtxt; - this.process=do_searchmsgtxt; - center.loadWallPaper(system.text_dir + "cshell/message.*.bin"); - break; - case "scantoyou": - this.menu=new Menu_yourmsgscan; - this.process=do_scantoyou; - center.loadWallPaper(system.text_dir + "cshell/message.*.bin"); - break; - case "newscan": - this.menu=new Menu_newmsgscan; - this.process=do_newscan; - center.loadWallPaper(system.text_dir + "cshell/message.*.bin"); - break; - case "download": - this.menu=new Menu_download; - this.process=do_downloadmenu; - center.loadWallPaper(system.text_dir + "cshell/file.*.bin"); - break; - case "filesettings": - this.menu=new Menu_filesettings(value); - this.process=do_filesettings; - center.loadWallPaper(system.text_dir + "cshell/file.*.bin"); - break; - case "upload": - this.menu=new Menu_upload; - this.process=do_uploadmenu; - center.loadWallPaper(system.text_dir + "cshell/file.*.bin"); - break; - default: - log("menu not found: " + name); - return false; + this.currentmenu=arguments[0]; + this.process=menucmd[arguments[0]]; + this.menu=new menuobj[arguments[0]]; + if(this.menu.no_action) { + bbs.node_action=this.menu.node_action; } this.title_shown=false; + if(center.wp_shown) center.clear(); } - } - -/* SHORTCUT COMMAND FUNCTIONS */ -function CommandList() +function SideBar() { - this["menu"]=loadMenu; - this["chat"]=chatInput; - this["xtrn"]=loadXtrn; - this["logoff"]=logoff; + this.lpadding=""; + this.rpadding=""; + this.fg=settings.menu_fg; + this.bg=settings.menu_bg; + this.hfg=settings.menu_hfg; + this.hbg=settings.menu_hbg; + this.width=settings.menu_width; + this.xpos=settings.menu_x; + this.ypos=settings.menu_y; + this.hotkeys= + KEY_LEFT + +KEY_RIGHT + +KEY_UP + +KEY_DOWN + +"\b\x7f\x1b<>Q+-" + +ctrl('O') + +ctrl('U') + +ctrl('T') + +ctrl('K') + +ctrl('P'); + for(var i in bottom.menu.items) { + this.hotkeys+=i; + } + this.addcmd=addcmd; + this.wp_shown=false; } /* DEFAULT USER SETTINGS */ @@ -397,10 +391,24 @@ function Settings(list) } function Favorites(list) { + this.items=[]; + for(var s in list) { - var hkey=getHotkey(s); var parameters=list[s].split(","); - this[hkey]=new Shortcut(s,parameters.shift()); - this[hkey].parameters=parameters; + var menuID=parameters.shift(); + var menuTitle=parameters.shift(); + var itemID=parameters.shift(); + var itemTitle=parameters.shift(); + var xtrnsec=parameters.shift(); + + this.items.push(new Favorite(menuID,menuTitle,itemID,itemTitle,xtrnsec)); } } +function Favorite(menuID,menuTitle,itemID,itemTitle,xtrnsec) +{ + this.menuID=menuID; + this.menuTitle=menuTitle; + this.itemID=itemID; + this.itemTitle=itemTitle; + this.xtrnsec=xtrnsec; +}