Skip to content

Commit

Permalink
Partial port to new SpTBXLib
Browse files Browse the repository at this point in the history
  • Loading branch information
pyscripter committed Apr 28, 2009
1 parent 63fcb0a commit 1b812d8
Show file tree
Hide file tree
Showing 104 changed files with 7,469 additions and 16,965 deletions.
Binary file modified Components/JvDockVSNetStyleSpTBX.dcr
Binary file not shown.
144 changes: 87 additions & 57 deletions Components/JvDockVSNetStyleSpTBX.pas
Expand Up @@ -53,6 +53,7 @@ TJvDockVSNETTabPanelSpTBX = class(TJvDockVSNETTabPanel)
FSelectHotIndex: Integer;
procedure CMMouseLeave(var Msg: TMessage); message CM_MOUSELEAVE;
protected
FontHeight : Integer;
procedure WMSpSkinChange(var Message: TMessage); message WM_SPSKINCHANGE;
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
procedure Paint; override;
Expand Down Expand Up @@ -89,6 +90,7 @@ TJvDockVSNETPanelSpTBX = class(TJvDockVSNETPanel)

TJvDockVSChannelSpTBX = class(TJvDockVSChannel)
protected
FontHeight : Integer;
procedure WMSpSkinChange(var Message: TMessage); message WM_SPSKINCHANGE;
procedure Paint; override;
procedure PopupPaneChanged; override;
Expand Down Expand Up @@ -133,7 +135,7 @@ implementation

procedure Register;
begin
RegisterComponents('SpTBX JVCL', [TJvDockVSNetStyleSpTBX]);
RegisterComponents('PyScripter Custom', [TJvDockVSNetStyleSpTBX]);
end;

const
Expand Down Expand Up @@ -468,14 +470,27 @@ constructor TJvDockVSNETTabPageControlSpTBX.Create(AOwner: TComponent);
end;

procedure TJvDockVSNETTabPageControlSpTBX.CreatePanel;
Var
TM: TTextMetric;
begin
inherited;
TJvDockVSNETTabPanelSpTBX(Panel).TabBottomOffset := 2; // changed from 3
TJvDockVSNETTabPanelSpTBX(Panel).TabTopOffset := 2;
TJvDockVSNETTabPanelSpTBX(Panel).TabHeight := 25;
TJvDockVSNETTabPanelSpTBX(Panel).TabLeftOffset := 2;
TJvDockVSNETTabPanelSpTBX(Panel).TabRightOffset := 2;
TJvDockVSNETTabPanelSpTBX(Panel).TabSplitterWidth := 0;
with Panel as TJvDockVSNETTabPanelSpTBX do begin
TabBottomOffset := 2; // changed from 3
TabTopOffset := 2;
TabLeftOffset := 2;
TabRightOffset := 2;
TabSplitterWidth := 0;

Canvas.Font.Assign(ToolbarFont);
if GetTextMetrics(Canvas.Handle, TM) then
FontHeight := TM.tmHeight
else begin
FontHeight := Abs(ToolbarFont.Height);
if ToolbarFont.Height < 0 then
Inc(FontHeight, 3); //tmInternalLeading
end;
TabHeight := Max(TJvDockVSNETTabPanelSpTBX(Panel).FontHeight + 10, 25);
end;
end;

destructor TJvDockVSNETTabPageControlSpTBX.Destroy;
Expand Down Expand Up @@ -551,15 +566,13 @@ procedure TJvDockVSNETTabPanelSpTBX.Paint;
CurrTabWidth: Integer;
I, CompleteWidth: Integer;
ImageWidth: Integer;
FontHeight: Integer;
CaptionString: string;
Edge: TSpTBXTabEdge;
Position: TSpTBXTabPosition;
IsActive, IsHot : Boolean;
State : TSpTBXSkinStatesType;
TextColor: TColor;
Format : UINT;
TM: TTextMetric;
begin
if SkinManager.GetSkinType <> sknSkin then begin
inherited;
Expand Down Expand Up @@ -600,14 +613,8 @@ procedure TJvDockVSNETTabPanelSpTBX.Paint;
CompleteWidth := TabLeftOffset;

// Paint all the tabs
Edge := tedLeft; // Only for the first visible tab
Canvas.Font.Assign(ToolbarFont);
if GetTextMetrics(Canvas.Handle, TM) then
FontHeight := TM.tmHeight
else
FontHeight := Abs(ToolbarFont.Height);


Edge := tedLeft; // Only for the first visible tab

for I := 0 to Page.Count - 1 do
begin
Expand Down Expand Up @@ -758,10 +765,17 @@ constructor TJvDockVSNETPanelSpTBX.Create(AOwner: TComponent);
{ TJvDockVSChannelSpTBX }

constructor TJvDockVSChannelSpTBX.Create(AOwner: TComponent);
var
NonClientMetrics: TNonClientMetrics;
begin
inherited;
ControlStyle := ControlStyle + [csOpaque];
SkinManager.AddSkinNotification(Self);
Canvas.Font.Assign(ToolbarFont);
NonClientMetrics.cbSize := SizeOf(NonClientMetrics);
if SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, @NonClientMetrics, 0) then
PInteger(@(Self.ChannelWidth))^ :=
Max(Abs(NonClientMetrics.lfSmCaptionFont.lfHeight) + 10, 22); // Access private property
end;

destructor TJvDockVSChannelSpTBX.Destroy;
Expand All @@ -777,39 +791,51 @@ procedure TJvDockVSChannelSpTBX.Paint;

procedure DrawSingleBlock(Block: TJvDockVSBlock);
var
DrawRect: TRect;
DrawRect, R: TRect;
I: Integer;
OldGraphicsMode: Integer;
VisiblePaneCount: Integer;
State : TSpTBXSkinStatesType;
TextColor: TColor;
IsChecked, IsHot: Boolean;
Flags : Integer;

procedure AdjustImagePos;
begin
if Align = alLeft then
begin
Inc(DrawRect.Left, 3);
Inc(DrawRect.Top, 4);
end
else
if Align = alTop then
begin
Inc(DrawRect.Left, 4);
Inc(DrawRect.Top, 2);
end
else
if Align = alRight then
begin
Inc(DrawRect.Left, 4);
Inc(DrawRect.Top, 4);
end
else
if Align = alBottom then
begin
Inc(DrawRect.Left, 4);
Inc(DrawRect.Top, 3);
R := DrawRect;
if Align in [alLeft, alRight] then begin
Inc(R.Top, 4);
R.Bottom := R.Top + Block.ImageList.Height;
R := SpCenterRectHoriz(R, Block.ImageList.Width);
end else begin
Inc(R.Left, 4);
R.Right := R.Left + Block.ImageList.Width;
R := SpCenterRectVert(R, Block.ImageList.Height);
end;

// if Align = alLeft then
// begin
// Inc(DrawRect.Left, 3);
// Inc(DrawRect.Top, 4);
// end
// else
// if Align = alTop then
// begin
// Inc(DrawRect.Left, 4);
// Inc(DrawRect.Top, 2);
// end
// else
// if Align = alRight then
// begin
// Inc(DrawRect.Left, 4);
// Inc(DrawRect.Top, 4);
// end
// else
// if Align = alBottom then
// begin
// Inc(DrawRect.Left, 4);
// Inc(DrawRect.Top, 3);
// end;
end;

begin
Expand All @@ -824,33 +850,27 @@ procedure TJvDockVSChannelSpTBX.Paint;
IsHot := TCrackJvDockVSBlock(Block).ActiveDockControl = Block.VSPane[I].DockForm;
IsChecked := Block.VSPane[I].Active;
State := CurrentSkin.GetState(True, False, IsHot, IsChecked);
// CurrentSkin.PaintBackground(Canvas, DrawRect, skncToolbarItem, State, True, True, IsVertical);
SpDrawXPButton(Canvas, DrawRect, True, False, IsHot, IsChecked, False, False, sknSkin);

AdjustImagePos;
SpDrawImageList(Canvas, Rect(DrawRect.Left, DrawRect.Top,
DrawRect.Left + Block.ImageList.Width, DrawRect.Top + Block.ImageList.Height),
Block.ImageList, I, True, False);
SpDrawImageList(Canvas, R, Block.ImageList, I, True, False);

if IsHot then
begin
Flags := DT_END_ELLIPSIS or DT_NOCLIP or DT_SINGLELINE;
// draw the Caption
if Align in [alTop, alBottom] then
Inc(DrawRect.Left, TCrackJvDockVSBlock(Block).InactiveBlockWidth)
else
if Align in [alTop, alBottom] then begin
Inc(DrawRect.Left, 2 + TCrackJvDockVSBlock(Block).InactiveBlockWidth);
Dec(DrawRect.Right, 2);
Flags := Flags or DT_VCENTER;
end else
if Align in [alLeft, alRight] then
begin
Inc(DrawRect.Top, TCrackJvDockVSBlock(Block).InactiveBlockWidth);
if Align = alLeft then
DrawRect.Left := 15
else
DrawRect.Left := 20;
Inc(DrawRect.Top, 2 + TCrackJvDockVSBlock(Block).InactiveBlockWidth);
DrawRect.Left := DrawRect.Right + 1 - ((ChannelWidth - FontHeight) div 2);
Dec(DrawRect.Bottom, 2);
DrawRect.Right := DrawRect.Left + (DrawRect.Bottom - DrawRect.Top);
end;
//Canvas.Brush.Color := (DockServer.DockStyle as TJvDockVSNetStyleMod).ChannelOption.TabColor;
//Canvas.Pen.Color := clBlack;

Dec(DrawRect.Right, 3);

OldGraphicsMode := SetGraphicsMode(Canvas.Handle, GM_ADVANCED);
Canvas.Brush.Style := bsClear;
Expand All @@ -860,7 +880,8 @@ procedure TJvDockVSChannelSpTBX.Paint;
TextColor := clBtnText;
Canvas.Font.Color := TextColor;

DrawText(Canvas.Handle, PChar(Block.VSPane[I].DockForm.Caption), -1, DrawRect, DT_END_ELLIPSIS or DT_NOCLIP);
DrawText(Canvas.Handle, PChar(Block.VSPane[I].DockForm.Caption), -1,
DrawRect, Flags);
SetGraphicsMode(Canvas.Handle, OldGraphicsMode);
end;
Inc(VisiblePaneCount);
Expand Down Expand Up @@ -890,7 +911,16 @@ procedure TJvDockVSChannelSpTBX.PopupPaneChanged;
end;

procedure TJvDockVSChannelSpTBX.ResetFontAngle;
Var
TM: TTextMetric;
begin
if GetTextMetrics(Canvas.Handle, TM) then
FontHeight := TM.tmHeight
else begin
FontHeight := Abs(Canvas.Font.Height);
if Canvas.Font.Height < 0 then
Inc(FontHeight, 3); //tmInternalLeading
end;
if Align in [alLeft, alRight] then
Canvas.Font.Handle := SpCreateRotatedFont(Canvas.Handle);
end;
Expand Down Expand Up @@ -1030,14 +1060,14 @@ constructor TJvDockVSNETSpTBXConjoinServerOption.Create(
ADockStyle: TJvDockObservableStyle);
begin
inherited;
GrabbersSize := 18;
end;

procedure TJvDockVSNETSpTBXConjoinServerOption.UpdateDefaultSystemCaptionInfo;
var
NonClientMetrics: TNonClientMetrics;
begin
inherited;
NonClientMetrics.cbSize := SizeOf(NonClientMetrics);
if SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, @NonClientMetrics, 0) then
GrabbersSize := Max(Abs(NonClientMetrics.lfSmCaptionFont.lfHeight) + 6, 18);
end;
Expand Down
Expand Up @@ -10,7 +10,7 @@
</PersonalityInfo>
<Delphi.Personality>
<Source>
<Source Name="MainSource">SpTBXJvLibD10D.dpk</Source>
<Source Name="MainSource">PyScripterCustom.dpk</Source>
</Source>
<FileVersion>
<FileVersion Name="Version">7.0</FileVersion>
Expand Down Expand Up @@ -106,7 +106,7 @@
<Compiler Name="CodePage"></Compiler>
</Compiler>
<Linker>
<Linker Name="MapFile">0</Linker>
<Linker Name="MapFile">3</Linker>
<Linker Name="OutputObjs">0</Linker>
<Linker Name="GenerateHpps">False</Linker>
<Linker Name="ConsoleApp">1</Linker>
Expand All @@ -116,7 +116,7 @@
<Linker Name="MinStackSize">16384</Linker>
<Linker Name="MaxStackSize">1048576</Linker>
<Linker Name="ImageBase">4194304</Linker>
<Linker Name="ExeDescription">Toolbar2000 -- SpTBX JVCL Lib</Linker>
<Linker Name="ExeDescription">PyScripter Custom Components</Linker>
</Linker>
<Directories>
<Directories Name="OutputDir"></Directories>
Expand Down Expand Up @@ -145,7 +145,7 @@
<Language Name="RootDir"></Language>
</Language>
<VersionInfo>
<VersionInfo Name="IncludeVerInfo">False</VersionInfo>
<VersionInfo Name="IncludeVerInfo">True</VersionInfo>
<VersionInfo Name="AutoIncBuild">False</VersionInfo>
<VersionInfo Name="MajorVer">1</VersionInfo>
<VersionInfo Name="MinorVer">0</VersionInfo>
Expand All @@ -170,7 +170,9 @@
<VersionInfoKeys Name="ProductName"></VersionInfoKeys>
<VersionInfoKeys Name="ProductVersion">1.0.0.0</VersionInfoKeys>
<VersionInfoKeys Name="Comments"></VersionInfoKeys>
</VersionInfoKeys> <Excluded_Packages>
</VersionInfoKeys>

<Excluded_Packages>
<Excluded_Packages Name="c:\program files\borland\bds\4.0\Bin\bcbie100.bpl">Borland C++Builder Internet Explorer 5 Components Package</Excluded_Packages>
</Excluded_Packages>
</Delphi.Personality>
Expand Down
16 changes: 10 additions & 6 deletions Components/SpTBXJvLibD10D.dpk → Components/PyScripterCustom.dpk
@@ -1,9 +1,8 @@
// JCL_DEBUG_EXPERT_GENERATEJDBG OFF
// JCL_DEBUG_EXPERT_INSERTJDBG OFF
package SpTBXJvLibD10D;
package PyScripterCustom;

{$R *.res}
{$R 'JvDockVSNetStyleSpTBX.dcr'}
{$R 'SpTBXPageScroller.dcr'}
{$ALIGN 8}
{$ASSERTIONS ON}
{$BOOLEVAL OFF}
Expand All @@ -25,7 +24,7 @@ package SpTBXJvLibD10D;
{$WRITEABLECONST OFF}
{$MINENUMSIZE 1}
{$IMAGEBASE $400000}
{$DESCRIPTION 'Toolbar2000 -- SpTBX JVCL Lib'}
{$DESCRIPTION 'PyScripter Custom Components'}
{$IMPLICITBUILD ON}

requires
Expand All @@ -39,9 +38,14 @@ requires
JvCustomD10R,
SpTBXLib_d10,
tb2k_d10,
JvDockingD10R;
JvDockingD10R,
TntUnicodeVcl,
vclactnband,
vcldb,
dbrtl;

contains
JvDockVSNetStyleSpTBX in 'JvDockVSNetStyleSpTBX.pas';
JvDockVSNetStyleSpTBX in 'JvDockVSNetStyleSpTBX.pas',
SpTBXPageScroller in 'SpTBXPageScroller.pas';

end.
Binary file not shown.

0 comments on commit 1b812d8

Please sign in to comment.