SRL Archive - Suggestions

Few things for Simba


Nava2

2010-01-03 09:09:50

  • Export to HTML for easy Printing
  • Printing? (Not really important)
  • Bar above function list for easy dragging, its annoying to try and avoid the TTree Structure
  • Color in the status bar for Code Hints, or maybe create a panel at the bottom, above the bottom bar which pops up when code hints are activated. Like Chrome does when you roll over a link -> http://i47.tinypic.com/4pwgsw.png
  • DTM Utility
  • Custom Themes?

Just making a list :)

And yes, most of these are purely aesthetic.

mastaraymond

2010-01-03 09:19:17

From: Nava2
  • Bar above function list for easy dragging, its annoying to try and avoid the TTree Structure

Just making a list :)

And yes, most of these are purely aesthetic.

I've been trying to make this.. I just can't find out howto do it :-(.

The HTML exporting is quite easy, it's already implemented in SynEdit.

Nava2

2010-01-03 09:25:18

From: mastaraymond
I've been trying to make this.. I just can't find out howto do it :-(.

The HTML exporting is quite easy, it's already implemented in SynEdit.


Bullzeye might know how, since he setup the docking.

This may be worded wrongly, but could pointers from the bar and the list be pointed to the same function? The OnDrag property?

mastaraymond

2010-01-03 09:38:56

From: Nava2
Bullzeye might know how, since he setup the docking.

This may be worded wrongly, but could pointers from the bar and the list be pointed to the same function? The OnDrag property?

Well yes.. But the point is, I can't find howto make that -bar-.. I know it is in Lazarus, since I've seen test applications have it. I just can't find how to do it :redface:.

Btw, implemented the HTML export.

mastaraymond

2010-01-03 10:15:36

Okay.. Docking is officially a hell. I really have no clue how it works, bullz does the docking manually.. But in all the examples they use weird Dockingmanangers, I've got no clue howto create that lil bar! :-(.. Looks like the header is drawn by a 3rd-party component:

procedure TEasyDockHeader.Draw(AZone: TEasyZone; ACanvas: TCanvas; ACaption: string; const MousePos: TPoint);
(* Problem with colors on other than win32 widgetsets (gtk2...)
*)
const
clBack = clHighlight;
clFont = clHighlightText;

var
IsMouseDown: Boolean;

//procedure DrawButton(ARect: TRect; IsMouseDown, IsMouseOver: Boolean; ABitmap: TCustomBitmap); inline;
procedure DrawButton(ARect: TRect; ABitmap: TCustomBitmap);
const
// ------------- Pressed, Hot -----------------------
BtnDetail: array[Boolean, Boolean] of TThemedToolBar =
(
(ttbButtonNormal, ttbButtonHot),
(ttbButtonNormal, ttbButtonPressed)
);
var
Details: TThemedElementDetails;
dx, dy: integer;
IsMouseOver: boolean;
begin
ACanvas.FillRect(ARect);
IsMouseOver := PtInRect(ARect, MousePos);
Details := ThemeServices.GetElementDetails(BtnDetail[IsMouseDown, IsMouseOver]);
ThemeServices.DrawElement(ACanvas.Handle, Details, ARect);
ARect := ThemeServices.ContentRect(ACanvas.Handle, Details, ARect);
//move button into rect, excluding border
dx := (ARect.Right - ARect.Left - ABitmap.Width) div 2;
dy := (ARect.Bottom - ARect.Top - ABitmap.Height) div 2;
ACanvas.Draw(ARect.Left + dx, ARect.Top + dy, ABitmap);
end;

procedure DrawGrabberLine(Left, Top, Right, Bottom: Integer);
begin
with ACanvas do
begin
Pen.Color := clBtnHighlight;
MoveTo(Right, Top);
LineTo(Left, Top);
LineTo(Left, Bottom);
Pen.Color := clBtnShadow;
LineTo(Right, Bottom);
LineTo(Right, Top);
end;
end;

var
BtnRect: TRect;
ARect, DrawRect: TRect;
// LCL doesn't handle orientation in TFont
OldFont, RotatedFont: HFONT;
OldMode: Integer;
ALogFont: TLogFont;
AOrientation: TDockOrientation;
AControl: TControl;
AStyle: TEasyHeaderStyle;
HasSizer: boolean;
begin
(* Some colors inavailable on some widgetsets!
*)
if AZone.Style = hsNone then
exit; //no header at all

IsMouseDown := (GetKeyState(VK_LBUTTON) and $80) <> 0;
//debug
AControl := AZone.FChildControl;
AStyle := AZone.Style;
HasSizer := AZone.HasSizer;
AOrientation := AControl.DockOrientation;

ARect := AZone.GetBounds;
ACanvas.Brush.Color := clBtnFace;

//draw splitter?
if HasSizer then begin
// border?
BtnRect := GetRectOfPart(ARect, AOrientation, zpSizer, HasSizer, AStyle);
ACanvas.FillRect(BtnRect);
end;

//erase - which color(s)?
DrawRect := GetRectOfPart(ARect, AOrientation, zpAll, HasSizer, AStyle);
//ACanvas.Brush.Color := clBack; // clActiveCaption;
ACanvas.FillRect(DrawRect);

//border
InflateRect(DrawRect, -1, -1); //outer bevel?
ACanvas.Brush.Color := clBtnShadow;
ACanvas.FrameRect(DrawRect); //1 pixel border
ACanvas.Brush.Color := clBtnFace;

// draw caption
case AStyle of
hsMinimal:
with DrawRect do begin
DrawRect := GetRectOfPart(ARect, AOrientation, zpCaption, HasSizer, AStyle);
if AOrientation = doVertical then begin
inc(Top, dDBorder);
DrawGrabberLine(Left, Top, Right, Top+2);
inc(Top, 3);
DrawGrabberLine(Left, Top, Right, Top+2);
end else begin
inc(Left, dDBorder);
DrawGrabberLine(Left, Top, Left+2, Bottom);
inc(Left, 3);
DrawGrabberLine(Left, Top, Left+2, Bottom);
end;
end;
hsForm:
begin
//ACanvas.Font.Color := clFont; //clCaptionText;
DrawRect := GetRectOfPart(ARect, AOrientation, zpCaption, HasSizer, AStyle);

OldMode := SetBkMode(ACanvas.Handle, TRANSPARENT);

//for some reason the caption is not offset properly?
if AOrientation = doVertical then begin
inc(DrawRect.Left, dBorder); //looks better
DrawText(ACanvas.Handle, PChar(ACaption), -1, DrawRect, DT_LEFT or DT_SINGLELINE or DT_VCENTER)
end else begin
OldFont := 0;
if GetObject(ACanvas.Font.Reference.Handle, SizeOf(ALogFont), @ALogFont) <> 0 then
begin
ALogFont.lfEscapement := 900;
RotatedFont := CreateFontIndirect(ALogFont);
if RotatedFont <> 0 then
OldFont := SelectObject(ACanvas.Handle, RotatedFont);
end;
// from msdn: DrawText doesnot support font with orientation and escapement <> 0
//TextOut(ACanvas.Handle, DrawRect.Left, DrawRect.Bottom, PChar(ACaption), Length(ACaption));
TextOut(ACanvas.Handle, DrawRect.Left-2, DrawRect.Bottom-2, PChar(ACaption), Length(ACaption));
if OldFont <> 0 then
DeleteObject(SelectObject(ACanvas.Handle, OldFont));
end;
SetBkMode(ACanvas.Handle, OldMode);
end;
end;

// buttons - which colors to use?
ACanvas.Brush.Color := clBtnFace;
//ACanvas.Pen.Color := clButtonText;

// draw close button
BtnRect := GetRectOfPart(ARect, AOrientation, zpCloseButton, HasSizer, AStyle);
DrawButton(BtnRect, DockBtnImages[dhiClose]);

{$IFDEF restore}
// draw restore button
BtnRect := GetRectOfPart(ARect, AOrientation, zpRestoreButton, HasSizer, AStyle);
DrawButton(BtnRect, DockBtnImages[dhiRestore]);
{$ENDIF}
end;

Nava2

2010-01-03 10:54:51

I think the third party component is the window toolkit… I'm probably making assumptions, but you sure its not a part of FPC/Laz?

bullzeye95

2010-01-03 12:54:29

From: mastaraymond
Okay.. Docking is officially a hell. I really have no clue how it works, bullz does the docking manually.. But in all the examples they use weird Dockingmanangers, I've got no clue howto create that lil bar! :-(.. Looks like the header is drawn by a 3rd-party component:


I think I understand it well enough. I haven't had any time because I waited until the very end of Christmas break to do two huge projects that are due tomorrow (why am I even posting here?) :<

I will do this tomorrow if I have time, which I should.

mastaraymond

2010-01-03 12:58:26

From: bullzeye95
I think I understand it well enough. I haven't had any time because I waited until the very end of Christmas break to do two huge projects that are due tomorrow (why am I even posting here?) :<

I will do this tomorrow if I have time, which I should.

I made a kind-of workaround already ;). You cannot get the real cool header unless you use some kind of DockManager package, which I'm not really happy with.

mastaraymond

2010-01-03 14:29:50


Nava2

2010-01-03 16:05:13

From: mastaraymond


NAICE!

Now, what about the code hints in a panel along the bottom? Yes, no?