Ignore:
Timestamp:
Nov 22, 2012, 2:32:10 PM (12 years ago)
Author:
chronos
Message:
  • Modified: Each methods separated to own unit. Code from unit is displayed to user in main form after method selection.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GraphicTest/UMainForm.pas

    r446 r447  
    66
    77uses
    8   Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ComCtrls,
    9   ExtCtrls, StdCtrls, DateUtils, UPlatform, LCLType, IntfGraphics, fpImage,
    10   Math, GraphType, Contnrs, LclIntf, Spin, UFastBitmap, UDrawMethod;
     8  Classes, SysUtils, FileUtil, SynHighlighterPas, SynMemo, Forms, Controls,
     9  Graphics, Dialogs, ComCtrls, ExtCtrls, StdCtrls, DateUtils, UPlatform,
     10  LCLType, IntfGraphics, fpImage, Math, GraphType, Contnrs, LclIntf, Spin,
     11  UFastBitmap, UDrawMethod;
    1112
    1213const
     
    1516type
    1617
    17 
    1818  { TMainForm }
    1919
    2020  TMainForm = class(TForm)
    21     ButtonStop: TButton;
    2221    ButtonBenchmark: TButton;
    2322    ButtonSingleTest: TButton;
     23    ButtonStop: TButton;
     24    CheckBoxDoubleBuffered: TCheckBox;
    2425    CheckBoxEraseBackground: TCheckBox;
    25     CheckBoxDoubleBuffered: TCheckBox;
    2626    FloatSpinEdit1: TFloatSpinEdit;
    2727    Label1: TLabel;
     
    3030    Label4: TLabel;
    3131    ListViewMethods: TListView;
     32    Memo1: TMemo;
     33    PageControl1: TPageControl;
     34    Panel1: TPanel;
     35    SpinEditHeight: TSpinEdit;
    3236    SpinEditWidth: TSpinEdit;
    33     SpinEditHeight: TSpinEdit;
     37    Splitter1: TSplitter;
     38    SynMemo1: TSynMemo;
     39    SynPasSyn1: TSynPasSyn;
     40    TabSheet1: TTabSheet;
     41    TabSheet2: TTabSheet;
    3442    TimerUpdateList: TTimer;
    3543    procedure ButtonBenchmarkClick(Sender: TObject);
     
    7482
    7583uses
    76   UDrawForm;
     84  UDrawForm, ULazIntfImageColorsCopy, ULazIntfImageColorsNoCopy, UCanvasPixels,
     85  UCanvasPixelsUpdateLock, UBGRABitmapPaintBox, UBitmapRawImageDataPaintBox,
     86  UBitmapRawImageData, UBitmapRawImageDataMove, UDummyMethod, UOpenGLMethod,
     87  UOpenGLPBOMethod;
     88
     89const
     90  DrawMethodClasses: array[0..{$IFDEF opengl}10{$ELSE}8{$ENDIF}] of TDrawMethodClass = (
     91    TCanvasPixels, TCanvasPixelsUpdateLock, TLazIntfImageColorsCopy,
     92    TLazIntfImageColorsNoCopy, TBitmapRawImageData, TBitmapRawImageDataPaintBox,
     93    TBitmapRawImageDataMove, TBGRABitmapPaintBox{$IFDEF opengl}, TOpenGLMethod, TOpenGLPBOMethod{$ENDIF}
     94    ,TDummyMethod);
     95
    7796
    7897
     
    94113    DrawMethods.Add(NewDrawMethod);
    95114  end;
     115
     116  PageControl1.TabIndex := 0;
    96117end;
    97118
     
    213234procedure TMainForm.ListViewMethodsSelectItem(Sender: TObject; Item: TListItem;
    214235  Selected: Boolean);
     236var
     237  FileName: string;
    215238begin
    216239  UpdateInterface;
     240  if Assigned(ListViewMethods.Selected) then begin
     241    FileName := 'Methods' + DirectorySeparator + 'U' +
     242    Copy(TDrawMethod(DrawMethods[ListViewMethods.Selected.Index]).ClassName, 2, High(Integer)) + '.pas';
     243
     244    if FileExistsUTF8(FileName) then
     245      SynMemo1.Lines.LoadFromFile(FileName)
     246      else SynMemo1.Lines.Clear;
     247    Memo1.Lines.Assign(TDrawMethod(DrawMethods[ListViewMethods.Selected.Index]).Description);
     248  end;
    217249end;
    218250
Note: See TracChangeset for help on using the changeset viewer.