Changeset 7 for trunk/Forms


Ignore:
Timestamp:
May 9, 2015, 12:00:33 AM (10 years ago)
Author:
chronos
Message:
  • Added: Action to switch to full screen mode.
  • Added: Video driver registration.
Location:
trunk/Forms
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormMain.lfm

    r6 r7  
    1010  OnCreate = FormCreate
    1111  OnDestroy = FormDestroy
     12  OnKeyDown = FormKeyDown
    1213  OnShow = FormShow
    13   LCLVersion = '1.3'
     14  LCLVersion = '1.5'
    1415  object PaintBox1: TPaintBox
    1516    Left = 0
     
    1920    Align = alClient
    2021    OnClick = PaintBox1Click
     22    OnResize = PaintBox1Resize
    2123  end
    2224  object MainMenu1: TMainMenu
  • trunk/Forms/UFormMain.pas

    r6 r7  
    2929    procedure FormCreate(Sender: TObject);
    3030    procedure FormDestroy(Sender: TObject);
     31    procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
    3132    procedure FormShow(Sender: TObject);
    3233    procedure PaintBox1Click(Sender: TObject);
     34    procedure PaintBox1Resize(Sender: TObject);
    3335  private
    3436    SerialText: string;
     37    OriginalBounds: TRect;
     38    OriginalWindowState: TWindowState;
     39    ScreenBounds: TRect;
    3540    procedure SerialDeviceReceiveDataSync;
    3641    procedure SerialDeviceReceiveData(Data: TMemory);
     42    procedure VideoDeviceRedraw(Sender: TObject);
     43    procedure SwitchFullScreen;
    3744  public
    3845    Kernel: TKernel;
     
    5562  NewApp: TApp;
    5663  SerialDevice: TBaseSerialDevice;
    57   NewScreen: TScreen;
     64  VideoDevice: TBaseVideoDevice;
    5865begin
    5966  Kernel := TKernel.Create;
     
    6269  SerialDevice := TBaseSerialDevice.Create;
    6370  SerialDevice.Name := 'Serial0';
     71  SerialDevice.ClassName := 'Serial port';
    6472  SerialDevice.OnReceiveData := SerialDeviceReceiveData;
    6573  Kernel.Devices.Add(SerialDevice);
     74
     75  VideoDevice := TBaseVideoDevice.Create;
     76  VideoDevice.Name := 'Video0';
     77  VideoDevice.ClassName := 'Graphic card';
     78  VideoDevice.OnRedraw := VideoDeviceRedraw;
     79  VideoDevice.DPI := Screen.PixelsPerInch;
     80  VideoDevice.VideoMemorySize := Point(PaintBox1.Width, PaintBox1.Height);;
     81  Kernel.Devices.Add(VideoDevice);
     82
    6683  NewApp := TAppClock.Create;
    6784  Kernel.Apps.Add(NewApp);
    68   NewScreen := TScreen.Create;
    69   NewScreen.Size := Point(PaintBox1.Width, PaintBox1.Height);
    70   NewScreen.DPI := Screen.PixelsPerInch;
    71   Kernel.Screens.Add(NewScreen);
    7285end;
    7386
     
    7992procedure TFormMain.AFullscreenExecute(Sender: TObject);
    8093begin
    81 
     94  SwitchFullScreen;
     95{  AFullscreen.Checked := not AFullscreen.Checked;
     96  if AFullscreen.Checked then begin
     97    WindowState := wsFullScreen;
     98    BorderStyle := bsNone;
     99  end else begin
     100    BorderStyle := bsSingle;
     101    WindowState := wsNormal;
     102  end;
     103  }
    82104end;
    83105
     
    87109end;
    88110
     111procedure TFormMain.SwitchFullScreen;
     112begin
     113  if WindowState <> wsFullScreen then begin
     114    // To full screen
     115    OriginalWindowState := WindowState;
     116    OriginalBounds := BoundsRect;
     117
     118    WindowState := wsFullScreen;
     119  end else begin
     120    // From full screen
     121    WindowState := OriginalWindowState;
     122    BoundsRect := OriginalBounds;
     123    {$IFDEF MSWINDOWS}
     124    BorderStyle := bsSizeable;
     125    {$ENDIF}
     126    if OriginalWindowState = wsMaximized then
     127      WindowState := wsMaximized
     128    else
     129      with OriginalBounds do
     130        SetBounds(Left, Top, Right - Left, Bottom - Top) ;
     131    {$IFDEF LINUX}
     132    BorderStyle := bsSizeable;
     133    {$ENDIF}
     134  end;
     135end;
     136
    89137procedure TFormMain.FormDestroy(Sender: TObject);
    90138begin
    91139  Kernel.Free;
     140end;
     141
     142procedure TFormMain.FormKeyDown(Sender: TObject; var Key: Word;
     143  Shift: TShiftState);
     144begin
     145
    92146end;
    93147
     
    100154begin
    101155
     156end;
     157
     158procedure TFormMain.PaintBox1Resize(Sender: TObject);
     159begin
    102160end;
    103161
     
    114172end;
    115173
     174procedure TFormMain.VideoDeviceRedraw(Sender: TObject);
     175begin
     176
     177end;
     178
    116179end.
    117180
  • trunk/Forms/UFormTerminal.lfm

    r6 r7  
    11object FormTerminal: TFormTerminal
    2   Left = 327
     2  Left = 590
    33  Height = 240
    4   Top = 34
     4  Top = 496
    55  Width = 320
    66  Caption = 'FormTerminal'
    77  ClientHeight = 240
    88  ClientWidth = 320
    9   LCLVersion = '1.3'
     9  LCLVersion = '1.5'
    1010  object Memo1: TMemo
    1111    Left = 0
Note: See TracChangeset for help on using the changeset viewer.