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
No related branches found
No related tags found
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 @@
* 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
shortcut
s
=
new
Favorites
();
var
bottom
=
new
MainMenu
();
var
favorite
s
=
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,17 +93,25 @@ function shell()
/* LEFT MENU COMMAND PROCESSING */
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
:
lightBarUp
(
m
);
lightBarUp
(
left
.
menu
);
break
;
case
KEY_DOWN
:
lightBarDown
(
m
);
lightBarDown
(
left
.
menu
);
break
;
case
KEY_HOME
:
lightBarHome
(
m
);
lightBarHome
(
left
.
menu
);
break
;
case
KEY_END
:
lightBarEnd
(
m
);
lightBarEnd
(
left
.
menu
);
break
;
case
KEY_LEFT
:
previousMenu
();
...
...
@@ -99,10 +119,22 @@ function shell()
case
KEY_RIGHT
:
case
"
Q
"
:
case
"
\
x1b
"
:
hide
SideMenu
();
hide
LeftWindow
();
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
;
...
...
@@ -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
hide
SideMenu
()
function
hide
LeftWindow
()
{
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
show
SideMenu
()
function
show
LeftWindow
()
{
log
(
"
showing side menu
"
);
expandCenter
(
-
(
settings
.
menu_width
+
1
),
"
left
"
);
drawSeparator
(
settings
.
menu_width
+
2
,
2
,
settings
.
main_height
);
left
.
menu_shown
=
true
;
...
...
@@ -354,48 +418,109 @@ 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
;
this
.
add
(
text
,
undefined
,
settings
.
menu_width
,
undefined
,
undefined
,
disabled
);
this
.
items
[
this
.
items
.
length
-
1
].
id
=
id
;
}
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
))
{
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
(
"
,
"
));
/* 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
;
}
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
(
'
r
'
,
true
);
settings_file
.
open
(
'
w+
'
,
false
);
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
);
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
load
Favorite
s
()
function
load
Setting
s
()
{
if
(
file_exists
(
settings_file
.
name
))
{
settings_file
.
open
(
'
r
'
,
true
);
...
...
@@ -403,62 +528,13 @@ function loadFavorites()
log
(
"
error opening user settings
"
,
LOG_WARNING
);
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
();
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
();
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 */
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
M
enu_bottom
(
menu_items
,
9
,
console
.
screen_rows
);
this
.
menu
=
new
M
ainMenu
(
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
.
w
allpaper
=
new
Graphic
(
width
,
height
);
this
.
w
allpaper
.
load
(
file
);
this
.
w
p
=
new
Graphic
(
width
,
height
);
this
.
w
p
.
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
;
}
}
/* SHORTCUT COMMAND FUNCTIONS */
function
CommandList
()
{
this
[
"
menu
"
]
=
loadMenu
;
this
[
"
chat
"
]
=
chatInput
;
this
[
"
xtrn
"
]
=
loadXtrn
;
this
[
"
logoff
"
]
=
logoff
;
if
(
center
.
wp_shown
)
center
.
clear
();
}
}
function
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
=
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
;
}
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