Ticket #3041: MainWin.cpp_r28723.diff
File MainWin.cpp_r28723.diff, 1.6 KB (added by , 16 years ago) |
---|
-
MainWin.cpp
90 90 , fFrameResizedTriggeredAutomatically(false) 91 91 , fIgnoreFrameResized(false) 92 92 , fFrameResizedCalled(true) 93 , fWindowCentered(false) 93 94 { 94 95 BRect rect = Bounds(); 95 96 … … 508 509 509 510 510 511 void 512 MainWin::Show() 513 { 514 _CenterWindow(); 515 BWindow::Show(); 516 } 517 518 519 void 511 520 MainWin::VideoFormatChange(int width, int height, float width_scale, float height_scale) 512 521 { 513 522 // called when video format or aspect ratio changes … … 1175 1184 } 1176 1185 } 1177 1186 } 1187 1188 1189 void 1190 MainWin::_CenterWindow() 1191 { 1192 if (fWindowCentered) 1193 return; 1194 fWindowCentered = true; 1195 1196 BScreen screen(this); 1197 if (!screen.IsValid()) 1198 return; 1199 1200 BRect frame = screen.Frame(); 1201 BRect windowFrame = Frame(); 1202 1203 float left = floor((frame.Width() - windowFrame.Width()) / 2); 1204 float top = floor((frame.Height() - windowFrame.Height()) / 2); 1205 1206 if (left < 20) 1207 left = 20; 1208 if (top < 20) 1209 top = 20; 1210 1211 MoveTo(left, top); 1212 } -
MainWin.h
61 61 62 62 void SetInterfaceMenuMarker(); 63 63 void SetChannelMenuMarker(); 64 65 virtual void Show(); 64 66 65 67 void VideoFormatChange(int width, int height, float width_scale, float height_scale); 66 68 … … 106 108 bool fFrameResizedTriggeredAutomatically; 107 109 bool fIgnoreFrameResized; 108 110 bool fFrameResizedCalled; 111 112 private: 113 114 void _CenterWindow(); 115 116 bool fWindowCentered; 109 117 }; 110 118 111 119 #endif