Skip to content

Commit

Permalink
- Improved checkbox and radiobutton painting.
Browse files Browse the repository at this point in the history
  • Loading branch information
SilverpointDev committed Sep 18, 2023
1 parent 4f2d5b7 commit 1532e8d
Show file tree
Hide file tree
Showing 9 changed files with 225 additions and 75 deletions.
69 changes: 69 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Uncomment these types if you want even more clean repository. But be careful.
# It can make harm to an existing project source. Read explanations below.
#
# Resource files are binaries containing manifest, project icon and version info.
# They can not be viewed as text or compared by diff-tools. Consider replacing them with .rc files.
#*.res
#
# Type library file (binary). In old Delphi versions it should be stored.
# Since Delphi 2009 it is produced from .ridl file and can safely be ignored.
#*.tlb
#
# Diagram Portfolio file. Used by the diagram editor up to Delphi 7.
# Uncomment this if you are not using diagrams or use newer Delphi version.
#*.ddp
#
# Visual LiveBindings file. Added in Delphi XE2.
# Uncomment this if you are not using LiveBindings Designer.
#*.vlb
#
# Deployment Manager configuration file for your project. Added in Delphi XE2.
# Uncomment this if it is not mobile development and you do not use remote debug feature.
#*.deployproj
#
# C++ object files produced when C/C++ Output file generation is configured.
# Uncomment this if you are not using external objects (zlib library for example).
#*.obj
#

# Delphi compiler-generated binaries (safe to delete)
*.exe
*.dll
*.bpl
*.bpi
*.dcp
*.so
*.apk
*.drc
*.map
*.dres
*.rsm
*.tds
*.dcu
*.lib
*.a
*.o
*.ocx

# Delphi autogenerated files (duplicated info)
*.cfg
*.hpp
*Resource.rc

# Delphi local files (user-specific info)
*.local
*.identcache
*.projdata
*.tvsconfig
*.dsk

# Delphi history and backups
__history/
__recovery/
*.~*

# Castalia statistics file (since XE7 Castalia is distributed with Delphi)
*.stat

# Binary folder
Bin
8 changes: 8 additions & 0 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
The contents of this package are licensed under the terms of the Mozilla Public License Version 1.1, found at:

- Mozilla Public License, version 1.1
http://www.mozilla.org/MPL/MPL-1.1.html

Software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.

The initial developer of this package is Robert Lee.
51 changes: 51 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Silverpoint Skin Editor

With the help of Silverpoint Skin Editor designers will be able to easily create and modify skins of applications based on SpTBXLib.

## Basic Concepts

The term skin refers to the concept of changing the software's look and feel, making it aesthetically pleasing.
Software that is capable of having a skin applied is referred to as being skinnable, and the process of writing or applying such a skin is known as skinning.

A skin for Silverpoint Skin Editor is made of a SKN file describing the logical structure of the skin. This is a text file that follows a specific format and it is used by the skin engine to skin the application's controls.

## Getting Started

When Skin Editor is opened you have the option to create a new skin, open an existing one or create a skin based on a template.

Skin Editor has 4 sections or panes:

1) Elements: this pane has a list of every control/element and their different states.
2) Skin Properties: shows the skin properties and their values. Some of the properties you can change are:
- Name: the skin name.
- Author: the skin author.
- Office Icons: when set to true the menu item icons are painted with shadows (imitating Office).
- Office Menu: when set to true the height of the separators on popup menus is 6 pixels (imitating Office), otherwise the size is 10 pixels. Also when the items are disabled the hottrack is not painted.
- Office Statusbar: when set to true the Statusbar panels are painted with rectangular separators like Office.
3) Element Properties: shows the selected element properties. Some of the properties you can change are:
- Body: to edit the Body properties select the type of the Body and change the gradient colors, Solid uses 1 color, the Simple Gradients uses 2, and the rest uses 4 colors.
- Borders: to edit the Borders properties select the type of the Borders and change the border colors. You can specify the external and internal borders.
- Text: specifies the text color.
4) Preview: this pane shows the preview of the skin.

## Creating a New Skin

1) Create a new project by clicking the New button on the toolbar.
2) Specify the Skin Name and Author on the New Skin dialog.
You can also create a skin based upon a template.
3) You can now start editing the skin.
An element can consist of several states, for instance the Button element has 6 states (Normal, Disabled, Hot, Pushed, Checked, Checked & Hot), while other elements have just a few like the ProgressBar element that has only 2 states (Normal, Hot).
To access a specific element property, you must first locate the element on the Elements pane and then select the corresponding state, when the state is selected the properties will be showed on the Element Properties pane.

For more info go to:
http://www.silverpointdevelopment.com


## License

The contents of this package are licensed under the terms of the Mozilla Public License Version 1.1, found at:
http://www.mozilla.org/MPL/MPL-1.1.html

Software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.

The initial developer of this package is Robert Lee.
20 changes: 20 additions & 0 deletions Release History.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
18 September 2023 - version 1.0.6
- Improved checkbox and radiobutton painting.

18 March 2014 - version 1.0.5
- Added Delphi XE4 and XE5 support.

19 April 2013 - version 1.0.4
- Added Delphi XE3 support.

29 June 2011 - version 1.0.3
- Minor bug fixes.

24 April 2010 - version 1.0.2
- Minor bug fixes.

2 December 2009 - version 1.0.1
- Minor bug fixes.

13 September 2009 - version 1.0
- Initial release.
16 changes: 10 additions & 6 deletions Source/UUtils.pas
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ procedure SpUIDrawSkinState(ACanvas: TCanvas; ARect: TRect; Selected: Boolean;
I: Integer;
CanDrawText: Boolean;
TextFlags: Cardinal;
CheckboxState: TCheckBoxState;
begin
B := TBitmap.Create;
try
Expand Down Expand Up @@ -82,10 +83,13 @@ procedure SpUIDrawSkinState(ACanvas: TCanvas; ARect: TRect; Selected: Boolean;
begin
R.Right := R.Left + 13;
R := SpCenterRectVert(R, 13);
if C = skncCheckBox then
ASkin.PaintMenuCheckMark(B.Canvas, R, S in [sknsChecked, sknsCheckedAndHotTrack], False, S, DPI)
if C = skncCheckBox then begin
if S in [sknsChecked, sknsCheckedAndHotTrack] then CheckboxState := cbChecked
else CheckboxState := cbUnchecked;
SpDrawXPCheckBoxGlyph(nil, B.Canvas, R, S <> sknsDisabled, CheckboxState, S in [sknsHotTrack, sknsCheckedAndHotTrack], S = sknsPushed, DPI);
end
else
ASkin.PaintMenuRadioMark(B.Canvas, R, S in [sknsChecked, sknsCheckedAndHotTrack], S, DPI);
SpDrawXPRadioButtonGlyph(nil, B.Canvas, R, S <> sknsDisabled, S in [sknsChecked, sknsCheckedAndHotTrack], S in [sknsHotTrack, sknsCheckedAndHotTrack], S = sknsPushed, DPI);
R.Left := R.Right + 4;
R.Right := B.Width;
TextFlags := TextFlags and not DT_CENTER;
Expand All @@ -95,12 +99,12 @@ procedure SpUIDrawSkinState(ACanvas: TCanvas; ARect: TRect; Selected: Boolean;
CanDrawText := False;
I := GetSystemMetrics(SM_CXVSCROLL) + 2;
R := SpCenterRect(R, I, I);
SpDrawXPStatusBar(B.Canvas, Rect(0, 0, 0, 0), R, DPI);
SpDrawXPStatusBar(nil, B.Canvas, Rect(0, 0, 0, 0), R, DPI);
end;
skncSeparator:
begin
CanDrawText := False;
SpDrawXPMenuSeparator(B.Canvas, R, False, True, DPI);
SpDrawXPMenuSeparator(nil, B.Canvas, R, False, True, DPI);
end;
skncToolbarGrip:
begin
Expand All @@ -122,7 +126,7 @@ procedure SpUIDrawSkinState(ACanvas: TCanvas; ARect: TRect; Selected: Boolean;

// Draw text
if CanDrawText then begin
B.Canvas.Font.Color := ASkin.GetTextColor(C, S);
B.Canvas.Font.Color := ASkin.GetTextColor(nil, C, S);
SpDrawXPText(B.Canvas, SSpTBXSkinDisplayStatesString[S], R, TextFlags);
end;

Expand Down
48 changes: 26 additions & 22 deletions Source/frmMain.dfm
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ object Form1: TForm1
Font.Name = 'Tahoma'
Font.Style = []
Menu = MainMenu1
OldCreateOrder = False
OnCreate = FormCreate
OnDestroy = FormDestroy
PixelsPerInch = 96
TextHeight = 13
object pnlMenu: TPanel
Left = 0
Expand All @@ -23,15 +21,17 @@ object Form1: TForm1
Align = alClient
BevelOuter = bvNone
TabOrder = 2
ExplicitTop = 29
ExplicitHeight = 557
ExplicitWidth = 862
ExplicitHeight = 553
end
object StatusBar1: TStatusBar
Left = 0
Top = 586
Width = 866
Height = 19
Panels = <>
ExplicitTop = 585
ExplicitWidth = 862
end
object pnlEditor: TPanel
Left = 0
Expand All @@ -41,8 +41,8 @@ object Form1: TForm1
Align = alClient
BevelOuter = bvNone
TabOrder = 0
ExplicitTop = 29
ExplicitHeight = 557
ExplicitWidth = 862
ExplicitHeight = 553
object Splitter1: TSplitter
Left = 233
Top = 0
Expand All @@ -59,7 +59,7 @@ object Form1: TForm1
Align = alLeft
BevelOuter = bvNone
TabOrder = 0
ExplicitHeight = 557
ExplicitHeight = 553
object CategoryButtons1: TCategoryButtons
Left = 0
Top = 21
Expand All @@ -76,13 +76,13 @@ object Form1: TForm1
GradientDirection = gdVertical
ParentDoubleBuffered = False
PopupMenu = PopupMenu1
RegularButtonColor = 15660791
SelectedButtonColor = 13361893
RegularButtonColor = clWhite
SelectedButtonColor = 15132390
TabOrder = 0
OnContextPopup = CategoryButtons1ContextPopup
OnDrawButton = CategoryButtons1DrawButton
OnSelectedItemChange = CategoryButtons1SelectedItemChange
ExplicitHeight = 536
ExplicitHeight = 532
end
object lblElementsTitle: TSpTBXLabel
Left = 0
Expand Down Expand Up @@ -110,7 +110,8 @@ object Form1: TForm1
Align = alClient
BevelOuter = bvNone
TabOrder = 1
ExplicitHeight = 557
ExplicitWidth = 626
ExplicitHeight = 553
object Splitter2: TSplitter
Left = 257
Top = 0
Expand All @@ -126,7 +127,8 @@ object Form1: TForm1
BevelOuter = bvNone
TabOrder = 1
OnAlignPosition = pnlPreviewAlignPosition
ExplicitHeight = 557
ExplicitWidth = 366
ExplicitHeight = 553
object lblPreviewTitle: TSpTBXLabel
Left = 0
Top = 0
Expand All @@ -143,6 +145,7 @@ object Form1: TForm1
Font.Style = [fsBold]
ParentFont = False
OnDraw = edlblPropertiesDraw
ExplicitWidth = 366
end
end
object pnlProperties: TPanel
Expand All @@ -153,7 +156,7 @@ object Form1: TForm1
Align = alLeft
BevelOuter = bvNone
TabOrder = 0
ExplicitHeight = 557
ExplicitHeight = 553
object pnlPropertiesEd: TPanel
Left = 0
Top = 158
Expand All @@ -162,7 +165,7 @@ object Form1: TForm1
Align = alClient
BevelOuter = bvNone
TabOrder = 3
ExplicitHeight = 399
ExplicitHeight = 395
object edSplitter2: TSplitter
Left = 136
Top = 0
Expand All @@ -182,7 +185,7 @@ object Form1: TForm1
Color = clWindow
ParentBackground = False
TabOrder = 0
ExplicitHeight = 399
ExplicitHeight = 395
object lblBodyTitle1: TSpTBXLabel
Left = 0
Top = 0
Expand Down Expand Up @@ -385,7 +388,7 @@ object Form1: TForm1
Color = clWindow
ParentBackground = False
TabOrder = 1
ExplicitHeight = 399
ExplicitHeight = 395
object lblBodyTitle2: TSpTBXLabel
Left = 0
Top = 0
Expand Down Expand Up @@ -827,6 +830,7 @@ object Form1: TForm1
ParentShowHint = False
ShowHint = True
TabOrder = 3
ExplicitWidth = 862
object ToolButton1: TToolButton
Left = 0
Top = 0
Expand Down Expand Up @@ -862,7 +866,7 @@ object Form1: TForm1
end
end
object MainMenu1: TMainMenu
Left = 16
Left = 24
Top = 280
object mFile1: TMenuItem
Caption = 'File'
Expand Down Expand Up @@ -925,17 +929,17 @@ object Form1: TForm1
object OpenDialog1: TOpenDialog
DefaultExt = 'skn'
Filter = 'Skin Files (*.skn)|*.skn'
Left = 80
Left = 104
Top = 280
end
object SaveDialog1: TSaveDialog
DefaultExt = 'skn'
Filter = 'Skin Files (*.skn)|*.skn'
Left = 144
Left = 184
Top = 280
end
object ActionList1: TActionList
Left = 80
Left = 112
Top = 352
object aHelp: TAction
Category = 'Help'
Expand Down Expand Up @@ -1019,7 +1023,7 @@ object Form1: TForm1
end
end
object PopupMenu1: TPopupMenu
Left = 16
Left = 32
Top = 352
object smCopy1: TMenuItem
Action = aCopy
Expand All @@ -1041,7 +1045,7 @@ object Form1: TForm1
end
end
object ImageList1: TImageList
Left = 144
Left = 184
Top = 352
Bitmap = {
494C010105000A00040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
Expand Down
Loading

0 comments on commit 1532e8d

Please sign in to comment.