diff --git a/sc2/ChangeLog b/sc2/ChangeLog index e4f33bca2..3b9827078 100644 --- a/sc2/ChangeLog +++ b/sc2/ChangeLog @@ -1,4 +1,5 @@ Changes towards version 0.7: +- Make DoPopupWindow() work over faded out screens. - SvdB - Trackplayer rewrite; fixed many bugs - Alex - Source tree reorg: libs/ moved out of sc2code/, msvc++/ moved to build/msvc6/, src/sc2code/ renamed to src/uqm/ - Coredev diff --git a/sc2/src/libs/gfxlib.h b/sc2/src/libs/gfxlib.h index 3dda0ae98..9c525bb64 100644 --- a/sc2/src/libs/gfxlib.h +++ b/sc2/src/libs/gfxlib.h @@ -246,7 +246,7 @@ extern void FlushColorXForms (void); #define GetColorMapAddress GetStringAddress #define GetColorMapContents GetStringContents -void SetSystemRect (RECT *pRect); +void SetSystemRect (const RECT *pRect); void ClearSystemRect (void); #endif /* _GFXLIB_H */ diff --git a/sc2/src/libs/graphics/sdl/sdl_common.c b/sc2/src/libs/graphics/sdl/sdl_common.c index bda7fde93..a739b5ebc 100644 --- a/sc2/src/libs/graphics/sdl/sdl_common.c +++ b/sc2/src/libs/graphics/sdl/sdl_common.c @@ -221,7 +221,7 @@ static BOOLEAN system_box_active = 0; static SDL_Rect system_box; void -SetSystemRect (RECT *r) +SetSystemRect (const RECT *r) { system_box_active = TRUE; system_box.x = r->corner.x; diff --git a/sc2/src/libs/graphics/widgets.c b/sc2/src/libs/graphics/widgets.c index 402ef16e5..23cbda817 100644 --- a/sc2/src/libs/graphics/widgets.c +++ b/sc2/src/libs/graphics/widgets.c @@ -79,8 +79,10 @@ DrawShadowedBox (RECT *r, COLOR bg, COLOR dark, COLOR medium) UnbatchGraphics (); } +// windowRect, if not NULL, will be filled with the dimensions of the +// window drawn. void -DrawLabelAsWindow (WIDGET_LABEL *label) +DrawLabelAsWindow (WIDGET_LABEL *label, RECT *windowRect) { COLOR oldfg = SetContextForeGroundColor (WIDGET_DIALOG_TEXT_COLOR); FONT oldfont = 0; @@ -129,6 +131,16 @@ DrawLabelAsWindow (WIDGET_LABEL *label) if (oldfont) SetContextFont (oldfont); SetContextForeGroundColor (oldfg); + + if (windowRect != NULL) { + // Add the outer border added by DrawShadowedBox. + // XXX: It may be nicer to add a border size parameter to + // DrawShadowedBox, instead of assuming 2 here. + windowRect->corner.x = r.corner.x - 2; + windowRect->corner.y = r.corner.y - 2; + windowRect->extent.width = r.extent.width + 4; + windowRect->extent.height = r.extent.height + 4; + } } void diff --git a/sc2/src/libs/graphics/widgets.h b/sc2/src/libs/graphics/widgets.h index 9cf084f51..640bdd47d 100644 --- a/sc2/src/libs/graphics/widgets.h +++ b/sc2/src/libs/graphics/widgets.h @@ -176,7 +176,7 @@ typedef struct _widget_controlentry { } WIDGET_CONTROLENTRY; void DrawShadowedBox (RECT *r, COLOR bg, COLOR dark, COLOR medium); -void DrawLabelAsWindow (WIDGET_LABEL *label); +void DrawLabelAsWindow (WIDGET_LABEL *label, RECT *windowRect); void Widget_SetWindowColors (COLOR bg, COLOR dark, COLOR medium); FONT Widget_SetFont (FONT newFont); diff --git a/sc2/src/uqm/confirm.c b/sc2/src/uqm/confirm.c index 6784abdce..5e26663f2 100644 --- a/sc2/src/uqm/confirm.c +++ b/sc2/src/uqm/confirm.c @@ -211,6 +211,7 @@ DoPopupWindow (const char *msg) FRAME F; CONTEXT oldContext; RECT oldRect; + RECT windowRect; POPUP_STATE state; MENU_SOUND_FLAGS s0, s1; @@ -250,7 +251,8 @@ DoPopupWindow (const char *msg) Widget_SetFont (StarConFont); Widget_SetWindowColors (SHADOWBOX_BACKGROUND_COLOR, SHADOWBOX_DARK_COLOR, SHADOWBOX_MEDIUM_COLOR); - DrawLabelAsWindow (&label); + DrawLabelAsWindow (&label, &windowRect); + SetSystemRect (&windowRect); GetMenuSounds (&s0, &s1); SetMenuSounds (MENU_SOUND_NONE, MENU_SOUND_NONE); @@ -258,6 +260,7 @@ DoPopupWindow (const char *msg) state.InputFunc = DoPopup; DoInput (&state, TRUE); + ClearSystemRect (); DrawStamp (&s); DestroyDrawable (ReleaseDrawable (s.frame)); SetContextClipRect (&oldRect); diff --git a/sc2/src/uqm/setupmenu.c b/sc2/src/uqm/setupmenu.c index 23f52251a..24981bb00 100644 --- a/sc2/src/uqm/setupmenu.c +++ b/sc2/src/uqm/setupmenu.c @@ -586,7 +586,7 @@ rebind_control (WIDGET_CONTROLENTRY *widget) int index = widget->highlighted; FlushInput (); - DrawLabelAsWindow (&labels[3]); + DrawLabelAsWindow (&labels[3], NULL); RebindInputState (template, control, index); populate_editkeys (template); FlushInput ();