Changeset 14
- Timestamp:
- Jan 7, 2017, 8:54:23 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Components/ButtonA.pas
r10 r14 30 30 procedure Register; 31 31 begin 32 RegisterComponents('Samples', [TButtonA]);32 RegisterComponents('Samples', [TButtonA]); 33 33 end; 34 34 35 35 constructor TButtonA.Create(aOwner: TComponent); 36 36 begin 37 inherited Create(aOwner);38 FCaption:='';39 SetBounds(0,0,100,25);37 inherited Create(aOwner); 38 FCaption := ''; 39 SetBounds(0, 0, 100, 25); 40 40 end; 41 41 42 42 procedure TButtonA.Paint; 43 43 begin 44 with Canvas do45 if FGraphic<>nil then44 with Canvas do 45 if FGraphic <> nil then 46 46 begin 47 BitBlt(Canvas.Handle,0,0,100,25,Graphic.Canvas.Handle,48 195,243+26*Byte(Down),SRCCOPY);49 Canvas.Brush.Style:=bsClear;50 Textout(50-(TextWidth(FCaption)+1) div 2,12-textheight(FCaption) div 2,51 FCaption);47 BitBlt(Canvas.Handle, 0, 0, 100, 25, Graphic.Canvas.Handle, 195, 48 243 + 26 * Byte(Down), SRCCOPY); 49 Canvas.Brush.Style := bsClear; 50 Textout(50 - (TextWidth(FCaption) + 1) div 2, 12 - textheight(FCaption) 51 div 2, FCaption); 52 52 end 53 else begin Brush.Color:=$0000FF; FrameRect(Rect(0,0,100,25)) end 53 else 54 begin 55 Brush.Color := $0000FF; 56 FrameRect(Rect(0, 0, 100, 25)) 57 end 54 58 end; 55 59 56 60 procedure TButtonA.SetCaption(x: string); 57 61 begin 58 if x<>FCaption then62 if x <> FCaption then 59 63 begin 60 FCaption:=x;61 Invalidate64 FCaption := x; 65 Invalidate 62 66 end 63 67 end; … … 65 69 procedure TButtonA.SetFont(const x: TFont); 66 70 begin 67 Canvas.Font.Assign(x);68 Canvas.Font.Color:=$000000;71 Canvas.Font.Assign(x); 72 Canvas.Font.Color := $000000; 69 73 end; 70 74 71 75 end. 72 -
trunk/Components/ButtonB.pas
r10 r14 30 30 procedure Register; 31 31 begin 32 RegisterComponents('Samples', [TButtonB]);32 RegisterComponents('Samples', [TButtonB]); 33 33 end; 34 34 35 35 constructor TButtonB.Create(aOwner: TComponent); 36 36 begin 37 inherited Create(aOwner);38 ShowHint:=true;39 SetBounds(0,0,25,25);37 inherited Create(aOwner); 38 ShowHint := true; 39 SetBounds(0, 0, 25, 25); 40 40 end; 41 41 42 42 procedure TButtonB.Paint; 43 43 begin 44 with Canvas do45 if FGraphic<>nil then44 with Canvas do 45 if FGraphic <> nil then 46 46 begin 47 BitBlt(Canvas.Handle,0,0,25,25,FGraphic.Canvas.Handle,48 169,243+26*Byte(FDown),SRCCOPY);49 if FIndex>=0 then47 BitBlt(Canvas.Handle, 0, 0, 25, 25, FGraphic.Canvas.Handle, 169, 48 243 + 26 * Byte(FDown), SRCCOPY); 49 if FIndex >= 0 then 50 50 begin 51 BitBlt(Canvas.Handle,0,0,25,25,FMask.Canvas.Handle,52 1+FIndex mod 12 *26,337+FIndex div 12 *26,SRCAND);53 BitBlt(Canvas.Handle,0,0,25,25,FGraphic.Canvas.Handle,54 1+FIndex mod 12 *26,337+FIndex div 12 *26,SRCPAINT);51 BitBlt(Canvas.Handle, 0, 0, 25, 25, FMask.Canvas.Handle, 52 1 + FIndex mod 12 * 26, 337 + FIndex div 12 * 26, SRCAND); 53 BitBlt(Canvas.Handle, 0, 0, 25, 25, FGraphic.Canvas.Handle, 54 1 + FIndex mod 12 * 26, 337 + FIndex div 12 * 26, SRCPAINT); 55 55 end 56 56 end 57 else begin Brush.Color:=$0000FF; FrameRect(Rect(0,0,25,25)) end 57 else 58 begin 59 Brush.Color := $0000FF; 60 FrameRect(Rect(0, 0, 25, 25)) 61 end 58 62 end; 59 63 60 64 procedure TButtonB.SetIndex(x: integer); 61 65 begin 62 if x<>FIndex then66 if x <> FIndex then 63 67 begin 64 FIndex:=x;65 Invalidate68 FIndex := x; 69 Invalidate 66 70 end 67 71 end; 68 72 69 73 end. 70 -
trunk/Components/ButtonBase.pas
r10 r14 10 10 constructor Create(aOwner: TComponent); override; 11 11 protected 12 FDown, FPermanent: boolean;12 FDown, FPermanent: boolean; 13 13 FGraphic: TBitmap; 14 //FDownSound, FUpSound: string;14 // FDownSound, FUpSound: string; 15 15 ClickProc: TNotifyEvent; 16 16 DownChangedProc: TNotifyEvent; 17 17 procedure SetDown(x: boolean); 18 //procedure PlayDownSound;19 //procedure PlayUpSound;18 // procedure PlayDownSound; 19 // procedure PlayUpSound; 20 20 procedure MouseDown(Button: TMouseButton; Shift: TShiftState; 21 21 x, y: integer); override; … … 27 27 public 28 28 property Graphic: TBitmap read FGraphic write FGraphic; 29 //property DownSound: string read FDownSound write FDownSound;30 //property UpSound: string read FUpSound write FUpSound;29 // property DownSound: string read FDownSound write FDownSound; 30 // property UpSound: string read FUpSound write FUpSound; 31 31 published 32 32 property Visible; … … 34 34 property Permanent: boolean read FPermanent write FPermanent; 35 35 property OnClick: TNotifyEvent read ClickProc write ClickProc; 36 property OnDownChanged: TNotifyEvent read DownChangedProc write DownChangedProc; 36 property OnDownChanged: TNotifyEvent read DownChangedProc 37 write DownChangedProc; 37 38 end; 38 39 39 40 implementation 40 41 41 // uses42 // 42 // uses 43 // MMSystem; 43 44 44 constructor TButtonBase.Create( AOwner: TComponent);45 constructor TButtonBase.Create(aOwner: TComponent); 45 46 begin 46 47 inherited; 47 //FDownSound:=''; 48 //FUpSound:=''; 49 FGraphic:=nil; Active:=false; FDown:=false; FPermanent:=false; 50 ClickProc:=nil; 48 // FDownSound:=''; 49 // FUpSound:=''; 50 FGraphic := nil; 51 Active := false; 52 FDown := false; 53 FPermanent := false; 54 ClickProc := nil; 51 55 end; 52 56 53 57 procedure TButtonBase.MouseDown(Button: TMouseButton; Shift: TShiftState; 54 58 x, y: integer); 55 59 begin 56 Active :=true;57 MouseMove(Shift, x,y)60 Active := true; 61 MouseMove(Shift, x, y) 58 62 end; 59 63 60 64 procedure TButtonBase.MouseUp(Button: TMouseButton; Shift: TShiftState; 61 65 x, y: integer); 62 66 begin 63 if ssLeft in Shift then exit; 64 MouseMove(Shift,x,y); 67 if ssLeft in Shift then 68 exit; 69 MouseMove(Shift, x, y); 65 70 if Active and FDown then 66 71 begin 67 //PlayUpSound;68 Active:=false;69 if FDown<>FPermanent then72 // PlayUpSound; 73 Active := false; 74 if FDown <> FPermanent then 70 75 begin 71 FDown:=FPermanent; 72 Invalidate; 73 if @DownChangedProc<>nil then DownChangedProc(self); 76 FDown := FPermanent; 77 Invalidate; 78 if @DownChangedProc <> nil then 79 DownChangedProc(self); 74 80 end; 75 if (Button=mbLeft) and (@ClickProc<>nil) then ClickProc(self) 81 if (Button = mbLeft) and (@ClickProc <> nil) then 82 ClickProc(self) 76 83 end 77 else84 else 78 85 begin 79 //if FDown then PlayUpSound;80 Active:=false;81 if FDown then86 // if FDown then PlayUpSound; 87 Active := false; 88 if FDown then 82 89 begin 83 FDown:=false; 84 Invalidate; 85 if @DownChangedProc<>nil then DownChangedProc(self); 90 FDown := false; 91 Invalidate; 92 if @DownChangedProc <> nil then 93 DownChangedProc(self); 86 94 end; 87 95 end … … 90 98 procedure TButtonBase.MouseMove(Shift: TShiftState; x, y: integer); 91 99 begin 92 if Active then 93 if (x>=0) and (x<Width) and (y>=0) and (y<Height) then 94 if (ssLeft in Shift) and not FDown then 95 begin 96 {PlayDownSound;} 97 FDown:=true; 98 Paint; 99 if @DownChangedProc<>nil then DownChangedProc(self); 100 end 101 else else if FDown and not FPermanent then 102 begin 103 {PlayUpSound;} 104 FDown:=false; 105 Paint; 106 if @DownChangedProc<>nil then DownChangedProc(self); 107 end 100 if Active then 101 if (x >= 0) and (x < Width) and (y >= 0) and (y < Height) then 102 if (ssLeft in Shift) and not FDown then 103 begin 104 { PlayDownSound; } 105 FDown := true; 106 Paint; 107 if @DownChangedProc <> nil then 108 DownChangedProc(self); 109 end 110 else 111 else if FDown and not FPermanent then 112 begin 113 { PlayUpSound; } 114 FDown := false; 115 Paint; 116 if @DownChangedProc <> nil then 117 DownChangedProc(self); 118 end 108 119 end; 109 120 110 121 procedure TButtonBase.SetDown(x: boolean); 111 122 begin 112 FDown:=x;113 Invalidate123 FDown := x; 124 Invalidate 114 125 end; 115 126 116 // procedure TButtonBase.PlayDownSound;117 // begin118 // if DownSound<>'' then SndPlaySound(pchar(DownSound),SND_ASYNC)119 // end;127 // procedure TButtonBase.PlayDownSound; 128 // begin 129 // if DownSound<>'' then SndPlaySound(pchar(DownSound),SND_ASYNC) 130 // end; 120 131 121 // procedure TButtonBase.PlayUpSound;122 // begin123 // if UpSound<>'' then SndPlaySound(pchar(UpSound),SND_ASYNC)124 // end;132 // procedure TButtonBase.PlayUpSound; 133 // begin 134 // if UpSound<>'' then SndPlaySound(pchar(UpSound),SND_ASYNC) 135 // end; 125 136 126 137 end. 127 -
trunk/Components/ButtonC.pas
r10 r14 27 27 procedure Register; 28 28 begin 29 RegisterComponents('Samples', [TButtonC]);29 RegisterComponents('Samples', [TButtonC]); 30 30 end; 31 31 32 32 constructor TButtonC.Create(aOwner: TComponent); 33 33 begin 34 inherited Create(aOwner);35 ShowHint:=true;36 SetBounds(0,0,12,12);34 inherited Create(aOwner); 35 ShowHint := true; 36 SetBounds(0, 0, 12, 12); 37 37 end; 38 38 39 39 procedure TButtonC.Paint; 40 40 begin 41 with Canvas do 42 if FGraphic<>nil then 43 BitBlt(Canvas.Handle,0,0,12,12,FGraphic.Canvas.Handle, 44 169+13*Byte(FDown),159+13*FIndex,SRCCOPY) 45 else begin Brush.Color:=$0000FF; FrameRect(Rect(0,0,12,12)) end 41 with Canvas do 42 if FGraphic <> nil then 43 BitBlt(Canvas.Handle, 0, 0, 12, 12, FGraphic.Canvas.Handle, 44 169 + 13 * Byte(FDown), 159 + 13 * FIndex, SRCCOPY) 45 else 46 begin 47 Brush.Color := $0000FF; 48 FrameRect(Rect(0, 0, 12, 12)) 49 end 46 50 end; 47 51 48 52 procedure TButtonC.SetIndex(x: integer); 49 53 begin 50 if x<>FIndex then54 if x <> FIndex then 51 55 begin 52 FIndex:=x;53 Invalidate56 FIndex := x; 57 Invalidate 54 58 end 55 59 end; 56 60 57 61 end. 58 -
trunk/Components/ButtonN.pas
r10 r14 12 12 FPossible, FLit: boolean; 13 13 FGraphic, FMask, FBackGraphic: TBitmap; 14 FIndex, BackIndex: integer;14 FIndex, BackIndex: integer; 15 15 FSmartHint: string; 16 16 ChangeProc: TNotifyEvent; … … 40 40 procedure Register; 41 41 begin 42 RegisterComponents('Samples', [TButtonN]);42 RegisterComponents('Samples', [TButtonN]); 43 43 end; 44 44 45 45 constructor TButtonN.Create(aOwner: TComponent); 46 46 begin 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); 56 56 end; 57 57 58 58 procedure TButtonN.Paint; 59 59 begin 60 with Canvas do60 with Canvas do 61 61 begin 62 if FGraphic<>nil then62 if FGraphic <> nil then 63 63 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 then64 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 67 67 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); 72 72 end 73 73 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); 77 81 end 78 82 end; 79 83 80 84 procedure TButtonN.MouseDown(Button: TMouseButton; Shift: TShiftState; 81 85 x, y: integer); 82 86 begin 83 if FPossible and (Button=mbLeft) and (@ChangeProc<>nil) then84 ChangeProc(Self)87 if FPossible and (Button = mbLeft) and (@ChangeProc <> nil) then 88 ChangeProc(Self) 85 89 end; 86 90 87 91 procedure TButtonN.SetPossible(x: boolean); 88 92 begin 89 if x<>FPossible then93 if x <> FPossible then 90 94 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 95 101 end 96 102 end; … … 98 104 procedure TButtonN.SetLit(x: boolean); 99 105 begin 100 if x<>FLit then106 if x <> FLit then 101 107 begin 102 FLit:=x;103 Invalidate108 FLit := x; 109 Invalidate 104 110 end 105 111 end; … … 107 113 procedure TButtonN.SetIndex(x: integer); 108 114 begin 109 if x<>FIndex then115 if x <> FIndex then 110 116 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 115 123 end 116 124 end; … … 118 126 procedure TButtonN.SetSmartHint(x: string); 119 127 begin 120 if x<>FSmartHint then128 if x <> FSmartHint then 121 129 begin 122 FSmartHint:=x; 123 if FPossible then Hint:=x; 130 FSmartHint := x; 131 if FPossible then 132 Hint := x; 124 133 end 125 134 end; 126 135 127 136 end. 128 -
trunk/Components/EOTButton.pas
r10 r14 8 8 9 9 const 10 eotBlinkOff=-1; eotCancel=0; eotGray=1; eotBlinkOn=2; eotBackToNego=3; 10 eotBlinkOff = -1; 11 eotCancel = 0; 12 eotGray = 1; 13 eotBlinkOn = 2; 14 eotBackToNego = 3; 11 15 12 16 type … … 15 19 destructor Destroy; override; 16 20 procedure SetButtonIndexFast(x: integer); 17 procedure SetBack(ca: TCanvas; x, y: integer);21 procedure SetBack(ca: TCanvas; x, y: integer); 18 22 private 19 23 FTemplate: TBitmap; … … 37 41 procedure Register; 38 42 begin 39 RegisterComponents('Samples', [TEOTButton]);43 RegisterComponents('Samples', [TEOTButton]); 40 44 end; 41 45 42 procedure ImageOp_CBC(Dst,Src: TBitmap; xDst,yDst,xSrc,ySrc,w,h,Color0,Color2: integer); 46 procedure ImageOp_CBC(Dst, Src: TBitmap; xDst, yDst, xSrc, ySrc, w, h, Color0, 47 Color2: integer); 43 48 // Src is template 44 49 // B channel = Color0 amp … … 46 51 // R channel = Color2 amp 47 52 type 48 TLine=array[0..9999,0..2] of Byte;53 TLine = array [0 .. 9999, 0 .. 2] of Byte; 49 54 var 50 ix,iy,amp0,amp1,trans,Value: integer;51 SrcLine,DstLine: ^TLine;55 ix, iy, amp0, amp1, trans, Value: integer; 56 SrcLine, DstLine: ^TLine; 52 57 begin 53 for iy:=0 to h-1 do58 for iy := 0 to h - 1 do 54 59 begin 55 SrcLine:=Src.ScanLine[ySrc+iy];56 DstLine:=Dst.ScanLine[yDst+iy];57 for ix:=0 to w-1 do60 SrcLine := Src.ScanLine[ySrc + iy]; 61 DstLine := Dst.ScanLine[yDst + iy]; 62 for ix := 0 to w - 1 do 58 63 begin 59 trans:=SrcLine[xSrc+ix,0]*2; // green channel = transparency60 amp0:=SrcLine[xSrc+ix,1]*2;61 amp1:=SrcLine[xSrc+ix,2]*2;62 if trans<>$FF then64 trans := SrcLine[xSrc + ix, 0] * 2; // green channel = transparency 65 amp0 := SrcLine[xSrc + ix, 1] * 2; 66 amp1 := SrcLine[xSrc + ix, 2] * 2; 67 if trans <> $FF then 63 68 begin 64 Value:=(DstLine[xDst+ix][0]*trans+(Color2 shr 16 and $FF)*amp1+(Color0 shr 16 and $FF)*amp0) div $FF; 65 if Value<256 then 66 DstLine[xDst+ix][0]:=Value 67 else DstLine[xDst+ix][0]:=255; 68 Value:=(DstLine[xDst+ix][1]*trans+(Color2 shr 8 and $FF)*amp1+(Color0 shr 8 and $FF)*amp0) div $FF; 69 if Value<256 then 70 DstLine[xDst+ix][1]:=Value 71 else DstLine[xDst+ix][1]:=255; 72 Value:=(DstLine[xDst+ix][2]*trans+(Color2 and $FF)*amp1+(Color0 and $FF)*amp0) div $FF; 73 if Value<256 then 74 DstLine[xDst+ix][2]:=Value 75 else DstLine[xDst+ix][2]:=255; 69 Value := (DstLine[xDst + ix][0] * trans + (Color2 shr 16 and $FF) * amp1 70 + (Color0 shr 16 and $FF) * amp0) div $FF; 71 if Value < 256 then 72 DstLine[xDst + ix][0] := Value 73 else 74 DstLine[xDst + ix][0] := 255; 75 Value := (DstLine[xDst + ix][1] * trans + (Color2 shr 8 and $FF) * amp1 76 + (Color0 shr 8 and $FF) * amp0) div $FF; 77 if Value < 256 then 78 DstLine[xDst + ix][1] := Value 79 else 80 DstLine[xDst + ix][1] := 255; 81 Value := (DstLine[xDst + ix][2] * trans + (Color2 and $FF) * amp1 + 82 (Color0 and $FF) * amp0) div $FF; 83 if Value < 256 then 84 DstLine[xDst + ix][2] := Value 85 else 86 DstLine[xDst + ix][2] := 255; 76 87 end 77 88 end … … 81 92 constructor TEOTButton.Create; 82 93 begin 83 inherited Create(aOwner);84 Buffer:=TBitmap.Create;85 Buffer.PixelFormat:=pf24bit;86 Buffer.Width:=48;87 Buffer.Height:=48;88 Back:=TBitmap.Create;89 Back.PixelFormat:=pf24bit;90 Back.Width:=48;91 Back.Height:=48;92 ShowHint:=true;93 SetBounds(0,0,48,48);94 inherited Create(aOwner); 95 Buffer := TBitmap.Create; 96 Buffer.PixelFormat := pf24bit; 97 Buffer.Width := 48; 98 Buffer.Height := 48; 99 Back := TBitmap.Create; 100 Back.PixelFormat := pf24bit; 101 Back.Width := 48; 102 Back.Height := 48; 103 ShowHint := true; 104 SetBounds(0, 0, 48, 48); 94 105 end; 95 106 96 107 destructor TEOTButton.Destroy; 97 108 begin 98 Buffer.Free;99 Back.Free;100 inherited Destroy;109 Buffer.Free; 110 Back.Free; 111 inherited Destroy; 101 112 end; 102 113 103 114 procedure TEOTButton.Paint; 104 115 begin 105 with Canvas do106 if FGraphic<>nil then116 with Canvas do 117 if FGraphic <> nil then 107 118 begin 108 BitBlt(Buffer.Canvas.Handle,0,0,48,48,Back.Canvas.Handle,0,0,SRCCOPY); 109 ImageOp_CBC(Buffer, Template, 0, 0, 133, 149+48*byte(FDown), 48, 48, $000000, $FFFFFF); 110 if FIndex>=0 then 111 ImageOp_CBC(Buffer, Template, 8, 8, 1+32*byte(FIndex), 246, 32, 32, $000000, $FFFFFF); 112 BitBlt(Canvas.Handle,0,0,48,48,Buffer.Canvas.Handle,0,0,SRCCOPY); 119 BitBlt(Buffer.Canvas.Handle, 0, 0, 48, 48, Back.Canvas.Handle, 0, 120 0, SRCCOPY); 121 ImageOp_CBC(Buffer, Template, 0, 0, 133, 149 + 48 * Byte(FDown), 48, 48, 122 $000000, $FFFFFF); 123 if FIndex >= 0 then 124 ImageOp_CBC(Buffer, Template, 8, 8, 1 + 32 * Byte(FIndex), 246, 32, 32, 125 $000000, $FFFFFF); 126 BitBlt(Canvas.Handle, 0, 0, 48, 48, Buffer.Canvas.Handle, 0, 0, SRCCOPY); 113 127 end 114 else begin Brush.Color:=$0000FF; FrameRect(Rect(0,0,48,48)) end 128 else 129 begin 130 Brush.Color := $0000FF; 131 FrameRect(Rect(0, 0, 48, 48)) 132 end 115 133 end; 116 134 117 135 procedure TEOTButton.SetIndex(x: integer); 118 136 begin 119 if x<>FIndex then137 if x <> FIndex then 120 138 begin 121 FIndex:=x;122 Invalidate139 FIndex := x; 140 Invalidate 123 141 end 124 142 end; … … 126 144 procedure TEOTButton.SetButtonIndexFast(x: integer); 127 145 begin 128 if Visible and (x<>FIndex) then146 if Visible and (x <> FIndex) then 129 147 begin 130 FIndex:=x;131 try132 Paint133 except148 FIndex := x; 149 try 150 Paint 151 except 134 152 end 135 153 end 136 154 end; 137 155 138 procedure TEOTButton.SetBack(ca: TCanvas; x, y: integer);156 procedure TEOTButton.SetBack(ca: TCanvas; x, y: integer); 139 157 begin 140 BitBlt(Back.Canvas.Handle,0,0,48,48,ca.Handle,x,y,SRCCOPY);158 BitBlt(Back.Canvas.Handle, 0, 0, 48, 48, ca.Handle, x, y, SRCCOPY); 141 159 end; 142 160 143 161 end. 144 -
trunk/Integrated.lpi
r12 r14 29 29 <PathDelim Value="\"/> 30 30 <Target> 31 <Filename Value=" C-evo"/>31 <Filename Value="c-evo"/> 32 32 </Target> 33 33 <SearchPaths> 34 <IncludeFiles Value="LocalPlayer "/>34 <IncludeFiles Value="LocalPlayer;$(ProjOutDir)"/> 35 35 <OtherUnitFiles Value="LocalPlayer"/> 36 36 <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> … … 45 45 </Parsing> 46 46 <CodeGeneration> 47 <SmartLinkUnit Value="True"/> 48 <TargetCPU Value="i386"/> 49 <TargetOS Value="win32"/> 47 50 <Optimizations> 48 51 <OptimizationLevel Value="3"/> … … 53 56 <GenerateDebugInfo Value="False"/> 54 57 </Debugging> 58 <LinkSmart Value="True"/> 55 59 <Options> 56 60 <Win32> … … 290 294 </Target> 291 295 <SearchPaths> 292 <IncludeFiles Value="LocalPlayer ;$(ProjOutDir)"/>296 <IncludeFiles Value="LocalPlayer"/> 293 297 <OtherUnitFiles Value="LocalPlayer"/> 294 298 <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/> -
trunk/ScreenTools.pas
r11 r14 7 7 Windows, StringTables, 8 8 9 LCLIntf, LCLType, LMessages, Messages, SysUtils, Classes, Graphics, Controls, Forms, Menus; 9 LCLIntf, LCLType, LMessages, Messages, SysUtils, Classes, Graphics, Controls, 10 Forms, Menus; 10 11 11 12 type … … 16 17 end; 17 18 18 function ChangeResolution(x, y, bpp, freq: integer): boolean; 19 procedure RestoreResolution; 20 function Play(Item: string; Index: integer = -1): boolean; 21 procedure PreparePlay(Item: string; Index: integer = -1); 22 procedure EmptyMenu(MenuItems: TMenuItem; Keep: integer = 0); 23 function turntoyear(Turn: integer): integer; 24 function TurnToString(Turn: integer): string; 25 function MovementToString(Movement: integer): string; 26 procedure BtnFrame(ca: TCanvas; p: TRect; const T: TTexture); 27 procedure EditFrame(ca: TCanvas; p: TRect; const T: TTexture); 28 function HexStringToColor(s: string): integer; 29 function LoadGraphicFile(bmp: TBitmap; Path: string; 30 Options: integer = 0): boolean; 31 function LoadLocalizedGraphicFile(bmp: TBitmap; Path: string; 32 Options: integer = 0): boolean; 33 function LoadGraphicSet(Name: string): integer; 34 procedure Dump(dst: TBitmap; HGr, xDst, yDst, Width, Height, xGr, 35 yGr: integer); 36 procedure Sprite(Canvas: TCanvas; HGr, xDst, yDst, Width, Height, xGr, 37 yGr: integer); overload; 38 procedure Sprite(dst: TBitmap; HGr, xDst, yDst, Width, Height, xGr, 39 yGr: integer); overload; 40 procedure MakeBlue(dst: TBitmap; x, y, w, h: integer); 41 procedure ImageOp_B(dst, Src: TBitmap; xDst, yDst, xSrc, ySrc, w, 42 h: integer); 43 procedure ImageOp_BCC(dst, Src: TBitmap; xDst, yDst, xSrc, ySrc, w, h, 44 Color1, Color2: integer); 45 procedure ImageOp_CCC(bmp: TBitmap; x, y, w, h, Color0, Color1, 46 Color2: integer); 47 procedure SLine(ca: TCanvas; x0, x1, y: integer; cl: TColor); 48 procedure DLine(ca: TCanvas; x0, x1, y: integer; cl0, cl1: TColor); 49 procedure Frame(ca: TCanvas; x0, y0, x1, y1: integer; cl0, cl1: TColor); 50 procedure RFrame(ca: TCanvas; x0, y0, x1, y1: integer; cl0, cl1: TColor); 51 procedure CFrame(ca: TCanvas; x0, y0, x1, y1, Corner: integer; cl: TColor); 52 procedure FrameImage(ca: TCanvas; Src: TBitmap; 53 x, y, Width, Height, xSrc, ySrc: integer; IsControl: boolean = false); 54 procedure GlowFrame(dst: TBitmap; x0, y0, Width, Height: integer; 55 cl: TColor); 56 procedure InitOrnament; 57 procedure InitCityMark(const T: TTexture); 58 procedure Fill(ca: TCanvas; Left, Top, Width, Height, xOffset, 59 yOffset: integer); 60 procedure FillLarge(ca: TCanvas; x0, y0, x1, y1, xm: integer); 61 procedure FillSeamless(ca: TCanvas; Left, Top, Width, Height, xOffset, 62 yOffset: integer; const Texture: TBitmap); 63 procedure FillRectSeamless(ca: TCanvas; 64 x0, y0, x1, y1, xOffset, yOffset: integer; const Texture: TBitmap); 65 procedure PaintBackground(Form: TForm; Left, Top, Width, Height: integer); 66 procedure Corner(ca: TCanvas; x, y, Kind: integer; const T: TTexture); 67 procedure BiColorTextOut(ca: TCanvas; clMain, clBack: TColor; x, y: integer; 68 s: string); 69 procedure LoweredTextOut(ca: TCanvas; cl: TColor; const T: TTexture; 70 x, y: integer; s: string); 71 function BiColorTextWidth(ca: TCanvas; s: string): integer; 72 procedure RisedTextOut(ca: TCanvas; x, y: integer; s: string); 73 procedure LightGradient(ca: TCanvas; x, y, Width, Color: integer); 74 procedure DarkGradient(ca: TCanvas; x, y, Width, Kind: integer); 75 procedure VLightGradient(ca: TCanvas; x, y, Height, Color: integer); 76 procedure VDarkGradient(ca: TCanvas; x, y, Height, Kind: integer); 77 procedure NumberBar(dst: TBitmap; x, y: integer; Cap: string; val: integer; 78 const T: TTexture); 79 procedure CountBar(dst: TBitmap; x, y, w: integer; Kind: integer; 80 Cap: string; val: integer; const T: TTexture); 81 procedure PaintProgressBar(ca: TCanvas; 82 Kind, x, y, pos, Growth, max: integer; const T: TTexture); 83 procedure PaintRelativeProgressBar(ca: TCanvas; 84 Kind, x, y, size, pos, Growth, max: integer; IndicateComplete: boolean; 85 const T: TTexture); 86 procedure PaintLogo(ca: TCanvas; x, y, clLight, clShade: integer); 87 function SetMainTextureByAge(Age: integer): boolean; 88 89 const 90 nGrExtmax = 64; 91 wMainTexture = 640; 92 hMainTexture = 480; 93 94 // template positions in Template.bmp 95 xLogo = 1; 96 yLogo = 1; 97 wLogo = 122; 98 hLogo = 23; // logo 99 xBBook = 1; 100 yBBook = 74; 101 wBBook = 143; 102 hBBook = 73; // big book 103 xSBook = 72; 104 ySBook = 37; 105 wSBook = 72; 106 hSBook = 36; // small book 107 xNation = 1; 108 yNation = 25; 109 xCoal = 1; 110 yCoal = 148; 111 112 // Icons.bmp structure 113 xSizeBig = 56; 114 ySizeBig = 40; 115 116 GlowRange = 8; 117 118 EmptySpaceColor = $101010; 119 120 // template positions in System2.bmp 121 xOrna = 156; 122 yOrna = 1; 123 wOrna = 27; 124 hOrna = 26; // ornament 125 126 // sound modes 127 smOff = 0; 128 smOn = 1; 129 smOnAlt = 2; 130 131 // color matrix 132 clkAge0 = 1; 133 cliTexture = 0; 134 cliBevelLight = cliTexture + 1; 135 cliBevelShade = cliTexture + 2; 136 cliTextLight = cliTexture + 3; 137 cliTextShade = cliTexture + 4; 138 cliLitText = cliTexture + 5; 139 cliMark = cliTexture + 6; 140 cliDimmedText = cliTexture + 7; 141 cliRoad = 8; 142 cliHouse = cliRoad + 1; 143 cliImp = cliRoad + 2; 144 cliImpProject = cliRoad + 3; 145 cliPage = 13; 146 cliCover = cliPage + 1; 147 clkMisc = 5; 148 cliPaper = 0; 149 cliPaperText = 1; 150 cliPaperCaption = 2; 151 clkCity = 6; 152 cliPlains = 0; 153 cliPrairie = 1; 154 cliHills = 2; 155 cliTundra = 3; 156 cliWater = 4; 157 158 // LoadGraphicFile options 159 gfNoError = $01; 160 gfNoGamma = $02; 161 gfJPG = $04; 162 163 type 164 TGrExtDescr = record { don't use dynamic strings here! } 165 Name: string[31]; 166 Data, Mask: TBitmap; 167 pixUsed: array [Byte] of Byte; 168 end; 169 170 TGrExtDescrSize = record { for size calculation only - must be the same as 171 TGrExtDescr, but without pixUsed } 172 Name: string[31]; 173 Data, Mask: TBitmap; 174 end; 175 176 TFontType = (ftNormal, ftSmall, ftTiny, ftCaption, ftButton); 177 178 var 179 Phrases, Phrases2, Sounds: TStringTable; 180 nGrExt: integer; 181 GrExt: array [0 .. nGrExtmax - 1] of ^TGrExtDescr; 182 HGrSystem, HGrSystem2, ClickFrameColor, SoundMode, MainTextureAge: integer; 183 MainTexture: TTexture; 184 Templates, Colors, Paper, BigImp, LogoBuffer: TBitmap; 185 FullScreen, GenerateNames, InitOrnamentDone, 186 Phrases2FallenBackToEnglish: boolean; 187 188 UniFont: array [TFontType] of TFont; 19 function ChangeResolution(x, y, bpp, freq: integer): boolean; 20 procedure RestoreResolution; 21 function Play(Item: string; Index: integer = -1): boolean; 22 procedure PreparePlay(Item: string; Index: integer = -1); 23 procedure EmptyMenu(MenuItems: TMenuItem; Keep: integer = 0); 24 function turntoyear(Turn: integer): integer; 25 function TurnToString(Turn: integer): string; 26 function MovementToString(Movement: integer): string; 27 procedure BtnFrame(ca: TCanvas; p: TRect; const T: TTexture); 28 procedure EditFrame(ca: TCanvas; p: TRect; const T: TTexture); 29 function HexStringToColor(s: string): integer; 30 function LoadGraphicFile(bmp: TBitmap; Path: string; 31 Options: integer = 0): boolean; 32 function LoadLocalizedGraphicFile(bmp: TBitmap; Path: string; 33 Options: integer = 0): boolean; 34 function LoadGraphicSet(Name: string): integer; 35 procedure Dump(dst: TBitmap; HGr, xDst, yDst, Width, Height, xGr, yGr: integer); 36 procedure Sprite(Canvas: TCanvas; HGr, xDst, yDst, Width, Height, xGr, 37 yGr: integer); overload; 38 procedure Sprite(dst: TBitmap; HGr, xDst, yDst, Width, Height, xGr, 39 yGr: integer); overload; 40 procedure MakeBlue(dst: TBitmap; x, y, w, h: integer); 41 procedure ImageOp_B(dst, Src: TBitmap; xDst, yDst, xSrc, ySrc, w, h: integer); 42 procedure ImageOp_BCC(dst, Src: TBitmap; xDst, yDst, xSrc, ySrc, w, h, Color1, 43 Color2: integer); 44 procedure ImageOp_CCC(bmp: TBitmap; x, y, w, h, Color0, Color1, 45 Color2: integer); 46 procedure SLine(ca: TCanvas; x0, x1, y: integer; cl: TColor); 47 procedure DLine(ca: TCanvas; x0, x1, y: integer; cl0, cl1: TColor); 48 procedure Frame(ca: TCanvas; x0, y0, x1, y1: integer; cl0, cl1: TColor); 49 procedure RFrame(ca: TCanvas; x0, y0, x1, y1: integer; cl0, cl1: TColor); 50 procedure CFrame(ca: TCanvas; x0, y0, x1, y1, Corner: integer; cl: TColor); 51 procedure FrameImage(ca: TCanvas; Src: TBitmap; 52 x, y, Width, Height, xSrc, ySrc: integer; IsControl: boolean = false); 53 procedure GlowFrame(dst: TBitmap; x0, y0, Width, Height: integer; cl: TColor); 54 procedure InitOrnament; 55 procedure InitCityMark(const T: TTexture); 56 procedure Fill(ca: TCanvas; Left, Top, Width, Height, xOffset, 57 yOffset: integer); 58 procedure FillLarge(ca: TCanvas; x0, y0, x1, y1, xm: integer); 59 procedure FillSeamless(ca: TCanvas; Left, Top, Width, Height, xOffset, 60 yOffset: integer; const Texture: TBitmap); 61 procedure FillRectSeamless(ca: TCanvas; x0, y0, x1, y1, xOffset, 62 yOffset: integer; const Texture: TBitmap); 63 procedure PaintBackground(Form: TForm; Left, Top, Width, Height: integer); 64 procedure Corner(ca: TCanvas; x, y, Kind: integer; const T: TTexture); 65 procedure BiColorTextOut(ca: TCanvas; clMain, clBack: TColor; x, y: integer; 66 s: string); 67 procedure LoweredTextOut(ca: TCanvas; cl: TColor; const T: TTexture; 68 x, y: integer; s: string); 69 function BiColorTextWidth(ca: TCanvas; s: string): integer; 70 procedure RisedTextOut(ca: TCanvas; x, y: integer; s: string); 71 procedure LightGradient(ca: TCanvas; x, y, Width, Color: integer); 72 procedure DarkGradient(ca: TCanvas; x, y, Width, Kind: integer); 73 procedure VLightGradient(ca: TCanvas; x, y, Height, Color: integer); 74 procedure VDarkGradient(ca: TCanvas; x, y, Height, Kind: integer); 75 procedure NumberBar(dst: TBitmap; x, y: integer; Cap: string; val: integer; 76 const T: TTexture); 77 procedure CountBar(dst: TBitmap; x, y, w: integer; Kind: integer; Cap: string; 78 val: integer; const T: TTexture); 79 procedure PaintProgressBar(ca: TCanvas; Kind, x, y, pos, Growth, max: integer; 80 const T: TTexture); 81 procedure PaintRelativeProgressBar(ca: TCanvas; Kind, x, y, size, pos, Growth, 82 max: integer; IndicateComplete: boolean; const T: TTexture); 83 procedure PaintLogo(ca: TCanvas; x, y, clLight, clShade: integer); 84 function SetMainTextureByAge(Age: integer): boolean; 85 86 const 87 nGrExtmax = 64; 88 wMainTexture = 640; 89 hMainTexture = 480; 90 91 // template positions in Template.bmp 92 xLogo = 1; 93 yLogo = 1; 94 wLogo = 122; 95 hLogo = 23; // logo 96 xBBook = 1; 97 yBBook = 74; 98 wBBook = 143; 99 hBBook = 73; // big book 100 xSBook = 72; 101 ySBook = 37; 102 wSBook = 72; 103 hSBook = 36; // small book 104 xNation = 1; 105 yNation = 25; 106 xCoal = 1; 107 yCoal = 148; 108 109 // Icons.bmp structure 110 xSizeBig = 56; 111 ySizeBig = 40; 112 113 GlowRange = 8; 114 115 EmptySpaceColor = $101010; 116 117 // template positions in System2.bmp 118 xOrna = 156; 119 yOrna = 1; 120 wOrna = 27; 121 hOrna = 26; // ornament 122 123 // sound modes 124 smOff = 0; 125 smOn = 1; 126 smOnAlt = 2; 127 128 // color matrix 129 clkAge0 = 1; 130 cliTexture = 0; 131 cliBevelLight = cliTexture + 1; 132 cliBevelShade = cliTexture + 2; 133 cliTextLight = cliTexture + 3; 134 cliTextShade = cliTexture + 4; 135 cliLitText = cliTexture + 5; 136 cliMark = cliTexture + 6; 137 cliDimmedText = cliTexture + 7; 138 cliRoad = 8; 139 cliHouse = cliRoad + 1; 140 cliImp = cliRoad + 2; 141 cliImpProject = cliRoad + 3; 142 cliPage = 13; 143 cliCover = cliPage + 1; 144 clkMisc = 5; 145 cliPaper = 0; 146 cliPaperText = 1; 147 cliPaperCaption = 2; 148 clkCity = 6; 149 cliPlains = 0; 150 cliPrairie = 1; 151 cliHills = 2; 152 cliTundra = 3; 153 cliWater = 4; 154 155 // LoadGraphicFile options 156 gfNoError = $01; 157 gfNoGamma = $02; 158 gfJPG = $04; 159 160 type 161 TGrExtDescr = record { don't use dynamic strings here! } 162 Name: string[31]; 163 Data, Mask: TBitmap; 164 pixUsed: array [Byte] of Byte; 165 end; 166 167 TGrExtDescrSize = record { for size calculation only - must be the same as 168 TGrExtDescr, but without pixUsed } 169 Name: string[31]; 170 Data, Mask: TBitmap; 171 end; 172 173 TFontType = (ftNormal, ftSmall, ftTiny, ftCaption, ftButton); 174 175 var 176 Phrases, Phrases2, Sounds: TStringTable; 177 nGrExt: integer; 178 GrExt: array [0 .. nGrExtmax - 1] of ^TGrExtDescr; 179 HGrSystem, HGrSystem2, ClickFrameColor, SoundMode, MainTextureAge: integer; 180 MainTexture: TTexture; 181 Templates, Colors, Paper, BigImp, LogoBuffer: TBitmap; 182 FullScreen, GenerateNames, InitOrnamentDone, 183 Phrases2FallenBackToEnglish: boolean; 184 185 UniFont: array [TFontType] of TFont; 189 186 190 187 implementation … … 1457 1454 1458 1455 Reg := TRegistry.create; 1459 Reg.OpenKey('SOFTWARE\cevo\RegVer9', true);1460 1456 try 1461 Gamma := Reg.ReadInteger('Gamma'); 1462 except 1463 Gamma := 100; 1464 Reg.WriteInteger('Gamma', Gamma); 1465 end; 1466 Reg.closekey; 1467 Reg.Free; 1457 Reg.OpenKey('SOFTWARE\cevo\RegVer9', true); 1458 if Reg.ValueExists('Gamma') then 1459 Gamma := Reg.ReadInteger('Gamma') 1460 else begin 1461 Gamma := 100; 1462 Reg.WriteInteger('Gamma', Gamma); 1463 end; 1464 finally 1465 Reg.Free; 1466 end; 1468 1467 1469 1468 if Gamma <> 100 then -
trunk/Start.pas
r12 r14 207 207 Reg.WriteInteger('MultiControl', 0); 208 208 Reg.closekey; 209 210 // register file type: "cevo Book" -- fails with no administrator rights!211 try212 Reg.RootKey := HKEY_CLASSES_ROOT;213 Reg.OpenKey('.cevo', true);214 Reg.WriteString('', 'cevoBook');215 Reg.closekey;216 Reg.OpenKey('cevoBook', true);217 Reg.WriteString('', 'cevo Book');218 Reg.closekey;219 Reg.OpenKey('cevoBook\DefaultIcon', true);220 Reg.WriteString('', ParamStr(0) + ',0');221 Reg.closekey;222 Reg.OpenKey('cevoBook\shell\open\command', true);223 Reg.WriteString('', ParamStr(0) + ' "%1"');224 Reg.closekey;225 except226 end;227 209 end 228 210 else
Note:
See TracChangeset
for help on using the changeset viewer.