home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mega Top 1
/
os2_top1.zip
/
os2_top1
/
DEMO
/
RIM22
/
MACROS
/
STARTUP.RM
< prev
Wrap
Text File
|
1993-11-12
|
4KB
|
118 lines
/*
** Macro module: startup.rm - startup macros for RimStar Programmer's Editor
**
** 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.
**
*/
#define INCL_EVENT
#include "macro.h"
HKEYBOARD hkDefault;
int cxChar; /* width of font in pixels */
int cyChar; /* height of font (descender + ascender) */
int cyDesc; /* descender height */
void
_init(void) {
LibAutoload("keyboard", "KbdBindDefault");
LibAutoload("menu", "MnuSetMenuAccel", "MnuCommandHandler",
"MnuInitHandler", "ToolbarCommandHandler");
LibAutoload("mouse", "MouEvent");
LibAutoload("buffer", "ReadOnlyBuffer");
LibAutoload("lang", "LangInit");
} /* end _init() */
/*
** Handler for EVENT_FONT_CHANGED
** Keeps the global variables correctly
** set for the size of the current font
*/
int
FontEvent(USHORT event, PFONTATTRIB pfAttr) {
cxChar = pfAttr->cxChar;
cyChar = pfAttr->cyChar;
cyDesc = pfAttr->cyDesc;
return 0;
} /* end FontEvent() */
void
_startup(void) {
char *pathname;
PFONTATTRIB pfAttr;
/* Get current font attributes */
pfAttr = SysQueryFontSize();
cxChar = pfAttr->cxChar;
cyChar = pfAttr->cyChar;
cyDesc = pfAttr->cyDesc;
/* Register font chage event handler */
EventRegisterEvent(EVENT_FONT_CHANGED, EVENT_NORMAL, "FontEvent");
/* Register mouse handling function */
EventRegisterEvent(EVENT_MOUSE, EVENT_NORMAL, "MouEvent");
/* Register read-only buffer handling function */
EventRegisterEvent(EVENT_EDIT_READ_ONLY, EVENT_NORMAL, "ReadOnlyBuffer");
/* Register language handling function */
EventRegisterEvent(EVENT_BUFFER_CREATED, EVENT_NORMAL, "LangInit");
/*
** Setup keyboard mapping.
** Your default keyboard mapping function should
** be named `KbdBindDefault'. Each supplied keyboard
** map uses the same name so that all you need to do
** is copy or rename the desired compiled keyboard file
** to "KEYBOARD.OBM" and startup will find and load it.
*/
KbdBindDefault();
/* Place on keyboard stack - so other push/pops work correctly */
hkDefault = KbdQueryCurrentKeyboard();
if ( hkDefault )
KbdPush(hkDefault);
/* Set all short-cut key helps for the main menu */
MnuSetMenuAccel(); /* see menu.rm */
/* load default source browser database */
/* See if environment variable set */
pathname = getenv("RSE_SBD");
if ( !pathname )
pathname = "sbd.sbd"; /* try current directory */
SbLoadDatabase(pathname, 1);
if ( LibQueryFunction("Startup") )
Startup(); /* Place for your customizations */
} /* end _startup() */
/*
** End macro: startup.rm
*/