home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mega Top 1
/
os2_top1.zip
/
os2_top1
/
DEMO
/
RIM22
/
MACROS
/
MULTIED.RM
< prev
next >
Wrap
Text File
|
1993-11-05
|
15KB
|
451 lines
/*
** Macro module: multied.rm - MultiEdit(R) keyboard map
**
** Multi-Edit is a registered trademark of American Cybernetics, Inc.
**
** Copyright (C) 1993 Brian L. Smith
** Copyright (C) 1993 RimStar Technology, Inc.
** All rights reserved internationally.
** Unlicensed use is a violation of applicable laws.
**
** This source code is provided to licensed users of RimStar's products
** for the purpose of allowing the user to customize and/or enhance RimStar's
** products. The source code remains the property of the copyright holders
** with all rights reserved internationally.
** Any modifications to the source code are considered derivative works and
** all rights thereto are reserved to the copyright holders except
** that the purchaser may use the derivitive work in the same manner
** as permitted by the license governing the unmodified product.
** Distribution in any manner of any part of the original source code,
** whether in source or object form, is expressly prohibited without the
** express written permission of the copyright holders.
**
*/
#include "macro.h"
/*
** This sets up the editor for a Multi-Edit keyboard mapping.
** The following keys assignments are not supported in this
** version of the editor, alternatives are provided in ():
** F8 - Copy Block (Use Ctrl+Ins & Shift+Ins)
** Shift+F8 - Move Block (Use Shift+Del & Shift+Ins)
** F10 - Menu (press and release Alt key instead)
** Shift+F3 - File Manager
** Shift+F8 - Move Block
** Shift+F1 - Previous Help Topic
** Ctrl+F1 - Language Extension Help
** Shift+F4 - Condensed Display
** Ctrl+F5 - Repeat last Search & Replace (Use SearchAgain & ReplaceAgain)
** Alt+A - ASCII Table
** Alt+J - Right Justify
** Alt+K - Display Key-Codes (use KbdQueryFunction)
** Alt+P - Phone/Address List
** Alt+Ins - Cut & Paste from Help (use copy from help &
** import clipboard & paste)
** Alt+S - Spell feature
**
** There are over 300 functions available to you in the editor.
** Some of them have key strokes assigned to them in this file and
** some are commented out leaving the choice of key stroke assignment
** to you.
**
** To have the editor use this keyboard mapping - copy or rename multiedt.obm
** to keyboard.obm. Brief.obm is the default key map for
** the RimStar Programmer's editor.
*/
void
_init(void) {
LibAutoload("misc", "quote", "next_word", "prev_word", "toupper", "tolower",
"delete_next_word", "delete_prev_word");
LibAutoload("c_smart", "find_matching_delim" );
LibAutoload( "c_indent", "_c_expand" );
LibAutoload( "kbd", "KbdBindAsciiKeys");
} /* end _init() */
void
KbdBindDefault() {
char *self_insert = "SelfInsert";
char *p;
/*
** ascii mapping
*/
KbdBindAsciiKeys();
/*
** Help
*/
KbdBind("Alt+H", "HelpQueryInfHelp");
KbdBind("Shift+F1", "HelpIndex");
KbdBind("F1", "HelpForHelp");
/*
** NOTE: To use QueryInfHelp you must add the following environment variable
** to your config.sys:
** SET RSE_INF=GUIREF20.INF+PMFUN.INF+PMGPI.INF+PMHOK.INF+PMMSG.INF+PMREL.INF+PMWIN.INF+PMWKP.INF
** The setting is taken from the combination of the PROGREF20 and PMREF environment variables
** You may add additional .INF files or remove some.
*/
#if 0
KbdBind("Alt+H", "HelpQueryQuickHelp"); /* invokes Microsoft Quick Help program */
#endif
/*
** bookmarks
*/
KbdBind("Alt+J+1", "BookmarkGoto 1");
KbdBind("Alt+J+2", "BookmarkGoto 2");
KbdBind("Alt+J+3", "BookmarkGoto 3");
KbdBind("Alt+J+4", "BookmarkGoto 4");
KbdBind("Alt+J+5", "BookmarkGoto 5");
KbdBind("Alt+J+6", "BookmarkGoto 6");
KbdBind("Alt+J+7", "BookmarkGoto 7");
KbdBind("Alt+J+8", "BookmarkGoto 8");
KbdBind("Alt+J+9", "BookmarkGoto 9");
KbdBind("Alt+J+0", "BookmarkGoto 10");
KbdBind("Alt+1", "BookmarkSet 1");
KbdBind("Alt+2", "BookmarkSet 2");
KbdBind("Alt+3", "BookmarkSet 3");
KbdBind("Alt+4", "BookmarkSet 4");
KbdBind("Alt+5", "BookmarkSet 5");
KbdBind("Alt+6", "BookmarkSet 6");
KbdBind("Alt+7", "BookmarkSet 7");
KbdBind("Alt+8", "BookmarkSet 8");
KbdBind("Alt+9", "BookmarkSet 9");
KbdBind("Alt+0", "BookmarkSet 10");
/*
** Deletions
*/
KbdBind("Ctrl+Shift+DELETE", p="BufDeleteToEOL");
KbdBind("Ctrl+Shift+KP_DELETE", p);
KbdBind("Ctrl+Shift+BACKSPACE", "BufDeleteToSOL");
KbdBind("Alt+|", "BufDeleteWhitespace");
KbdBind("BACKSPACE", p="BufBackspace");
KbdBind("Shift+BACKSPACE", p);
KbdBind("Ctrl+DELETE", "delete_next_word"); /* in misc.rm */
KbdBind("Ctrl+BACKSPACE", "delete_prev_word"); /* in misc.rm */
KbdBind("Alt+BACKSPACE", "Undo");
KbdBind("KP_STAR", "UndoModification");
KbdBind("Shift+Ctrl+KP_STAR", "UndoAll");
KbdBind("Alt+N", "BufNextBuffer");
KbdBind("Ctrl+F2", "DlgRenameBuffer");
KbdBind("Alt+P", "Print");
KbdBind("Alt+Q+T", "quote"); /* in misc.rm */
KbdBind("Alt+R", "BufInsertFile");
KbdBind("Alt+I", "ToggleInsert");
KbdBind("Alt+T", "ToggleTabs");
#if 0
KbdBind("Alt+Z", ""); /* Start windowed command interpreter. Use Alt+ESC to start one. */
#endif
KbdBind("Alt+-", "BufPrevBuffer");
/*
** Dialogs
*/
KbdBind("Ctrl+F6", "DlgBufferList");
KbdBind("Alt+E", "DlgOpenFile");
KbdBind("Alt+V", "DlgVersion");
KbdBind("F2", "SaveBuffer");
KbdBind("F3", "BufNewFile");
/*
** All supported special key names follow, even those not assigned
** just so you know what every key is named.
**
** KP stands for the Key Pad keys.
**
** Alt+ESCAPE, Alt+TAB and Ctrl+ESCAPE are reserved for OS/2 PM's use
** do not define these as they will be ignored.
*/
KbdBind("Shift+TAB", "MovPrevTabPos");
KbdBind("Ctrl+Enter", "BufInsertNewline");
KbdBind("F8", "BufCopyToScrap");
KbdBind("F6", "WinNextWindow");
KbdBind("Shift+F6", "WinPrevWindow");
// KbdBind("F2", "WinTileWindows");
// KbdBind("Shift+F2", "WinCascade");
// KbdBind("F3", "WinNewWindow");
// KbdBind("F4", "WinDeleteCurrentWindow");
/*
** Search & Replace Operations
*/
KbdBind("F5", "SearchForward");
// KbdBind("F5", "SearchBackward");
// KbdBind("F5", "SearchAgain");
KbdBind("Shift+F5", "ReplaceForward");
// KbdBind("Shitf+F5", "ReplaceBackward");
// KbdBind("Shift+F6", "ReplaceAgain");
/*
** Keystroke Macros
*/
KbdBind("Alt+F10", "KbdMacroRecord"); /* starts/stops keystroke macro recording */
KbdBind("Alt+Shift+F10", "KbdMacroLoad"); /* load keystroke macro from disk */
// KbdBind("Shift+F7", "KbdMacroPause"); /* pause keystroke macro playback */
KbdBind("F10", "KbdMacroPlay"); /* plays a recorded keystroke macro */
KbdBind("Ctrl+F10", "KbdMacroSave"); /* saves last recorded macro to disk */
KbdBind("Ctrl+Shift+F10", "LibLoadMacro");
KbdBind("Shift+F10", "LibExecFunction");
KbdBind("F9", "ExecAssoc");
KbdBind("Ctrl+K", "ExecKillProcess"); /* Kills a program executed on buffer */
/*
** For use in error output buffer - place cursor on error line
** ALT+F9 jumps to file & line in error, loading the file if needed
*/
// KbdBind("Alt+F9", "ErrJumpToError");
KbdBind("Shift+F9", "ErrNextError");
KbdBind("Ctrl+P", "ErrPrevError");
/*
** NOTE: Consecutive requests of the Home builtin command and the End builtin
** command support BRIEF's convention. A key assigned to the Home or End
** builtin command will perform three different actions when invoked
** consecutively:
**
** For the Home builtin command:
**
** 1st time command invoked - move to the beginning of the current line
** 2nd (consecutive) invocation - move to the beginning of the top line in window
** 3rd (consecutive) invocation - move to the beginning of the buffer (file)
**
** For the End builtin command:
**
** 1st time command invoked - move to end of current line
** 2nd (consecutive) invocation - move to end of last line in window
** 3rd (consecutive) invocation - move to end of the buffer (file)
**
**
** So if the Home builtin command is assigned to the HOME key:
**
** HOME moves to the beginning of the current line
** HOME+HOME moves to the beginning of the top line in window
** HOME+HOME+HOME moves to the beginning of the file
**
** and if the End builtin command is assigned to the END key:
**
** END moves to the end of the current line
** END+END moves to the end of the last line in window
** END+END+END moves to the end of the file
**
** Any other commands invoked in between will reset the counters.
**
** If you don't want this behavior you can use LineStart and LineEnd
** these commands do only the single action.
*/
/*
** cursor movement
*/
KbdBind("KP_LEFT", p="MovLeft");
KbdBind("LEFT", p);
KbdBind("RIGHT", p="MovRight");
KbdBind("KP_RIGHT", p);
KbdBind("UP", p="MovUp");
KbdBind("KP_UP", p);
KbdBind("DOWN", p="MovDown");
KbdBind("KP_DOWN", p);
KbdBind("Ctrl+LEFT", p="prev_word"); /* in misc.rm */
KbdBind("Ctrl+KP_LEFT", p);
KbdBind("Ctrl+RIGHT", p="next_word"); /* in misc.rm */
KbdBind("Ctrl+KP_RIGHT", p);
KbdBind("Ctrl+E", "StartOfBlock");
KbdBind("Ctrl+C", "EndOfBlock");
KbdBind("Alt+F5", "DlgGotoLine");
KbdBind("HOME", p="MovSOL");
KbdBind("KP_HOME", "MovSOL");
KbdBind("END", p="MovEOL");
KbdBind("KP_END", p);
KbdBind("Ctrl+HOME", "MovSOF");
KbdBind("Ctrl+END", "MovEOF");
KbdBind("Ctrl+T", "MovTopWin");
KbdBind("Ctrl+B", "MovBottomWin");
KbdBind("PGUP", p="MovPageUp");
KbdBind("KP_PGUP", p);
KbdBind("PGDN", p="MovPageDown");
KbdBind("KP_PGDN", p);
// KbdBind("Ctrl+T", "WinScrollTop");
KbdBind("Ctrl+UP", p="WinScrollDown");
KbdBind("Ctrl+KP_UP", p);
// KbdBind("Ctrl+B", "WinScrollBottom");
KbdBind("Ctrl+DOWN", p="WinScrollUp");
KbdBind("Ctrl+KP_DOWN", p);
KbdBind("Ctrl+I", "SelfInsert");
KbdBind("Ctrl+U", "MovPrevTabPos");
KbdBind("F4", "MarkPushPos");
KbdBind("Shift+F4", "MarkPopPos");
KbdBind("Shift+LEFT", "MovPrevChar");
KbdBind("Shift+RIGHT", "MovNextChar");
#if 0
KbdBind("KP_5", "");
#endif
/*
** Block Operations
*/
KbdBind("F7", "MarkLineOrEndMark");
KbdBind("Shift+F7", "MarkColumn");
KbdBind("Alt+A", "MarkExclusive");
KbdBind("Ctrl+F7", "MarkNormal");
// KbdBind("F7", "MarkEndSel");
KbdBind("Alt+B+F", "MarkRemoveSel");
KbdBind("Alt+F3", "slide_in");
KbdBind("Alt+F2", "slide_out");
KbdBind("Ctrl+F8", p="BufDeleteCharOrSelection");
KbdBind("DELETE", p);
KbdBind("KP_DELETE", p);
KbdBind("Ctrl+INSERT", p="BufCopyToScrap");
KbdBind("Ctrl+KP_INSERT", p);
KbdBind("Shift+DELETE", p="BufCutToScrap");
KbdBind("Shift+KP_DELETE", p);
KbdBind("Ctrl+KP_PLUS", "CopyAppendToScrap"); /* append to current scrap */
KbdBind("Shift+INSERT", p="BufPasteScrap");
KbdBind("Shift+KP_INSERT", p);
KbdBind("Ctrl+KP_MINUS", "CutAppendToScrap"); /* append to current scrap */
KbdBind("Alt+Shift+BACKSPACE","BufDeleteLine");
KbdBind("Shift+F2", "SaveBuffer");
KbdBind("Ctrl+A", "MarkSwapSel");
// KbdBind("Shift+INSERT", "ImportClipboard");
// KbdBind("Ctrl+INSERT", "ExportClipboard");
KbdBind("Ctrl+-", "BufDeleteCurrentBuffer");
KbdBind("Shift+Ctrl+-", "WinDeleteWindowAndBuffer");
KbdBind("Ctrl+W", "ToggleBackups");
/*
** Default Key Assignments
*/
KbdBind("Alt+Q", "SysSaveAndExit");
KbdBind("Alt+X", "ExitEditor");
KbdBind("Alt+F9", "_c_expand");
KbdBind("Alt+Enter", "Redo");
KbdBind("Shift+KP_STAR", "RedoModification");
KbdBind("Shift+Alt +KP_STAR", "RedoAll");
KbdBind("Ctrl+F9", "find_matching_delim"); /* in c_smart.rm */
/* Source browser bindings */
KbdBind("Ctrl+Alt+F12", p="SbJumpBack");
KbdBind("Alt+J+B", p);
KbdBind("Alt+S+Alt+S", p="SbBrowseSymbolAtCursor");
KbdBind("Alt+S+S", p);
KbdBind("F11", p);
KbdBind("Alt+S+Alt+D", p="SbBrowseDefs");
KbdBind("Alt+S+D", p);
KbdBind("Shift+F11", p);
KbdBind("Alt+S+Alt+M", p="SbBrowseSymbolsDefinedInModule");
KbdBind("Alt+S+M", p);
KbdBind("Alt+F11", p);
KbdBind("Ctrl+G", p); /* Brief's `routines' assignment */
KbdBind("Alt+S+Alt+R", p="SbBrowseRefs");
KbdBind("Alt+S+R", p);
KbdBind("Ctrl+F11", p);
KbdBind("Alt+S+Alt+F", p="SbFindNext");
KbdBind("Alt+S+F", p);
KbdBind("F12", p);
KbdBind("Alt+S+Alt+B", p="SbFindPrev");
KbdBind("Alt+S+B", p);
KbdBind("Shift+F12", p);
KbdBind("Alt+F12", "SbGotoDef");
KbdBind("Alt+F12", "SbGotoDef");
} /* end KbdBindDefault() - Multi-edit key map */
void
MarkLineOrEndMark( void ) {
SHORT rc;
rc = MarkQuerySelType();
if ( rc )
MarkEndSel();
else
MarkLine();
} /* end MarkLineOrEndMark */
void
CopyAppendToScrap(void) {
BufCopyToScrap(1);
} /* end CopyAppendToScrap */
void
CutAppendToScrap(void) {
BufCutToScrap(1);
} /* end CutAppendToScrap */
void
StartOfBlock(void) {
SELECTION p;
MarkQuerySel( &p );
MovAbs( p.s_line, p.s_column );
} /* end StartOfBlock */
void
EndOfBlock(void) {
SELECTION p;
MarkQuerySel( &p );
MovAbs( p.e_line, p.e_column );
} /* end EndOfBlock */
void
BookmarkSet(USHORT number) {
HMARK hMark;
USHORT reply;
char szTitle[32];
hMark = MarkQueryGlobalFromID(number);
if ( !hMark )
hMark = MarkAllocGlobal(number);
else {
sprintf(szTitle, "Set bookmark %d", number);
reply = PopupMsgBox( "This bookmark is already set. Overwrite?", szTitle,
MB_YESNO | MB_ICONQUESTION |
MB_MOVEABLE | MB_APPLMODAL);
if ( reply == MBID_YES )
MarkResetMark(hMark);
}
} /* end BookmarkSet() */
void
BookmarkGoto(USHORT number) {
HMARK hMark;
char szTitle[32];
hMark = MarkQueryGlobalFromID(number);
if ( hMark )
MarkGoto(hMark);
else {
sprintf(szTitle, "Jump to bookmark %d", number);
PopupMsg("That bookmark is not set", szTitle);
}
} /* end BookmarkGoto() */
/*
** End module: multied.rm
*/