home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Global Amiga Experience
/
globalamigaexperience.iso
/
text_dtp
/
editor
/
turbotext
/
rexx
/
getkin.ttx
< prev
next >
Wrap
Text File
|
1995-07-10
|
2KB
|
94 lines
/** $VER: GetKin.ttx 2.0 (9.1.94)
**
** This macro loads a document that is related by name to whatever the
** current document is. For example, if you are editing a ".c" file,
** you can load the ".h" file that goes with it, or vice versa. Windows
** are sized to 1/2 screen, with one on the top and one on the bottom, to
** allow you to look at both of the documents easily.
**
** To add your own relations, just add new pairs below and increment
** the "NumRelations" variable. Relations are included for C, C++, ASM and
** Modula-2.
**
** Written by Chris Bailey
** Modified by Martin Taillefer
**/
OPTIONS RESULTS
NumRelations = 7
/* for C */
Relations.0.0 = ".h"
Relations.0.1 = ".c"
/* for C++ */
Relations.1.0 = ".h"
Relations.1.1 = ".cpp"
/* for C++ */
Relations.2.0 = ".h"
Relations.2.1 = ".cc"
/* for C++ */
Relations.3.0 = ".h"
Relations.3.1 = ".cxx"
/* for ASM */
Relations.4.0 = ".i"
Relations.4.1 = ".asm"
/* for ASM */
Relations.5.0 = ".i"
Relations.5.1 = ".a"
/* for Modula-2 */
Relations.6.0 = ".def"
Relations.6.1 = ".mod"
GetFilePath
filename = RESULT
i = 0
DO i = 0 TO NumRelations-1
idx = index(filename,Relations.i.0)
IF idx ~= 0 THEN DO
newname = delstr(filename,idx,length(Relations.i.0)) || Relations.i.1
CALL NewDoc(newname)
RETURN
END
idx = index(filename,Relations.i.1)
IF idx ~= 0 THEN DO
newname = delstr(filename,idx,LENGTH(Relations.i.1)) || Relations.i.0
CALL NewDoc(newname)
RETURN
END
END
SetStatusBar "No kin file for " || filename
RETURN
/* end of Main() */
NewDoc:
PARSE ARG name
/* NewDoc does the following :
* - Sizes the current window to 1/2 screen and moves it to the top
* - Opens a new edit window with the named document
* - Sizes the new window to 1/2 screen and moves it to the bottom
*/
GetScreenInfo
PARSE VAR RESULT dummy dummy screenWidth screenHeight .
windowHeight = (screenHeight - 2) / 2
MoveSizeWindow 0 2 screenWidth windowHeight
windowSpec = "0/"||(2+windowHeight)||"/"||screenWidth||"/"||(windowHeight + (screenHeight - (windowHeight*2 + 2)))
OpenDoc WINDOW windowSpec name