View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0003757 | JEDI VCL | 00 JVCL Components | public | 2006-06-09 06:31 | 2006-06-09 07:40 |
| Reporter | anudedeus | Assigned To | obones | ||
| Priority | normal | Severity | feature | Reproducibility | always |
| Status | resolved | Resolution | fixed | ||
| Product Version | Daily / GIT | ||||
| Target Version | Fixed in Version | 3.30 | |||
| Summary | 0003757: jvGradientCaption : new properties EndColor and FillDirection | ||||
| Description | I introduced these 2 properties, as they are very trivial to implement and present in a number of other components suites. Please review the default value for EndColor = clActiveCaption, maybe the best is clGradientActiveCaption? I also fixed the >255 bug in the steps, now it restarts back from 0 (i.e. 256=0, 257=1, 258=2 and so on). This is my first update to the code using TortoiseSVN, I'm attaching the diff file here, but should I use an option from TortoiseSVN and submit it directly? How exactly? | ||||
| Tags | No tags attached. | ||||
|
2006-06-09 06:31
|
JvGradientCaptionAXP.diff (5,306 bytes)
Index: JvGradientCaption.pas
===================================================================
--- JvGradientCaption.pas (revision 10684)
+++ JvGradientCaption.pas (working copy)
@@ -49,6 +49,8 @@
FRgnChanged: Boolean;
FWinHook: TJvWindowHook;
FStartColor: TColor;
+ FEndColor: TColor;
+ FFillDirection : TFillDirection;
FCaptions: TJvCaptionList;
FFont: TFont;
FDefaultFont: Boolean;
@@ -89,6 +91,8 @@
procedure SetFontInactiveColor(Value: TColor);
procedure SetHideDirection(Value: THideDirection);
procedure SetPopupMenu(Value: TPopupMenu);
+ PROCEDURE SetEndColor(Value: TColor);
+ PROCEDURE SetFillDirection(Value: TFillDirection);
protected
procedure Loaded; override;
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
@@ -119,6 +123,10 @@
property PopupMenu: TPopupMenu read FPopupMenu write SetPopupMenu;
property StartColor: TColor read FStartColor write SetStartColor
default clWindowText;
+ PROPERTY EndColor: TColor READ FEndColor WRITE SetEndColor
+ DEFAULT clActiveCaption; // new property introduced by AxP (AnuDeDeus)
+ PROPERTY FillDirection : TFillDirection read FFillDirection write SetFillDirection
+ DEFAULT fdLeftToRight; // new property introduced by AxP (AnuDeDeus)
property OnActivate: TNotifyEvent read FOnActivate write FOnActivate;
property OnDeactivate: TNotifyEvent read FOnDeactivate write FOnDeactivate;
end;
@@ -175,12 +183,14 @@
property Visible: Boolean read FVisible write SetVisible default True;
end;
-function GradientFormCaption(AForm: TCustomForm; AStartColor: TColor): TJvGradientCaption;
+// I didn't really understand the purpose of this function, but I updated it anyway, hope it's fine
+FUNCTION GradientFormCaption(AForm: TCustomForm; AStartColor, AEndColor: TColor):
+ TJvGradientCaption;
{$IFDEF UNITVERSIONING}
const
UnitVersioning: TUnitVersionInfo = (
- RCSfile: '$URL$';
+ RCSfile: '$RCSfile: JvGradientCaption.pas,v $';
Revision: '$Revision$';
Date: '$Date$';
LogPath: 'JVCL\run'
@@ -193,12 +203,14 @@
SysUtils,
JvConsts;
-function GradientFormCaption(AForm: TCustomForm; AStartColor: TColor): TJvGradientCaption;
+FUNCTION GradientFormCaption(AForm: TCustomForm; AStartColor, AEndColor: TColor):
+ TJvGradientCaption;
begin
Result := TJvGradientCaption.Create(AForm);
with Result do
try
FStartColor := AStartColor;
+ FEndColor := AEndColor;
FormCaption := AForm.Caption;
Update;
except
@@ -445,6 +457,8 @@
FWinHook.BeforeMessage := BeforeMessage;
FWinHook.AfterMessage := AfterMessage;
FStartColor := clWindowText;
+ FEndColor := clActiveCaption;// doubt: should it be clGradientActiveCaption?
+ FFillDirection := fdLeftToRight;
FFontInactiveColor := clInactiveCaptionText;
FFormCaption := '';
FFont := TFont.Create;
@@ -720,6 +734,17 @@
end;
end;
+PROCEDURE TJvGradientCaption.SetEndColor(Value: TColor);
+BEGIN
+ IF FEndColor <> Value THEN
+ BEGIN
+ FEndColor := Value;
+ IF Active THEN
+ Update;
+ END;
+END;
+
+
function TJvGradientCaption.GetActive: Boolean;
begin
Result := FActive;
@@ -848,7 +873,7 @@
var
R, DrawRect: TRect;
Icons: TBorderIcons;
- C: TColor;
+// C: TColor; replaced by FEndColor
Ico: HIcon;
Image: TBitmap;
S: string;
@@ -932,29 +957,28 @@
Image.Width := RectWidth(R);
Image.Height := RectHeight(R);
R := Rect(-Image.Width div 4, 0, Image.Width, Image.Height);
- if SysGradient then
- begin
- if FWindowActive then
- C := clGradientActiveCaption
- else
- C := clGradientInactiveCaption;
- end
- else
- begin
- if FWindowActive then
- C := clActiveCaption
- else
- C := clInactiveCaption;
- end;
+// if SysGradient then
+// begin
+// if FWindowActive then
+// C := clGradientActiveCaption
+// else
+// C := clGradientInactiveCaption;
+// end
+// else
+// begin
+// if FWindowActive then
+// C := clActiveCaption
+// else
+// C := clInactiveCaption;
+// end;
if (FWindowActive and GradientActive) or
(not FWindowActive and GradientInactive) then
begin
- GradientFillRect(Image.Canvas, R, FStartColor, C, fdLeftToRight,
- FGradientSteps);
+ GradientFillRect(Image.Canvas, R, FStartColor, FEndColor, FFillDirection, FGradientSteps);
end
else
begin
- Image.Canvas.Brush.Color := C;
+ Image.Canvas.Brush.Color := FEndColor;
Image.Canvas.FillRect(R);
end;
R.Left := 0;
@@ -1109,7 +1133,7 @@
begin
if FGradientSteps <> Value then
begin
- FGradientSteps := Value;
+ FGradientSteps := Value mod 256; // auto resets to 0 at 256
if Active and ((FWindowActive and GradientActive) or
(not FWindowActive and GradientInactive)) then
Update;
@@ -1156,7 +1180,18 @@
end;
end;
+procedure TJvGradientCaption.SetFillDirection(Value: TFillDirection);
+begin
+ IF FFillDirection <> Value THEN
+ BEGIN
+ FFillDirection := Value;
+ IF Active THEN
+ Update;
+ END;
+end;
+
{$IFDEF UNITVERSIONING}
+
initialization
RegisterUnitVersion(HInstance, UnitVersioning);
|
|
|
That file is just fine, you generatd it using Tortoise, Create Patch, that's ok for us. I'll review this and let you know |
|
|
Thanks for that, it is now in SVN. However, next time, please respect the Style Guide, especially the part that says that reserved words are written in lower case. http://homepages.borland.com/jedi/jvcl/StyleGuide.htm |
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2006-06-09 06:31 | anudedeus | New Issue | |
| 2006-06-09 06:31 | anudedeus | File Added: JvGradientCaptionAXP.diff | |
| 2006-06-09 07:20 | obones | Note Added: 0009549 | |
| 2006-06-09 07:20 | obones | Status | new => acknowledged |
| 2006-06-09 07:40 | obones | Status | acknowledged => resolved |
| 2006-06-09 07:40 | obones | Resolution | open => fixed |
| 2006-06-09 07:40 | obones | Assigned To | => obones |
| 2006-06-09 07:40 | obones | Note Added: 0009550 |