Changeset 33 for trunk/Forms


Ignore:
Timestamp:
Jan 5, 2017, 11:48:36 PM (8 years ago)
Author:
chronos
Message:
  • Added: Remember last used image size and color format.
  • Added: Automatically create blank image.
Location:
trunk/Forms
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormMain.lfm

    r31 r33  
    3636    Panels = <   
    3737      item
    38         Width = 50
     38        Width = 200
     39      end   
     40      item
     41        Width = 200
     42      end   
     43      item
     44        Width = 200
    3945      end>
    4046    SimplePanel = False
     
    7076      Top = 2
    7177      Action = Core.AToolPen
     78    end
     79    object ToolButton4: TToolButton
     80      Left = 113
     81      Top = 2
     82      Caption = 'ToolButton4'
     83      OnClick = ToolButton4Click
    7284    end
    7385  end
  • trunk/Forms/UFormMain.pas

    r31 r33  
    5050    ToolButton2: TToolButton;
    5151    ToolButton3: TToolButton;
     52    ToolButton4: TToolButton;
    5253    procedure FormActivate(Sender: TObject);
    5354    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
     
    7071    procedure PaintBox1Resize(Sender: TObject);
    7172    procedure Timer1Timer(Sender: TObject);
     73    procedure ToolButton4Click(Sender: TObject);
    7274  private
     75    EnableDraw: Boolean;
    7376    TempBitmap: TBitmap;
    7477    StartMousePoint: TPoint;
     
    109112end;
    110113
     114procedure TFormMain.ToolButton4Click(Sender: TObject);
     115begin
     116  EnableDraw := True;
     117end;
     118
    111119procedure TFormMain.OpenRecentClick(Sender: TObject);
    112120begin
     
    127135    StatusBar1.Panels[0].Text := '[' + IntToStr(Pos.X) + ', ' + IntToStr(Pos.Y) + '] Zoom:' +
    128136      FloatToStr(Core.Project.View.Zoom);
     137    StatusBar1.Panels[1].Text := 'Src: ' + IntToStr(View.SrcRect.Right - View.SrcRect.Left) + ', ' +
     138      IntToStr(View.SrcRect.Bottom - View.SrcRect.Top);
     139    StatusBar1.Panels[2].Text := 'Dst: ' + IntToStr(View.DestRect.Right - View.DestRect.Left) + ', ' +
     140      IntToStr(View.DestRect.Bottom - View.DestRect.Top);
    129141  end;
    130142end;
     
    144156    TempBitmap.Canvas.FillRect(0, 0, TempBitmap.Width, TempBitmap.Height);
    145157    View.DestRect := Bounds(0, 0, PaintBox1.Width, PaintBox1.Height);
    146     //Bitmap.PaintToCanvas(TempBitmap.Canvas, View.SrcRect);
    147     Bitmap.PaintToBitmap(TempBitmap, View.SrcRect);
     158   // Bitmap.PaintToCanvas(TempBitmap.Canvas, View.SrcRect);
     159   // if EnableDraw then
     160      Bitmap.PaintToBitmap(TempBitmap, View.SrcRect);
    148161    //TempBitmap.EndUpdate(False);
    149162    PaintBox1.Canvas.StretchDraw(View.DestRect, TempBitmap);
  • trunk/Forms/UFormNew.lfm

    r28 r33  
    88  ClientWidth = 497
    99  OnClose = FormClose
     10  OnCreate = FormCreate
    1011  OnShow = FormShow
    11   LCLVersion = '1.6.2.0'
     12  LCLVersion = '1.6.0.4'
    1213  object SpinEditWidth: TSpinEdit
    1314    Left = 168
    14     Height = 28
     15    Height = 34
    1516    Top = 24
    1617    Width = 122
     
    2122  object Label1: TLabel
    2223    Left = 15
    23     Height = 20
     24    Height = 24
    2425    Top = 26
    25     Width = 43
     26    Width = 56
    2627    Caption = 'Width:'
    2728    ParentColor = False
     
    2930  object Label2: TLabel
    3031    Left = 15
    31     Height = 20
     32    Height = 24
    3233    Top = 64
    33     Width = 48
     34    Width = 62
    3435    Caption = 'Height:'
    3536    ParentColor = False
     
    3738  object SpinEditHeight: TSpinEdit
    3839    Left = 168
    39     Height = 28
     40    Height = 34
    4041    Top = 64
    4142    Width = 122
     
    4647  object Label3: TLabel
    4748    Left = 15
    48     Height = 20
     49    Height = 24
    4950    Top = 104
    50     Width = 73
     51    Width = 96
    5152    Caption = 'Resolution:'
    5253    ParentColor = False
     
    5455  object SpinEditDPI: TSpinEdit
    5556    Left = 168
    56     Height = 28
     57    Height = 34
    5758    Top = 104
    5859    Width = 122
     
    6364  object Label4: TLabel
    6465    Left = 15
    65     Height = 20
     66    Height = 24
    6667    Top = 167
    67     Width = 82
     68    Width = 105
    6869    Caption = 'Color depth:'
    6970    ParentColor = False
     
    7172  object ComboBoxColorFormat: TComboBox
    7273    Left = 167
    73     Height = 28
     74    Height = 38
    7475    Top = 157
    7576    Width = 209
    76     ItemHeight = 20
     77    ItemHeight = 0
    7778    OnChange = SpinEditWidthChange
    7879    Style = csDropDownList
     
    100101  object Label5: TLabel
    101102    Left = 16
    102     Height = 20
     103    Height = 24
    103104    Top = 224
    104     Width = 118
     105    Width = 152
    105106    Caption = 'Memory required:'
    106107    ParentColor = False
     
    108109  object LabelMemRequire: TLabel
    109110    Left = 192
    110     Height = 20
     111    Height = 24
    111112    Top = 224
    112     Width = 12
     113    Width = 15
    113114    Caption = '   '
    114115    ParentColor = False
  • trunk/Forms/UFormNew.pas

    r30 r33  
    77uses
    88  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Spin,
    9   StdCtrls, ActnList, UFGraphics, URegistry;
     9  StdCtrls, ActnList, Menus, UFGraphics, URegistry;
    1010
    1111type
     
    2727    SpinEditHeight: TSpinEdit;
    2828    procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
     29    procedure FormCreate(Sender: TObject);
    2930    procedure FormShow(Sender: TObject);
    3031    procedure SpinEditWidthChange(Sender: TObject);
     
    3233    { private declarations }
    3334  public
     35    DefaultSize: TPoint;
    3436  end;
    3537
     
    5052  ColorFormat: TColorFormat;
    5153begin
    52   ColorFormat := ColorFormatManager.Formats[ComboBoxColorFormat.ItemIndex];
     54  ColorFormat := TColorFormat(ColorFormatManager.Formats.Items[ComboBoxColorFormat.ItemIndex]);
    5355  LabelMemRequire.Caption := IntToStr(SpinEditWidth.Value * SpinEditHeight.Value *
    5456    ColorFormat.BitDepth div 8) + ' bytes';
     
    7880    SpinEditHeight.Value := Core.Project.Bitmap.Size.Y;
    7981  end else begin
    80     SpinEditWidth.Value := 200;
    81     SpinEditHeight.Value := 100;
     82    SpinEditWidth.Value := DefaultSize.X;
     83    SpinEditHeight.Value := DefaultSize.X;
    8284  end;
    8385  SpinEditDPI.Value := 72;
     
    9092end;
    9193
     94procedure TFormNew.FormCreate(Sender: TObject);
     95begin
     96  DefaultSize := Point(600, 200);
     97end;
     98
    9299end.
    93100
Note: See TracChangeset for help on using the changeset viewer.