home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga MA Magazine 1998 #6
/
amigamamagazinepolishissue1998.iso
/
coders
/
guicreator
/
demos
/
managecdpics.c
< prev
next >
Wrap
C/C++ Source or Header
|
1977-12-31
|
35KB
|
536 lines
/*************************************************************************/
/* */
/* Includes */
/* */
/*************************************************************************/
#include "ManageCDPics_Includes.h"
#include "ManageCDPics.h"
/*************************************************************************/
/* */
/* Variables and Structures */
/* */
/*************************************************************************/
extern struct IntuitionBase *IntuitionBase;
extern struct GfxBase *GfxBase;
extern struct Library *GadToolsBase ;
extern struct Library *AslBase ;
extern struct Library *DataTypesBase;
/*************************************************************************/
/* */
/* Defines */
/* */
/*************************************************************************/
#define RASTERX (GfxBase->DefaultFont->tf_XSize)
#define RASTERY (GfxBase->DefaultFont->tf_YSize/2+4)
#define XSIZE(x) ((x)*RASTERX)
#define YSIZE(x) ((x)*RASTERY)
#define XPOS(x) (XSIZE(x)+customscreen->WBorLeft)
#define YPOS(x) (YSIZE(x)+customscreen->BarHeight+1)
#define ERROR_NO_WINDOW_OPENED 1001L
#define ERROR_NO_PUBSCREEN_LOCKED 1002L
#define ERROR_NO_GADGETS_CREATED 1003L
#define ERROR_NO_VISUALINFO 1004L
#define ERROR_NO_PICTURE_LOADED 1005L
#define ERROR_NO_GADGETLIST_CREATED 1006L
#define ERROR_NO_WINDOW_MENU 1007L
struct ManageCDPicsWindowData
{
BOOL gd_Disabled_CD;
struct List *gd_Labels_CD;
UWORD gd_Selected_CD;
UWORD gd_Top_CD;
BOOL gd_Disabled_Category;
struct List *gd_Labels_Category;
UWORD gd_Selected_Category;
UWORD gd_Top_Category;
BOOL gd_Disabled_Picture;
struct List *gd_Labels_Picture;
UWORD gd_Selected_Picture;
UWORD gd_Top_Picture;
BOOL gd_Disabled_Text;
char gd_Text_Text[256];
BOOL gd_Disabled_String;
char gd_String_String[64];
BOOL gd_Disabled_ToShow;
UWORD gd_Active_ToShow;
STRPTR *gd_Labels_ToShow;
BOOL gd_Disabled_SavePrefs;
BOOL gd_Disabled_Slideshow;
BOOL gd_Disabled_Show;
};
/*************************************************************************/
/* */
/* Routines to handle gadgets */
/* */
/*************************************************************************/
void HandleGadgetsManageCDPicsWindow(struct Window *win,struct Gadget *wingads[],ULONG gadgetid,ULONG messagecode,struct ManageCDPicsWindowData *gadgetdata,APTR userdata)
{
switch(gadgetid)
{
case LVID_CD:
CDClicked(win,wingads,gadgetid,messagecode,userdata);
break;
case LVID_Category:
CategoryClicked(win,wingads,gadgetid,messagecode,userdata);
break;
case LVID_Picture:
PictureClicked(win,wingads,gadgetid,messagecode,userdata);
break;
case TXID_Text:
TextClicked(win,wingads,gadgetid,messagecode,userdata);
break;
case STID_String:
StringClicked(win,wingads,gadgetid,messagecode,userdata);
break;
case CYID_ToShow:
ToShowClicked(win,wingads,gadgetid,messagecode,userdata);
break;
case BTID_SavePrefs:
SavePrefsClicked(win,wingads,gadgetid,messagecode,userdata);
break;
case BTID_Slideshow:
SlideshowClicked(win,wingads,gadgetid,messagecode,userdata);
break;
case BTID_Show:
ShowClicked(win,wingads,gadgetid,messagecode,userdata);
break;
};
}
/*************************************************************************/
/* */
/* Routines to create gadgets */
/* */
/*************************************************************************/
struct Gadget *CreateGadgetsManageCDPicsWindow(struct Gadget **gadgetlist,struct NewGadget newgad[],struct Gadget *wingads[],struct ManageCDPicsWindowData *gadgetdata)
{
struct Gadget *gadget=CreateContext(gadgetlist);
if (gadget)
{
wingads[LVID_CD]=gadget=CreateGadget(LISTVIEW_KIND,gadget,&newgad[LVID_CD],GA_Disabled,gadgetdata->gd_Disabled_CD,GTLV_Labels,gadgetdata->gd_Labels_CD,GTLV_ReadOnly,FALSE,GTLV_Selected,gadgetdata->gd_Selected_CD,GTLV_ShowSelected,NULL,GTLV_Top,gadgetdata->gd_Top_CD,LAYOUTA_Spacing,0,TAG_END);
wingads[LVID_Category]=gadget=CreateGadget(LISTVIEW_KIND,gadget,&newgad[LVID_Category],GA_Disabled,gadgetdata->gd_Disabled_Category,GTLV_Labels,gadgetdata->gd_Labels_Category,GTLV_ReadOnly,FALSE,GTLV_Selected,gadgetdata->gd_Selected_Category,GTLV_ShowSelected,NULL,GTLV_Top,gadgetdata->gd_Top_Category,LAYOUTA_Spacing,0,TAG_END);
wingads[LVID_Picture]=gadget=CreateGadget(LISTVIEW_KIND,gadget,&newgad[LVID_Picture],GA_Disabled,gadgetdata->gd_Disabled_Picture,GTLV_Labels,gadgetdata->gd_Labels_Picture,GTLV_ReadOnly,FALSE,GTLV_Selected,gadgetdata->gd_Selected_Picture,GTLV_ShowSelected,NULL,GTLV_Top,gadgetdata->gd_Top_Picture,LAYOUTA_Spacing,0,TAG_END);
wingads[LAID_Gadget5]=gadget=CreateGadget(TEXT_KIND,gadget,&newgad[LAID_Gadget5],GT_Underscore,'_',GTTX_Border,FALSE,TAG_END);
wingads[LAID_Gadget6]=gadget=CreateGadget(TEXT_KIND,gadget,&newgad[LAID_Gadget6],GT_Underscore,'_',GTTX_Border,FALSE,TAG_END);
wingads[LAID_Gadget7]=gadget=CreateGadget(TEXT_KIND,gadget,&newgad[LAID_Gadget7],GT_Underscore,'_',GTTX_Border,FALSE,TAG_END);
wingads[TXID_Text]=gadget=CreateGadget(TEXT_KIND,gadget,&newgad[TXID_Text],GA_Disabled,gadgetdata->gd_Disabled_Text,GTTX_Border,TRUE,GTTX_CopyText,TRUE,GTTX_Text,gadgetdata->gd_Text_Text,TAG_END);
wingads[LAID_Gadget9]=gadget=CreateGadget(TEXT_KIND,gadget,&newgad[LAID_Gadget9],GT_Underscore,'_',GTTX_Border,FALSE,TAG_END);
wingads[STID_String]=gadget=CreateGadget(STRING_KIND,gadget,&newgad[STID_String],GA_Disabled,gadgetdata->gd_Disabled_String,GA_TabCycle,TRUE,GTST_MaxChars,64,GTST_String,gadgetdata->gd_String_String,GA_TabCycle,TRUE,STRINGA_ExitHelp,TRUE,STRINGA_Justification,GACT_STRINGLEFT,STRINGA_ReplaceMode,TRUE,TAG_END);
wingads[LAID_Gadget12]=gadget=CreateGadget(TEXT_KIND,gadget,&newgad[LAID_Gadget12],GT_Underscore,'_',GTTX_Border,FALSE,TAG_END);
wingads[CYID_ToShow]=gadget=CreateGadget(CYCLE_KIND,gadget,&newgad[CYID_ToShow],GA_Disabled,gadgetdata->gd_Disabled_ToShow,GTCY_Labels,gadgetdata->gd_Labels_ToShow,GTCY_Active,gadgetdata->gd_Active_ToShow,TAG_END);
wingads[BTID_SavePrefs]=gadget=CreateGadget(BUTTON_KIND,gadget,&newgad[BTID_SavePrefs],GA_Disabled,gadgetdata->gd_Disabled_SavePrefs,GT_Underscore,'_',TAG_END);
wingads[BTID_Slideshow]=gadget=CreateGadget(BUTTON_KIND,gadget,&newgad[BTID_Slideshow],GA_Disabled,gadgetdata->gd_Disabled_Slideshow,GT_Underscore,'_',TAG_END);
wingads[BTID_Show]=gadget=CreateGadget(BUTTON_KIND,gadget,&newgad[BTID_Show],GA_Disabled,gadgetdata->gd_Disabled_Show,GT_Underscore,'_',TAG_END);
return gadget;
}
else return NULL;
}
/*************************************************************************/
/* */
/* Routines to handle windows */
/* */
/*************************************************************************/
void HandleManageCDPicsWindow(struct Screen *customscreen,LONG left,LONG top,APTR userdata)
{
APTR visualinfo=GetVisualInfo(customscreen,TAG_DONE);
if (visualinfo)
{
struct Gadget *gadgetlist = NULL;
struct Menu *menustrip = NULL;
ULONG height=33,width=79,maxheight=1024,maxwidth=1280;
struct Gadget *wingads[14];
STRPTR title = "ManageCDPics © 1994-95 by Markus Hillenbrand";
struct Window *win = NULL;
struct TextAttr textattr = { GfxBase->DefaultFont->tf_Message.mn_Node.ln_Name,GfxBase->DefaultFont->tf_YSize,FS_NORMAL,FPF_DISKFONT };
struct NewGadget newgad[] = {
XPOS(1),YPOS(2),XSIZE(25),YSIZE(20),NULL,&textattr,LVID_CD,PLACETEXT_ABOVE,visualinfo,NULL,
XPOS(27),YPOS(2),XSIZE(25),YSIZE(20),NULL,&textattr,LVID_Category,PLACETEXT_ABOVE,visualinfo,NULL,
XPOS(53),YPOS(2),XSIZE(25),YSIZE(20),NULL,&textattr,LVID_Picture,PLACETEXT_ABOVE,visualinfo,NULL,
XPOS(1),YPOS(0),XSIZE(25),YSIZE(2),"_CD:",&textattr,LAID_Gadget5,PLACETEXT_IN,visualinfo,NULL,
XPOS(27),YPOS(0),XSIZE(25),YSIZE(2),"C_ategory:",&textattr,LAID_Gadget6,PLACETEXT_IN,visualinfo,NULL,
XPOS(53),YPOS(0),XSIZE(25),YSIZE(2),"_Picture:",&textattr,LAID_Gadget7,PLACETEXT_IN,visualinfo,NULL,
XPOS(1),YPOS(22),XSIZE(77),YSIZE(2),NULL,&textattr,TXID_Text,PLACETEXT_LEFT,visualinfo,NULL,
XPOS(1),YPOS(25),XSIZE(29),YSIZE(2),"Program to _view Picture with:",&textattr,LAID_Gadget9,PLACETEXT_IN,visualinfo,NULL,
XPOS(1),YPOS(27),XSIZE(51),YSIZE(2),NULL,&textattr,STID_String,PLACETEXT_LEFT,visualinfo,NULL,
XPOS(53),YPOS(25),XSIZE(15),YSIZE(2),"Select _to show:",&textattr,LAID_Gadget12,PLACETEXT_IN,visualinfo,NULL,
XPOS(53),YPOS(27),XSIZE(25),YSIZE(2),NULL,&textattr,CYID_ToShow,PLACETEXT_ABOVE,visualinfo,NULL,
XPOS(1),YPOS(30),XSIZE(25),YSIZE(2),"_Save Prefs",&textattr,BTID_SavePrefs,PLACETEXT_IN,visualinfo,NULL,
XPOS(27),YPOS(30),XSIZE(25),YSIZE(2),"Start S_lideshow",&textattr,BTID_Slideshow,PLACETEXT_IN,visualinfo,NULL,
XPOS(53),YPOS(30),XSIZE(25),YSIZE(2),"Show P_icture(s)",&textattr,BTID_Show,PLACETEXT_IN,visualinfo,NULL,
};
STRPTR LA_ToShow[] = { "Single","Category","CD",NULL };
struct ManageCDPicsWindowData gadgetdata = {
/* belongs to a listview gadget */
FALSE,
(struct List *)~0,
0,
0,
/* belongs to a listview gadget */
FALSE,
(struct List *)~0,
0,
0,
/* belongs to a listview gadget */
FALSE,
(struct List *)~0,
0,
0,
/* belongs to a text gadget */
FALSE,
(char *)"",
/* belongs to a string gadget */
FALSE,
(char *)"",
/* belongs to a cycle gadget */
FALSE,
0,
(STRPTR *)&LA_ToShow[0],
/* belongs to a button */
FALSE,
/* belongs to a button */
FALSE,
/* belongs to a button */
FALSE,
};
struct NewMenu menu[] = { NM_TITLE, "Program" , 0 ,0,0,0,
NM_ITEM , "About" ,"A",0,0,0,
NM_END , NULL , 0 ,0,0,0 };
height= YSIZE(height);
width = XSIZE(width) ;
if (left==-1) left = (customscreen->Width-width)/2;
if (top ==-1) top = (customscreen->Height-height)/2;
if (CreateGadgetsManageCDPicsWindow(&gadgetlist,newgad,wingads,&gadgetdata)!=NULL)
{
if (height>customscreen->Height || width>customscreen->Width) GUICreatorErrorReport(NULL,ERROR_SCREEN_TOO_SMALL);
win=OpenWindowTags(NULL,WA_Activate, TRUE,
WA_CloseGadget, TRUE,
WA_DepthGadget, TRUE,
WA_SizeGadget, TRUE,
WA_DragBar, TRUE,
WA_Gadgets, gadgetlist,
WA_InnerHeight, height,
WA_InnerWidth, width,
WA_IDCMP, IDCMP_CLOSEWINDOW|IDCMP_MENUPICK|IDCMP_NEWSIZE|IDCMP_VANILLAKEY|IDCMP_REFRESHWINDOW|IDCMP_GADGETUP|BUTTONIDCMP|STRINGIDCMP|CYCLEIDCMP|LISTVIEWIDCMP,
WA_Left, left,
WA_Top, top,
WA_MaxHeight, maxheight,
WA_MinHeight, height,
WA_MaxWidth, maxwidth,
WA_MinWidth, width,
WA_SizeBRight, FALSE,
WA_SizeBBottom, TRUE,
WA_SmartRefresh, TRUE,
WA_CustomScreen, customscreen,
WA_Title, title,
WA_NewLookMenus, TRUE,
TAG_END);
if (win)
{
menustrip=CreateMenus(menu,GTMN_NewLookMenus,TRUE,TAG_END);
if (menustrip)
{
if (LayoutMenus(menustrip,visualinfo,GTMN_NewLookMenus,TRUE,TAG_END))
{
if (SetMenuStrip(win,menustrip))
{
struct IntuiMessage *imessage = NULL;
struct Gadget *idcmpgad = NULL;
struct NewGadget ngcopy[] = newgad;
long double xscale = 1.0;
long double yscale = 1.0;
STRPTR stringpointer = NULL;
ULONG i = 0;
ULONG gadgetcount = 14;
ULONG idcmpclass = 0;
UWORD messagecode = 0;
BOOL running = TRUE;
ULONG signal = 0;
ULONG longpointer1 = 0;
ULONG longpointer2 = 0;
SetFont(win->RPort,GfxBase->DefaultFont);
GT_RefreshWindow(win,NULL);
/* User-Setup */
UserSetupManageCDPicsWindow(win,wingads,userdata);
do
{
WindowLimits(win,width+win->BorderLeft+win->BorderRight,height+win->BorderTop+win->BorderBottom,maxwidth,maxheight);
if (running) signal=Wait(SIGBREAKF_CTRL_C | 1L << win->UserPort->mp_SigBit);
if (signal & SIGBREAKF_CTRL_C) running=FALSE;
WindowLimits(win,win->Width,win->Height,win->Width,win->Height);
while (running && (imessage=GT_GetIMsg(win->UserPort)))
{
idcmpgad=(struct Gadget *)imessage->IAddress;
idcmpclass=imessage->Class;
messagecode =imessage->Code;
GT_ReplyIMsg(imessage);
switch(idcmpclass)
{
case IDCMP_REFRESHWINDOW:
GT_BeginRefresh(win);
GT_EndRefresh(win,TRUE);
break;
case IDCMP_MENUPICK:
switch(MENUNUM(messagecode))
{
case 0:
switch (ITEMNUM(messagecode))
{
case 0:
About(win);
break;
}
/* end-switch */
break;
}
/* end-switch */
break;
case IDCMP_NEWSIZE:
GT_GetGadgetAttrs(wingads[LVID_CD],win,NULL,GA_Disabled,&longpointer1,GTLV_Labels,&longpointer2,TAG_END);
gadgetdata.gd_Disabled_CD=(longpointer1==0)?FALSE:TRUE;
gadgetdata.gd_Labels_CD=(struct List *)longpointer2;
GT_GetGadgetAttrs(wingads[LVID_CD],win,NULL,GTLV_Top,&longpointer1,GTLV_Selected,&longpointer2,TAG_END);
gadgetdata.gd_Top_CD=longpointer1;
gadgetdata.gd_Selected_CD=longpointer2;
GT_GetGadgetAttrs(wingads[LVID_Category],win,NULL,GA_Disabled,&longpointer1,GTLV_Labels,&longpointer2,TAG_END);
gadgetdata.gd_Disabled_Category=(longpointer1==0)?FALSE:TRUE;
gadgetdata.gd_Labels_Category=(struct List *)longpointer2;
GT_GetGadgetAttrs(wingads[LVID_Category],win,NULL,GTLV_Top,&longpointer1,GTLV_Selected,&longpointer2,TAG_END);
gadgetdata.gd_Top_Category=longpointer1;
gadgetdata.gd_Selected_Category=longpointer2;
GT_GetGadgetAttrs(wingads[LVID_Picture],win,NULL,GA_Disabled,&longpointer1,GTLV_Labels,&longpointer2,TAG_END);
gadgetdata.gd_Disabled_Picture=(longpointer1==0)?FALSE:TRUE;
gadgetdata.gd_Labels_Picture=(struct List *)longpointer2;
GT_GetGadgetAttrs(wingads[LVID_Picture],win,NULL,GTLV_Top,&longpointer1,GTLV_Selected,&longpointer2,TAG_END);
gadgetdata.gd_Top_Picture=longpointer1;
gadgetdata.gd_Selected_Picture=longpointer2;
GT_GetGadgetAttrs(wingads[TXID_Text],win,NULL,GA_Disabled,&longpointer1,GTTX_Text,&stringpointer,TAG_END);
gadgetdata.gd_Disabled_Text=(longpointer1==0)?FALSE:TRUE;
strcpy(gadgetdata.gd_Text_Text,stringpointer);
GT_GetGadgetAttrs(wingads[STID_String],win,NULL,GA_Disabled,&longpointer1,GTST_String,&stringpointer,TAG_END);
gadgetdata.gd_Disabled_String=(longpointer1==0)?FALSE:TRUE;
strcpy(gadgetdata.gd_String_String,stringpointer);
GT_GetGadgetAttrs(wingads[CYID_ToShow],win,NULL,GA_Disabled,&longpointer1,GTCY_Active,&longpointer2,TAG_END);
gadgetdata.gd_Disabled_ToShow=(longpointer1==0)?FALSE:TRUE;
gadgetdata.gd_Active_ToShow=longpointer2;
GT_GetGadgetAttrs(wingads[CYID_ToShow],win,NULL,GTCY_Labels,&longpointer1,TAG_END);
gadgetdata.gd_Labels_ToShow=(STRPTR *)longpointer1;
GT_GetGadgetAttrs(wingads[BTID_SavePrefs],win,NULL,GA_Disabled,&longpointer1,TAG_END);
gadgetdata.gd_Disabled_SavePrefs=(longpointer1==0)?FALSE:TRUE;
GT_GetGadgetAttrs(wingads[BTID_Slideshow],win,NULL,GA_Disabled,&longpointer1,TAG_END);
gadgetdata.gd_Disabled_Slideshow=(longpointer1==0)?FALSE:TRUE;
GT_GetGadgetAttrs(wingads[BTID_Show],win,NULL,GA_Disabled,&longpointer1,TAG_END);
gadgetdata.gd_Disabled_Show=(longpointer1==0)?FALSE:TRUE;
RemoveGList(win,gadgetlist,-1);
SetAPen(win->RPort,0L);
RectFill(win->RPort,win->BorderLeft,win->BorderTop,win->Width-win->BorderRight-1,win->Height-win->BorderBottom-1);
RefreshWindowFrame(win);
xscale=(long double)win->Width /(long double)(width+win->BorderLeft+win->BorderRight);
yscale=(long double)win->Height/(long double)(height+win->BorderTop+win->BorderBottom);
for (i=0;i<gadgetcount;i++)
{
ngcopy[i].ng_LeftEdge=(WORD)((long double)newgad[i].ng_LeftEdge*xscale);
ngcopy[i].ng_TopEdge =(WORD)((long double)newgad[i].ng_TopEdge *yscale);
ngcopy[i].ng_Width =(WORD)((long double)newgad[i].ng_Width *xscale);
ngcopy[i].ng_Height =(WORD)((long double)newgad[i].ng_Height *yscale);
}
FreeGadgets(gadgetlist);
gadgetlist=NULL;
CreateGadgetsManageCDPicsWindow(&gadgetlist,ngcopy,wingads,&gadgetdata);
AddGList(win,gadgetlist,-1,-1,NULL);
RefreshGList(gadgetlist,win,NULL,-1);
GT_RefreshWindow(win,NULL);
break;
case IDCMP_VANILLAKEY:
switch(messagecode)
{
case 'c':
GT_GetGadgetAttrs(wingads[LVID_CD],win,NULL,GA_Disabled,&longpointer1,TAG_END);
if (longpointer1==0)
{
GT_GetGadgetAttrs(wingads[LVID_CD],win,NULL,GTLV_Selected,&longpointer1,TAG_END);
GT_SetGadgetAttrs(wingads[LVID_CD],win,NULL,GTLV_Selected,longpointer1+1,TAG_END);
GT_GetGadgetAttrs(wingads[LVID_CD],win,NULL,GTLV_Selected,&longpointer2,TAG_END);
if (longpointer2!=longpointer1)
{
HandleGadgetsManageCDPicsWindow(win,wingads,LVID_CD,longpointer2,&gadgetdata,userdata);
}
}
break;
case 'C':
GT_GetGadgetAttrs(wingads[LVID_CD],win,NULL,GA_Disabled,&longpointer1,TAG_END);
if (longpointer1==0)
{
GT_GetGadgetAttrs(wingads[LVID_CD],win,NULL,GTLV_Selected,&longpointer1,TAG_END);
if (longpointer1!=0)
{
GT_SetGadgetAttrs(wingads[LVID_CD],win,NULL,GTLV_Selected,longpointer1-1,TAG_END);
HandleGadgetsManageCDPicsWindow(win,wingads,LVID_CD,longpointer1-1,&gadgetdata,userdata);
}
}
break;
case 'a':
GT_GetGadgetAttrs(wingads[LVID_Category],win,NULL,GA_Disabled,&longpointer1,TAG_END);
if (longpointer1==0)
{
GT_GetGadgetAttrs(wingads[LVID_Category],win,NULL,GTLV_Selected,&longpointer1,TAG_END);
GT_SetGadgetAttrs(wingads[LVID_Category],win,NULL,GTLV_Selected,longpointer1+1,TAG_END);
GT_GetGadgetAttrs(wingads[LVID_Category],win,NULL,GTLV_Selected,&longpointer2,TAG_END);
if (longpointer2!=longpointer1)
{
HandleGadgetsManageCDPicsWindow(win,wingads,LVID_Category,longpointer2,&gadgetdata,userdata);
}
}
break;
case 'A':
GT_GetGadgetAttrs(wingads[LVID_Category],win,NULL,GA_Disabled,&longpointer1,TAG_END);
if (longpointer1==0)
{
GT_GetGadgetAttrs(wingads[LVID_Category],win,NULL,GTLV_Selected,&longpointer1,TAG_END);
if (longpointer1!=0)
{
GT_SetGadgetAttrs(wingads[LVID_Category],win,NULL,GTLV_Selected,longpointer1-1,TAG_END);
HandleGadgetsManageCDPicsWindow(win,wingads,LVID_Category,longpointer1-1,&gadgetdata,userdata);
}
}
break;
case 'p':
GT_GetGadgetAttrs(wingads[LVID_Picture],win,NULL,GA_Disabled,&longpointer1,TAG_END);
if (longpointer1==0)
{
GT_GetGadgetAttrs(wingads[LVID_Picture],win,NULL,GTLV_Selected,&longpointer1,TAG_END);
GT_SetGadgetAttrs(wingads[LVID_Picture],win,NULL,GTLV_Selected,longpointer1+1,TAG_END);
GT_GetGadgetAttrs(wingads[LVID_Picture],win,NULL,GTLV_Selected,&longpointer2,TAG_END);
if (longpointer2!=longpointer1)
{
HandleGadgetsManageCDPicsWindow(win,wingads,LVID_Picture,longpointer2,&gadgetdata,userdata);
}
}
break;
case 'P':
GT_GetGadgetAttrs(wingads[LVID_Picture],win,NULL,GA_Disabled,&longpointer1,TAG_END);
if (longpointer1==0)
{
GT_GetGadgetAttrs(wingads[LVID_Picture],win,NULL,GTLV_Selected,&longpointer1,TAG_END);
if (longpointer1!=0)
{
GT_SetGadgetAttrs(wingads[LVID_Picture],win,NULL,GTLV_Selected,longpointer1-1,TAG_END);
HandleGadgetsManageCDPicsWindow(win,wingads,LVID_Picture,longpointer1-1,&gadgetdata,userdata);
}
}
break;
case 'v':
GT_GetGadgetAttrs(wingads[STID_String],win,NULL,GA_Disabled,&longpointer1,TAG_END);
if (longpointer1==0) ActivateGadget(wingads[STID_String],win,NULL);
break;
case 't':
GT_GetGadgetAttrs(wingads[CYID_ToShow],win,NULL,GA_Disabled,&longpointer1,TAG_END);
if (longpointer1==0)
{
GT_GetGadgetAttrs(wingads[CYID_ToShow],win,NULL,GTCY_Active,&longpointer1,TAG_END);
if (++longpointer1==3) longpointer1=0;
GT_SetGadgetAttrs(wingads[CYID_ToShow],win,NULL,GTCY_Active,longpointer1,TAG_END);
HandleGadgetsManageCDPicsWindow(win,wingads,CYID_ToShow,longpointer1,&gadgetdata,userdata);
}
break;
case 'T':
GT_GetGadgetAttrs(wingads[CYID_ToShow],win,NULL,GA_Disabled,&longpointer1,TAG_END);
if (longpointer1==0)
{
GT_GetGadgetAttrs(wingads[CYID_ToShow],win,NULL,GTCY_Active,&longpointer1,TAG_END);
if (longpointer1==0) longpointer1=3;
longpointer1--;
GT_SetGadgetAttrs(wingads[CYID_ToShow],win,NULL,GTCY_Active,longpointer1,TAG_END);
HandleGadgetsManageCDPicsWindow(win,wingads,CYID_ToShow,longpointer1,&gadgetdata,userdata);
}
break;
case 's':
GT_GetGadgetAttrs(wingads[BTID_SavePrefs],win,NULL,GA_Disabled,&longpointer1,TAG_END);
if (longpointer1==0) HandleGadgetsManageCDPicsWindow(win,wingads,BTID_SavePrefs,messagecode,&gadgetdata,userdata);
break;
case 'l':
GT_GetGadgetAttrs(wingads[BTID_Slideshow],win,NULL,GA_Disabled,&longpointer1,TAG_END);
if (longpointer1==0) HandleGadgetsManageCDPicsWindow(win,wingads,BTID_Slideshow,messagecode,&gadgetdata,userdata);
break;
case 'i':
GT_GetGadgetAttrs(wingads[BTID_Show],win,NULL,GA_Disabled,&longpointer1,TAG_END);
if (longpointer1==0) HandleGadgetsManageCDPicsWindow(win,wingads,BTID_Show,messagecode,&gadgetdata,userdata);
break;
case 27:
running=FALSE;
break;
}
break;
case IDCMP_CLOSEWINDOW:
running=FALSE;
break;
case IDCMP_GADGETUP:
case MXIDCMP:
HandleGadgetsManageCDPicsWindow(win,wingads,idcmpgad->GadgetID,messagecode,&gadgetdata,userdata);
break;
}
/* end-switch */
}
/* end-while */
}
while (running);
ClearMenuStrip(win);
}
else GUICreatorErrorReport(win,ERROR_NO_WINDOW_MENU);
}
else GUICreatorErrorReport(win,ERROR_NO_WINDOW_MENU);
FreeMenus(menustrip);
}
else GUICreatorErrorReport(win,ERROR_NO_WINDOW_MENU);
if (win) CloseWindow(win);
}
else GUICreatorErrorReport(win,ERROR_NO_WINDOW_OPENED);
if (gadgetlist) FreeGadgets(gadgetlist);
}
else GUICreatorErrorReport(NULL,ERROR_NO_GADGETS_CREATED);
if (visualinfo) FreeVisualInfo(visualinfo);
}
else GUICreatorErrorReport(NULL,ERROR_NO_VISUALINFO);
}