home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 5 Edit
/
05-Edit.zip
/
p2demo21.exe
/
PEL
/
STATBAR.PEL
< prev
next >
Wrap
Text File
|
1995-02-22
|
16KB
|
558 lines
# $Header: P:\source\wmacros\statbar.pev 1.16 22 Feb 1995 14:04:10 PFHJXM0 $
## $Tabs:4 7$
##############################################################################
#
# Compuware Corporation
# 31440 Northwestern Highway
# Farmington Hills, Michigan 48334-2564
#
# This source code listing contains information that is
# proprietary to Compuware Corporation and may not be copied
# duplicated, translated, transmitted, stored, retrieved
# or in any manner or by any method conveyed or disclosed
# to a third party or parties without express written
# permission from Compuware Corporation.
#
#
##############################################################################
#### $Workfile: statbar.pel $
#########################################################################
## Status Bar flags (STB) are different bits in a long:
##
## The top word is currently unused.
##
## The next word is shown below. Note that a Status bar flag of 0
## implies that no element of the status bar is visible. Therefore it
## is not drawn. In all other cases it appears.
##
## 0xN000 0x0N00 0x00N0 0x000N
## |_8_|_4_|_2_|_1_| |_8_|_4_|_2_|_1_| |_8_|_4_|_2_|_1_| |_8_|_4_|_2_|_1_|
## | unused | |un1 pau B # | | * ind|cur pos| | clock items |
##
## The message flag (*) indicates whether popups or the status bar is used
## for messages; the prompt flag (#) indicates whether popups or the status
## bar is used for prompts and confirms.
##
global STB_TIME12 = 0x00001
global STB_TIME24 = 0x00002
global STB_DATE = 0x00004
global STB_DAYOFWEEK = 0x00008
global STB_CLOCK = STB_TIME24 + STB_TIME12+STB_DATE+STB_DAYOFWEEK
global STB_TIME = STB_TIME24 + STB_TIME12
global STB_LINE = 0x00010
global STB_COLUMN = 0x00020
global STB_LAST_LINE = 0x00040
global STB_PAUSEONERR = 0x00080
global STB_PROMPTS = 0x00100 # prompts displays on status bar
global STB_MESSAGES = 0x00200 # messages display on status bar
global STB_INDICATORS = 0x00400
global STB_BUSY = 0x00800
global STB_MESSAGELEV0 = 0x01000
global STB_MESSAGELEV1 = 0x02000
global STB_EMULATION = 0x04000
global STB_DYNA_SIZE = 0x08000
global STB_OFFSET = 0x10000
global STB_LINE_COLUMN = STB_LINE + STB_COLUMN
global STB_POSITION = STB_LINE + STB_COLUMN + STB_LAST_LINE + STB_OFFSET
global STB_TOTAL_INDS = STB_INDICATORS + STB_EMULATION
global STB_LEVELS = STB_MESSAGELEV0 + STB_MESSAGELEV1
# useful combinations
global STB_DEFAULT = STB_TIME12 + STB_DAYOFWEEK + STB_DATE+ \
STB_COLUMN + STB_LINE + STB_MESSAGES+ \
STB_INDICATORS + STB_PAUSEONERR
global STB_DEFAULT_PROMPTS = STB_DEFAULT + STB_PROMPTS
global STB_VISIBLE = STB_CLOCK + STB_POSITION + \
STB_MESSAGES+ STB_INDICATORS
local statusBarOn = STB_DEFAULT
local prevStatusBarFlags
### status bar functions
#
function toggle_status_bar( enable, flags )
{
# local menu = menu_info(0, 0x2000)
# local action
local count = argcount();
enable += 0;
if(count < 1 )
enable = !status_bar_flags
if(enable)
{
if(count == 2) # flags specified, so set status_bar_flags
{
status_bar_flags = flags;
if(flags) # not 0, so save them for later
statusBarOn = flags
}
else if(status_bar_flags) # already on, save them
statusBarOn = status_bar_flags;
else # not on, change them to the flags last used
status_bar_flags = statusBarOn;
}
else # turn them off
status_bar_flags = 0
# action = !!status_bar_flags ? MI_CHECKED : MI_UNCHECKED
# if ( menu )
# modify_menuitem( menu, IDM_STATUSBAR, action)
}
# Change the value of status_bar_flags, while saving a copy of the previous
# settings so that they may later be restored.
#
global function save_status_bar_flags()
{
prevStatusBarFlags = status_bar_flags
}
global function set_status_bar_flags( newFlags )
{
prevStatusBarFlags = status_bar_flags
status_bar_flags = newFlags
}
# Enable the message bit in status_bar_flags, saving the previous value
# so that it may later be restored.
#
global function enable_status_bar_messages()
{
prevStatusBarFlags = status_bar_flags
status_bar_flags = or(status_bar_flags, STB_MESSAGES)
}
# Disable the message bit in status_bar_flags, saving the previous value
# so that it may later be restored.
#
global function disable_status_bar_messages()
{
prevStatusBarFlags = status_bar_flags
status_bar_flags = and(status_bar_flags, not(STB_MESSAGES))
}
# Enable the prompt bit in status_bar_flags, saving the previous value
# so that it may later be restored.
#
global function enable_status_bar_prompts()
{
prevStatusBarFlags = status_bar_flags
status_bar_flags = or(status_bar_flags, STB_PROMPTS)
}
# Disable the prompt bit in status_bar_flags, saving the previous value
# so that it may later be restored.
#
global function disable_status_bar_prompts()
{
prevStatusBarFlags = status_bar_flags
status_bar_flags = and(status_bar_flags, not(STB_PROMPTS))
}
# Restore status_bar_flags to a prior value.
#
global function restore_status_bar()
{
status_bar_flags = prevStatusBarFlags
}
function default_status_bar( prompt_on_bar )
{
prevStatusBarFlags = status_bar_flags
if ( prompt_on_bar )
status_bar_flags = STB_DEFAULT_PROMPTS
else
status_bar_flags = STB_DEFAULT
}
global function toggle_stb_flags(mask, value)
{
local msg, suffix = "disabled.";
# If no value supplied, toggle the old value;
if(argcount() < 2)
value = xor(mask, and(status_bar_flags, mask));
if ( value )
{
status_bar_flags = or( status_bar_flags, mask )
suffix = "enabled.";
}
else
status_bar_flags = and( status_bar_flags, not(mask) )
if(mask == STB_COLUMN)
msg = "Columns on status bar " suffix;
else if(mask == STB_DATE)
msg = "Date on status bar " suffix;
else if(mask == STB_DAYOFWEEK)
msg = "Day of week on status bar " suffix;
else if(mask == STB_DYNA_SIZE)
msg = "Dynamic resizing of status bar " suffix;
else if(mask == STB_EMULATION)
msg = "Emulaton on status bar " suffix;
else if(mask == STB_INDICATORS)
msg = "Other indicators on status bar " suffix;
else if(mask == STB_LAST_LINE)
msg = "Last line on status bar " suffix;
else if(mask == STB_LINE)
msg = "Current line on status bar " suffix;
else if(mask == STB_MESSAGES)
msg = "Messages on status bar " suffix;
else if(mask == STB_PROMPTS)
msg = "Prompts on status bar " suffix;
else if(mask == STB_TIME12)
msg = "12 hour time on status bar " suffix;
else if(mask == STB_TIME24)
msg = "24 hour time on status bar " suffix;
else if(mask == STB_TIME)
msg = "Time on status bar " suffix;
else
msg = "Status bar feature " suffix;
message(msg);
return value;
}
#
# toggle the display of messages and notifys on the status bar
#
#function toggle_stb_message( on ) #PUBLIC #INT
#{
# if ( argcount() < 1 )
# on = !and( status_bar_flags, STB_MESSAGES )
# else
# on = 0+on
#
# #
# # toggle the setting
# #
# if ( on )
# status_bar_flags = or( status_bar_flags, STB_MESSAGES )
# else
# status_bar_flags = and( status_bar_flags, not( STB_MESSAGES ))
#
# message( "Status bar messages %s.", on ? "on" : "off" )
# return on
#}
#
# toggle the display of prompts and confirms on the status bar
#
#function toggle_stb_prompt( on ) #PUBLIC #INT
#{
# if ( argcount() < 1 )
# on = !and( status_bar_flags, STB_PROMPTS )
# else
# on = 0+on
#
# #
# # toggle the setting
# #
# if ( on )
# status_bar_flags = or( status_bar_flags, STB_PROMPTS )
# else
# status_bar_flags = and( status_bar_flags, not( STB_PROMPTS ))
#
# message( "Status bar prompts %s.", on ? "on" : "off" )
# return on
#}
#
# toggle the display of current line position on the status bar
#
#function toggle_stb_line( on ) #PUBLIC #INT
#{
# if ( argcount() < 1 )
# on = !and( status_bar_flags, STB_LINE )
# else
# on = 0+on
#
# #
# # toggle the setting
# #
# if ( on )
# status_bar_flags = or( status_bar_flags, STB_LINE )
# else
# status_bar_flags = and( status_bar_flags, not( STB_LINE ))
#
# message( "Status bar line display %s.", on ? "on" : "off" )
# return on
#}
#
# toggle the display of current column position on the status bar
#
#function toggle_stb_column( on ) #PUBLIC #INT
#{
# if ( argcount() < 1 )
# on = !and( status_bar_flags, STB_COLUMN )
# else
# on = 0+on
#
# #
# # toggle the setting
# #
# if ( on )
# status_bar_flags = or( status_bar_flags, STB_COLUMN )
# else
# status_bar_flags = and( status_bar_flags, not( STB_COLUMN ))
#
# message( "Status bar column display %s.", on ? "on" : "off" )
# return on
#}
#
# toggle the display of indicators on the status bar
#
#function toggle_stb_indicators( on ) #PUBLIC #INT
#{
# if ( argcount() < 1 )
# on = !and( status_bar_flags, STB_INDICATORS )
# else
# on = 0+on
#
# #
# # toggle the setting
# #
# if ( on )
# status_bar_flags = or( status_bar_flags, STB_INDICATORS )
# else
# status_bar_flags = and( status_bar_flags, not( STB_INDICATORS ))
#
# message( "Status bar indicators %s.", on ? "on" : "off" )
# return on
#}
#
# toggle the display of the day of the week on the status bar
#
#function toggle_stb_dow( on ) #PUBLIC #INT
#{
# if ( argcount() < 1 )
# on = !and( status_bar_flags, STB_DAYOFWEEK )
# else
# on = 0+on
#
# #
# # toggle the setting
# #
# if ( on )
# status_bar_flags = or( status_bar_flags, STB_DAYOFWEEK )
# else
# {
# oldClock = and( status_bar_flags, STB_CLOCK )
# status_bar_flags = and( status_bar_flags, not( STB_DAYOFWEEK ))
# }
# message( "Status bar day of week display %s.", on ? "on" : "off" )
# return on
#}
#
# toggle the display of date on the status bar
#
#function toggle_stb_date( on ) #PUBLIC #INT
#{
# if ( argcount() < 1 )
# on = !and( status_bar_flags, STB_DATE )
# else
# on = 0+on
#
# #
# # toggle the setting
# #
# if ( on )
# status_bar_flags = or( status_bar_flags, STB_DATE )
# else {
# oldClock = and( status_bar_flags, STB_CLOCK )
# status_bar_flags = and( status_bar_flags, not( STB_DATE ))
# }
# message( "Status bar date display %s.", on ? "on" : "off" )
# return on
#}
#
# toggle the display of 12 hour format time on the status bar
#
#function toggle_stb_time12( on ) #PUBLIC #INT
#{
# if ( argcount() < 1 )
# on = !and( status_bar_flags, STB_TIME12 )
# else
# on = 0+on
#
# # turn 24 hour time off
# #
# status_bar_flags = and( status_bar_flags, not( STB_TIME24 ))
#
# #
# # toggle the setting
# #
# if ( on )
# status_bar_flags = or( status_bar_flags, STB_TIME12 )
# else {
# oldClock = and( status_bar_flags, STB_CLOCK )
# status_bar_flags = and( status_bar_flags, not( STB_TIME12 ))
# }
# message( "Status bar 12 hour time display %s.", on ? "on" : "off" )
# return on
#}
#
# toggle the display of 24 hour format time on the status bar
#
#function toggle_stb_time24( on ) #PUBLIC #INT
#{
# if ( argcount() < 1 )
# on = !and( status_bar_flags, STB_TIME24 )
# else
# on = 0+on
#
# # turn 12 hour time off
# #
# status_bar_flags = and( status_bar_flags, not( STB_TIME12 ))
#
# #
# # toggle the setting
# #
# if ( on )
# status_bar_flags = or( status_bar_flags, STB_TIME24 )
# else {
# oldClock = and( status_bar_flags, STB_CLOCK )
# status_bar_flags = and( status_bar_flags, not( STB_TIME24 ))
# }
#
# message( "Status bar 24 hour time display %s.", on ? "on" : "off" )
# return on
#}
# local oldClock = and( status_bar_flags, STB_CLOCK )
#
# toggle the display of date, day and time on the status bar
#
#function toggle_stb_clock( on ) #PUBLIC #INT
#{
# if ( argcount() < 1 )
# on = !and( status_bar_flags, STB_CLOCK )
# else
# on = 0+on
#
# #
# # toggle the setting
# #
# if ( on )
# status_bar_flags = or( status_bar_flags, oldClock )
# else {
# oldClock = and( status_bar_flags, STB_CLOCK )
# status_bar_flags = and( status_bar_flags, not( STB_CLOCK ))
# }
#
# message( "Status bar clock display %s.", on ? "on" : "off" )
# return on
#}
#
# toggle the display of the emulation mode on the status bar
#
#function toggle_stb_emulation( on ) #PUBLIC #INT
#{
# if ( argcount() < 1 )
# on = !and( status_bar_flags, STB_EMULATION )
# else
# on = 0+on
#
# #
# # toggle the setting
# #
# if ( on )
# status_bar_flags = or( status_bar_flags, STB_EMULATION )
# else
# status_bar_flags = and( status_bar_flags, not( STB_EMULATION ))
#
# message( "Status bar emulation mode display %s.", on ? "on" : "off" )
# return on
#}
#
# toggle the display of the last line on the status bar
#
#function toggle_stb_lastline( on ) #PUBLIC #INT
#{
# if ( argcount() < 1 )
# on = !and( status_bar_flags, STB_LAST_LINE)
# else
# on = 0+on
#
# #
# # toggle the setting
# #
# if ( on )
# status_bar_flags = or( status_bar_flags, STB_LAST_LINE)
# else
# status_bar_flags = and( status_bar_flags, not( STB_LAST_LINE))
#
# message( "Status bar last line display %s.", on ? "on" : "off" )
# return on
#}
#
# toggle the display of the dynamic sizing on the status bar
#
#function toggle_stb_dynasize( on ) #PUBLIC #INT
#{
# if ( argcount() < 1 )
# on = !and( status_bar_flags, STB_DYNA_SIZE )
# else
# on = 0+on
#
# #
# # toggle the setting
# #
# if ( on )
# status_bar_flags = or( status_bar_flags, STB_DYNA_SIZE )
# else
# status_bar_flags = and( status_bar_flags, not( STB_DYNA_SIZE ))
#
# message( "Status bar dynamic sizing display %s.", on ? "on" : "off" )
# return on
#}
#
# toggle the display of the dynamic sizing on the status bar
#
#function toggle_stb_offset( on ) #PUBLIC #INT
#{
# if ( argcount() < 1 )
# on = !and( status_bar_flags, STB_OFFSET )
# else
# on = 0+on
#
# #
# # toggle the setting
# #
# if ( on )
# status_bar_flags = or( status_bar_flags, STB_OFFSET )
# else
# status_bar_flags = and( status_bar_flags, not( STB_OFFSET ))
#
# message( "Status bar offset display %s.", on ? "on" : "off" )
# return on
#}