Changeset 472 for GraphicTest/UMainForm.pas
- Timestamp:
- Apr 9, 2015, 9:58:36 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GraphicTest/UMainForm.pas
r471 r472 28 28 ButtonSingleTest: TButton; 29 29 ButtonStop: TButton; 30 CheckBox 1: TCheckBox;30 CheckBoxOpaque: TCheckBox; 31 31 CheckBoxDoubleBuffered: TCheckBox; 32 32 CheckBoxEraseBackground: TCheckBox; 33 ComboBox 1: TComboBox;33 ComboBoxPixelFormat: TComboBox; 34 34 FileExit1: TFileExit; 35 35 FloatSpinEdit1: TFloatSpinEdit; … … 65 65 TabSheet1: TTabSheet; 66 66 TabSheet2: TTabSheet; 67 TimerUpdateSettings: TTimer; 67 68 TimerUpdateList: TTimer; 68 69 procedure AExportAsWikiTextExecute(Sender: TObject); … … 71 72 procedure ATestOneMethodExecute(Sender: TObject); 72 73 procedure ATestStopExecute(Sender: TObject); 73 procedure CheckBox 1Change(Sender: TObject);74 procedure CheckBoxOpaqueChange(Sender: TObject); 74 75 procedure CheckBoxDoubleBufferedChange(Sender: TObject); 75 76 procedure CheckBoxEraseBackgroundChange(Sender: TObject); 76 procedure ComboBox 1Change(Sender: TObject);77 procedure ComboBoxPixelFormatChange(Sender: TObject); 77 78 procedure FormCreate(Sender: TObject); 78 79 procedure FormDestroy(Sender: TObject); … … 85 86 procedure SpinEditWidthChange(Sender: TObject); 86 87 procedure TimerUpdateListTimer(Sender: TObject); 88 procedure TimerUpdateSettingsTimer(Sender: TObject); 87 89 private 90 FCurrentMethod: TDrawMethod; 88 91 MethodIndex: Integer; 89 92 SingleTestActive: Boolean; … … 96 99 procedure UpdateMethodList; 97 100 procedure UpdateInterface; 98 procedure UpdateFrameSize;99 101 procedure RegisterDrawMethods; 100 102 procedure RegisterDrawMethod(MethodClass: TDrawMethodClass); … … 105 107 Scenes: TObjectList; // TObjectList<TFastBitmap> 106 108 SceneIndex: Integer; 109 property CurrentMethod: TDrawMethod read FCurrentMethod; 107 110 end; 108 111 … … 141 144 142 145 for PF := Low(TPixelFormat) to High(TPixelFormat) do 143 ComboBox 1.Items.Add(GetEnumName(TypeInfo(TPixelFormat), Integer(PF)));146 ComboBoxPixelFormat.Items.Add(GetEnumName(TypeInfo(TPixelFormat), Integer(PF))); 144 147 145 148 PageControl1.TabIndex := 0; … … 151 154 StartTime: TDateTime; 152 155 begin 156 FCurrentMethod := Method; 153 157 with Method do begin 154 158 Init(DrawForm, FrameSize, PixelFormat); … … 171 175 Done; 172 176 end; 177 FCurrentMethod := nil; 173 178 end; 174 179 … … 255 260 end; 256 261 257 procedure TMainForm.CheckBox 1Change(Sender: TObject);258 begin 259 if CheckBox 1.Checked then262 procedure TMainForm.CheckBoxOpaqueChange(Sender: TObject); 263 begin 264 if CheckBoxOpaque.Checked then 260 265 DrawForm.ControlStyle := DrawForm.ControlStyle + [csOpaque] 261 266 else DrawForm.ControlStyle := DrawForm.ControlStyle - [csOpaque]; 267 if Assigned(FCurrentMethod) then 268 FCurrentMethod.UpdateSettings; 262 269 end; 263 270 … … 272 279 end; 273 280 274 procedure TMainForm.ComboBox 1Change(Sender: TObject);275 begin 276 PixelFormat := TPixelFormat(ComboBox 1.ItemIndex);281 procedure TMainForm.ComboBoxPixelFormatChange(Sender: TObject); 282 begin 283 PixelFormat := TPixelFormat(ComboBoxPixelFormat.ItemIndex); 277 284 UpdateInterface; 278 285 end; … … 292 299 procedure TMainForm.FormShow(Sender: TObject); 293 300 begin 294 UpdateFrameSize;295 301 UpdateMethodList; 296 302 UpdateInterface; 297 303 DrawForm.Show; 304 DrawForm.Left := Left + Width; 305 DrawForm.Top := Top; 298 306 end; 299 307 … … 339 347 begin 340 348 FrameSize.Y := SpinEditHeight.Value; 341 UpdateFrameSize;342 349 end; 343 350 … … 345 352 begin 346 353 FrameSize.X := SpinEditWidth.Value; 347 UpdateFrameSize;348 354 end; 349 355 … … 351 357 begin 352 358 UpdateMethodList; 359 end; 360 361 procedure TMainForm.TimerUpdateSettingsTimer(Sender: TObject); 362 begin 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; 353 370 end; 354 371 … … 382 399 CheckBoxDoubleBuffered.Checked := DrawForm.DoubleBuffered; 383 400 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); 393 403 end; 394 404
Note:
See TracChangeset
for help on using the changeset viewer.