home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Frozen Fish 1: Amiga
/
FrozenFish-Apr94.iso
/
bbs
/
alib
/
d9xx
/
d912
/
yak.lha
/
Yak
/
Source
/
Source.lha
/
popup.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-08-02
|
19KB
|
636 lines
/*
* Source machine generated by GadToolsBox V2.0b
* which is (c) Copyright 1991-1993 Jaba Development
*
* GUI Designed by : Martin W Scott and Gaël Marziou
*/
#include <exec/types.h>
#include <intuition/intuition.h>
#include <intuition/classes.h>
#include <intuition/classusr.h>
#include <intuition/imageclass.h>
#include <intuition/gadgetclass.h>
#include <libraries/gadtools.h>
#include <graphics/displayinfo.h>
#include <graphics/gfxbase.h>
#include <clib/exec_protos.h>
#include <clib/intuition_protos.h>
#include <clib/gadtools_protos.h>
#include <clib/graphics_protos.h>
#include <clib/locale_protos.h>
#include <clib/utility_protos.h>
#include <string.h>
#include <pragmas/exec_pragmas.h>
#include <pragmas/intuition_pragmas.h>
#include <pragmas/gadtools_pragmas.h>
#include <pragmas/graphics_pragmas.h>
#include <pragmas/utility_pragmas.h>
#include "popup.h"
#include "popup_fix.h" /**** ADDED */
#define CATCOMP_ARRAY
#include "popup_locale_strings.h"
extern struct LocaleBase *LocaleBase;
extern struct Catalog *Catalog;
struct Screen *Scr = NULL;
UBYTE *PubScreenName = "Workbench";
APTR VisualInfo = NULL;
struct Window *HelpWnd = NULL;
struct Window *HotKeyWnd = NULL;
struct Gadget *HelpGList = NULL;
struct Gadget *HotKeyGList = NULL;
struct Menu *HelpMenus = NULL;
UWORD HelpZoom[4];
struct Gadget *HelpGadgets[20];
struct Gadget *HotKeyGadgets[8];
UWORD HelpLeft = 0;
UWORD HelpTop = 11;
UWORD HelpWidth = 632;
UWORD HelpHeight = 164;
UWORD HotKeyLeft = 0;
UWORD HotKeyTop = 11;
UWORD HotKeyWidth = 455;
UWORD HotKeyHeight = 150;
UBYTE *HelpWdt = NULL;
UBYTE *HotKeyWdt = NULL;
struct TextAttr *Font, Attr;
UWORD FontX, FontY;
UWORD OffX, OffY;
UBYTE *getString (int n)
{
UBYTE *result;
STRPTR s = CatCompArray[n].cca_Str;
if (Catalog)
result = (UBYTE *) GetCatalogStr(Catalog, n, s);
else {
result = (UBYTE *) s;
}
return result;
}
UBYTE *MBMethod0Labels[4];
void InitMBMethod0Labels (void)
{
MBMethod0Labels[0] = getString(NONE_STRING);
MBMethod0Labels[1] = getString(SPRITES_STRING);
MBMethod0Labels[2] = getString(COPPER_STRING);
MBMethod0Labels[3] = NULL ;
}
UBYTE *Options1Labels[4];
void InitOptions1Label (void)
{
Options1Labels[0] = getString(NO_SCREEN_CHANGE_STRING);
Options1Labels[1] = getString(WORKBENCH_TO_FRONT_STRING);
Options1Labels[2] = getString(DEFAULT_PUBSCR_TO_FRONT_STRING);
Options1Labels[3] = NULL ;
}
extern struct MinList Actions1List;
struct Node Actions1Nodes[] = {
&Actions1Nodes[1], ( struct Node * )&Actions1List.mlh_Head, 0, 0, NULL,
&Actions1Nodes[2], &Actions1Nodes[0], 0, 0, NULL,
&Actions1Nodes[3], &Actions1Nodes[1], 0, 0, NULL,
&Actions1Nodes[4], &Actions1Nodes[2], 0, 0, NULL,
&Actions1Nodes[5], &Actions1Nodes[3], 0, 0, NULL,
&Actions1Nodes[6], &Actions1Nodes[4], 0, 0, NULL,
&Actions1Nodes[7], &Actions1Nodes[5], 0, 0, NULL,
&Actions1Nodes[8], &Actions1Nodes[6], 0, 0, NULL,
&Actions1Nodes[9], &Actions1Nodes[7], 0, 0, NULL,
&Actions1Nodes[10], &Actions1Nodes[8], 0, 0, NULL,
&Actions1Nodes[11], &Actions1Nodes[9], 0, 0, NULL,
&Actions1Nodes[12], &Actions1Nodes[10], 0, 0, NULL,
&Actions1Nodes[13], &Actions1Nodes[11], 0, 0, NULL,
&Actions1Nodes[14], &Actions1Nodes[12], 0, 0, NULL,
( struct Node * )&Actions1List.mlh_Tail, &Actions1Nodes[13], 0, 0, NULL };
void InitActions1Nodes (void)
{
Actions1Nodes[0].ln_Name = getString(DOS_Command_ACT);
Actions1Nodes[1].ln_Name = getString(Close_Window_ACT);
Actions1Nodes[2].ln_Name = getString(Zip_Window_ACT);
Actions1Nodes[3].ln_Name = getString(Shrink_Window_ACT);
Actions1Nodes[4].ln_Name = getString(Expand_Window_ACT);
Actions1Nodes[5].ln_Name = getString(Cycle_Windows_ACT);
Actions1Nodes[6].ln_Name = getString(Open_Palette_ACT);
Actions1Nodes[7].ln_Name = getString(Screen_to_Front_ACT);
Actions1Nodes[8].ln_Name = getString(Screen_to_Back_ACT);
Actions1Nodes[9].ln_Name = getString(Activate_Workbench_ACT);
Actions1Nodes[10].ln_Name = getString(Centre_Screen_ACT);
Actions1Nodes[11].ln_Name = getString(Blank_Display_ACT);
Actions1Nodes[12].ln_Name = getString(Insert_Text_ACT);
Actions1Nodes[13].ln_Name = getString(Insert_Date_ACT);
Actions1Nodes[14].ln_Name = getString(Show_Yak_Interface_ACT);
}
struct MinList Actions1List = {
( struct MinNode * )&Actions1Nodes[0],
( struct MinNode * )NULL,
( struct MinNode * )&Actions1Nodes[14] };
struct IntuiText HelpIText[] = {
2, 0, JAM1,40, 11, NULL, NULL, NULL,
2, 0, JAM1,84, 93, NULL, NULL, NULL,
2, 0, JAM1,508, 11, NULL, NULL, NULL,
2, 0, JAM1,488, 85, NULL, NULL, NULL };
#define Help_TNUM 4
void InitHelpIText (void)
{
HelpIText[0].IText = getString(TOGGLES_STRING);
HelpIText[1].IText = getString(INCLUSION_PATTERNS_STRING);
HelpIText[2].IText = getString(MISCELLANEOUS_STRING);
HelpIText[3].IText = getString(TIMEOUT_STRING);
}
struct NewMenu HelpNewMenu[] = {
NM_TITLE, NULL, NULL, 0, NULL, NULL,
NM_ITEM, NULL, NULL, 0, 0L, NULL,
NM_ITEM, NULL, NULL, 0, 0L, NULL,
NM_ITEM, NULL, NULL, 0, 0L, NULL,
NM_ITEM, NULL, NULL, 0, 0L, NULL,
NM_ITEM, NULL, NULL, 0, NULL, NULL,
NM_SUB, NULL, NULL, 0, 0L, NULL,
NM_SUB, NULL, NULL, 0, 0L, NULL,
NM_SUB, NULL, NULL, 0, 0L, NULL,
NM_SUB, NULL, NULL, 0, 0L, NULL,
NM_SUB, NULL, NULL, 0, 0L, NULL,
NM_END, NULL, NULL, 0, 0L, NULL };
void InitHelpNewMenu (void)
{
HelpNewMenu[0].nm_Label = (STRPTR)getString(PROJECT_STRING);
HelpNewMenu[1].nm_Label = (STRPTR)getString(LOAD_SETTINGS_STRING);
HelpNewMenu[1].nm_CommKey = (STRPTR)getString(LOAD_SHORTCUT);
HelpNewMenu[2].nm_Label = (STRPTR)getString(SAVE_SETTINGS_STRING);
HelpNewMenu[2].nm_CommKey = (STRPTR)getString(SAVE_SHORTCUT);
HelpNewMenu[3].nm_Label = (STRPTR)getString(HIDE_WINDOW_STRING);
HelpNewMenu[3].nm_CommKey = (STRPTR)getString(HIDE_SHORTCUT);
HelpNewMenu[4].nm_Label = (STRPTR)getString(QUIT_STRING);
HelpNewMenu[4].nm_CommKey = (STRPTR)getString(QUIT_SHORTCUT);
HelpNewMenu[5].nm_Label = (STRPTR)getString(Credits_STRING);
HelpNewMenu[6].nm_Label = (STRPTR)getString(Credits_Line1_STRING);
HelpNewMenu[7].nm_Label = (STRPTR)getString(Credits_Line2_STRING);
HelpNewMenu[8].nm_Label = (STRPTR)getString(Credits_Line3_STRING);
HelpNewMenu[9].nm_Label = (STRPTR)getString(Credits_Line4_STRING);
HelpNewMenu[10].nm_Label = (STRPTR)getString(Credits_Line5_STRING);
}
UWORD HelpGTypes[] = {
BUTTON_KIND,
BUTTON_KIND,
CHECKBOX_KIND,
CHECKBOX_KIND,
CHECKBOX_KIND,
CHECKBOX_KIND,
CHECKBOX_KIND,
CHECKBOX_KIND,
CHECKBOX_KIND,
CHECKBOX_KIND,
CYCLE_KIND,
CHECKBOX_KIND,
BUTTON_KIND,
STRING_KIND,
STRING_KIND,
STRING_KIND,
STRING_KIND,
INTEGER_KIND,
INTEGER_KIND,
INTEGER_KIND
};
UWORD HotKeyGTypes[] = {
LISTVIEW_KIND,
LISTVIEW_KIND,
STRING_KIND,
STRING_KIND,
CYCLE_KIND,
BUTTON_KIND,
BUTTON_KIND,
BUTTON_KIND
};
struct NewGadget HelpNGad[] = {
449, 143, 89, 19, NULL, NULL, GD_Hide, PLACETEXT_IN, NULL, NULL,
543, 143, 85, 19, NULL, NULL, GD_Quit, PLACETEXT_IN, NULL, NULL,
11, 23, 26, 11, NULL, NULL, GD_AutoCheck, PLACETEXT_RIGHT, NULL, NULL,
202, 23, 26, 11, NULL, NULL, GD_KeyActCheck, PLACETEXT_RIGHT, NULL, NULL,
11, 56, 26, 11, NULL, NULL, GD_CTFCheck, PLACETEXT_RIGHT, NULL, NULL,
11, 67, 26, 11, NULL, NULL, GD_CTBCheck, PLACETEXT_RIGHT, NULL, NULL,
202, 34, 26, 11, NULL, NULL, GD_ScrCycleCheck, PLACETEXT_RIGHT, NULL, NULL,
202, 56, 26, 11, NULL, NULL, GD_WildStarCheck, PLACETEXT_RIGHT, NULL, NULL,
202, 45, 26, 11, NULL, NULL, GD_ScrActCheck, PLACETEXT_RIGHT, NULL, NULL,
11, 34, 26, 11, NULL, NULL, GD_AutoPopCheck, PLACETEXT_RIGHT, NULL, NULL,
463, 53, 153, 17, NULL, NULL, GD_MBMethod, PLACETEXT_ABOVE, NULL, NULL,
11, 45, 26, 11, NULL, NULL, GD_RMBActCheck, PLACETEXT_RIGHT, NULL, NULL,
449, 121, 179, 20, NULL, NULL, GD_EditHotkeys, PLACETEXT_IN, NULL, NULL,
225, 107, 215, 12, NULL, NULL, GD_AutoPat, PLACETEXT_LEFT, NULL, NULL,
225, 120, 215, 12, NULL, NULL, GD_ClickPat, PLACETEXT_LEFT, NULL, NULL,
225, 133, 215, 12, NULL, NULL, GD_PopPat, PLACETEXT_LEFT, NULL, NULL,
225, 146, 215, 12, NULL, NULL, GD_ClickWinPat, PLACETEXT_LEFT, NULL, NULL,
577, 21, 44, 12, NULL, NULL, GD_ClickVol, PLACETEXT_LEFT, NULL, NULL,
577, 90, 44, 12, NULL, NULL, GD_ScrTONum, PLACETEXT_LEFT, NULL, NULL,
577, 103, 44, 12, NULL, NULL, GD_MouseTONum, PLACETEXT_LEFT, NULL, NULL
};
void InitHelpNGad (void)
{
HelpNGad[0].ng_GadgetText = getString(HIDE_STRING);
HelpNGad[1].ng_GadgetText = getString(QUIT_STRING);
HelpNGad[2].ng_GadgetText = getString(AUTOPOINT_STRING);
HelpNGad[3].ng_GadgetText = getString(KEY_ACTIVATE_STRING);
HelpNGad[4].ng_GadgetText = getString(CLICK_TO_FRONT_STRING);
HelpNGad[5].ng_GadgetText = getString(CLICK_TO_BACK_STRING);
HelpNGad[6].ng_GadgetText = getString(SCREEN_TO_BACK_STRING);
HelpNGad[7].ng_GadgetText = getString(WILD_STAR_STRING);
HelpNGad[8].ng_GadgetText = getString(SCREEN_ACTIVATE_STRING);
HelpNGad[9].ng_GadgetText = getString(AUTOPOPTOFRONT_STRING);
HelpNGad[10].ng_GadgetText = getString(MOUSEBLANK_METHOD_STRING);
HelpNGad[11].ng_GadgetText = getString(RMB_ACTIVATE_STRING);
HelpNGad[12].ng_GadgetText = getString(EDIT_HOTKEYS_STRING);
HelpNGad[13].ng_GadgetText = getString(AUTOSCREENS_STRING);
HelpNGad[14].ng_GadgetText = getString(CLICKSCREENS_STRING);
HelpNGad[15].ng_GadgetText = getString(POPWINDOWS_STRING);
HelpNGad[16].ng_GadgetText = getString(CLICKWINDOWS_STRING);
HelpNGad[17].ng_GadgetText = getString(CLICKVOLUME_STRING);
HelpNGad[18].ng_GadgetText = getString(SCREENTIMEOUT_STRING);
HelpNGad[19].ng_GadgetText = getString(MOUSETIMEOUT_STRING);
}
struct NewGadget HotKeyNGad[] = {
225, 19, 214, 64, NULL, NULL, GD_Hotkeys, PLACETEXT_ABOVE|NG_HIGHLABEL, NULL, NULL,
16, 19, 189, 88, NULL, NULL, GD_Actions, PLACETEXT_ABOVE|NG_HIGHLABEL, NULL, NULL,
225, 80, 214, 13, NULL, NULL, GD_HKStr, 0, NULL, NULL,
96, 117, 223, 13, NULL, NULL, GD_Argument, PLACETEXT_LEFT, NULL, NULL,
96, 131, 223, 13, NULL, NULL, GD_Options, PLACETEXT_LEFT, NULL, NULL,
225, 94, 106, 13, NULL, NULL, GD_Add, PLACETEXT_IN, NULL, NULL,
333, 94, 106, 13, NULL, NULL, GD_Delete, PLACETEXT_IN, NULL, NULL,
339, 117, 100, 27, NULL, NULL, GD_Return, PLACETEXT_IN, NULL, NULL
};
void InitHotKeyNGad (void)
{
HotKeyNGad[0].ng_GadgetText = getString(HOTKEYS_STRING);
HotKeyNGad[1].ng_GadgetText = getString(ACTIONS_STRING);
HotKeyNGad[3].ng_GadgetText = getString(ARGUMENT_STRING);
HotKeyNGad[4].ng_GadgetText = getString(OPTIONS_STRING);
HotKeyNGad[5].ng_GadgetText = getString(ADD_STRING);
HotKeyNGad[6].ng_GadgetText = getString(DELETE_STRING);
HotKeyNGad[7].ng_GadgetText = getString(RETURN_STRING);
}
void InitGUI (void)
{
HotKeyWdt = HelpWdt;
InitMBMethod0Labels ();
InitOptions1Label ();
InitHelpIText ();
InitHelpNewMenu ();
InitHelpNGad ();
InitActions1Nodes ();
InitHotKeyNGad ();
}
ULONG HelpGTags[] = {
(TAG_DONE),
(TAG_DONE),
(TAG_DONE),
(TAG_DONE),
(TAG_DONE),
(TAG_DONE),
(TAG_DONE),
(TAG_DONE),
(TAG_DONE),
(TAG_DONE),
(GTCY_Labels), (ULONG)&MBMethod0Labels[ 0 ], (TAG_DONE),
(TAG_DONE),
(TAG_DONE),
(GTST_MaxChars), 99, (TAG_DONE),
(GTST_MaxChars), 99, (TAG_DONE),
(GTST_MaxChars), 99, (TAG_DONE),
(GTST_MaxChars), 99, (TAG_DONE),
(GTIN_Number), 0, (GTIN_MaxChars), 4, (TAG_DONE),
(GTIN_Number), 0, (GTIN_MaxChars), 4, (TAG_DONE),
(GTIN_Number), 0, (GTIN_MaxChars), 4, (TAG_DONE)
};
ULONG HotKeyGTags[] = {
(GT_Underscore), '_', (TAG_DONE),
(GTLV_Labels), (ULONG)&Actions1List, (GTLV_ShowSelected), NULL, (GT_Underscore), '_', (TAG_DONE),
(GTST_MaxChars), 256, (TAG_DONE),
(GTST_MaxChars), 512, (GT_Underscore), '_', (TAG_DONE),
(GTCY_Labels), (ULONG)&Options1Labels[ 0 ], (GT_Underscore), '_', (TAG_DONE),
(GT_Underscore), '_', (TAG_DONE),
(GT_Underscore), '_', (TAG_DONE),
(GT_Underscore), '_', (TAG_DONE)
};
static UWORD ComputeX( UWORD value )
{
return(( UWORD )((( FontX * value ) + 4 ) / 8 ));
}
static UWORD ComputeY( UWORD value )
{
return(( UWORD )((( FontY * value ) + 4 ) / 8 ));
}
static void ComputeFont( UWORD width, UWORD height )
{
Font = &Attr;
Font->ta_Name = (STRPTR)Scr->RastPort.Font->tf_Message.mn_Node.ln_Name;
Font->ta_YSize = FontY = Scr->RastPort.Font->tf_YSize;
/* FontX = Scr->RastPort.Font->tf_XSize; */
/**** ADDED NEXT LINE */
FontX = CalcFontX();
OffX = Scr->WBorLeft;
OffY = Scr->RastPort.TxHeight + Scr->WBorTop + 1;
if ( width && height ) {
if (( ComputeX( width ) + OffX + Scr->WBorRight ) > Scr->Width )
goto UseTopaz;
if (( ComputeY( height ) + OffY + Scr->WBorBottom ) > Scr->Height )
goto UseTopaz;
}
return;
UseTopaz:
Font->ta_Name = (STRPTR)"topaz.font";
FontX = FontY = Font->ta_YSize = 8;
}
int SetupScreen( void )
{
if ( ! ( Scr = LockPubScreen( PubScreenName )))
return( 1L );
ComputeFont( 0, 0 );
if ( ! ( VisualInfo = GetVisualInfo( Scr, TAG_DONE )))
return( 2L );
return( 0L );
}
void CloseDownScreen( void )
{
if ( VisualInfo ) {
FreeVisualInfo( VisualInfo );
VisualInfo = NULL;
}
if ( Scr ) {
UnlockPubScreen( NULL, Scr );
Scr = NULL;
}
}
void HelpRender( void )
{
UWORD cnt;
UWORD X,Y;
ComputeFont( HelpWidth, HelpHeight );
/* TimeOut Box */
X = OffX + ComputeX( 448 );
Y = OffY + ComputeY( 77 );
DrawBevelBox( HelpWnd->RPort, X, Y,
ComputeX( 180 ),
ComputeY( 42 ),
GT_VisualInfo, VisualInfo, TAG_DONE );
HelpIText[ 3 ].LeftEdge = X + 4;
HelpIText[ 3 ].TopEdge = Y + 3;
/* Miscellaneous box */
X = OffX + ComputeX( 448 );
Y = OffY + ComputeY( 3 );
DrawBevelBox( HelpWnd->RPort, X, Y,
ComputeX( 179 ),
ComputeY( 72 ),
GT_VisualInfo, VisualInfo, TAG_DONE );
HelpIText[ 2 ].LeftEdge = X + 4;
HelpIText[ 2 ].TopEdge = Y + 3;
/* Inclusion Patterns box */
X = OffX + ComputeX( 4 );
Y = OffY + ComputeY( 85 );
DrawBevelBox( HelpWnd->RPort, X, Y,
ComputeX( 441 ),
ComputeY( 77 ),
GT_VisualInfo, VisualInfo, TAG_DONE );
HelpIText[ 1 ].LeftEdge = X + 4;
HelpIText[ 1 ].TopEdge = Y + 3;
/* Toggles box */
X = OffX + ComputeX( 4 );
Y = OffY + ComputeY( 3 );
DrawBevelBox( HelpWnd->RPort, X, Y,
ComputeX( 440 ),
ComputeY( 80 ),
GT_VisualInfo, VisualInfo, TAG_DONE );
HelpIText[ 0 ].LeftEdge = X + 4;
HelpIText[ 0 ].TopEdge = Y + 3;
for ( cnt = 0; cnt < Help_TNUM; cnt++ ) {
HelpIText[ cnt ].ITextFont = Font;
PrintIText( HelpWnd->RPort, &HelpIText[ cnt ], 0, 0 );
}
}
int OpenHelpWindow( void )
{
struct NewGadget ng;
struct Gadget *g;
UWORD lc, tc;
UWORD wleft = HelpLeft, wtop = HelpTop, ww, wh;
ComputeFont( HelpWidth, HelpHeight );
ww = ComputeX( HelpWidth );
wh = ComputeY( HelpHeight );
if (( wleft + ww + OffX + Scr->WBorRight ) > Scr->Width ) wleft = Scr->Width - ww;
if (( wtop + wh + OffY + Scr->WBorBottom ) > Scr->Height ) wtop = Scr->Height - wh;
if ( ! ( g = CreateContext( &HelpGList )))
return( 1L );
for( lc = 0, tc = 0; lc < Help_CNT; lc++ ) {
CopyMem((char * )&HelpNGad[ lc ], (char * )&ng, (long)sizeof( struct NewGadget ));
ng.ng_VisualInfo = VisualInfo;
ng.ng_TextAttr = Font;
ng.ng_LeftEdge = OffX + ComputeX( ng.ng_LeftEdge );
ng.ng_TopEdge = OffY + ComputeY( ng.ng_TopEdge );
ng.ng_Width = ComputeX( ng.ng_Width );
ng.ng_Height = ComputeY( ng.ng_Height);
HelpGadgets[ lc ] = g = CreateGadgetA((ULONG)HelpGTypes[ lc ], g, &ng, ( struct TagItem * )&HelpGTags[ tc ] );
while( HelpGTags[ tc ] ) tc += 2;
tc++;
if ( NOT g )
return( 2L );
}
/**** CHANGED */
if ( ! ( HelpMenus = CreateMenus( HelpNewMenu, GTMN_NewLookMenus,
TRUE, 0L,
TAG_DONE )))
return( 3L );
LayoutMenus( HelpMenus, VisualInfo, GTMN_NewLookMenus, TRUE, TAG_DONE );
HelpZoom[0] = HelpZoom[1] = 0;
if ( HelpWdt )
HelpZoom[2] = TextLength( &Scr->RastPort, (UBYTE *)HelpWdt, strlen((char *)HelpWdt )) + 80;
else
HelpZoom[2] = 80L;
HelpZoom[3] = Scr->WBorTop + Scr->RastPort.TxHeight + 1;
if ( ! ( HelpWnd = OpenWindowTags( NULL,
WA_Left, wleft,
WA_Top, wtop,
WA_Width, ww + OffX + Scr->WBorRight,
WA_Height, wh + OffY + Scr->WBorBottom,
WA_IDCMP, BUTTONIDCMP|CHECKBOXIDCMP|CYCLEIDCMP|STRINGIDCMP|INTEGERIDCMP|IDCMP_GADGETDOWN|IDCMP_INTUITICKS|IDCMP_MOUSEMOVE|IDCMP_MOUSEBUTTONS|
IDCMP_MENUPICK|IDCMP_CLOSEWINDOW|
IDCMP_CHANGEWINDOW|IDCMP_REFRESHWINDOW,
WA_Flags, WFLG_DRAGBAR|WFLG_DEPTHGADGET|WFLG_CLOSEGADGET|WFLG_SMART_REFRESH|WFLG_ACTIVATE,
WA_Gadgets, HelpGList,
WA_Title, HelpWdt,
WA_ScreenTitle, getString(COPYRIGHT_STRING),
WA_Zoom, HelpZoom,
WA_AutoAdjust, TRUE,
/**** ADDED */ WA_NewLookMenus,TRUE,
TAG_DONE )))
return( 4L );
SetMenuStrip( HelpWnd, HelpMenus );
GT_RefreshWindow( HelpWnd, NULL );
HelpRender();
return( 0L );
}
void CloseHelpWindow( void )
{
if ( HelpMenus ) {
ClearMenuStrip( HelpWnd );
FreeMenus( HelpMenus );
HelpMenus = NULL; }
if ( HelpWnd ) {
CloseWindow( HelpWnd );
HelpWnd = NULL;
}
if ( HelpGList ) {
FreeGadgets( HelpGList );
HelpGList = NULL;
}
}
int OpenHotKeyWindow( void )
{
struct NewGadget ng;
struct Gadget *g;
UWORD lc, tc;
UWORD wleft = HotKeyLeft, wtop = HotKeyTop, ww, wh;
ComputeFont( HotKeyWidth, HotKeyHeight );
ww = ComputeX( HotKeyWidth );
wh = ComputeY( HotKeyHeight );
if (( wleft + ww + OffX + Scr->WBorRight ) > Scr->Width ) wleft = Scr->Width - ww;
if (( wtop + wh + OffY + Scr->WBorBottom ) > Scr->Height ) wtop = Scr->Height - wh;
if ( ! ( g = CreateContext( &HotKeyGList )))
return( 1L );
for( lc = 0, tc = 0; lc < HotKey_CNT; lc++ ) {
CopyMem((char * )&HotKeyNGad[ lc ], (char * )&ng, (long)sizeof( struct NewGadget ));
ng.ng_VisualInfo = VisualInfo;
ng.ng_TextAttr = Font;
ng.ng_LeftEdge = OffX + ComputeX( ng.ng_LeftEdge );
ng.ng_TopEdge = OffY + ComputeY( ng.ng_TopEdge );
ng.ng_Width = ComputeX( ng.ng_Width );
ng.ng_Height = ComputeY( ng.ng_Height);
HotKeyGadgets[ lc ] = g = CreateGadgetA((ULONG)HotKeyGTypes[ lc ], g, &ng, ( struct TagItem * )&HotKeyGTags[ tc ] );
while( HotKeyGTags[ tc ] ) tc += 2;
tc++;
if ( NOT g )
return( 2L );
}
if ( ! ( HotKeyWnd = OpenWindowTags( NULL,
WA_Left, wleft,
WA_Top, wtop,
WA_Width, ww + OffX + Scr->WBorRight,
WA_Height, wh + OffY + Scr->WBorBottom,
WA_IDCMP, LISTVIEWIDCMP|STRINGIDCMP|CYCLEIDCMP|BUTTONIDCMP|IDCMP_CLOSEWINDOW|IDCMP_VANILLAKEY|IDCMP_REFRESHWINDOW,
WA_Flags, WFLG_DRAGBAR|WFLG_DEPTHGADGET|WFLG_CLOSEGADGET|WFLG_SMART_REFRESH,
WA_Gadgets, HotKeyGList,
WA_Title, HotKeyWdt,
WA_ScreenTitle, getString(COPYRIGHT_STRING),
TAG_DONE )))
return( 4L );
GT_RefreshWindow( HotKeyWnd, NULL );
return( 0L );
}
void CloseHotKeyWindow( void )
{
if ( HotKeyWnd ) {
CloseWindow( HotKeyWnd );
HotKeyWnd = NULL;
}
if ( HotKeyGList ) {
FreeGadgets( HotKeyGList );
HotKeyGList = NULL;
}
}