Ignore:
Timestamp:
Apr 9, 2015, 9:58:36 PM (10 years ago)
Author:
chronos
Message:
  • Fixed: Use csOpaque control style also to Image, PaintBox and OpenGLControl.
  • Modified: Change size of test frame with SpinEdits as delayed using timer.
  • Updated: BRGABitmap package to version 8.1.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GraphicTest/UMainForm.pas

    r471 r472  
    2828    ButtonSingleTest: TButton;
    2929    ButtonStop: TButton;
    30     CheckBox1: TCheckBox;
     30    CheckBoxOpaque: TCheckBox;
    3131    CheckBoxDoubleBuffered: TCheckBox;
    3232    CheckBoxEraseBackground: TCheckBox;
    33     ComboBox1: TComboBox;
     33    ComboBoxPixelFormat: TComboBox;
    3434    FileExit1: TFileExit;
    3535    FloatSpinEdit1: TFloatSpinEdit;
     
    6565    TabSheet1: TTabSheet;
    6666    TabSheet2: TTabSheet;
     67    TimerUpdateSettings: TTimer;
    6768    TimerUpdateList: TTimer;
    6869    procedure AExportAsWikiTextExecute(Sender: TObject);
     
    7172    procedure ATestOneMethodExecute(Sender: TObject);
    7273    procedure ATestStopExecute(Sender: TObject);
    73     procedure CheckBox1Change(Sender: TObject);
     74    procedure CheckBoxOpaqueChange(Sender: TObject);
    7475    procedure CheckBoxDoubleBufferedChange(Sender: TObject);
    7576    procedure CheckBoxEraseBackgroundChange(Sender: TObject);
    76     procedure ComboBox1Change(Sender: TObject);
     77    procedure ComboBoxPixelFormatChange(Sender: TObject);
    7778    procedure FormCreate(Sender: TObject);
    7879    procedure FormDestroy(Sender: TObject);
     
    8586    procedure SpinEditWidthChange(Sender: TObject);
    8687    procedure TimerUpdateListTimer(Sender: TObject);
     88    procedure TimerUpdateSettingsTimer(Sender: TObject);
    8789  private
     90    FCurrentMethod: TDrawMethod;
    8891    MethodIndex: Integer;
    8992    SingleTestActive: Boolean;
     
    9699    procedure UpdateMethodList;
    97100    procedure UpdateInterface;
    98     procedure UpdateFrameSize;
    99101    procedure RegisterDrawMethods;
    100102    procedure RegisterDrawMethod(MethodClass: TDrawMethodClass);
     
    105107    Scenes: TObjectList; // TObjectList<TFastBitmap>
    106108    SceneIndex: Integer;
     109    property CurrentMethod: TDrawMethod read FCurrentMethod;
    107110  end;
    108111
     
    141144
    142145  for PF := Low(TPixelFormat) to High(TPixelFormat) do
    143     ComboBox1.Items.Add(GetEnumName(TypeInfo(TPixelFormat), Integer(PF)));
     146    ComboBoxPixelFormat.Items.Add(GetEnumName(TypeInfo(TPixelFormat), Integer(PF)));
    144147
    145148  PageControl1.TabIndex := 0;
     
    151154  StartTime: TDateTime;
    152155begin
     156  FCurrentMethod := Method;
    153157  with Method do begin
    154158    Init(DrawForm, FrameSize, PixelFormat);
     
    171175    Done;
    172176  end;
     177  FCurrentMethod := nil;
    173178end;
    174179
     
    255260end;
    256261
    257 procedure TMainForm.CheckBox1Change(Sender: TObject);
    258 begin
    259   if CheckBox1.Checked then
     262procedure TMainForm.CheckBoxOpaqueChange(Sender: TObject);
     263begin
     264  if CheckBoxOpaque.Checked then
    260265    DrawForm.ControlStyle := DrawForm.ControlStyle + [csOpaque]
    261266    else DrawForm.ControlStyle := DrawForm.ControlStyle - [csOpaque];
     267  if Assigned(FCurrentMethod) then
     268    FCurrentMethod.UpdateSettings;
    262269end;
    263270
     
    272279end;
    273280
    274 procedure TMainForm.ComboBox1Change(Sender: TObject);
    275 begin
    276   PixelFormat := TPixelFormat(ComboBox1.ItemIndex);
     281procedure TMainForm.ComboBoxPixelFormatChange(Sender: TObject);
     282begin
     283  PixelFormat := TPixelFormat(ComboBoxPixelFormat.ItemIndex);
    277284  UpdateInterface;
    278285end;
     
    292299procedure TMainForm.FormShow(Sender: TObject);
    293300begin
    294   UpdateFrameSize;
    295301  UpdateMethodList;
    296302  UpdateInterface;
    297303  DrawForm.Show;
     304  DrawForm.Left := Left + Width;
     305  DrawForm.Top := Top;
    298306end;
    299307
     
    339347begin
    340348  FrameSize.Y := SpinEditHeight.Value;
    341   UpdateFrameSize;
    342349end;
    343350
     
    345352begin
    346353  FrameSize.X := SpinEditWidth.Value;
    347   UpdateFrameSize;
    348354end;
    349355
     
    351357begin
    352358  UpdateMethodList;
     359end;
     360
     361procedure TMainForm.TimerUpdateSettingsTimer(Sender: TObject);
     362begin
     363  if (FrameSize.X <> DrawForm.FrameSize.X) or
     364    (FrameSize.Y <> DrawForm.FrameSize.Y) then begin
     365      DrawForm.FrameSize := FrameSize;
     366      DrawForm.ClientWidth := FrameSize.X;
     367      DrawForm.ClientHeight := FrameSize.Y;
     368      GenerateSceneFrames;
     369    end;
    353370end;
    354371
     
    382399  CheckBoxDoubleBuffered.Checked := DrawForm.DoubleBuffered;
    383400  CheckBoxEraseBackground.Checked := DrawForm.EraseBackgroundEnabled;
    384   CheckBox1.Checked := csOpaque in DrawForm.ControlStyle;
    385   ComboBox1.ItemIndex := Integer(PixelFormat);
    386 end;
    387 
    388 procedure TMainForm.UpdateFrameSize;
    389 begin
    390   DrawForm.ClientWidth := FrameSize.X;
    391   DrawForm.ClientHeight := FrameSize.Y;
    392   GenerateSceneFrames;
     401  CheckBoxOpaque.Checked := csOpaque in DrawForm.ControlStyle;
     402  ComboBoxPixelFormat.ItemIndex := Integer(PixelFormat);
    393403end;
    394404
Note: See TracChangeset for help on using the changeset viewer.