Changeset 6 for trunk/Inp.pas


Ignore:
Timestamp:
Jan 7, 2017, 11:32:14 AM (7 years ago)
Author:
chronos
Message:
  • Modified: Formated all project source files using Delphi formatter as original indentation and other formatting was really bad.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Inp.pas

    r2 r6  
    11{$INCLUDE switches}
    2 
    32unit Inp;
    43
     
    65
    76uses
    8   ScreenTools,Messg,
     7  ScreenTools, Messg,
    98
    109  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
     
    3635procedure TInputDlg.FormCreate(Sender: TObject);
    3736begin
    38 Canvas.Font.Assign(UniFont[ftNormal]);
    39 Canvas.Brush.Style:=bsClear;
    40 TitleHeight:=ClientHeight;
    41 InitButtons();
    42 Center:=true
     37  Canvas.Font.Assign(UniFont[ftNormal]);
     38  Canvas.Brush.Style := bsClear;
     39  TitleHeight := ClientHeight;
     40  InitButtons();
     41  Center := true
    4342end;
    4443
    4544procedure TInputDlg.FormPaint(Sender: TObject);
    4645begin
    47 PaintBackground(self,3,3,ClientWidth-6,ClientHeight-6);
    48 Frame(Canvas,0,0,ClientWidth-1,ClientHeight-1,0,0);
    49 Frame(Canvas,1,1,ClientWidth-2,ClientHeight-2,MainTexture.clBevelLight,
    50   MainTexture.clBevelShade);
    51 Frame(Canvas,2,2,ClientWidth-3,ClientHeight-3,MainTexture.clBevelLight,
    52   MainTexture.clBevelShade);
    53 EditFrame(Canvas,EInput.BoundsRect,MainTexture);
    54 BtnFrame(Canvas,OKBtn.BoundsRect,MainTexture);
    55 RisedTextOut(Canvas,(ClientWidth-BiColorTextWidth(Canvas,Caption)) div 2,9,Caption);
    56 {Corner(canvas,1,1,0,MainTexture);
    57 Corner(canvas,ClientWidth-9,1,1,MainTexture);
    58 Corner(canvas,1,ClientHeight-9,2,MainTexture);
    59 Corner(canvas,ClientWidth-9,ClientHeight-9,3,MainTexture);}
     46  PaintBackground(self, 3, 3, ClientWidth - 6, ClientHeight - 6);
     47  Frame(Canvas, 0, 0, ClientWidth - 1, ClientHeight - 1, 0, 0);
     48  Frame(Canvas, 1, 1, ClientWidth - 2, ClientHeight - 2,
     49    MainTexture.clBevelLight, MainTexture.clBevelShade);
     50  Frame(Canvas, 2, 2, ClientWidth - 3, ClientHeight - 3,
     51    MainTexture.clBevelLight, MainTexture.clBevelShade);
     52  EditFrame(Canvas, EInput.BoundsRect, MainTexture);
     53  BtnFrame(Canvas, OKBtn.BoundsRect, MainTexture);
     54  RisedTextOut(Canvas, (ClientWidth - BiColorTextWidth(Canvas, Caption)) div 2,
     55    9, Caption);
     56  { Corner(canvas,1,1,0,MainTexture);
     57    Corner(canvas,ClientWidth-9,1,1,MainTexture);
     58    Corner(canvas,1,ClientHeight-9,2,MainTexture);
     59    Corner(canvas,ClientWidth-9,ClientHeight-9,3,MainTexture); }
    6060end;
    6161
    6262procedure TInputDlg.OKBtnClick(Sender: TObject);
    6363begin
    64 if EInput.Text='' then ModalResult:=mrCancel
    65 else ModalResult:=mrOK
     64  if EInput.Text = '' then
     65    ModalResult := mrCancel
     66  else
     67    ModalResult := mrOK
    6668end;
    6769
    6870procedure TInputDlg.EInputKeyPress(Sender: TObject; var Key: Char);
    6971begin
    70 if (Key=#13) and (EInput.Text<>'') then begin Key:=#0 ; ModalResult:=mrOK end
    71 else if Key=#27 then begin Key:=#0; ModalResult:=mrCancel end
     72  if (Key = #13) and (EInput.Text <> '') then
     73  begin
     74    Key := #0;
     75    ModalResult := mrOK
     76  end
     77  else if Key = #27 then
     78  begin
     79    Key := #0;
     80    ModalResult := mrCancel
     81  end
    7282end;
    7383
    7484procedure TInputDlg.FormShow(Sender: TObject);
    7585begin
    76 OKBtn.Caption:=Phrases.Lookup('BTN_OK');
    77 EInput.Font.Color:=MainTexture.clMark;
    78 EInput.SelStart:=0;
    79 EInput.SelLength:=Length(EInput.Text);
    80 if Center then CenterToRect(Rect(0,0,Screen.Width,Screen.Height));
     86  OKBtn.Caption := Phrases.Lookup('BTN_OK');
     87  EInput.Font.Color := MainTexture.clMark;
     88  EInput.SelStart := 0;
     89  EInput.SelLength := Length(EInput.Text);
     90  if Center then
     91    CenterToRect(Rect(0, 0, Screen.Width, Screen.Height));
    8192end;
    8293
    8394procedure TInputDlg.FormClose(Sender: TObject; var Action: TCloseAction);
    8495begin
    85 Center:=true
     96  Center := true
    8697end;
    8798
    8899procedure TInputDlg.CenterToRect(Rect: TRect);
    89100begin
    90 Center:=false;
    91 Left:=Rect.Left+(Rect.Right-Rect.Left-Width) div 2;
    92 Top:=Rect.Top+(Rect.Bottom-Rect.Top-Height) div 2;
     101  Center := false;
     102  Left := Rect.Left + (Rect.Right - Rect.Left - Width) div 2;
     103  Top := Rect.Top + (Rect.Bottom - Rect.Top - Height) div 2;
    93104end;
    94105
    95106end.
    96 
Note: See TracChangeset for help on using the changeset viewer.