home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mega Top 1
/
os2_top1.zip
/
os2_top1
/
DEMO
/
RIM22
/
MACROS
/
BRIEF.RM
< prev
next >
Wrap
Text File
|
1994-01-06
|
13KB
|
346 lines
/*
** Macro module: brief.c - Brief(R) keyboard map
**
** Brief is a registered trademark of Borland International
**
** 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 Brief keyboard mapping.
** To have the editor use this - copy or rename brief.obm
** to keyboard.obm This mapping is the default key map for
** the RimStar Programmer's editor.
*/
void
_init(void) {
LibAutoload("kbd", "KbdBindAsciiKeys");
LibAutoload("misc", "quote", "next_word", "prev_word",
"delete_next_word", "delete_prev_word",
"open_line", "toupper", "tolower" );
LibAutoload("c_smart", "find_matching_delim");
} /* end _init() */
void
KbdBindDefault() {
char *self_insert = "SelfInsert";
char *p;
KbdBindAsciiKeys(); /* Binds all the typable keys & system menu bindings */
KbdBind("Alt+A", "MarkExclusive");
KbdBind("Alt+B", "DlgBufferList");
KbdBind("Alt+C", "MarkColumn");
KbdBind("Alt+D", "BufDeleteLine");
KbdBind("Alt+E", "DlgOpenFile");
KbdBind("Alt+G", "DlgGotoLine");
KbdBind("Alt+H", "HelpQueryInfHelp");
/*
** 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
KbdBind("Alt+I", "ToggleInsert");
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+K", "BufDeleteToEOL");
KbdBind("Alt+L", "MarkLine");
KbdBind("Alt+M", "MarkNormal");
KbdBind("Alt+N", "BufNextBuffer");
KbdBind("Alt+O", "DlgRenameBuffer");
KbdBind("Alt+P", "Print");
KbdBind("Alt+Q", "quote"); /* in misc.rm */
KbdBind("Alt+R", "BufInsertFile");
KbdBind("Alt+T", "ToggleTabs");
KbdBind("Alt+U", "Undo");
KbdBind("Alt+V", "DlgVersion");
KbdBind("Alt+W", "SaveBuffer");
KbdBind("Alt+X", "ExitEditor");
KbdBind("Alt+Y", "Redo");
#if 0
KbdBind("Alt+Z", ""); /* Start windowed command interpreter. Use Alt+ESC to start one. */
#endif
KbdBind("Alt+-", "BufPrevBuffer");
KbdBind("Alt+|", "BufDeleteWhitespace");
KbdBind("Alt+]", "find_matching_delim"); /* in c_smart.rm */
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");
/*
** 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("BACKSPACE", "BufBackspace");
KbdBind("Shift+BACKSPACE", "BufBackspace");
KbdBind("Alt+BACKSPACE", "delete_next_word"); /* in misc.rm */
KbdBind("Ctrl+BACKSPACE", "delete_prev_word"); /* in misc.rm */
KbdBind("Shift+TAB", "MovPrevTabPos");
KbdBind("Ctrl+Enter", p="open_line");
KbdBind("Ctrl+Kp_Enter", p);
KbdBind("KP_STAR", "UndoModification");
KbdBind("Shift+KP_STAR", "RedoModification");
KbdBind("Shift+Ctrl+KP_STAR", "UndoAll");
KbdBind("Shift+Alt +KP_STAR", "RedoAll");
KbdBind("F1", "WinNextWindow");
KbdBind("Shift+F1", "WinPrevWindow");
KbdBind("F2", "WinTileWindows");
KbdBind("Shift+F2", "WinCascade");
KbdBind("F3", "WinNewWindow");
KbdBind("F4", "WinDeleteCurrentWindow");
KbdBind("F5", "SearchForward");
KbdBind("Alt+F5", "SearchBackward");
KbdBind("Shift + F5", "SearchAgain");
KbdBind("F6", "ReplaceForward");
KbdBind("Alt+F6", "ReplaceBackward");
KbdBind("Shift+F6", "ReplaceAgain");
KbdBind("F7", "KbdMacroRecord"); /* starts/stops keystroke macro recording */
KbdBind("Alt+F7", "KbdMacroLoad"); /* load keystroke macro from disk */
KbdBind("Shift+F7", "KbdMacroPause"); /* pause keystroke macro playback */
KbdBind("F8", "KbdMacroPlay"); /* plays a recorded keystroke macro */
KbdBind("Alt+F8", "KbdMacroSave"); /* saves last recorded macro to disk */
KbdBind("F9", "LibLoadMacro");
KbdBind("F10", "LibExecFunction");
KbdBind("Alt+F10", "ExecAssoc");
/*
** 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");
/*
** 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 MovSOL and MovEOL
** these commands do only the single action.
*/
KbdBind("HOME", "MovStartBrief");
KbdBind("KP_HOME", "MovStartBrief");
KbdBind("Ctrl+HOME", "MovTopWin");
KbdBind("Ctrl+KP_HOME", "MovTopWin");
KbdBind("END", "MovEndBrief");
KbdBind("KP_END", "MovEndBrief");
KbdBind("Ctrl+KP_END", "MovBottomWin");
KbdBind("Ctrl+END", "MovBottomWin");
KbdBind("PGUP", "MovPageUp");
KbdBind("KP_PGUP", "MovPageUp");
KbdBind("Ctrl+PGUP", "MovSOF");
KbdBind("Ctrl+KP_PGUP", "MovSOF");
KbdBind("PGDN", "MovPageDown");
KbdBind("KP_PGDN", "MovPageDown");
KbdBind("Ctrl+PGDN", "MovEOF");
KbdBind("Ctrl+KP_PGDN", "MovEOF");
KbdBind("UP", "MovUp");
KbdBind("KP_UP", "MovUp");
KbdBind("DOWN", "MovDown");
KbdBind("KP_DOWN", "MovDown");
KbdBind("KP_LEFT", "MovLeft");
KbdBind("LEFT", "MovLeft");
KbdBind("Shift+LEFT", "MovPrevChar");
KbdBind("Ctrl+LEFT", "prev_word"); /* in misc.rm */
KbdBind("Ctrl+KP_LEFT", "prev_word");
KbdBind("RIGHT", "MovRight");
KbdBind("Shift+RIGHT", "MovNextChar");
KbdBind("KP_RIGHT", "MovRight");
KbdBind("Ctrl+RIGHT", "next_word"); /* in misc.rm */
KbdBind("Ctrl+KP_RIGHT", "next_word");
#if 0
KbdBind("KP_5", "");
#endif
KbdBind("KP_MINUS", "CutToScrap");
KbdBind("KP_PLUS", "CopyToScrap");
KbdBind("Shift+KP_MINUS", "CutAppendToScrap"); /* append to current scrap */
KbdBind("Shift+KP_PLUS", "CopyAppendToScrap"); /* append to current scrap */
KbdBind("INSERT", "BufPasteScrap");
KbdBind("KP_INSERT", "BufPasteScrap");
KbdBind("Shift+INSERT", "ImportClipboard");
KbdBind("Ctrl+INSERT", "ExportClipboard");
KbdBind("DELETE", "BufDeleteCharOrSelection");
KbdBind("KP_DELETE", "BufDeleteCharOrSelection");
KbdBind("Ctrl+-", "BufDeleteCurrentBuffer");
KbdBind("Shift+Ctrl+-", "WinDeleteWindowAndBuffer");
KbdBind("Ctrl+A", "MarkSwapSel");
KbdBind("Ctrl+B", "WinScrollBottom");
KbdBind("Ctrl+C", "WinScrollCenter");
KbdBind("Ctrl+D", "WinScrollDown");
KbdBind("Ctrl+K", "ExecKillProcess"); /* Kills a program executed on buffer */
KbdBind("Ctrl+N", "ErrNextError");
KbdBind("Ctrl+P", "ErrPrevError");
KbdBind("Ctrl+T", "WinScrollTop");
KbdBind("Ctrl+U", "WinScrollUp");
KbdBind("Ctrl+W", "ToggleBackups");
KbdBind("Ctrl+X", "SysSaveAndExit");
/* 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");
/*
╔════════════════════════════════════╗
║ Double line box drawing characters ║
╚════════════════════════════════════╝
*/
KbdBind("Shift+KP_Home", "BufInsertChar 201"); /* Upper-left corner ╠ */
KbdBind("Shift+KP_Up", "BufInsertChar 203"); /* Top tee ╦ */
KbdBind("Shift+KP_PgUp", "BufInsertChar 187"); /* Upper-right corner ╗ */
KbdBind("Shift+KP_Left", "BufInsertChar 204"); /* Left tee ╠ */
KbdBind("Shift+KP_5", "BufInsertChar 205"); /* Horiz double line ═ */
KbdBind("Shift+KP_Right", "BufInsertChar 185"); /* Right tee ╣ */
KbdBind("Shift+KP_End", "BufInsertChar 200"); /* Lower-left corner ╚ */
KbdBind("Shift+KP_Down", "BufInsertChar 202"); /* Bottom tee ╩ */
KbdBind("Shift+KP_PgDn", "BufInsertChar 188"); /* Lower-right corner ╝ */
KbdBind("Shift+KP_Slash", "BufInsertChar 186"); /* Vertical double line ║ */
} /* end KbdBindDefault() - Brief key map */
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: brief.c
*/