Changeset 69
- Timestamp:
- Nov 28, 2020, 12:35:06 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Forms/UFormMain.pas
r68 r69 73 73 procedure TFormMain.FormActivate(Sender: TObject); 74 74 begin 75 end; 76 77 procedure TFormMain.FormClose(Sender: TObject; var CloseAction: TCloseAction); 78 begin 79 PersistentForm1.Save(Self); 80 end; 81 82 procedure TFormMain.FormDestroy(Sender: TObject); 83 begin 84 SaveConfig; 85 Engine.Free; 86 end; 87 88 procedure TFormMain.FormKeyPress(Sender: TObject; var Key: char); 89 begin 90 if Key = #32 then begin 91 if Engine.State = gsRunning then Engine.State := gsPaused 92 else if Engine.State = gsPaused then Engine.State := gsRunning; 93 end; 94 end; 95 96 procedure TFormMain.FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState 97 ); 98 const 99 KeyF11 = 122; 100 begin 101 if Key = KeyF11 then begin 102 FullScreen := not FullScreen; 103 PersistentForm1.SetFullScreen(FormMain.FullScreen); 104 end else 105 Engine.KeyUp(Key); 106 end; 107 108 procedure TFormMain.FormShow(Sender: TObject); 109 begin 75 110 if not Initialized then begin 76 111 Initialized := True; … … 78 113 PersistentForm1.Load(Self, False, True); 79 114 FullScreen := PersistentForm1.FormFullScreen; 80 Randomize;81 115 Engine.InitMenus; 82 116 Engine.ImagePassenger.Picture.Assign(FormImages.ImagePassenger.Picture); … … 86 120 Engine.MainMenu; 87 121 end; 88 end;89 90 procedure TFormMain.FormClose(Sender: TObject; var CloseAction: TCloseAction);91 begin92 PersistentForm1.Save(Self);93 end;94 95 procedure TFormMain.FormDestroy(Sender: TObject);96 begin97 SaveConfig;98 Engine.Free;99 end;100 101 procedure TFormMain.FormKeyPress(Sender: TObject; var Key: char);102 begin103 if Key = #32 then begin104 if Engine.State = gsRunning then Engine.State := gsPaused105 else if Engine.State = gsPaused then Engine.State := gsRunning;106 end;107 end;108 109 procedure TFormMain.FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState110 );111 const112 KeyF11 = 122;113 begin114 if Key = KeyF11 then begin115 FullScreen := not FullScreen;116 PersistentForm1.SetFullScreen(FormMain.FullScreen);117 end else118 Engine.KeyUp(Key);119 end;120 121 procedure TFormMain.FormShow(Sender: TObject);122 begin123 122 end; 124 123 -
trunk/Packages/Common/UPersistentForm.pas
r68 r69 314 314 if State then begin 315 315 FormFullScreen := True; 316 FormNormalSize := Form.BoundsRect; 316 317 FormRestoredSize := Bounds(Form.RestoredLeft, Form.RestoredTop, Form.RestoredWidth, 317 318 Form.RestoredHeight); 319 FormWindowState := Form.WindowState; 318 320 ShowWindow(Form.Handle, SW_SHOWFULLSCREEN); 319 321 {$IFDEF WINDOWS} … … 322 324 end else begin 323 325 FormFullScreen := False; 324 if Form.WindowState = wsNormal then begin325 ShowWindow(Form.Handle, SW_SHOWNORMAL);326 //Form.BoundsRect := FormRestoredSize;327 end else if Form.WindowState = wsMaximized then ShowWindow(Form.Handle, SW_SHOWMAXIMIZED);328 326 {$IFDEF WINDOWS} 329 327 Form.BorderStyle := bsSizeable; 330 328 {$ENDIF} 329 ShowWindow(Form.Handle, SW_SHOWNORMAL); 330 if FormWindowState = wsNormal then begin 331 Form.BoundsRect := FormNormalSize; 332 end else 333 if FormWindowState = wsMaximized then begin 334 Form.BoundsRect := FormRestoredSize; 335 Form.WindowState := wsMaximized; 336 end; 331 337 end; 332 338 end;
Note:
See TracChangeset
for help on using the changeset viewer.