diff --git a/exec/cshell.js b/exec/cshell.js index 3b9c73a52f3a43286b847d584ff33e81be4a241c..f6d55e5c95cdd0b1129502597402764f2bb84b5e 100644 --- a/exec/cshell.js +++ b/exec/cshell.js @@ -83,7 +83,6 @@ function shell() { while(1) { cycle(); - var cmd=""; if(left.menu) { cmd=left.menu.getval(); @@ -186,9 +185,44 @@ function shell() } function cycle() { + /* Update node action */ + if(bbs.node_action != system.node_list[bbs.node_num-1].action) + system.node_list[bbs.node_num-1].action = bbs.node_action; + + /* Check for messages */ + if(system.node_list[bbs.node_num-1].misc & NODE_MSGW) + right.addNotice(system.get_telegram(user.number)); + if(system.node_list[bbs.node_num-1].misc & NODE_NMSG) + right.addNotice(system.get_node_message(bbs.node_num)); + + /* Fix up node status */ + if(system.node_list[bbs.node_num-1].status==NODE_WFC) { + system.node_list[bbs.node_num-1].status=NODE_INUSE; + } + + /* Check if user data has changed */ + if((system.node_list[bbs.node_num-1].misc & NODE_UDAT) && user.compare_ars("REST NOT G")) { + user.cached=false; + system.node_list[bbs.node_num-1].misc &= ~NODE_UDAT; + } + + /* Interrupted? */ + if(system.node_list[bbs.node_num-1].misc & NODE_INTR) { + bbs.hangup(); + } + + /* Sysop Chat? */ + if(system.node_list[bbs.node_num-1].misc & NODE_LCHAT) { + // TODO: No way of calling bbs.priave_chat(true) + // bbs.private_chat(); + bbs.nodesync(); + full_redraw=true; + } + right.cycle(); center.cycle(); left.cycle(); + if(full_redraw) { redraw(); } @@ -221,6 +255,20 @@ function redraw() full_redraw=false; } +function loadWallPaper(file) +{ + if(!file_exists(file)) return false; + + var width=0; + var height=0; + var size=file_getname(file).split(".")[1].split("x"); + if(size[0]) width=Number(size[0]); + if(size[1]) height=Number(size[1]); + + var wp=new Graphic(width,height); + wp.load(file); + return wp; +} function drawTitle(x,y,str) { console.attributes=BG_LIGHTGRAY + BLACK; @@ -290,10 +338,6 @@ function logoff() } } else bbs.hangup(); } -function loadMenu() -{ - return left.loadMenu.apply(left,arguments); -} function chatInput() { showChat(); @@ -451,6 +495,10 @@ function set_hotkeys(lb) lb.items[i].retval=i; } } +function loadMenu() +{ + return left.loadMenu.apply(left,arguments); +} /* MENU FUNCTIONS */ function format_opt(str, width, expand) diff --git a/exec/load/cshell_menu.js b/exec/load/cshell_menu.js index fd32ea4136c31822e8c7ec9b8ba899716db097c6..02b76e97e0e759c1823f89ac667a1c112f9276bb 100644 --- a/exec/load/cshell_menu.js +++ b/exec/load/cshell_menu.js @@ -300,6 +300,8 @@ menuobj["shellsettings"]=function() { this.addcmd("Remote Chat","cr"); this.addcmd("Global Chat","cg"); this.addcmd("Private Chat","cp"); + this.addcmd("Clock Foreground","cfg"); + this.addcmd("Clock Background","cbg"); this.addcmd("",undefined,true); this.addcmd("Save Settings","s"); set_hotkeys(this); @@ -311,7 +313,7 @@ menuobj["setcolorbg"]=function() { this.items=new Array(); this.addcmd("BLACK","BG_BLACK"); this.addcmd("BLUE","BG_BLUE"); - this.addcmd("GRAY","BG_GRAY"); + this.addcmd("GRAY","BG_LIGHTGRAY"); this.addcmd("GREEN","BG_GREEN"); this.addcmd("BROWN","BG_BROWN"); this.addcmd("RED","BG_RED"); @@ -501,7 +503,6 @@ menucmd["xtrnsecs"]=function(key) { menucmd["xtrnsec"]=function(key) { clear_screen(); bbs.exec_xtrn(xtrn_area.sec_list[this.xtrnsec].prog_list[Number(key)].number); - console.ctrlkey_passthru=console.ctrlkey_passthru; } menucmd["file"]=function(key) { var i; @@ -1383,6 +1384,14 @@ menucmd["shellsettings"]=function(key) { settings.temp="chat_private_color"; this.loadMenu("setcolorfg"); break; + case "cfg": + settings.temp="clock_fg"; + this.loadMenu("setcolorfg"); + break; + case "cbg": + settings.temp="clock_bg"; + this.loadMenu("setcolorbg"); + break; case "s": saveSettings(); break; @@ -1394,6 +1403,7 @@ menucmd["setcolorfg"]=function(key) { var current=this.currentmenu; this.currentmenu=""; this.loadMenu(current); + right.init(); full_redraw=true; } menucmd["setcolorbg"]=menucmd["setcolorfg"]; diff --git a/exec/load/cshell_obj.js b/exec/load/cshell_obj.js index a16b49027c54712eb1042b55fd64cdac7929246d..047f99836e90df47d7a250a89ef96fc6a4cf108a 100644 --- a/exec/load/cshell_obj.js +++ b/exec/load/cshell_obj.js @@ -110,37 +110,78 @@ function Shortcut() /* RIGHT WINDOW */ function RightWindow() { - this.clock=new DigitalClock(); - this.width=18; - this.logo=new Graphic(this.width-2,10); - this.alerts=[]; - this.update=true; - - this.x=console.screen_columns-this.width; + this.width=settings.right_width; + this.x=console.screen_columns-Number(this.width)+1; this.y=2; - + this.init=function() { - this.clock.init(this.x,this.y+10,LIGHTBLUE); - this.logo.load(system.text_dir + "cshell/logo.16x10.bin"); + this.clock=new DigitalClock(); + this.clock_x=this.x; + this.clock_y=this.y; + this.clock.init(this.clock_x,this.clock_y,this.width-1,settings.clock_fg,settings.clock_bg); + + this.alert_x=this.x; + this.alert_y=this.y+this.clock.height+1; + this.alert_height=console.screen_rows-3-this.clock.height; + + this.chat_msgs=0; + this.notices=[]; } this.redraw=function() { drawSeparator(console.screen_columns-this.width,2,console.screen_rows-2); - this.clock.update(true); - this.logo.draw(this.x+1,this.y); - this.drawAlerts(); + this.clock.draw(this.clock_x,this.clock_y); + this.drawInfo(); } this.cycle=function() { - this.clock.update(); + if(this.clock.update()) { + this.clock.draw(this.clock_x,this.clock_y); + } if(this.update) { - this.drawAlerts(); + clearBlock(this.alert_x,this.alert_y,this.width-1,this.alert_height); + this.drawInfo(); + this.listNodes(); + this.update=false; + } + } + this.drawInfo=function() + { + setPosition(this.alert_x,this.alert_y); + if(this.chat_msgs > 0) + displayInfo(printPadded("\1r\1h *NEW CHAT MSGS*",this.width-1)); + if(this.notices.length > 0) + displayInfo(printPadded("\1r\1h *NEW NOTICES*",this.width-1)); + displayInfo(""); + } + this.listNodes=function() + { + var count=0; + for(var n=0;n<system.node_list.length;n++) { + var node=system.node_list[n]; + switch(node.status) { + case NODE_LOGON: + case NODE_NEWUSER: + if(count++==0) displayInfo(printPadded("\1w\1hNODE STATUS",this.width-1)); + displayInfo(printPadded("\1n" + (n+1) +"\1h: \1n\1g" + NodeStatus[node.status])); + break; + case NODE_INUSE: + if(count++==0) displayInfo(printPadded("\1w\1hNODE STATUS",this.width-1)); + displayInfo(printPadded("\1n" + (n+1) +"\1h: \1n\1g" + system.username(node.useron))); + break; + } } } - this.drawAlerts=function() + this.chatAlert=function() { - this.update=false; + this.chat_msgs++; + this.update=true; + } + this.addNotice=function(text) + { + this.notices.push(text); + this.update=true; } } @@ -187,10 +228,12 @@ function MainWindow() } this.cycle=function() { - this.chat.cycle(); + if(this.chat.cycle()) + right.chatAlert(); } this.restore=function() { + this.clear(); this.loadWallPaper(directory(system.text_dir + "cshell/main.*.bin")[0]); this.redraw(); } @@ -320,14 +363,17 @@ function SideBar() this.hfg=settings.menu_hfg; this.hbg=settings.menu_hbg; this.width=settings.menu_width; + this.force_width=settings.menu_width; this.xpos=settings.menu_x; this.ypos=settings.menu_y; + this.callback=cycle; + this.timeout=10; this.hotkeys= KEY_LEFT +KEY_RIGHT +KEY_UP +KEY_DOWN - +"\b\x7f\x1b<>Q+-" + +"\b\x7f\x1b<>Q+- " +ctrl('O') +ctrl('U') +ctrl('T') @@ -343,7 +389,7 @@ function SideBar() /* DEFAULT USER SETTINGS */ function Settings(list) { - this.shell_bg=BG_BROWN; + this.shell_bg=BG_RED; this.main_hkey_color=YELLOW; this.main_text_color=BLACK; @@ -361,6 +407,10 @@ function Settings(list) this.chat_global_color=MAGENTA; this.chat_private_color=YELLOW; + this.clock_fg=BLACK; + this.clock_bg=BG_LIGHTGRAY; + this.right_width=18; + for(var s in list) { this[s]=list[s]; }