You've already forked lazarus-ccr
tvplanit: Show category colors and icons in category combobox of event editor.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6432 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -284,6 +284,7 @@ const
|
|||||||
VL_LCL_SCALING := 0;
|
VL_LCL_SCALING := 0;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
|
DROPDOWN_COUNT = 24;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ object DlgEventEdit: TDlgEventEdit
|
|||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
OnShow = FormShow
|
OnShow = FormShow
|
||||||
Position = poScreenCenter
|
Position = poScreenCenter
|
||||||
LCLVersion = '1.6.4.0'
|
LCLVersion = '1.9.0.0'
|
||||||
object ButtonPanel: TPanel
|
object ButtonPanel: TPanel
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 37
|
Height = 37
|
||||||
@ -205,8 +205,9 @@ object DlgEventEdit: TDlgEventEdit
|
|||||||
Width = 253
|
Width = 253
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
BorderSpacing.Top = 6
|
BorderSpacing.Top = 6
|
||||||
ItemHeight = 15
|
ItemHeight = 17
|
||||||
OnDrawItem = CategoryDrawItem
|
OnDrawItem = CategoryDrawItem
|
||||||
|
Style = csOwnerDrawFixed
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
end
|
end
|
||||||
object imgClock: TImage
|
object imgClock: TImage
|
||||||
|
@ -252,6 +252,9 @@ begin
|
|||||||
LoadCaptions;
|
LoadCaptions;
|
||||||
EndDate.Enabled := False;
|
EndDate.Enabled := False;
|
||||||
EndTime.Enabled := false;
|
EndTime.Enabled := false;
|
||||||
|
|
||||||
|
Category.DropDownCount := DROPDOWN_COUNT;
|
||||||
|
Category.ItemHeight := LocationEdit.Height - 4;
|
||||||
end;
|
end;
|
||||||
{=====}
|
{=====}
|
||||||
|
|
||||||
@ -292,34 +295,58 @@ end;
|
|||||||
procedure TDlgEventEdit.CategoryDrawItem(Control: TWinControl; Index: Integer;
|
procedure TDlgEventEdit.CategoryDrawItem(Control: TWinControl; Index: Integer;
|
||||||
ARect: TRect; State: TOwnerDrawState);
|
ARect: TRect; State: TOwnerDrawState);
|
||||||
var
|
var
|
||||||
Color, SaveColor: TColor;
|
lBkColor, lGutterColor, SavedColor: TColor;
|
||||||
Name: string;
|
lDesc: string;
|
||||||
|
lBmp: TBitmap;
|
||||||
ColorRect: TRect;
|
ColorRect: TRect;
|
||||||
|
IconX, IconY: Integer;
|
||||||
|
hTxt, hGutter, hDist, vMargin, hMargin: Integer;
|
||||||
|
SavedStyle: TBrushStyle;
|
||||||
begin
|
begin
|
||||||
Unused(Control, State);
|
Unused( State);
|
||||||
|
|
||||||
|
hTxt := Category.Canvas.TextHeight('Tj');
|
||||||
|
vMargin := ScaleY(2, DesignTimeDPI);
|
||||||
|
hMargin := ScaleX(3, DesignTimeDPI);
|
||||||
|
hGutter := ScaleX(10, DesignTimeDPI);
|
||||||
|
hDist := ScaleX(5, DesignTimeDPI);
|
||||||
|
|
||||||
|
with CatColorMap.GetCategory(Index) do begin
|
||||||
|
lGutterColor := Color;
|
||||||
|
lDesc := Description;
|
||||||
|
lBmp := Bitmap;
|
||||||
|
lBkColor := BackgroundColor;
|
||||||
|
end;
|
||||||
|
|
||||||
|
SavedColor := Category.Canvas.Brush.Color;
|
||||||
|
SavedStyle := Category.Canvas.Brush.Style;
|
||||||
|
|
||||||
|
if State * [odSelected, odFocused] = [] then
|
||||||
|
Category.Canvas.Brush.Color := lBkColor;
|
||||||
Category.Canvas.FillRect(ARect);
|
Category.Canvas.FillRect(ARect);
|
||||||
|
|
||||||
Color := CatColorMap.GetCategory(Index).Color;
|
Category.Canvas.Brush.Color := lGutterColor;
|
||||||
Name := CatColorMap.GetCategory(Index).Description;
|
|
||||||
|
|
||||||
SaveColor := Category.Canvas.Brush.Color;
|
|
||||||
Category.Canvas.Brush.Color := Color;
|
|
||||||
Category.Canvas.Pen.Color := clBlack;
|
Category.Canvas.Pen.Color := clBlack;
|
||||||
ColorRect.Left := ARect.Left + 3;
|
ColorRect.Left := ARect.Left + hMargin;
|
||||||
ColorRect.Top := ARect.Top + 2;
|
ColorRect.Top := ARect.Top + vMargin;
|
||||||
ColorRect.Bottom := ARect.Bottom - 2;
|
ColorRect.Bottom := ARect.Bottom - vMargin;
|
||||||
ColorRect.Right := ColorRect.Left + 20;
|
ColorRect.Right := ColorRect.Left + hGutter;
|
||||||
Category.Canvas.FillRect(ColorRect);
|
Category.Canvas.FillRect(ColorRect);
|
||||||
{$IFDEF VERSION5}
|
|
||||||
Category.Canvas.Rectangle(ColorRect);
|
Category.Canvas.Rectangle(ColorRect);
|
||||||
{$ELSE}
|
|
||||||
Category.Canvas.Rectangle(ColorRect.Left, ColorRect.Top, ColorRect.Right,
|
if lBmp <> nil then begin
|
||||||
ColorRect.Bottom);
|
IconX := ColorRect.Right + hMargin;
|
||||||
{$ENDIF}
|
IconY := (ARect.Top + ARect.Bottom - lBmp.Height) div 2;
|
||||||
ARect.Left := ColorRect.Right + 5;
|
Category.Canvas.Draw(IconX, IconY, lBmp);
|
||||||
Category.Canvas.Brush.Color := SaveColor;
|
inc(ColorRect.Right, lBmp.Width);
|
||||||
Category.Canvas.TextOut(ARect.Left, ARect.Top, Name);
|
end;
|
||||||
|
|
||||||
|
ARect.Left := ColorRect.Right + hDist;
|
||||||
|
Category.Canvas.Brush.Style := bsClear;
|
||||||
|
Category.Canvas.TextOut(ARect.Left, (ARect.Top + ARect.Bottom - hTxt) div 2, lDesc);
|
||||||
|
|
||||||
|
Category.Canvas.Brush.Color := SavedColor;
|
||||||
|
Category.canvas.Brush.Style := SavedStyle;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TDlgEventEdit.CancelBtnClick(Sender: TObject);
|
procedure TDlgEventEdit.CancelBtnClick(Sender: TObject);
|
||||||
|
Reference in New Issue
Block a user