1 /* Copyright 2007-2012 Fredrik Wikstrom. All rights reserved.
3 ** Redistribution and use in source and binary forms, with or without
4 ** modification, are permitted provided that the following conditions
7 ** 1. Redistributions of source code must retain the above copyright
8 ** notice, this list of conditions and the following disclaimer.
10 ** 2. Redistributions in binary form must reproduce the above copyright
11 ** notice, this list of conditions and the following disclaimer in the
12 ** documentation and/or other materials provided with the distribution.
14 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS `AS IS'
15 ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 ** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
18 ** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19 ** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20 ** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21 ** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22 ** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23 ** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24 ** POSSIBILITY OF SUCH DAMAGE.
27 #include "diskimagegui.h"
28 #include <proto/exec.h>
29 #include <proto/dos.h>
30 #include <proto/utility.h>
31 #include <proto/intuition.h>
32 #include <proto/diskimage.h>
33 #include <clib/alib_protos.h>
34 #include "rev/DiskImageGUI_rev.h"
36 LONG
DoReq (Object
*req
) {
39 struct Window
*window
;
42 SetWindowBusy(~0, TRUE
);
44 if (Gui
.windows
[WID_MAIN
]) {
45 GetAttr(WINDOW_Window
, Gui
.windows
[WID_MAIN
], (Tag
*)&window
);
49 res
= DoMethod(req
, RM_OPENREQ
, NULL
, window
, Gui
.screen
);
51 struct Screen
*screen
;
52 screen
= LockPubScreen(NULL
);
54 res
= DoMethod(req
, RM_OPENREQ
, NULL
, NULL
, screen
);
55 UnlockPubScreen(NULL
, screen
);
59 SetWindowBusy(~0, FALSE
);
67 #ifndef FALLBACK_IMAGES
68 void ImageNotFoundRequester (CONST_STRPTR image
) {
71 CONST_STRPTR gadgettext
;
74 SNPrintf(titletext
, sizeof(titletext
), GetString(&LocaleInfo
, MSG_ERROR_WND
), PROGNAME
);
75 SNPrintf(bodytext
, sizeof(bodytext
), GetString(&LocaleInfo
, MSG_IMAGENOTFOUND_REQ
), image
);
76 gadgettext
= GetString(&LocaleInfo
, MSG_OK_GAD
);
78 req
= RequesterObject
,
79 REQ_TitleText
, titletext
,
80 REQ_BodyText
, bodytext
,
81 REQ_GadgetText
, gadgettext
,
88 void AboutRequester (void) {
91 CONST_STRPTR gadgettext
;
94 SNPrintf(titletext
, sizeof(titletext
), GetString(&LocaleInfo
, MSG_ABOUT_WND
), PROGNAME
);
95 bodytext
= ASPrintf(GetString(&LocaleInfo
, MSG_ABOUT_REQ
),
96 DiskImageBase
->lib_Node
.ln_Name
, DiskImageBase
->lib_Version
, DiskImageBase
->lib_Revision
,
97 PROGNAME
, VERSION
, REVISION
);
98 gadgettext
= GetString(&LocaleInfo
, MSG_OK_GAD
);
100 IoErrRequester(ERROR_NO_FREE_STORE
);
104 req
= RequesterObject
,
105 REQ_TitleText
, titletext
,
106 REQ_BodyText
, bodytext
,
107 REQ_GadgetText
, gadgettext
,
115 void IoErrRequester (LONG error
) {
118 CONST_STRPTR gadgettext
;
121 if (error
== NO_ERROR
) {
125 SNPrintf(titletext
, sizeof(titletext
), GetString(&LocaleInfo
, MSG_ERROR_WND
), PROGNAME
);
126 Fault(error
, NULL
, bodytext
, sizeof(bodytext
));
127 gadgettext
= GetString(&LocaleInfo
, MSG_OK_GAD
);
129 req
= RequesterObject
,
130 REQ_TitleText
, titletext
,
131 REQ_BodyText
, bodytext
,
132 REQ_GadgetText
, gadgettext
,
138 void ErrorStringRequester (CONST_STRPTR error_string
) {
140 CONST_STRPTR bodytext
;
141 CONST_STRPTR gadgettext
;
144 SNPrintf(titletext
, sizeof(titletext
), GetString(&LocaleInfo
, MSG_ERROR_WND
), PROGNAME
);
145 bodytext
= error_string
;
146 gadgettext
= GetString(&LocaleInfo
, MSG_OK_GAD
);
148 req
= RequesterObject
,
149 REQ_TitleText
, titletext
,
150 REQ_BodyText
, bodytext
,
151 REQ_GadgetText
, gadgettext
,
157 void RequiredVersionRequester (CONST_STRPTR res_name
, LONG version
, LONG revision
) {
160 CONST_STRPTR gadgettext
;
163 SNPrintf(titletext
, sizeof(titletext
), GetString(&LocaleInfo
, MSG_ERROR_WND
), PROGNAME
);
164 SNPrintf(bodytext
, sizeof(bodytext
), GetString(&LocaleInfo
, MSG_REQUIREDVERSION_REQ
),
165 res_name
, version
, revision
);
166 gadgettext
= GetString(&LocaleInfo
, MSG_OK_GAD
);
168 req
= RequesterObject
,
169 REQ_TitleText
, titletext
,
170 REQ_BodyText
, bodytext
,
171 REQ_GadgetText
, gadgettext
,