2003-08-17 14:34:05 +00:00
|
|
|
/*
|
2014-06-30 09:10:35 +00:00
|
|
|
** char MessageBox (char mode, const char *format, ...)
|
|
|
|
**
|
|
|
|
** Maciej 'YTM/Elysium' Witkowiak, 17.08.2003
|
|
|
|
**
|
|
|
|
*/
|
2003-08-17 14:34:05 +00:00
|
|
|
|
|
|
|
#include <geos.h>
|
|
|
|
#include <stdio.h>
|
2022-05-08 16:47:55 +00:00
|
|
|
#include <stdarg.h>
|
2003-08-17 14:34:05 +00:00
|
|
|
|
|
|
|
void _mbprintout(void);
|
|
|
|
|
2017-06-28 18:43:31 +00:00
|
|
|
static const dlgBoxStr _mbdlg_EMPTY = {
|
2013-05-09 11:56:54 +00:00
|
|
|
DB_DEFPOS(1),
|
|
|
|
DB_OPVEC(&RstrFrmDialogue),
|
|
|
|
DB_USRROUT(&_mbprintout),
|
|
|
|
DB_END,
|
2003-08-17 14:34:05 +00:00
|
|
|
};
|
|
|
|
|
2017-06-28 18:43:31 +00:00
|
|
|
static const dlgBoxStr _mbdlg_OK = {
|
2013-05-09 11:56:54 +00:00
|
|
|
DB_DEFPOS(1),
|
|
|
|
DB_USRROUT(&_mbprintout),
|
|
|
|
DB_ICON(OK, DBI_X_1, DBI_Y_2),
|
|
|
|
DB_END,
|
2003-08-17 14:34:05 +00:00
|
|
|
};
|
|
|
|
|
2017-06-28 18:43:31 +00:00
|
|
|
static const dlgBoxStr _mbdlg_OKCANCEL = {
|
2013-05-09 11:56:54 +00:00
|
|
|
DB_DEFPOS(1),
|
|
|
|
DB_USRROUT(&_mbprintout),
|
|
|
|
DB_ICON(OK, DBI_X_0, DBI_Y_2),
|
|
|
|
DB_ICON(CANCEL, DBI_X_2, DBI_Y_2),
|
|
|
|
DB_END,
|
2003-08-17 14:34:05 +00:00
|
|
|
};
|
|
|
|
|
2017-06-28 18:43:31 +00:00
|
|
|
static const dlgBoxStr _mbdlg_YESNO = {
|
2013-05-09 11:56:54 +00:00
|
|
|
DB_DEFPOS(1),
|
|
|
|
DB_USRROUT(&_mbprintout),
|
|
|
|
DB_ICON(YES, DBI_X_0, DBI_Y_2),
|
|
|
|
DB_ICON(NO, DBI_X_2, DBI_Y_2),
|
|
|
|
DB_END,
|
2003-08-17 14:34:05 +00:00
|
|
|
};
|
|
|
|
|
2017-06-28 18:43:31 +00:00
|
|
|
static const dlgBoxStr * const _mbboxes[] = {
|
2013-05-09 11:56:54 +00:00
|
|
|
&_mbdlg_EMPTY,
|
|
|
|
&_mbdlg_OK,
|
|
|
|
&_mbdlg_OKCANCEL,
|
|
|
|
&_mbdlg_YESNO
|
2003-08-17 14:34:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
static char _mbbuffer[256];
|
|
|
|
|
|
|
|
char MessageBox(char mode, const char *format, ...)
|
|
|
|
{
|
|
|
|
register char *buf;
|
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
/* first format out things */
|
|
|
|
va_start(ap, format);
|
|
|
|
vsprintf(_mbbuffer, format, ap);
|
|
|
|
va_end(ap);
|
|
|
|
|
|
|
|
/* replace LFs by CRs */
|
|
|
|
buf = &_mbbuffer[0];
|
|
|
|
while (*buf) {
|
2013-05-09 11:56:54 +00:00
|
|
|
if (*buf==LF) *buf=CR;
|
|
|
|
++buf;
|
2003-08-17 14:34:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* validate mode */
|
|
|
|
if (mode>=MB_LAST)
|
2013-05-09 11:56:54 +00:00
|
|
|
mode = MB_EMPTY;
|
2003-08-17 14:34:05 +00:00
|
|
|
|
|
|
|
return DoDlgBox(_mbboxes[mode]);
|
|
|
|
}
|
|
|
|
|
|
|
|
void _mbprintout(void)
|
|
|
|
{
|
|
|
|
UseSystemFont();
|
|
|
|
curWindow.top = DEF_DB_TOP;
|
|
|
|
curWindow.left = DEF_DB_LEFT+10;
|
|
|
|
curWindow.right = DEF_DB_RIGHT-10;
|
|
|
|
curWindow.bot = DEF_DB_BOT;
|
|
|
|
PutString(_mbbuffer, DEF_DB_TOP+10+curFontDesc.height, DEF_DB_LEFT+10 );
|
|
|
|
}
|