home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mega Top 1
/
os2_top1.zip
/
os2_top1
/
DEMO
/
RIM22
/
MACROS
/
BORLIDE.RM
< prev
next >
Wrap
Text File
|
1994-01-10
|
12KB
|
432 lines
/*
** Macro module: borlide.rm - Borland's IDE keyboard map
**
**
** 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 Borland's IDE keyboard mapping.
** To have the editor use this - copy or rename borlide.obm
** to keyboard.obm. This file includes many useful functions that may
** not be supported by Borland's IDE. Some of these have been commented
** out. To use these functions uncomment them and change the key bindings
** to whatever key bindings you want to use, recompile this file, and then
** copy borlide.obm to keyboard.obm and reload the editor.
*/
void
_init(void) {
LibAutoload("misc", "quote", "next_word", "prev_word", "tospace",
"delete_next_word", "delete_prev_word");
LibAutoload("c_smart", "find_matching_delim", "_c_indent");
LibAutoload("Search", "SearchSel", "SelWord");
LibAutoload("Buffer", "EditFile", "SaveBuffer");
LibAutoload("Kbd", "KbdBindAsciiKeys" );
} /* end _init() */
void
KbdBindDefault() {
char *self_insert = "SelfInsert";
char *p;
/* call function for cua mapping */
KbdBindAsciiKeys();
/*
** bookmarks
*/
KbdBind("Ctrl+K+1", "BookmarkSet 1");
KbdBind("Ctrl+K+2", "BookmarkSet 2");
KbdBind("Ctrl+K+3", "BookmarkSet 3");
KbdBind("Ctrl+K+4", "BookmarkSet 4");
KbdBind("Ctrl+K+5", "BookmarkSet 5");
KbdBind("Ctrl+K+6", "BookmarkSet 6");
KbdBind("Ctrl+K+7", "BookmarkSet 7");
KbdBind("Ctrl+K+8", "BookmarkSet 8");
KbdBind("Ctrl+K+9", "BookmarkSet 9");
KbdBind("Ctrl+K+0", "BookmarkSet 10");
KbdBind("Ctrl+Q+1", "BookmarkGoto 1");
KbdBind("Ctrl+Q+2", "BookmarkGoto 2");
KbdBind("Ctrl+Q+3", "BookmarkGoto 3");
KbdBind("Ctrl+Q+4", "BookmarkGoto 4");
KbdBind("Ctrl+Q+5", "BookmarkGoto 5");
KbdBind("Ctrl+Q+6", "BookmarkGoto 6");
KbdBind("Ctrl+Q+7", "BookmarkGoto 7");
KbdBind("Ctrl+Q+8", "BookmarkGoto 8");
KbdBind("Ctrl+Q+9", "BookmarkGoto 9");
KbdBind("Ctrl+Q+0", "BookmarkGoto 10");
/*
** help
*/
/*
** Insert & Deletions
*/
KbdBind("Ctrl+V", p="ToggleInsert");
KbdBind("INSERT", p);
KbdBind("KP_INSERT", p);
KbdBind("Ctrl+N", "InsertNewLine");
KbdBind("Alt+Y", "BufDeleteLine");
KbdBind("Ctrl+Q+Y", "BufDeleteToEOL");
KbdBind("Ctrl+H", p="BufDeletePrevChar");
KbdBind("BACKSPACE", p);
KbdBind("Ctrl+G", p="BufDeleteCharOrSelection");
KbdBind("Ctrl+K+Y", p);
KbdBind("DELETE", p);
KbdBind("KP_DELETE", p);
KbdBind("Ctrl+T", "delete_next_word"); /* in misc.rm */
KbdBind("Ctrl+BACKSPACE", "delete_prev_word"); /* in misc.rm */
KbdBind("Ctrl+-", "BufDeleteCurrentBuffer");
KbdBind("Alt+|", "BufDeleteWhitespace");
KbdBind("Shift+DELETE", p="BufDeleteToScrap");
KbdBind("Shift+KP_DELETE", p);
KbdBind("Shift+KP_MINUS", p);
KbdBind("Ctrl+K+R", "BufInsertFile");
KbdBind("Ctrl+K+W", "BufWriteSel");
/*
** Dialogs
*/
KbdBind("Alt+B", "DlgBufferList");
KbdBind("Alt+V", "DlgVersion");
KbdBind("Alt+O", "DlgRenameBuffer");
KbdBind("Alt+W", "SaveBuffer");
KbdBind("Alt+E", "DlgOpenFile");
KbdBind("Alt+G", "DlgGotoLine");
/* search & replace */
KbdBind("ALT+S+ALT+F", "SearchSel 1");
KbdBind("ALT+S+ALT+B", "SearchSel 0");
KbdBind("Ctrl+Q+F", "SearchForward");
KbdBind("Ctrl+Q+B", "SearchBackward");
KbdBind("Ctrl+L", "SearchAgain");
KbdBind("Ctrl+Q+A", "ReplaceForward");
// KbdBind("Alt+F6", "ReplaceBackward");
// KbdBind("Shift+F6", "ReplaceAgain");
/*
** Keystroke macros
*/
KbdBind("Shift+Ctrl+R", "KbdMacroRecord"); /* starts/stops keystroke macro recording */
KbdBind("Alt+F7", "KbdMacroLoad"); /* load keystroke macro from disk */
KbdBind("Shift+F7", "KbdMacroPause"); /* pause keystroke macro playback */
KbdBind("Shift+Ctrl+P", "KbdMacroPlay"); /* plays a recorded keystroke macro */
KbdBind("Alt+F8", "KbdMacroSave"); /* saves last recorded macro to disk */
/*
** Cursor movement
*/
KbdBind("KP_LEFT", p="MovLeft");
KbdBind("LEFT", p);
KbdBind("Ctrl+S", p);
KbdBind("KP_RIGHT", p="MovRight");
KbdBind("RIGHT", p);
KbdBind("Ctrl+D", p);
KbdBind("Ctrl+A", "prev_word");
KbdBind("Ctrl+F", "next_word"); /* in misc.rm */
KbdBind("UP", p="MovUp");
KbdBind("KP_UP", p);
KbdBind("Ctrl+E", p);
KbdBind("DOWN", p="MovDown");
KbdBind("KP_DOWN", p);
KbdBind("Ctrl+X", p);
KbdBind("PGUP", p="MovPageUp");
KbdBind("Ctrl+R", p);
KbdBind("KP_PGUP", p);
KbdBind("Ctrl+C", p="MovPageDown");
KbdBind("PGDN", p);
KbdBind("KP_PGDN", p);
KbdBind("Ctrl+W", p="WinScrollDown");
KbdBind("Ctrl+UP", p);
KbdBind("Ctrl+KP_UP", p);
KbdBind("Ctrl+Z", p="WinScrollUp");
KbdBind("Ctrl+DOWN", p);
KbdBind("Ctrl+KP_Down", p);
KbdBind("Ctrl+HOME", p="MovSOF");
KbdBind("Ctrl+KP_HOME", p);
KbdBind("HOME", p="MovSOT");
KbdBind("KP_HOME", p);
KbdBind("Ctrl+END", p="MovEOF");
KbdBind("Ctrl+KP_END", p);
KbdBind("END", p="MovEOL");
KbdBind("KP_END", p);
KbdBind("Shift+TAB", "MovPrevTabPos");
KbdBind("Ctrl+Enter", p="BufInsertNewline");
KbdBind("Ctrl+KP_Enter", p);
KbdBind("Shift+ENTER", p);
KbdBind("Shift+KP_ENTER", p);
/*
** selection operations
*/
KbdBind("Ctrl+K+B", p="WSMarkBeginSel");
KbdBind("Ctrl+K+Ctrl+B", p);
KbdBind("Ctrl+K+K", p="MarkEndSel");
KbdBind("Ctrl+K+Ctrl+K", p);
KbdBind("Ctrl+K+T", "SelWord");
KbdBind("Alt+A", "MarkExclusive");
KbdBind("Alt+C", "MarkColumn");
KbdBind("Alt+L", "MarkLine");
KbdBind("Alt+M", "MarkNormal");
// KbdBind("Ctrl+A", "MarkSwapSel");
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
/*
** toggles
*/
KbdBind("Ctrl+O+T", "ToggleTabs");
KbdBind("Alt+N", "BufNextBuffer");
KbdBind("Ctrl+K+P", "Print");
KbdBind("Ctrl+P", "quote"); /* in misc.rm */
KbdBind("F3", "BufNewFile");
KbdBind("Alt+F3", "BufPrevBuffer");
/*
** undo & redo operations
*/
KbdBind("Ctrl+Q+L", p="Undo");
KbdBind("Alt+U", p);
KbdBind("Alt+BACKSPACE", p);
KbdBind("Shift+Ctrl+BACKSPACE", p);
KbdBind("KP_STAR", "UndoModification");
KbdBind("Shift+KP_STAR", "RedoModification");
KbdBind("Shift+Ctrl+KP_STAR", "UndoAll");
KbdBind("Shift+Alt +KP_STAR", "RedoAll");
/*
** 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.
*/
/*
** window operations
*/
KbdBind("Ctrl+F10", "WinMaximize");
KbdBind("F6", "WinNextWindow");
KbdBind("Shift+F6", "WinPrevWindow");
KbdBind("F2", "WinTileWindows");
KbdBind("Ctrl+F4", "WinDeleteCurrentWindow");
KbdBind("Ctrl+KP_HOME", "MovTopWin");
KbdBind("Ctrl+KP_END", "MovBottomWin");
KbdBind("Ctrl+B", "WinScrollBottom");
KbdBind("Ctrl+C", "WinScrollCenter");
/*
** macro operations
*/
KbdBind("F9", "LibLoadMacro");
KbdBind("F10", "LibExecFunction");
/*
** 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+F4", "ErrPrevError");
KbdBind("Shift+F3", "ErrNextError");
KbdBind("Ctrl+F3", "ExecAssoc"); /* Run compilers, etc. */
KbdBind("Shift+Ctrl+F3", "ExecKillProcess"); /* Stop compile */
#if 0
KbdBind("KP_5", "");
#endif
/*
** cut/copy/paste
*/
KbdBind("KP_MINUS", "BufCutToScrap");
KbdBind("Ctrl+K+C", p="BufCopyToScrap");
KbdBind("Ctrl+K+Ctrl+C", p);
KbdBind("Ctrl+K+V", p="BufPasteScrap");
KbdBind("Ctrl+K+Ctrl+V", p);
KbdBind("Shift+INSERT", "ImportClipboard");
KbdBind("Ctrl+INSERT", "ExportClipboard");
KbdBind("Shift+Ctrl+-", "WinDeleteWindowAndBuffer");
KbdBind("Ctrl+K+S", p="SaveBuffer");
KbdBind("Ctrl+K+Ctrl+S", p);
KbdBind("Shift+F2", p);
KbdBind("F2", p);
KbdBind("Ctrl+J", "tospace");
KbdBind("Alt+]", p="find_matching_delim"); /* in c_smart.rm */
KbdBind("Alt+[", p);
KbdBind("Ctrl+O+I", "_c_indent");
KbdBind("Alt+X", "ExitEditor");
/* 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("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");
} /* end KbdBindDefault() - Borland IDE key map */
void
MarkToSOT(void) {
SELECTION p;
LONG line, column;
LONG sot_line, sot_column;
BufQueryPosition( &line, &column);
PosSOT();
BufQueryPosition( &sot_line, &sot_column);
p.type = 1;
p.s_line = p.e_line = line;
p.s_column = sot_column;
p.e_column = column;
MarkCreateSel(&p);
} /* end MarkToSOT() */
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() */
void
DeleteLineOrSelection( void ) {
SHORT rc;
SELECTION p;
rc = MarkQuerySel( &p, 1);
if ( !rc )
BufDeleteLine();
else
BufDeleteCharOrSelection();
} /* end DeleteLineOrSelection */
void
WSMarkBeginSel( void ) {
if ( MarkQuerySelType() )
MarkRemoveSel();
else
MarkBeginSel();
} /* end WSMarkBeginSel() */
void
InsertNewLine( void ) {
BufInsertNewline();
MovUp();
MovEOL();
} /* end InsertNewLine */
/*
** End module: pwb.rm
*/