home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AmigActive 13
/
AACD13.ISO
/
AACD
/
Resources
/
System
/
BoingBag1
/
Contributions
/
InstallerNG
/
GUI-API
/
example
/
igui_CopylibConfirm.c
< prev
next >
Wrap
C/C++ Source or Header
|
1999-11-01
|
4KB
|
142 lines
#include "includes.h"
#include "installergui_data.h"
/********************************************************************
*
* DESCRIPTION
*
*/
/********************************************************************
*
* STATIC
*
*/
/********************************************************************
*
* EXTERN
*
*/
/********************************************************************
*
* PUBLIC
*
*/
/********************************************************************
*
* CODE
*
*/
long __asm igui_CopylibConfirm(register __a0 APTR application,
register __a1 struct FunctionEnvironment *localenv,
register __d0 long srcver,
register __d1 long destver)
{
#ifdef DEBUG
DEBUG_MAKRO
#endif
{
struct Application *app = (struct Application *) application;
char *body;
APTR obj;
long retval = 1,
event,
args[5];
// create an arg-array for the StringF function
args[0] = localenv->fe_Prompt;
args[1] = srcver >> 16;
args[2] = srcver & 0xffff;
args[4] = localenv->fe_Dest;
// if destver equals ~0, then no destfile does exist!
if (destver != ~0)
{
char *body2;
long args2[2];
args[3] = (long) app->app_Texts[COPYLIB_VERSION];
args2[0] = destver >> 16;
args2[1] = destver & 0xffff;
body2 = sav_StringF2(app->app_Texts[COPYLIB_PATTERN], &args);
if (!body2) { /* OUT OF MEMORY */ return(0); }
body = sav_StringF2(body2, &args2);
sav_FreeVec(body2);
}
// no destination file!
else
{
args[3] = (long) app->app_Texts[COPYLIB_NOVERSION];
body = sav_StringF2(app->app_Texts[COPYLIB_PATTERN], &args);
}
// there was not enough free memory, to create the formatted text
if (!body) { /* OUT OF MEMORY */ return(0); }
else
{
// after we created the text, we can now create the object itself
obj = GroupObject,
Child, HVSpace,
Child, TextObject,
MUIA_Frame, MUIV_Frame_None,
MUIA_Text_Contents, localenv->fe_Prompt,
MUIA_Text_SetMin, TRUE,
MUIA_Text_PreParse, "\33c",
End,
Child, TextObject,
MUIA_Background, MUII_TextBack,
//MUIA_Frame, MUIV_Frame_Text,
MUIA_Text_Contents, body,
MUIA_Text_SetMin, TRUE,
MUIA_Text_PreParse, "\33c",
End,
Child, HVSpace,
End;
// set the help text for this function
igui_SetHelp(app, (char *) localenv->fe_Help);
//
if (guistuff_NewContent(app, obj))
{
// make the "cancel" button into a "skip this part" button
igui_NameCancel(app, app->app_Texts[BUTTON_SKIP]);
// wait, until the user "proceeds", "skips" or confirms the "quit" action
do
{
event = igui_QuietWaitApp(app);
if (event == GUIEVENT_PROCEED) { retval = 1; break; }
else if (event == GUIEVENT_ABORT) { retval = 0; break; }
}
while (guistuff_HandleGUIEvent(app, event));
// restore the "cancel" button
igui_NameCancel(app, app->app_Texts[BUTTON_CANCEL]);
}
// free the memory of the body-text
sav_FreeVec(body);
}
//
igui_EmptyPanel(app);
return(retval);
}
}