Quit confirmation fixes, phase 3: font effect save/restore

git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@1213 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
avolkov
2003-09-08 21:59:32 +00:00
parent 0f0317b60b
commit 3b82982a0d
3 changed files with 24 additions and 8 deletions
+2
View File
@@ -30,6 +30,7 @@ DrawConfirmationWindow (BOOLEAN answer)
{ {
COLOR oldfg = SetContextForeGroundColor (MENU_BACKGROUND_COLOR); COLOR oldfg = SetContextForeGroundColor (MENU_BACKGROUND_COLOR);
FONT oldfont = SetContextFont (StarConFont); FONT oldfont = SetContextFont (StarConFont);
FONTEFFECT oldFontEffect = SetContextFontEffect (0, 0, 0);
RECT r; RECT r;
TEXT t; TEXT t;
BatchGraphics (); BatchGraphics ();
@@ -85,6 +86,7 @@ DrawConfirmationWindow (BOOLEAN answer)
UnbatchGraphics (); UnbatchGraphics ();
SetContextFontEffect (oldFontEffect.type, oldFontEffect.from, oldFontEffect.to);
SetContextFont (oldfont); SetContextFont (oldfont);
SetContextForeGroundColor (oldfg); SetContextForeGroundColor (oldfg);
} }
+9 -1
View File
@@ -215,6 +215,14 @@ extern INTERSECT_CODE BoxIntersect (PRECT pr1, PRECT pr2, PRECT
printer); printer);
extern void BoxUnion (PRECT pr1, PRECT pr2, PRECT punion); extern void BoxUnion (PRECT pr1, PRECT pr2, PRECT punion);
typedef struct
{
BOOLEAN Use;
DWORD from;
DWORD to;
BYTE type;
} FONTEFFECT;
#endif /* _GFXLIB_H */ #endif /* _GFXLIB_H */
@@ -266,7 +274,7 @@ extern DWORD LoadCelFile (PVOID pStr);
extern DWORD LoadGraphicInstance (DWORD res); extern DWORD LoadGraphicInstance (DWORD res);
extern DWORD LoadGraphic (DWORD res); extern DWORD LoadGraphic (DWORD res);
extern DRAWABLE LoadDisplayPixmap (PRECT area, FRAME frame); extern DRAWABLE LoadDisplayPixmap (PRECT area, FRAME frame);
extern void SetContextFontEffect (BYTE type, DWORD from, DWORD to); extern FONTEFFECT SetContextFontEffect (BYTE type, DWORD from, DWORD to);
extern FONT SetContextFont (FONT Font); extern FONT SetContextFont (FONT Font);
extern BOOLEAN DestroyFont (FONT_REF FontRef); extern BOOLEAN DestroyFont (FONT_REF FontRef);
extern FONT CaptureFont (FONT_REF FontRef); extern FONT CaptureFont (FONT_REF FontRef);
+13 -7
View File
@@ -22,15 +22,14 @@
extern FRAME Build_Font_Effect (FRAME FramePtr, DWORD from, DWORD to, BYTE type); extern FRAME Build_Font_Effect (FRAME FramePtr, DWORD from, DWORD to, BYTE type);
static BYTE char_delta_array[MAX_DELTAS]; static BYTE char_delta_array[MAX_DELTAS];
static struct {
BOOLEAN Use;
DWORD from;
DWORD to;
BYTE type;
} FontEffect = {0,0,0,0};
void SetContextFontEffect (BYTE type, DWORD from, DWORD to) static FONTEFFECT FontEffect = {0,0,0,0};
FONTEFFECT
SetContextFontEffect (BYTE type, DWORD from, DWORD to)
{ {
FONTEFFECT oldFontEffect = FontEffect;
if (from == to) if (from == to)
FontEffect.Use = 0; FontEffect.Use = 0;
else else
@@ -40,6 +39,13 @@ void SetContextFontEffect (BYTE type, DWORD from, DWORD to)
FontEffect.to = to; FontEffect.to = to;
FontEffect.type = type; FontEffect.type = type;
} }
if (!oldFontEffect.Use)
// reset fields so that when struct passed back
// the logic works correctly
oldFontEffect.to = oldFontEffect.from = 0;
return oldFontEffect;
} }