@@ -644,10 +644,7 @@ namespace UI
644644
645645 void hide ()
646646 {
647- loopchildren (o,
648- {
649- o->hide ();
650- });
647+ Object::hide ();
651648 if (onhide) execute (onhide);
652649 }
653650
@@ -827,7 +824,7 @@ namespace UI
827824 resetstate ();
828825 }
829826
830- void hide () {};
827+ void hide () { Object::hide (); };
831828
832829 bool show (Window *w)
833830 {
@@ -2035,7 +2032,7 @@ namespace UI
20352032 pophudmatrix ();
20362033 }
20372034
2038- void hide () { cleartext (); }
2035+ void hide () { Object::hide (); cleartext (); }
20392036
20402037 void cleartext ()
20412038 {
@@ -2141,82 +2138,78 @@ namespace UI
21412138
21422139 struct Font : Object
21432140 {
2144- string font;
2141+ char * font;
21452142
2146- Font () { font[0 ] = ' \0 ' ; }
2143+ Font () : font(NULL ) {}
2144+ ~Font () { delete[] font; }
21472145
21482146 void setup (const char *name)
21492147 {
21502148 Object::setup ();
2151- copystring (font, name, MAXSTRLEN );
2149+ SETSTR (font, name);
21522150 }
21532151
2154- #define WITHFONT (body ) do { \
2155- pushfont (); \
2156- setfont (font); \
2157- body; \
2158- popfont (); \
2159- } while (0 ); \
2160-
21612152 void layout ()
21622153 {
2163- WITHFONT ({
2164- Object::layout ();
2165- });
2154+ pushfont ();
2155+ setfont (font);
2156+ Object::layout ();
2157+ popfont ();
21662158 }
21672159
21682160 void draw (float sx, float sy)
21692161 {
2170- WITHFONT ({
2171- Object::draw (sx, sy);
2172- });
2162+ pushfont ();
2163+ setfont (font);
2164+ Object::draw (sx, sy);
2165+ popfont ();
21732166 }
21742167
21752168 void buildchildren (uint *contents)
21762169 {
2177- WITHFONT ({
2178- Object::buildchildren (contents);
2179- });
2170+ pushfont ();
2171+ setfont (font);
2172+ Object::buildchildren (contents);
2173+ popfont ();
21802174 }
21812175
21822176 #define DOSTATE (flags, func ) \
21832177 void func##children(float cx, float cy, int mask, bool inside, int setflags) \
21842178 { \
2185- WITHFONT ({ \
2186- Object::func##children (cx, cy, mask, inside, setflags); \
2187- }); \
2179+ pushfont (); \
2180+ setfont (font); \
2181+ Object::func##children (cx, cy, mask, inside, setflags); \
2182+ popfont (); \
21882183 } \
21892184 DOSTATES
21902185 #undef DOSTATE
21912186
21922187 bool rawkey (int code, bool isdown)
21932188 {
2194- bool result ;
2195- WITHFONT ({
2196- result = Object::rawkey (code, isdown);
2197- } );
2189+ pushfont () ;
2190+ setfont (font);
2191+ bool result = Object::rawkey (code, isdown);
2192+ popfont ( );
21982193 return result;
21992194 }
22002195
22012196 bool key (int code, bool isdown)
22022197 {
2203- bool result ;
2204- WITHFONT ({
2205- result = Object::key (code, isdown);
2206- } );
2198+ pushfont () ;
2199+ setfont (font);
2200+ bool result = Object::key (code, isdown);
2201+ popfont ( );
22072202 return result;
22082203 }
22092204
22102205 bool textinput (const char *str, int len)
22112206 {
2212- bool result ;
2213- WITHFONT ({
2214- result = Object::textinput (str, len);
2215- } );
2207+ pushfont () ;
2208+ setfont (font);
2209+ bool result = Object::textinput (str, len);
2210+ popfont ( );
22162211 return result;
22172212 }
2218-
2219- #undef WITHFONT
22202213 };
22212214
22222215 float uicontextscale = 0 ;
0 commit comments