Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
c47d2736
Commit
c47d2736
authored
14 years ago
by
mcmlxxix
Browse files
Options
Downloads
Patches
Plain Diff
added user favorites menu, add/del commands, menu info, menu wallpaper
start menu defaults to favorites
parent
49028502
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
exec/cshell.js
+229
-153
229 additions, 153 deletions
exec/cshell.js
exec/load/cshell_menu.js
+234
-269
234 additions, 269 deletions
exec/load/cshell_menu.js
exec/load/cshell_obj.js
+187
-179
187 additions, 179 deletions
exec/load/cshell_obj.js
with
650 additions
and
601 deletions
exec/cshell.js
+
229
−
153
View file @
c47d2736
...
@@ -14,6 +14,16 @@
...
@@ -14,6 +14,16 @@
* file: <menu_name>.<width>x<height>.bin
* file: <menu_name>.<width>x<height>.bin
* RIGHT WINDOW ICON:
* RIGHT WINDOW ICON:
* file: icon.16x10.bin
* 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
This shell relies on having commservice.js, commclient.js, and all other related
...
@@ -50,29 +60,31 @@ console.ctrlkey_passthru="+KOPTU";
...
@@ -50,29 +60,31 @@ console.ctrlkey_passthru="+KOPTU";
var
cmdlist
=
new
CommandList
();
var
cmdlist
=
new
CommandList
();
var
settings
=
new
Settings
();
var
settings
=
new
Settings
();
var
shortcut
s
=
new
Favorites
();
var
favorite
s
=
new
Favorites
();
var
bottom
=
new
MainMenu
();
var
bottom
=
new
BottomLine
();
var
right
=
new
RightWindow
();
var
right
=
new
RightWindow
();
var
center
=
new
MainWindow
();
var
center
=
new
MainWindow
();
var
left
=
new
SideMenu
();
var
left
=
new
LeftWindow
();
/* SHELL FUNCTIONS */
/* SHELL FUNCTIONS */
function
init
()
function
init
()
{
{
loadSettings
();
loadSettings
();
loadFavorites
();
bottom
.
init
();
bottom
.
init
();
right
.
init
();
right
.
init
();
center
.
init
();
center
.
init
();
left
.
init
();
left
.
init
();
if
(
favorites
.
items
.
length
>
0
)
{
loadMenu
(
"
favorites
"
);
showLeftWindow
();
}
redraw
();
redraw
();
}
}
function
shell
()
function
shell
()
{
{
while
(
1
)
while
(
1
)
{
{
cycle
();
cycle
();
var
cmd
=
""
;
var
cmd
=
""
;
...
@@ -81,17 +93,25 @@ function shell()
...
@@ -81,17 +93,25 @@ function shell()
/* LEFT MENU COMMAND PROCESSING */
/* LEFT MENU COMMAND PROCESSING */
switch
(
cmd
)
switch
(
cmd
)
{
{
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
:
case
KEY_UP
:
lightBarUp
(
m
);
lightBarUp
(
left
.
menu
);
break
;
break
;
case
KEY_DOWN
:
case
KEY_DOWN
:
lightBarDown
(
m
);
lightBarDown
(
left
.
menu
);
break
;
break
;
case
KEY_HOME
:
case
KEY_HOME
:
lightBarHome
(
m
);
lightBarHome
(
left
.
menu
);
break
;
break
;
case
KEY_END
:
case
KEY_END
:
lightBarEnd
(
m
);
lightBarEnd
(
left
.
menu
);
break
;
break
;
case
KEY_LEFT
:
case
KEY_LEFT
:
previousMenu
();
previousMenu
();
...
@@ -99,10 +119,22 @@ function shell()
...
@@ -99,10 +119,22 @@ function shell()
case
KEY_RIGHT
:
case
KEY_RIGHT
:
case
"
Q
"
:
case
"
Q
"
:
case
"
\
x1b
"
:
case
"
\
x1b
"
:
hide
SideMenu
();
hide
LeftWindow
();
center
.
restore
();
center
.
restore
();
bottom
.
restore
();
bottom
.
restore
();
continue
;
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
:
default
:
if
(
left
.
menu
.
items
[
cmd
])
{
if
(
left
.
menu
.
items
[
cmd
])
{
var
item_id
=
left
.
menu
.
items
[
cmd
].
id
;
var
item_id
=
left
.
menu
.
items
[
cmd
].
id
;
...
@@ -125,10 +157,16 @@ function shell()
...
@@ -125,10 +157,16 @@ function shell()
case
ctrl
(
'
K
'
):
/* CTRL-K Control Key Menu */
case
ctrl
(
'
K
'
):
/* CTRL-K Control Key Menu */
case
ctrl
(
'
P
'
):
/* Ctrl-P Messages */
case
ctrl
(
'
P
'
):
/* Ctrl-P Messages */
controlkeys
.
handle
(
key
);
controlkeys
.
handle
(
key
);
break
;
continue
;
case
"
"
:
case
"
"
:
redraw
();
redraw
();
break
;
break
;
case
"
-
"
:
if
(
!
favorites
.
items
.
length
>
0
)
{
break
;
}
loadMenu
(
"
delfavorite
"
);
break
;
case
"
\
x1b
"
:
case
"
\
x1b
"
:
case
"
Q
"
:
case
"
Q
"
:
return
false
;
return
false
;
...
@@ -141,18 +179,11 @@ function shell()
...
@@ -141,18 +179,11 @@ function shell()
}
}
if
(
!
left
.
menu
)
continue
;
if
(
!
left
.
menu
)
continue
;
var
m
=
left
.
menu
;
if
(
!
left
.
menu_shown
)
showLeftWindow
();
if
(
!
left
.
menu_shown
)
showSideMenu
();
if
(
!
left
.
title_shown
)
left
.
drawTitle
();
if
(
!
left
.
title_shown
)
left
.
drawTitle
();
/* DISPLAY CURRENT SECTION INFO */
if
(
menuinfo
[
left
.
currentmenu
])
{
switch
(
left
.
currentmenu
)
{
menuinfo
[
left
.
currentmenu
]();
case
"
xtrnsec
"
:
showXtrnProgInfo
(
m
);
break
;
case
"
xtrnsecs
"
:
showXtrnSecInfo
(
m
);
break
;
}
}
}
}
}
}
...
@@ -183,6 +214,10 @@ function redraw()
...
@@ -183,6 +214,10 @@ function redraw()
left
.
redraw
();
left
.
redraw
();
bottom
.
redraw
();
bottom
.
redraw
();
if
(
menuinfo
[
left
.
currentmenu
])
{
menuinfo
[
left
.
currentmenu
]();
}
full_redraw
=
false
;
full_redraw
=
false
;
}
}
function
drawTitle
(
x
,
y
,
str
)
function
drawTitle
(
x
,
y
,
str
)
...
@@ -233,6 +268,58 @@ function drawOutline()
...
@@ -233,6 +268,58 @@ function drawOutline()
console
.
putmsg
(
outline
,
P_SAVEATR
);
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 */
/* MAIN MENU */
function
hideChat
()
function
hideChat
()
...
@@ -265,7 +352,6 @@ function stretchCenter(height)
...
@@ -265,7 +352,6 @@ function stretchCenter(height)
}
}
function
expandCenter
(
width
,
side
)
function
expandCenter
(
width
,
side
)
{
{
log
(
"
expanding chat:
"
+
width
);
var
cols
=
center
.
chat
.
chatroom
.
columns
;
var
cols
=
center
.
chat
.
chatroom
.
columns
;
var
x
=
center
.
chat
.
chatroom
.
x
;
var
x
=
center
.
chat
.
chatroom
.
x
;
if
(
side
==
"
left
"
){
if
(
side
==
"
left
"
){
...
@@ -278,30 +364,9 @@ function expandCenter(width,side)
...
@@ -278,30 +364,9 @@ function expandCenter(width,side)
center
.
chat
.
resize
(
cols
,
undefined
,
x
,
undefined
);
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 */
/* LEFT MENU */
function
hide
SideMenu
()
function
hide
LeftWindow
()
{
{
log
(
"
hiding side menu
"
);
expandCenter
(
settings
.
menu_width
+
1
,
"
left
"
);
expandCenter
(
settings
.
menu_width
+
1
,
"
left
"
);
delete
left
.
menu
;
delete
left
.
menu
;
left
.
currentmenu
=
""
;
left
.
currentmenu
=
""
;
...
@@ -309,9 +374,8 @@ function hideSideMenu()
...
@@ -309,9 +374,8 @@ function hideSideMenu()
left
.
title_shown
=
false
;
left
.
title_shown
=
false
;
left
.
previous
=
[];
left
.
previous
=
[];
}
}
function
show
SideMenu
()
function
show
LeftWindow
()
{
{
log
(
"
showing side menu
"
);
expandCenter
(
-
(
settings
.
menu_width
+
1
),
"
left
"
);
expandCenter
(
-
(
settings
.
menu_width
+
1
),
"
left
"
);
drawSeparator
(
settings
.
menu_width
+
2
,
2
,
settings
.
main_height
);
drawSeparator
(
settings
.
menu_width
+
2
,
2
,
settings
.
main_height
);
left
.
menu_shown
=
true
;
left
.
menu_shown
=
true
;
...
@@ -354,48 +418,109 @@ function previousMenu()
...
@@ -354,48 +418,109 @@ function previousMenu()
{
{
left
.
previousMenu
();
left
.
previousMenu
();
}
}
function
addcmd
(
text
,
id
,
disabled
)
/* USER SETTINGS */
function
saveSettings
()
{
{
if
(
file_exists
(
settings_file
.
name
))
{
this
.
add
(
text
,
undefined
,
settings
.
menu_width
,
undefined
,
undefined
,
disabled
);
settings_file
.
open
(
'
w+
'
,
true
);
this
.
items
[
this
.
items
.
length
-
1
].
id
=
id
;
if
(
!
settings_file
.
is_open
)
{
log
(
"
error opening user settings
"
,
LOG_WARNING
);
return
;
}
}
settings_file
.
close
();
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
);
}
}
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
s
aveFavorites
(
)
function
s
et_hotkeys
(
lb
)
{
{
if
(
file_exists
(
settings_file
.
name
))
{
/* USE FIRST AVAILABLE HOTKEY AS TRIGGER */
settings_file
.
open
(
'
w+
'
,
true
);
/* RETURN VALUE = ITEM INDEX FOR MENU COMMAND REFERENCE */
if
(
!
settings_file
.
is_open
)
{
var
hotkeys
=
"
1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ
"
;
log
(
"
error opening user settings
"
,
LOG_WARNING
);
var
index
=
0
;
return
;
for
(
var
i
=
0
;
i
<
lb
.
items
.
length
;
i
++
)
{
}
if
(
lb
.
items
[
i
].
disabled
)
continue
;
for
each
(
var
s
in
this
.
shortcuts
)
{
var
values
=
[
s
.
command
];
while
(
bottom
.
menu
.
items
[
hotkeys
[
index
]])
index
++
;
settings_file
.
iniSetValue
(
"
shortcuts
"
,
s
.
text
,
s
.
parameters
.
join
(
"
,
"
));
lb
.
items
[
i
].
text
=
"
|
"
+
hotkeys
[
index
++
]
+
"
"
+
lb
.
items
[
i
].
text
;
lb
.
items
[
i
].
retval
=
i
;
}
}
settings_file
.
close
();
}
}
/* MENU FUNCTIONS */
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
;
}
return
(
str
);
}
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 */
}
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
);
full_redraw
=
true
;
/* We are going to a line-mode thing... re-enable CTRL keys. */
}
}
function
loadSettings
()
/* USER SETTINGS */
function
saveSettings
()
{
{
if
(
file_exists
(
settings_file
.
name
))
{
settings_file
.
open
(
'
w+
'
,
false
);
settings_file
.
open
(
'
r
'
,
true
);
if
(
!
settings_file
.
is_open
)
{
if
(
!
settings_file
.
is_open
)
{
log
(
"
error opening user settings
"
,
LOG_WARNING
);
log
(
"
error opening user settings
"
,
LOG_WARNING
);
return
;
return
;
}
}
var
data
=
settings_file
.
iniGetObject
(
"
settings
"
);
for
(
var
f
=
0
;
f
<
favorites
.
items
.
length
;
f
++
)
{
settings_file
.
close
();
var
fav
=
favorites
.
items
[
f
];
settings
=
new
Settings
(
data
);
var
value
=
fav
.
menuID
+
"
,
"
+
fav
.
menuTitle
+
"
,
"
+
fav
.
itemID
+
"
,
"
+
fav
.
itemTitle
+
"
,
"
+
fav
.
xtrnsec
;
settings_file
.
iniSetValue
(
"
favorites
"
,
f
,
value
);
}
}
settings_file
.
close
();
}
}
function
load
Favorite
s
()
function
load
Setting
s
()
{
{
if
(
file_exists
(
settings_file
.
name
))
{
if
(
file_exists
(
settings_file
.
name
))
{
settings_file
.
open
(
'
r
'
,
true
);
settings_file
.
open
(
'
r
'
,
true
);
...
@@ -403,62 +528,13 @@ function loadFavorites()
...
@@ -403,62 +528,13 @@ function loadFavorites()
log
(
"
error opening user settings
"
,
LOG_WARNING
);
log
(
"
error opening user settings
"
,
LOG_WARNING
);
return
;
return
;
}
}
var
data
=
settings_file
.
iniGetObject
(
"
shortcuts
"
);
var
set
=
settings_file
.
iniGetObject
(
"
settings
"
);
var
fav
=
settings_file
.
iniGetObject
(
"
favorites
"
);
settings
=
new
Settings
(
set
);
favorites
=
new
Favorites
(
fav
);
settings_file
.
close
();
settings_file
.
close
();
shortcuts
=
new
Favorites
(
data
);
}
}
function
add_favorite
()
{
// ToDo: create an interface for adding custom user commands
}
/* COMMAND LIST FUNCTIONS */
function
loadXtrn
()
{
}
}
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
'
:
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
);
}
hideChat
();
}
function
logoff
()
{
if
(
bbs
.
batch_dnload_total
)
{
if
(
console
.
yesno
(
bbs
.
text
(
Menu_downloadBatchQ
)))
{
bbs
.
batch_download
();
bbs
.
logoff
();
}
}
else
bbs
.
hangup
();
}
init
();
init
();
shell
();
shell
();
\ No newline at end of file
This diff is collapsed.
Click to expand it.
exec/load/cshell_menu.js
+
234
−
269
View file @
c47d2736
This diff is collapsed.
Click to expand it.
exec/load/cshell_obj.js
+
187
−
179
View file @
c47d2736
/* MAIN MENU */
/* MAIN MENU */
function
MainMenu
()
function
BottomLine
()
{
{
this
.
x
=
1
;
this
.
x
=
1
;
this
.
y
=
console
.
screen_rows
;
this
.
y
=
console
.
screen_rows
;
...
@@ -17,7 +17,7 @@ function MainMenu()
...
@@ -17,7 +17,7 @@ function MainMenu()
menu_items
[
"
V
"
]
=
new
Shortcut
(
"
Fa|vorites
"
,
"
menu
"
,
"
favorites
"
);
menu_items
[
"
V
"
]
=
new
Shortcut
(
"
Fa|vorites
"
,
"
menu
"
,
"
favorites
"
);
menu_items
[
"
S
"
]
=
new
Shortcut
(
"
|Settings
"
,
"
menu
"
,
"
settings
"
);
menu_items
[
"
S
"
]
=
new
Shortcut
(
"
|Settings
"
,
"
menu
"
,
"
settings
"
);
menu_items
[
"
L
"
]
=
new
Shortcut
(
"
|Logoff
"
,
"
logoff
"
,
""
);
menu_items
[
"
L
"
]
=
new
Shortcut
(
"
|Logoff
"
,
"
logoff
"
,
""
);
this
.
menu
=
new
M
enu_bottom
(
menu_items
,
9
,
console
.
screen_rows
);
this
.
menu
=
new
M
ainMenu
(
menu_items
,
9
,
console
.
screen_rows
);
}
}
this
.
restore
=
function
()
this
.
restore
=
function
()
{
{
...
@@ -41,6 +41,59 @@ function MainMenu()
...
@@ -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
()
function
Shortcut
()
{
{
this
.
enabled
=
true
;
this
.
enabled
=
true
;
...
@@ -58,25 +111,36 @@ function Shortcut()
...
@@ -58,25 +111,36 @@ function Shortcut()
function
RightWindow
()
function
RightWindow
()
{
{
this
.
clock
=
new
DigitalClock
();
this
.
clock
=
new
DigitalClock
();
this
.
graphic
;
this
.
width
=
18
;
this
.
x
=
console
.
screen_columns
-
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
.
y
=
2
;
this
.
init
=
function
()
this
.
init
=
function
()
{
{
this
.
clock
.
init
(
this
.
x
,
this
.
y
+
10
,
LIGHTBLUE
);
this
.
clock
.
init
(
this
.
x
,
this
.
y
+
10
,
LIGHTBLUE
);
this
.
graphic
=
new
Graphic
(
16
,
10
);
this
.
logo
.
load
(
system
.
text_dir
+
"
cshell/logo.16x10.bin
"
);
this
.
graphic
.
load
(
system
.
text_dir
+
"
cshell/logo.16x10.bin
"
);
}
}
this
.
redraw
=
function
()
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
.
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
.
cycle
=
function
()
{
{
this
.
clock
.
update
();
this
.
clock
.
update
();
if
(
this
.
update
)
{
this
.
drawAlerts
();
}
}
this
.
drawAlerts
=
function
()
{
this
.
update
=
false
;
}
}
}
}
...
@@ -84,7 +148,8 @@ function RightWindow()
...
@@ -84,7 +148,8 @@ function RightWindow()
function
MainWindow
()
function
MainWindow
()
{
{
this
.
in_chat
=
false
;
this
.
in_chat
=
false
;
this
.
wallpaper
=
false
;
this
.
wp
=
false
;
this
.
wp_shown
=
true
;
this
.
chat
=
new
ChatEngine
(
root
);
this
.
chat
=
new
ChatEngine
(
root
);
this
.
init
=
function
()
this
.
init
=
function
()
...
@@ -92,7 +157,7 @@ function MainWindow()
...
@@ -92,7 +157,7 @@ function MainWindow()
this
.
chat
.
init
(
settings
.
main_width
,
settings
.
main_height
-
3
,
2
,
5
);
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
.
input_line
.
init
(
9
,
console
.
screen_rows
,
console
.
screen_columns
-
9
,
"
\
0017
"
,
"
\
1k
"
);
this
.
chat
.
joinChan
(
"
BBS MAIN
"
,
user
.
alias
,
user
.
name
);
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
.
chat
.
chatroom
.
active
=
false
;
}
}
this
.
drawTitle
=
function
()
this
.
drawTitle
=
function
()
...
@@ -112,21 +177,31 @@ function MainWindow()
...
@@ -112,21 +177,31 @@ function MainWindow()
this
.
chat
.
input_line
.
toggle
();
this
.
chat
.
input_line
.
toggle
();
this
.
drawTitle
();
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
.
cycle
=
function
()
{
{
this
.
chat
.
cycle
();
this
.
chat
.
cycle
();
}
}
this
.
restore
=
function
()
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
();
}
}
this
.
redraw
=
function
()
this
.
redraw
=
function
()
{
{
if
(
this
.
in_chat
)
{
if
(
this
.
in_chat
)
{
this
.
drawChat
();
this
.
drawChat
();
}
else
{
}
else
if
(
this
.
wp
)
{
this
.
drawWallPaper
();
this
.
drawWallPaper
();
}
else
{
this
.
clear
();
}
}
}
}
...
@@ -137,23 +212,35 @@ function MainWindow()
...
@@ -137,23 +212,35 @@ function MainWindow()
}
}
this
.
loadWallPaper
=
function
(
file
)
this
.
loadWallPaper
=
function
(
file
)
{
{
file
=
directory
(
file
);
var
width
=
this
.
chat
.
chatroom
.
columns
;
var
width
=
0
;
var
height
=
this
.
chat
.
chatroom
.
rows
+
3
;
var
height
=
0
;
if
(
file_exists
(
file
))
{
if
(
file
.
length
)
{
var
size
=
file_getname
(
file
).
split
(
"
.
"
)[
1
].
split
(
"
x
"
);
var
size
=
file_getname
(
file
[
0
]).
split
(
"
.
"
)[
1
].
split
(
"
x
"
);
if
(
size
[
0
])
width
=
Number
(
size
[
0
]);
width
=
Number
(
size
[
0
]);
if
(
size
[
1
])
height
=
Number
(
size
[
1
]);
height
=
Number
(
size
[
1
]);
}
}
this
.
w
allpaper
=
new
Graphic
(
width
,
height
);
this
.
w
p
=
new
Graphic
(
width
,
height
);
this
.
w
allpaper
.
load
(
file
);
this
.
w
p
.
load
(
file
);
}
}
this
.
drawWallPaper
=
function
()
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_rows
=
0
;
var
msg_timeouts
=
new
Array
();
var
msg_timeouts
=
new
Array
();
...
@@ -166,35 +253,38 @@ function SideMenu()
...
@@ -166,35 +253,38 @@ function SideMenu()
this
.
title_shown
=
false
;
this
.
title_shown
=
false
;
this
.
previous
=
[];
this
.
previous
=
[];
this
.
curr_
xtrnsec
=
0
;
this
.
xtrnsec
=
0
;
this
.
currentmenu
;
this
.
currentmenu
;
this
.
menu
;
this
.
menu
;
this
.
process
;
this
.
process
;
this
.
init
=
function
()
this
.
init
=
function
()
{
{
Menu_sidebar
.
prototype
=
new
Lightbar
;
SideBar
.
prototype
=
new
Lightbar
;
Menu_main
.
prototype
=
new
Menu_sidebar
;
Menu_file
.
prototype
=
new
Menu_sidebar
;
menuobj
[
"
main
"
].
prototype
=
new
SideBar
;
Menu_filedir
.
prototype
=
new
Menu_sidebar
;
menuobj
[
"
file
"
].
prototype
=
new
SideBar
;
Menu_settings
.
prototype
=
new
Menu_sidebar
;
menuobj
[
"
filedir
"
].
prototype
=
new
SideBar
;
Menu_email
.
prototype
=
new
Menu_sidebar
;
menuobj
[
"
settings
"
].
prototype
=
new
SideBar
;
Menu_message
.
prototype
=
new
Menu_sidebar
;
menuobj
[
"
email
"
].
prototype
=
new
SideBar
;
Menu_chat
.
prototype
=
new
Menu_sidebar
;
menuobj
[
"
message
"
].
prototype
=
new
SideBar
;
Menu_xtrnsecs
.
prototype
=
new
Menu_sidebar
;
menuobj
[
"
chat
"
].
prototype
=
new
SideBar
;
Menu_xtrnsec
.
prototype
=
new
Menu_sidebar
;
menuobj
[
"
xtrnsecs
"
].
prototype
=
new
SideBar
;
Menu_info
.
prototype
=
new
Menu_sidebar
;
menuobj
[
"
xtrnsec
"
].
prototype
=
new
SideBar
;
Menu_userlist
.
prototype
=
new
Menu_sidebar
;
menuobj
[
"
info
"
].
prototype
=
new
SideBar
;
Menu_emailtarget
.
prototype
=
new
Menu_sidebar
;
menuobj
[
"
userlist
"
].
prototype
=
new
SideBar
;
Menu_download
.
prototype
=
new
Menu_sidebar
;
menuobj
[
"
emailtarget
"
].
prototype
=
new
SideBar
;
Menu_upload
.
prototype
=
new
Menu_sidebar
;
menuobj
[
"
download
"
].
prototype
=
new
SideBar
;
Menu_fileinfo
.
prototype
=
new
Menu_sidebar
;
menuobj
[
"
upload
"
].
prototype
=
new
SideBar
;
Menu_filesettings
.
prototype
=
new
Menu_sidebar
;
menuobj
[
"
fileinfo
"
].
prototype
=
new
SideBar
;
Menu_newmsgscan
.
prototype
=
new
Menu_sidebar
;
menuobj
[
"
filesettings
"
].
prototype
=
new
SideBar
;
Menu_yourmsgscan
.
prototype
=
new
Menu_sidebar
;
menuobj
[
"
newmsgscan
"
].
prototype
=
new
SideBar
;
Menu_searchmsgtxt
.
prototype
=
new
Menu_sidebar
;
menuobj
[
"
yourmsgscan
"
].
prototype
=
new
SideBar
;
Menu_chatsettings
.
prototype
=
new
Menu_sidebar
;
menuobj
[
"
searchmsgtxt
"
].
prototype
=
new
SideBar
;
Menu_favorites
.
prototype
=
new
Menu_sidebar
;
menuobj
[
"
chatsettings
"
].
prototype
=
new
SideBar
;
menuobj
[
"
favorites
"
].
prototype
=
new
SideBar
;
menuobj
[
"
addfavorite
"
].
prototype
=
new
SideBar
;
menuobj
[
"
delfavorite
"
].
prototype
=
new
SideBar
;
}
}
this
.
cycle
=
function
()
this
.
cycle
=
function
()
{
{
...
@@ -226,145 +316,49 @@ function SideMenu()
...
@@ -226,145 +316,49 @@ function SideMenu()
this
.
loadMenu
(
this
.
previous
.
pop
());
this
.
loadMenu
(
this
.
previous
.
pop
());
}
}
}
}
this
.
loadMenu
=
function
(
name
,
value
)
this
.
loadMenu
=
function
()
{
{
if
(
this
.
currentmenu
)
{
if
(
this
.
currentmenu
)
{
if
(
this
.
currentmenu
==
name
)
return
false
;
if
(
this
.
currentmenu
==
arguments
[
0
]
)
return
false
;
this
.
previous
.
push
(
this
.
currentmenu
);
this
.
previous
.
push
(
this
.
currentmenu
);
}
}
this
.
currentmenu
=
name
;
this
.
currentmenu
=
arguments
[
0
];
switch
(
name
)
this
.
process
=
menucmd
[
arguments
[
0
]];
{
this
.
menu
=
new
menuobj
[
arguments
[
0
]];
case
"
main
"
:
if
(
this
.
menu
.
no_action
)
{
this
.
menu
=
new
Menu_main
;
bbs
.
node_action
=
this
.
menu
.
node_action
;
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
.
title_shown
=
false
;
this
.
title_shown
=
false
;
}
if
(
center
.
wp_shown
)
center
.
clear
();
}
}
}
function
SideBar
()
/* SHORTCUT COMMAND FUNCTIONS */
{
function
CommandList
()
this
.
lpadding
=
""
;
{
this
.
rpadding
=
""
;
this
[
"
menu
"
]
=
loadMenu
;
this
.
fg
=
settings
.
menu_fg
;
this
[
"
chat
"
]
=
chatInput
;
this
.
bg
=
settings
.
menu_bg
;
this
[
"
xtrn
"
]
=
loadXtrn
;
this
.
hfg
=
settings
.
menu_hfg
;
this
[
"
logoff
"
]
=
logoff
;
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 */
/* DEFAULT USER SETTINGS */
...
@@ -397,10 +391,24 @@ function Settings(list)
...
@@ -397,10 +391,24 @@ function Settings(list)
}
}
function
Favorites
(
list
)
function
Favorites
(
list
)
{
{
this
.
items
=
[];
for
(
var
s
in
list
)
{
for
(
var
s
in
list
)
{
var
hkey
=
getHotkey
(
s
);
var
parameters
=
list
[
s
].
split
(
"
,
"
);
var
parameters
=
list
[
s
].
split
(
"
,
"
);
this
[
hkey
]
=
new
Shortcut
(
s
,
parameters
.
shift
());
var
menuID
=
parameters
.
shift
();
this
[
hkey
].
parameters
=
parameters
;
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
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment