summaryrefslogtreecommitdiff
path: root/app/wlib/mswlib/mswmsg.c
diff options
context:
space:
mode:
Diffstat (limited to 'app/wlib/mswlib/mswmsg.c')
-rw-r--r--app/wlib/mswlib/mswmsg.c103
1 files changed, 53 insertions, 50 deletions
diff --git a/app/wlib/mswlib/mswmsg.c b/app/wlib/mswlib/mswmsg.c
index 8487e31..154d89d 100644
--- a/app/wlib/mswlib/mswmsg.c
+++ b/app/wlib/mswlib/mswmsg.c
@@ -1,6 +1,5 @@
#include <windows.h>
#include <string.h>
-#include <malloc.h>
#include <stdlib.h>
#include <commdlg.h>
#include <math.h>
@@ -22,14 +21,14 @@
#define SCALE_SMALL 0.8
struct wMessage_t {
- WOBJ_COMMON
- long flags;
- const char * message;
- };
+ WOBJ_COMMON
+ long flags;
+ const char * message;
+};
static void repaintMessage(
- HWND hWnd,
- wControl_p b )
+ HWND hWnd,
+ wControl_p b )
{
wMessage_p bm = (wMessage_p)b;
HDC hDc;
@@ -41,33 +40,29 @@ static void repaintMessage(
hDc = GetDC( hWnd );
- if ( !mswThickFont )
- hFont = SelectObject( hDc, mswLabelFont );
+ hFont = SelectObject( hDc, mswLabelFont );
- switch( wMessageSetFont( ((wMessage_p)b)->flags ))
- {
- case BM_LARGE:
- scale = SCALE_LARGE;
- break;
- case BM_SMALL:
- scale = SCALE_SMALL;
- break;
+ switch( wMessageSetFont( ((wMessage_p)b)->flags )) {
+ case BM_LARGE:
+ scale = SCALE_LARGE;
+ break;
+ case BM_SMALL:
+ scale = SCALE_SMALL;
+ break;
}
- /* is a non-standard text height required? */
- if( scale != 1.0 )
- {
+ /* is a non-standard text height required? */
+ if( scale != 1.0 ) {
/* if yes, get information about the standard font used */
GetObject( GetStockObject( DEFAULT_GUI_FONT ), sizeof( LOGFONT ), &msgFont );
/* change the height */
- msgFont.lfHeight = (long)((double)msgFont.lfHeight * scale);
+ msgFont.lfHeight = (long)((double)msgFont.lfHeight * scale);
/* create and activate the new font */
hFont = SelectObject( hDc, CreateFontIndirect( &msgFont ) );
} else {
- if ( !mswThickFont )
- hFont = SelectObject( hDc, mswLabelFont );
+ hFont = SelectObject( hDc, mswLabelFont );
}
GetTextMetrics(hDc, &textMetrics);
@@ -78,36 +73,41 @@ static void repaintMessage(
rect.left = bm->x;
SetBkColor( hDc, GetSysColor( COLOR_BTNFACE ) );
- ExtTextOut( hDc, bm->x, bm->y + ((bm->h + 2 - textMetrics.tmHeight) / 2), ETO_CLIPPED|ETO_OPAQUE, &rect, bm->message, (int)(strlen( bm->message )), NULL );
+ ExtTextOut( hDc, bm->x, bm->y + ((bm->h + 2 - textMetrics.tmHeight) / 2),
+ ETO_CLIPPED|ETO_OPAQUE, &rect, bm->message, (int)(strlen( bm->message )),
+ NULL );
if( scale != 1.0 )
/* in case we did create a new font earlier, delete it now */
+ {
DeleteObject( SelectObject( hDc, GetStockObject( DEFAULT_GUI_FONT )));
- else
- if ( !mswThickFont )
- SelectObject( hDc, hFont );
+ } else {
+ SelectObject( hDc, hFont );
+ }
ReleaseDC( hWnd, hDc );
}
void wMessageSetValue(
- wMessage_p b,
- const char * arg )
+ wMessage_p b,
+ const char * arg )
{
- if (b->message)
+ if (b->message) {
free( CAST_AWAY_CONST b->message );
- if (arg)
+ }
+ if (arg) {
b->message = mswStrdup( arg );
- else
+ } else {
b->message = NULL;
+ }
repaintMessage( ((wControl_p)(b->parent))->hWnd, (wControl_p)b );
}
void wMessageSetWidth(
- wMessage_p b,
- wWinPix_t width )
+ wMessage_p b,
+ wWinPix_t width )
{
b->w = width;
@@ -122,41 +122,44 @@ wWinPix_t wMessageGetHeight( long flags )
{
double scale = 1.0;
- if( flags & BM_LARGE )
+ if( flags & BM_LARGE ) {
scale = SCALE_LARGE;
- if( flags & BM_SMALL )
+ }
+ if( flags & BM_SMALL ) {
scale = SCALE_SMALL;
+ }
return((wWinPix_t)((mswEditHeight) * scale ));
}
static void mswMessageSetBusy(
- wControl_p b,
- BOOL_T busy )
+ wControl_p b,
+ BOOL_T busy )
{
}
static callBacks_t messageCallBacks = {
- repaintMessage,
- NULL,
- NULL,
- mswMessageSetBusy };
+ repaintMessage,
+ NULL,
+ NULL,
+ mswMessageSetBusy
+};
wMessage_p wMessageCreateEx(
- wWin_p parent,
- wWinPix_t x,
- wWinPix_t y,
- const char * helpStr,
- wWinPix_t width,
- const char *message,
- long flags )
+ wWin_p parent,
+ wWinPix_t x,
+ wWinPix_t y,
+ const char * helpStr,
+ wWinPix_t width,
+ const char *message,
+ long flags )
{
wMessage_p b;
int index;
-
+
b = (wMessage_p)mswAlloc( parent, B_MESSAGE, NULL, sizeof *b, NULL, &index );
mswComputePos( (wControl_p)b, x, y );