home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD1.bin
/
new
/
util
/
cdity
/
yak
/
src
/
hotkey_window.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-10-13
|
15KB
|
477 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 <intuition/intuitionbase.h>
#include <libraries/gadtools.h>
#include <graphics/displayinfo.h>
#include <graphics/gfxbase.h>
#include <proto/exec.h>
#include <proto/intuition.h>
#include <proto/gadtools.h>
#include <proto/graphics.h>
#include <proto/locale.h>
#include <proto/utility.h>
#include <string.h>
#include "code.h"
#include "version.h"
#include "hotkey_types.h"
#include "yak.h"
#include "gui.h"
#define CATCOMP_NUMBERS
#include "locale/yak_locale_strings.h"
IMPORT struct Catalog *Catalog;
extern LONG (*HandleIDCMP)(void);
struct Window *HotKeyWnd = NULL;
struct Gadget *HotKeyGList = NULL;
struct Gadget *HotKeyGadgets[HotKey_CNT];
UWORD HotKeyLeft = 0;
UWORD HotKeyWidth = 530;
UWORD HotKeyHeight = 159;
UBYTE *HotKeyWdt = NULL;
WORD HotkeysTop=0;
WORD ActionsTop=0;
UBYTE *Options1Labels[4];
VOID
InitOptions1Label()
{
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;
}
IMPORT 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[5] ,0,0,NULL,
&Actions1Nodes[7] ,&Actions1Nodes[6] ,0,0,NULL,
&Actions1Nodes[8] ,&Actions1Nodes[7] ,0,0,NULL,
&Actions1Nodes[9] ,&Actions1Nodes[8] ,0,0,NULL,
&Actions1Nodes[10],&Actions1Nodes[9] ,0,0,NULL,
&Actions1Nodes[11],&Actions1Nodes[10],0,0,NULL,
&Actions1Nodes[12],&Actions1Nodes[11],0,0,NULL,
&Actions1Nodes[13],&Actions1Nodes[12],0,0,NULL,
&Actions1Nodes[14],&Actions1Nodes[13],0,0,NULL,
&Actions1Nodes[15],&Actions1Nodes[14],0,0,NULL,
&Actions1Nodes[16],&Actions1Nodes[15],0,0,NULL,
&Actions1Nodes[17],&Actions1Nodes[16],0,0,NULL,
(struct Node *)&Actions1List.mlh_Tail,&Actions1Nodes[16],0,0,NULL
};
VOID
InitActions1Nodes()
{
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);
Actions1Nodes[15].ln_Name = getString(Back_Cycle_Windows_ACT);
Actions1Nodes[16].ln_Name = getString(SetDefaultPublicScreen);
Actions1Nodes[17].ln_Name = getString(MenuShortcut);
}
struct MinList Actions1List = {
(struct MinNode *)&Actions1Nodes[0],
(struct MinNode *)NULL,
(struct MinNode *)&Actions1Nodes[15] };
UWORD HotKeyGTypes[] = {
LISTVIEW_KIND,
LISTVIEW_KIND,
STRING_KIND,
CYCLE_KIND,
BUTTON_KIND,
BUTTON_KIND,
BUTTON_KIND
};
struct NewGadget HotKeyNGad[] = {
234,15,290,80,NULL,NULL,GD_Hotkeys ,PLACETEXT_ABOVE|NG_HIGHLABEL,NULL,NULL,
6,15,224,96,NULL,NULL,GD_Actions ,PLACETEXT_ABOVE|NG_HIGHLABEL,NULL,NULL,
234,109,290,14,NULL,NULL,GD_Argument,PLACETEXT_LEFT ,NULL,NULL,
234,124,290,13,NULL,NULL,GD_Options ,PLACETEXT_LEFT ,NULL,NULL,
234,93,110,13,NULL,NULL,GD_Add ,PLACETEXT_IN ,NULL,NULL,
414,93,110,13,NULL,NULL,GD_Delete ,PLACETEXT_IN ,NULL,NULL,
215,143,100,13,NULL,NULL,GD_Return ,PLACETEXT_IN ,NULL,NULL
};
VOID InitHotKeyNGad (VOID)
{
HotKeyNGad[GD_Hotkeys].ng_GadgetText = getString(HOTKEYS_STRING);
HotKeyNGad[GD_Actions].ng_GadgetText = getString(ACTIONS_STRING);
HotKeyNGad[GD_Argument].ng_GadgetText = getString(ARGUMENT_STRING);
HotKeyNGad[GD_Options].ng_GadgetText = getString(OPTIONS_STRING);
HotKeyNGad[GD_Add].ng_GadgetText = getString(ADD_STRING);
HotKeyNGad[GD_Delete].ng_GadgetText = getString(DELETE_STRING);
HotKeyNGad[GD_Return].ng_GadgetText = getString(OK_STRING);
}
ULONG HotKeyGTags[] = {
(GTLV_ShowSelected),NULL,(TAG_DONE),
(GTLV_Labels),(ULONG)&Actions1List,(GTLV_ShowSelected),NULL,(TAG_DONE),
(GTST_MaxChars),512,(TAG_DONE),
(GTCY_Labels),(ULONG)&Options1Labels[ 0 ],(TAG_DONE),
(TAG_DONE),
(TAG_DONE),
(TAG_DONE)
};
VOID
HotKeyRender()
{
ComputeFont(HotKeyWidth,HotKeyHeight);
DrawBevelBox(HotKeyWnd->RPort,OffX,
OffY +ComputeY(140),
ComputeX(530),
ComputeY(HotKeyHeight) -ComputeY(140),
GT_VisualInfo,VisualInfo,TAG_DONE);
DrawBevelBox(HotKeyWnd->RPort,OffX,
OffY,
ComputeX(530),
ComputeY(140),
GT_VisualInfo,VisualInfo,TAG_DONE);
}
int
OpenHotKeyWindow()
{
struct NewGadget ng;
struct Gadget *g;
UWORD lc,tc;
UWORD wleft = HotKeyLeft,wtop = WindowTop,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),
WA_PubScreenName,PubScreenName,
TAG_DONE)))
return(4L);
GT_RefreshWindow(HotKeyWnd,NULL);
HotKeyRender();
return(0L);
}