Ignore:
Timestamp:
Jan 7, 2017, 8:54:23 PM (8 years ago)
Author:
chronos
Message:
  • Removed: Do not create file association at runtime as it is done by installer program.
  • Modified: Additional source formating using Delphi formatter.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Components/ButtonN.pas

    r10 r14  
    1212    FPossible, FLit: boolean;
    1313    FGraphic, FMask, FBackGraphic: TBitmap;
    14     FIndex,BackIndex: integer;
     14    FIndex, BackIndex: integer;
    1515    FSmartHint: string;
    1616    ChangeProc: TNotifyEvent;
     
    4040procedure Register;
    4141begin
    42 RegisterComponents('Samples', [TButtonN]);
     42  RegisterComponents('Samples', [TButtonN]);
    4343end;
    4444
    4545constructor TButtonN.Create(aOwner: TComponent);
    4646begin
    47 inherited Create(aOwner);
    48 ShowHint:=true;
    49 FGraphic:=nil;
    50 FBackGraphic:=nil;
    51 FPossible:=true;
    52 FLit:=false;
    53 FIndex:=-1;
    54 ChangeProc:=nil;
    55 SetBounds(0,0,42,42);
     47  inherited Create(aOwner);
     48  ShowHint := true;
     49  FGraphic := nil;
     50  FBackGraphic := nil;
     51  FPossible := true;
     52  FLit := false;
     53  FIndex := -1;
     54  ChangeProc := nil;
     55  SetBounds(0, 0, 42, 42);
    5656end;
    5757
    5858procedure TButtonN.Paint;
    5959begin
    60 with Canvas do
     60  with Canvas do
    6161  begin
    62   if FGraphic<>nil then
     62    if FGraphic <> nil then
    6363    begin
    64     BitBlt(Canvas.Handle,1,1,40,40,FBackGraphic.Canvas.Handle,
    65       1+80*BackIndex+40*byte(FPossible and FLit),176,SRCCOPY);
    66     if FPossible then
     64      BitBlt(Canvas.Handle, 1, 1, 40, 40, FBackGraphic.Canvas.Handle,
     65        1 + 80 * BackIndex + 40 * byte(FPossible and FLit), 176, SRCCOPY);
     66      if FPossible then
    6767      begin
    68       BitBlt(Canvas.Handle,3,3,36,36,FMask.Canvas.Handle,
    69         195+37*(FIndex mod 3),21+37*(FIndex div 3),SRCAND);
    70       BitBlt(Canvas.Handle,3,3,36,36,FGraphic.Canvas.Handle,
    71         195+37*(FIndex mod 3),21+37*(FIndex div 3),SRCPAINT);
     68        BitBlt(Canvas.Handle, 3, 3, 36, 36, FMask.Canvas.Handle,
     69          195 + 37 * (FIndex mod 3), 21 + 37 * (FIndex div 3), SRCAND);
     70        BitBlt(Canvas.Handle, 3, 3, 36, 36, FGraphic.Canvas.Handle,
     71          195 + 37 * (FIndex mod 3), 21 + 37 * (FIndex div 3), SRCPAINT);
    7272      end
    7373    end;
    74   MoveTo(0,41);
    75   Pen.Color:=$B0B0B0;LineTo(0,0);LineTo(41,0);
    76   Pen.Color:=$FFFFFF;LineTo(41,41);LineTo(0,41);
     74    MoveTo(0, 41);
     75    Pen.Color := $B0B0B0;
     76    LineTo(0, 0);
     77    LineTo(41, 0);
     78    Pen.Color := $FFFFFF;
     79    LineTo(41, 41);
     80    LineTo(0, 41);
    7781  end
    7882end;
    7983
    8084procedure TButtonN.MouseDown(Button: TMouseButton; Shift: TShiftState;
    81       x, y: integer);
     85  x, y: integer);
    8286begin
    83 if FPossible and (Button=mbLeft) and (@ChangeProc<>nil) then
    84   ChangeProc(Self)
     87  if FPossible and (Button = mbLeft) and (@ChangeProc <> nil) then
     88    ChangeProc(Self)
    8589end;
    8690
    8791procedure TButtonN.SetPossible(x: boolean);
    8892begin
    89 if x<>FPossible then
     93  if x <> FPossible then
    9094  begin
    91   FPossible:=x;
    92   if x then Hint:=FSmartHint
    93   else Hint:='';
    94   Invalidate
     95    FPossible := x;
     96    if x then
     97      Hint := FSmartHint
     98    else
     99      Hint := '';
     100    Invalidate
    95101  end
    96102end;
     
    98104procedure TButtonN.SetLit(x: boolean);
    99105begin
    100 if x<>FLit then
     106  if x <> FLit then
    101107  begin
    102   FLit:=x;
    103   Invalidate
     108    FLit := x;
     109    Invalidate
    104110  end
    105111end;
     
    107113procedure TButtonN.SetIndex(x: integer);
    108114begin
    109 if x<>FIndex then
     115  if x <> FIndex then
    110116  begin
    111   FIndex:=x;
    112   if x<6 then BackIndex:=1
    113   else BackIndex:=0;
    114   Invalidate
     117    FIndex := x;
     118    if x < 6 then
     119      BackIndex := 1
     120    else
     121      BackIndex := 0;
     122    Invalidate
    115123  end
    116124end;
     
    118126procedure TButtonN.SetSmartHint(x: string);
    119127begin
    120 if x<>FSmartHint then
     128  if x <> FSmartHint then
    121129  begin
    122   FSmartHint:=x;
    123   if FPossible then Hint:=x;
     130    FSmartHint := x;
     131    if FPossible then
     132      Hint := x;
    124133  end
    125134end;
    126135
    127136end.
    128 
Note: See TracChangeset for help on using the changeset viewer.