home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 5 Edit
/
05-Edit.zip
/
p2demo21.exe
/
PEL
/
MINSAVE.PEL
< prev
next >
Wrap
Text File
|
1995-03-31
|
3KB
|
114 lines
# $Header: P:\source\wmacros\minsave.pev 1.15 31 Mar 1995 12:58:54 PFHCFV0 $
## $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: minsave.pel $:
global function minimize_and_save()
{
local buf
local i = buffers_modified
local oldBuffer = current_buffer
local c, curr_win
# check to see if any files need saving
if ( i )
{
buf = sprintf( "%d %s been modified, Minimize[ynw]? ", \
i, i > 1 ? "buffers have" : "buffer has")
c = tolower( confirm(buf, "yYnNwW") )
if (c == "w")
{
if ( write_all_buffers() )
{
current_buffer = oldBuffer
}
else
{
warning("Could not write all buffers!")
return;
}
}
}
if (!i || (c && (c != "n")) )
set_editwin_property(EWC_MINIMIZE)
# if in detached mode must minimize all text windows also
if ( mdi_mode == 2 )
{
curr_win = current_window
collapse_window()
while ( curr_win != next_window("", 0, 1) )
{
collapse_window()
}
}
}
local FILE_REGEX = "[a-zA-Z0-9_:\\\\./]+"
global function open_file_under_cursor( filename, path, isDirs )
{
local fn = filename ? filename : file_under_cursor()
local fn2
local status = ""
local env_vars = path ? path : "INCLUDE;PATH;DPATH"
if ( !fn )
{
warning("No file under cursor" )
return status;
}
# check for the file in the current directory
if ( filemode(fn) == -1 )
{
# get the directory of the currently loaded buffer
# WGN 3/38/95 - added path_ext() to 3rd parameter so that files with
# no extension are handled properly.
fn2 = bld_fnam(buffer_filename, fn, path_ext(fn) )
if ( filemode(fn2) != -1 || (fn2 = search_path(fn, env_vars, isDirs)) != "" )
{
create_buf_and_win_key(fn2)
update_current_view()
status = fn2
}
else
warning("Cannot open file " fn )
}
else
{
create_buf_and_win_key(fn)
update_current_view()
status = fn
}
return status
}
global function file_under_cursor()
{
return symbol_under_cursor(FILE_REGEX)
}