- Timestamp:
- Apr 15, 2024, 8:29:24 PM (8 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LocalPlayer/Term.pas
r533 r534 349 349 FMessgExDlg: TMessgExDlg; 350 350 FHelpDlg: THelpDlg; 351 procedure ResizeControls; 351 352 procedure ArrangeDialogs; 352 353 procedure ArrangeDialog(Form: TBufferedDrawDlg); … … 2956 2957 TurnComplete := False; 2957 2958 MapValid := False; 2958 FormResize(nil); // calculate geometrics and paint all2959 ResizeControls; 2959 2960 SetTroopLoc(-1); 2960 2961 Idle := True; … … 4196 4197 4197 4198 procedure TMainScreen.FormResize(Sender: TObject); 4198 var4199 MiniFrame, MaxMapWidth: Integer;4200 4199 begin 4201 4200 if (LastResizeWidth = Width) and (LastResizeHeight = Height) and … … 4207 4206 end; 4208 4207 4209 SmallScreen := Width < 1024; 4210 with MainMap do begin 4211 MaxMapWidth := (G.lx * 2 - 3) * xxt; 4212 // avoide the same tile being visible left and right 4213 if Width <= MaxMapWidth then begin 4214 MapWidth := Width; 4215 MapOffset := 0; 4216 end else begin 4217 MapWidth := MaxMapWidth; 4218 MapOffset := (Width - MapWidth) div 2; 4219 end; 4220 MapHeight := Height - TopBarHeight - PanelHeight + Overlap; 4221 Panel.SetSize(Width, PanelHeight); 4222 TopBar.SetSize(Width, TopBarHeight); 4223 MiniFrame := (lxmax_xxx - G.ly) div 2; 4224 xMidPanel := (G.lx + MiniFrame) * 2 + 1; 4225 xRightPanel := Width - LeftPanelWidth - 10; 4226 if ClientMode = cEditMap then 4227 TrPitch := 2 * xxt 4228 else 4229 TrPitch := 66; 4230 xMini := MiniFrame - 5; 4231 yMini := (PanelHeight - 26 - lxmax_xxx) div 2 + MiniFrame; 4232 ywmax := (G.ly - MapHeight div yyt + 1) and not 1; 4233 ywcenter := -((MapHeight - yyt * (G.ly - 1)) div (4 * yyt)) * 2; 4234 end; 4235 // only for ywmax<=0 4236 if ywmax <= 0 then 4237 yw := ywcenter 4238 else if yw < 0 then 4239 yw := 0 4240 else if yw > ywmax then 4241 yw := ywmax; 4242 UnitInfoBtn.Top := Height - 29; 4243 UnitInfoBtn.Left := xMidPanel + 7 + 99; 4244 UnitBtn.Top := Height - 29; 4245 UnitBtn.Left := xMidPanel + 7 + 99 + 31; 4246 TerrainBtn.Top := Height - 29; 4247 TerrainBtn.Left := xMidPanel + 7 + 99 + 62; 4248 MovieSpeed1Btn.Top := Height - 91; 4249 MovieSpeed1Btn.Left := Width div 2 - 62; 4250 MovieSpeed2Btn.Top := Height - 91; 4251 MovieSpeed2Btn.Left := Width div 2 - 62 + 29; 4252 MovieSpeed3Btn.Top := Height - 91; 4253 MovieSpeed3Btn.Left := Width div 2 - 62 + 2 * 29; 4254 MovieSpeed4Btn.Top := Height - 91; 4255 MovieSpeed4Btn.Left := Width div 2 - 62 + 3 * 29 + 12; 4256 EOT.Top := Height - 64; 4257 EOT.Left := Width - 62; 4258 sb.SetBorderSpacing(Height - yTroop - 24, Width - xRightPanel + 8, 8); 4259 SetWindowPos(sb.ScrollBar.Handle, 0, xRightPanel + 10 - 14 - GetSystemMetrics(SM_CXVSCROLL), 4260 Height - MidPanelHeight + 8, 0, 0, SWP_NOSIZE or SWP_NOZORDER); 4261 MapBtn0.Left := xMini + G.lx - 44; 4262 MapBtn0.Top := Height - 15; 4263 MapBtn1.Left := xMini + G.lx - 28; 4264 MapBtn1.Top := Height - 15; 4265 { MapBtn2.Left := xMini + G.lx - 20; 4266 MapBtn2.Top := Height - 15; 4267 MapBtn3.Left := xMini + G.lx - 4; 4268 MapBtn3.Top := Height - 15; } 4269 MapBtn5.Left := xMini + G.lx - 12; 4270 MapBtn5.Top := Height - 15; 4271 MapBtn4.Left := xMini + G.lx + 20; 4272 MapBtn4.Top := Height - 15; 4273 MapBtn6.Left := xMini + G.lx + 36; 4274 MapBtn6.Top := Height - 15; 4275 TreasuryArea.Left := Width div 2 - 172; 4276 ResearchArea.Left := Width div 2; 4277 ManagementArea.Left := Width - xPalace; 4278 ManagementArea.Top := TopBarHeight + MapHeight - Overlap + yPalace; 4279 ArrangeMidPanel; 4280 if RepaintOnResize then 4281 begin 4282 RectInvalidate(0, TopBarHeight, Width, TopBarHeight + MapHeight); 4283 MapValid := False; 4284 PaintAll; 4285 end; 4208 ResizeControls; 4286 4209 end; 4287 4210 … … 8297 8220 MainMap.TileSize := TileSize; 8298 8221 NoMap.TileSize := TileSize; 8299 FormResize(nil); 8222 LastResizeWidth := -1; // Force repaint on 8223 ResizeControls; 8300 8224 SetMapPos(Loc, MapPos); 8301 8225 PaintAllMaps; … … 8342 8266 end; 8343 8267 8268 procedure TMainScreen.ResizeControls; 8269 var 8270 MiniFrame, MaxMapWidth: Integer; 8271 begin 8272 SmallScreen := Width < 1024; 8273 with MainMap do begin 8274 MaxMapWidth := (G.lx * 2 - 3) * xxt; 8275 // Avoid the same tile being visible left and right 8276 if Width <= MaxMapWidth then begin 8277 MapWidth := Width; 8278 MapOffset := 0; 8279 end else begin 8280 MapWidth := MaxMapWidth; 8281 MapOffset := (Width - MapWidth) div 2; 8282 end; 8283 MapHeight := Height - TopBarHeight - PanelHeight + Overlap; 8284 Panel.SetSize(Width, PanelHeight); 8285 TopBar.SetSize(Width, TopBarHeight); 8286 MiniFrame := (lxmax_xxx - G.ly) div 2; 8287 xMidPanel := (G.lx + MiniFrame) * 2 + 1; 8288 xRightPanel := Width - LeftPanelWidth - 10; 8289 if ClientMode = cEditMap then 8290 TrPitch := 2 * xxt 8291 else 8292 TrPitch := 66; 8293 xMini := MiniFrame - 5; 8294 yMini := (PanelHeight - 26 - lxmax_xxx) div 2 + MiniFrame; 8295 ywmax := (G.ly - MapHeight div yyt + 1) and not 1; 8296 ywcenter := -((MapHeight - yyt * (G.ly - 1)) div (4 * yyt)) * 2; 8297 end; 8298 // only for ywmax<=0 8299 if ywmax <= 0 then 8300 yw := ywcenter 8301 else if yw < 0 then 8302 yw := 0 8303 else if yw > ywmax then 8304 yw := ywmax; 8305 UnitInfoBtn.Top := Height - 29; 8306 UnitInfoBtn.Left := xMidPanel + 7 + 99; 8307 UnitBtn.Top := Height - 29; 8308 UnitBtn.Left := xMidPanel + 7 + 99 + 31; 8309 TerrainBtn.Top := Height - 29; 8310 TerrainBtn.Left := xMidPanel + 7 + 99 + 62; 8311 MovieSpeed1Btn.Top := Height - 91; 8312 MovieSpeed1Btn.Left := Width div 2 - 62; 8313 MovieSpeed2Btn.Top := Height - 91; 8314 MovieSpeed2Btn.Left := Width div 2 - 62 + 29; 8315 MovieSpeed3Btn.Top := Height - 91; 8316 MovieSpeed3Btn.Left := Width div 2 - 62 + 2 * 29; 8317 MovieSpeed4Btn.Top := Height - 91; 8318 MovieSpeed4Btn.Left := Width div 2 - 62 + 3 * 29 + 12; 8319 EOT.Top := Height - 64; 8320 EOT.Left := Width - 62; 8321 sb.SetBorderSpacing(Height - yTroop - 24, Width - xRightPanel + 8, 8); 8322 SetWindowPos(sb.ScrollBar.Handle, 0, xRightPanel + 10 - 14 - GetSystemMetrics(SM_CXVSCROLL), 8323 Height - MidPanelHeight + 8, 0, 0, SWP_NOSIZE or SWP_NOZORDER); 8324 MapBtn0.Left := xMini + G.lx - 44; 8325 MapBtn0.Top := Height - 15; 8326 MapBtn1.Left := xMini + G.lx - 28; 8327 MapBtn1.Top := Height - 15; 8328 { MapBtn2.Left := xMini + G.lx - 20; 8329 MapBtn2.Top := Height - 15; 8330 MapBtn3.Left := xMini + G.lx - 4; 8331 MapBtn3.Top := Height - 15; } 8332 MapBtn5.Left := xMini + G.lx - 12; 8333 MapBtn5.Top := Height - 15; 8334 MapBtn4.Left := xMini + G.lx + 20; 8335 MapBtn4.Top := Height - 15; 8336 MapBtn6.Left := xMini + G.lx + 36; 8337 MapBtn6.Top := Height - 15; 8338 TreasuryArea.Left := Width div 2 - 172; 8339 ResearchArea.Left := Width div 2; 8340 ManagementArea.Left := Width - xPalace; 8341 ManagementArea.Top := TopBarHeight + MapHeight - Overlap + yPalace; 8342 ArrangeMidPanel; 8343 if RepaintOnResize then begin 8344 RectInvalidate(0, TopBarHeight, Width, TopBarHeight + MapHeight); 8345 MapValid := False; 8346 PaintAll; 8347 end; 8348 end; 8349 8344 8350 procedure TMainScreen.ArrangeDialogs; 8345 8351 begin
Note:
See TracChangeset
for help on using the changeset viewer.