Skip to content
Snippets Groups Projects
Commit 6ee7d16b authored by mcmlxxix's avatar mcmlxxix
Browse files

added notification & chat message alerts, moved clock to upper right corner,...

added notification & chat message alerts, moved clock to upper right corner, removed mini logo, added clock colors to user settings, added node activity to right window
parent ee8d8e3c
Branches
Tags
No related merge requests found
...@@ -83,7 +83,6 @@ function shell() ...@@ -83,7 +83,6 @@ function shell()
{ {
while(1) { while(1) {
cycle(); cycle();
var cmd=""; var cmd="";
if(left.menu) { if(left.menu) {
cmd=left.menu.getval(); cmd=left.menu.getval();
...@@ -186,9 +185,44 @@ function shell() ...@@ -186,9 +185,44 @@ function shell()
} }
function cycle() 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(); right.cycle();
center.cycle(); center.cycle();
left.cycle(); left.cycle();
if(full_redraw) { if(full_redraw) {
redraw(); redraw();
} }
...@@ -221,6 +255,20 @@ function redraw() ...@@ -221,6 +255,20 @@ function redraw()
full_redraw=false; 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) function drawTitle(x,y,str)
{ {
console.attributes=BG_LIGHTGRAY + BLACK; console.attributes=BG_LIGHTGRAY + BLACK;
...@@ -290,10 +338,6 @@ function logoff() ...@@ -290,10 +338,6 @@ function logoff()
} }
} else bbs.hangup(); } else bbs.hangup();
} }
function loadMenu()
{
return left.loadMenu.apply(left,arguments);
}
function chatInput() function chatInput()
{ {
showChat(); showChat();
...@@ -451,6 +495,10 @@ function set_hotkeys(lb) ...@@ -451,6 +495,10 @@ function set_hotkeys(lb)
lb.items[i].retval=i; lb.items[i].retval=i;
} }
} }
function loadMenu()
{
return left.loadMenu.apply(left,arguments);
}
/* MENU FUNCTIONS */ /* MENU FUNCTIONS */
function format_opt(str, width, expand) function format_opt(str, width, expand)
......
...@@ -300,6 +300,8 @@ menuobj["shellsettings"]=function() { ...@@ -300,6 +300,8 @@ menuobj["shellsettings"]=function() {
this.addcmd("Remote Chat","cr"); this.addcmd("Remote Chat","cr");
this.addcmd("Global Chat","cg"); this.addcmd("Global Chat","cg");
this.addcmd("Private Chat","cp"); this.addcmd("Private Chat","cp");
this.addcmd("Clock Foreground","cfg");
this.addcmd("Clock Background","cbg");
this.addcmd("",undefined,true); this.addcmd("",undefined,true);
this.addcmd("Save Settings","s"); this.addcmd("Save Settings","s");
set_hotkeys(this); set_hotkeys(this);
...@@ -311,7 +313,7 @@ menuobj["setcolorbg"]=function() { ...@@ -311,7 +313,7 @@ menuobj["setcolorbg"]=function() {
this.items=new Array(); this.items=new Array();
this.addcmd("BLACK","BG_BLACK"); this.addcmd("BLACK","BG_BLACK");
this.addcmd("BLUE","BG_BLUE"); this.addcmd("BLUE","BG_BLUE");
this.addcmd("GRAY","BG_GRAY"); this.addcmd("GRAY","BG_LIGHTGRAY");
this.addcmd("GREEN","BG_GREEN"); this.addcmd("GREEN","BG_GREEN");
this.addcmd("BROWN","BG_BROWN"); this.addcmd("BROWN","BG_BROWN");
this.addcmd("RED","BG_RED"); this.addcmd("RED","BG_RED");
...@@ -501,7 +503,6 @@ menucmd["xtrnsecs"]=function(key) { ...@@ -501,7 +503,6 @@ menucmd["xtrnsecs"]=function(key) {
menucmd["xtrnsec"]=function(key) { menucmd["xtrnsec"]=function(key) {
clear_screen(); clear_screen();
bbs.exec_xtrn(xtrn_area.sec_list[this.xtrnsec].prog_list[Number(key)].number); bbs.exec_xtrn(xtrn_area.sec_list[this.xtrnsec].prog_list[Number(key)].number);
console.ctrlkey_passthru=console.ctrlkey_passthru;
} }
menucmd["file"]=function(key) { menucmd["file"]=function(key) {
var i; var i;
...@@ -1383,6 +1384,14 @@ menucmd["shellsettings"]=function(key) { ...@@ -1383,6 +1384,14 @@ menucmd["shellsettings"]=function(key) {
settings.temp="chat_private_color"; settings.temp="chat_private_color";
this.loadMenu("setcolorfg"); this.loadMenu("setcolorfg");
break; break;
case "cfg":
settings.temp="clock_fg";
this.loadMenu("setcolorfg");
break;
case "cbg":
settings.temp="clock_bg";
this.loadMenu("setcolorbg");
break;
case "s": case "s":
saveSettings(); saveSettings();
break; break;
...@@ -1394,6 +1403,7 @@ menucmd["setcolorfg"]=function(key) { ...@@ -1394,6 +1403,7 @@ menucmd["setcolorfg"]=function(key) {
var current=this.currentmenu; var current=this.currentmenu;
this.currentmenu=""; this.currentmenu="";
this.loadMenu(current); this.loadMenu(current);
right.init();
full_redraw=true; full_redraw=true;
} }
menucmd["setcolorbg"]=menucmd["setcolorfg"]; menucmd["setcolorbg"]=menucmd["setcolorfg"];
......
...@@ -110,37 +110,78 @@ function Shortcut() ...@@ -110,37 +110,78 @@ function Shortcut()
/* RIGHT WINDOW */ /* RIGHT WINDOW */
function RightWindow() function RightWindow()
{ {
this.clock=new DigitalClock(); this.width=settings.right_width;
this.width=18; this.x=console.screen_columns-Number(this.width)+1;
this.logo=new Graphic(this.width-2,10);
this.alerts=[];
this.update=true;
this.x=console.screen_columns-this.width;
this.y=2; this.y=2;
this.init=function() this.init=function()
{ {
this.clock.init(this.x,this.y+10,LIGHTBLUE); this.clock=new DigitalClock();
this.logo.load(system.text_dir + "cshell/logo.16x10.bin"); 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() this.redraw=function()
{ {
drawSeparator(console.screen_columns-this.width,2,console.screen_rows-2); drawSeparator(console.screen_columns-this.width,2,console.screen_rows-2);
this.clock.update(true); this.clock.draw(this.clock_x,this.clock_y);
this.logo.draw(this.x+1,this.y); this.drawInfo();
this.drawAlerts();
} }
this.cycle=function() this.cycle=function()
{ {
this.clock.update(); if(this.clock.update()) {
this.clock.draw(this.clock_x,this.clock_y);
}
if(this.update) { 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() ...@@ -187,10 +228,12 @@ function MainWindow()
} }
this.cycle=function() this.cycle=function()
{ {
this.chat.cycle(); if(this.chat.cycle())
right.chatAlert();
} }
this.restore=function() this.restore=function()
{ {
this.clear();
this.loadWallPaper(directory(system.text_dir + "cshell/main.*.bin")[0]); this.loadWallPaper(directory(system.text_dir + "cshell/main.*.bin")[0]);
this.redraw(); this.redraw();
} }
...@@ -320,14 +363,17 @@ function SideBar() ...@@ -320,14 +363,17 @@ function SideBar()
this.hfg=settings.menu_hfg; this.hfg=settings.menu_hfg;
this.hbg=settings.menu_hbg; this.hbg=settings.menu_hbg;
this.width=settings.menu_width; this.width=settings.menu_width;
this.force_width=settings.menu_width;
this.xpos=settings.menu_x; this.xpos=settings.menu_x;
this.ypos=settings.menu_y; this.ypos=settings.menu_y;
this.callback=cycle;
this.timeout=10;
this.hotkeys= this.hotkeys=
KEY_LEFT KEY_LEFT
+KEY_RIGHT +KEY_RIGHT
+KEY_UP +KEY_UP
+KEY_DOWN +KEY_DOWN
+"\b\x7f\x1b<>Q+-" +"\b\x7f\x1b<>Q+- "
+ctrl('O') +ctrl('O')
+ctrl('U') +ctrl('U')
+ctrl('T') +ctrl('T')
...@@ -343,7 +389,7 @@ function SideBar() ...@@ -343,7 +389,7 @@ function SideBar()
/* DEFAULT USER SETTINGS */ /* DEFAULT USER SETTINGS */
function Settings(list) function Settings(list)
{ {
this.shell_bg=BG_BROWN; this.shell_bg=BG_RED;
this.main_hkey_color=YELLOW; this.main_hkey_color=YELLOW;
this.main_text_color=BLACK; this.main_text_color=BLACK;
...@@ -361,6 +407,10 @@ function Settings(list) ...@@ -361,6 +407,10 @@ function Settings(list)
this.chat_global_color=MAGENTA; this.chat_global_color=MAGENTA;
this.chat_private_color=YELLOW; this.chat_private_color=YELLOW;
this.clock_fg=BLACK;
this.clock_bg=BG_LIGHTGRAY;
this.right_width=18;
for(var s in list) { for(var s in list) {
this[s]=list[s]; this[s]=list[s];
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment