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
3d3d8af6
Commit
3d3d8af6
authored
19 years ago
by
deuce
Browse files
Options
Downloads
Patches
Plain Diff
Document the rest of the item properties.
Add a nodraw property to the object indicating a redraw is unnecessary.
parent
42cd5956
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
exec/load/lightbar.js
+29
-5
29 additions, 5 deletions
exec/load/lightbar.js
with
29 additions
and
5 deletions
exec/load/lightbar.js
+
29
−
5
View file @
3d3d8af6
...
...
@@ -19,6 +19,12 @@ if(this.SYS_CLOSED==undefined)
* width - The width of this item. If not specified, is the width of
* the text. Otherwise, the text is truncated or padded with
* spaces to fit the width.
* lpadding - the string that is displated before THIS item and is not
* highlighted
* rpadding - the string that is displated after THIS item and is not
* highlighted
* disabled - Indicates that this item is disabled and cannot be
* selected
* direction: 0 for vertical, 1 for horizontal.
* Horizontal menus always have one space of padding added between
* items.
...
...
@@ -41,6 +47,8 @@ if(this.SYS_CLOSED==undefined)
* hblanks: The number of horizontal blanks between items for horizontal menus.
* hotkeys: A string of keys which will immediately return the key value rather
* than a retval
* nodraw: Indicates that the lightbar does not need to be redrawn on next entry.
* This is reset to false on every return
*/
function
Lightbar
(
items
)
{
...
...
@@ -73,7 +81,7 @@ function Lightbar(items)
this
.
items
=
items
;
}
function
Lightbar_additem
(
txt
,
retval
,
width
,
lpadding
,
rpadding
,
disabled
)
function
Lightbar_additem
(
txt
,
retval
,
width
,
lpadding
,
rpadding
,
disabled
,
nodraw
)
{
var
item
=
new
Object
;
...
...
@@ -92,6 +100,8 @@ function Lightbar_additem(txt, retval, width, lpadding, rpadding, disabled)
item
.
rpadding
=
rpadding
;
if
(
disabled
!=
undefined
)
item
.
disabled
=
disabled
;
if
(
nodraw
!=
undefined
)
item
.
nodraw
=
nodraw
;
this
.
items
.
push
(
item
);
}
...
...
@@ -117,6 +127,7 @@ function Lightbar_failsafe_getval()
return
(
undefined
);
this
.
current
=
i
;
retval
=
this
.
items
[
i
].
retval
;
this
.
nodraw
=
false
;
return
(
retval
);
}
...
...
@@ -158,9 +169,11 @@ function Lightbar_getval(current)
if
(
this
.
current
<
0
||
this
.
current
>=
this
.
items
.
length
)
{
alert
(
"
current parameter is out of range!
"
);
this
.
current
=
0
;
if
(
this
.
items
.
length
<=
0
)
if
(
this
.
items
.
length
<=
0
)
{
this
.
nodraw
=
false
;
return
(
null
);
}
}
var
orig_cur
=
this
.
current
;
while
(
this
.
items
[
this
.
current
].
retval
==
undefined
||
this
.
items
[
this
.
current
].
disabled
)
{
this
.
current
++
;
...
...
@@ -168,6 +181,7 @@ function Lightbar_getval(current)
this
.
current
=
0
;
if
(
this
.
current
==
orig_cur
)
{
alert
(
"
No items with a return value!
"
);
this
.
nodraw
=
false
;
return
(
undefined
);
}
}
...
...
@@ -184,6 +198,7 @@ function Lightbar_getval(current)
if
(
this
.
items
[
i
].
width
==
undefined
)
{
if
(
this
.
items
[
i
]
==
undefined
)
{
alert
(
"
Sparse items array!
"
);
this
.
nodraw
=
false
;
return
(
null
);
}
if
(
this
.
items
[
i
].
text
==
undefined
)
{
...
...
@@ -200,6 +215,7 @@ function Lightbar_getval(current)
}
}
if
(
!
this
.
nodraw
)
this
.
draw
();
last_cur
=
this
.
current
;
...
...
@@ -221,10 +237,12 @@ function Lightbar_getval(current)
// Some basic validation.
if
(
this
.
items
[
i
]
==
undefined
)
{
alert
(
"
Sparse items array!
"
);
this
.
nodraw
=
false
;
return
(
this
.
failsafe_getval
());
}
if
(
this
.
items
[
i
].
text
==
undefined
)
{
alert
(
"
No text for item
"
+
i
+
"
!
"
);
this
.
nodraw
=
false
;
return
(
this
.
failsafe_getval
());
}
var
cleaned
=
this
.
items
[
i
].
text
;
...
...
@@ -332,11 +350,14 @@ function Lightbar_getval(current)
}
if
(
item_count
==
0
)
{
alert
(
"
No items with a return value!
"
);
this
.
nodraw
=
false
;
return
(
undefined
);
}
console
.
gotoxy
(
cursx
,
cursy
);
if
(
ret
!=
undefined
)
if
(
ret
!=
undefined
)
{
this
.
nodraw
=
false
;
return
(
ret
);
}
last_cur
=
this
.
current
;
...
...
@@ -347,8 +368,10 @@ function Lightbar_getval(current)
* procesed.
*/
var
key
=
console
.
getkey
(
K_UPPER
|
(
user
.
settings
&
USER_SPIN
?
K_GETSTR
:
0
));
if
(
this
.
hotkeys
.
indexOf
(
key
)
!=-
1
)
if
(
this
.
hotkeys
.
indexOf
(
key
)
!=-
1
)
{
this
.
nodraw
=
false
;
return
(
key
);
}
switch
(
key
)
{
case
KEY_UP
:
if
(
this
.
direction
==
0
)
{
...
...
@@ -404,6 +427,7 @@ function Lightbar_getval(current)
break
;
case
'
\r
'
:
case
'
\n
'
:
this
.
nodraw
=
false
;
if
(
this
.
items
[
this
.
current
].
retval
==
undefined
)
return
(
undefined
);
return
(
this
.
items
[
this
.
current
].
retval
);
...
...
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